var-imp.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Filip Konvicka <filip.konvicka@logis.cz>
* Lubomir Moric <lubomir.moric@logis.cz>
* Vincent Barichard <Vincent.Barichard@univ-angers.fr>
*
* Contributing authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* LOGIS, s.r.o., 2008
* Christian Schulte, 2010
* Vincent Barichard, 2012
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <cmath>
namespace Gecode { namespace Float {
class FloatVarImp;
class FloatDelta : public Delta {
friend class FloatVarImp;
private:
FloatNum _min;
FloatNum _max;
public:
FloatDelta(void);
FloatDelta(FloatNum min, FloatNum max);
private:
FloatNum min(void) const;
FloatNum max(void) const;
};
}}
#include <gecode/float/var-imp/delta.hpp>
namespace Gecode { namespace Float {
class FloatVarImp : public FloatVarImpBase {
protected:
FloatVal dom;
FloatVarImp(Space& home, FloatVarImp& x);
public:
FloatVarImp(Space& home, const FloatVal& d);
FloatVal domain(void) const;
FloatNum min(void) const;
FloatNum max(void) const;
FloatVal val(void) const;
FloatNum med(void) const;
FloatNum size(void) const;
bool assigned(void) const;
bool zero_in(void) const;
bool in(FloatNum n) const;
bool in(const FloatVal& n) const;
ModEvent eq(Space& home, FloatNum n);
ModEvent eq(Space& home, const FloatVal& n);
ModEvent lq(Space& home, FloatNum n);
ModEvent lq(Space& home, const FloatVal& n);
ModEvent gq(Space& home, FloatNum n);
ModEvent gq(Space& home, const FloatVal& n);
GECODE_FLOAT_EXPORT void subscribe(Space& home, Propagator& p, PropCond pc, bool schedule=true);
GECODE_FLOAT_EXPORT void reschedule(Space& home, Propagator& p, PropCond pc);
GECODE_FLOAT_EXPORT void subscribe(Space& home, Advisor& a, bool fail);
static ModEventDelta med(ModEvent me);
private:
GECODE_FLOAT_EXPORT FloatVarImp* perform_copy(Space& home);
public:
FloatVarImp* copy(Space& home);
static FloatNum min(const Delta& d);
static FloatNum max(const Delta& d);
};
}}
#include <gecode/float/var-imp/float.hpp>
// STATISTICS: float-var
Gecode::Advisor
Base-class for advisors.
Definition core.hpp:1292
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Gecode::FloatVal
Float value type.
Definition float.hh:334
Gecode::Float::FloatDelta::FloatVarImp
friend class FloatVarImp
Definition var-imp.hpp:49
Gecode::Float::FloatDelta::FloatDelta
FloatDelta(void)
Create float delta as providing no information.
Definition delta.hpp:44
Gecode::Float::FloatVarImpBase::FloatVarImpBase
FloatVarImpBase(Gecode::Space &home, FloatVarImpBase &x)
Constructor for cloning x.
Definition var-imp.hpp:435
Gecode::Float::FloatVarImpBase::schedule
static void schedule(Gecode::Space &home, Gecode::Propagator &p, Gecode::ModEvent me)
Schedule propagator p.
Definition var-imp.hpp:448
Gecode::Float::FloatVarImp
Float variable implementation.
Definition var-imp.hpp:76
Gecode::Float::FloatVarImp::zero_in
bool zero_in(void) const
Test whether 0 is contained in domain.
Definition float.hpp:100
Gecode::Float::FloatVarImp::subscribe
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
Definition float.cpp:50
Gecode::Float::FloatVarImp::min
FloatNum min(void) const
Return minimum of domain.
Definition float.hpp:67
Gecode::Float::FloatVarImp::FloatVarImp
FloatVarImp(Space &home, FloatVarImp &x)
Constructor for cloning x.
Definition float.hpp:53
Gecode::Float::FloatVarImp::eq
ModEvent eq(Space &home, FloatNum n)
Restrict domain values to be equal to n.
Definition float.hpp:185
Gecode::Float::FloatVarImp::max
FloatNum max(void) const
Return maximum of domain.
Definition float.hpp:71
Gecode::Float::FloatVarImp::val
FloatVal val(void) const
Return value of domain (only if assigned).
Definition float.hpp:75
Gecode::Float::FloatVarImp::dom
FloatVal dom
Domain information.
Definition var-imp.hpp:79
Gecode::Float::FloatVarImp::in
bool in(FloatNum n) const
Test whether n is contained in domain.
Definition float.hpp:104
Gecode::Float::FloatVarImp::reschedule
void reschedule(Space &home, Propagator &p, PropCond pc)
Re-schedule propagator p with propagation condition pc.
Definition float.cpp:56
Gecode::Float::FloatVarImp::copy
FloatVarImp * copy(Space &home)
Return copy of this variable.
Definition float.hpp:216
Gecode::Float::FloatVarImp::size
FloatNum size(void) const
Return width of domain (distance between maximum and minimum).
Definition float.hpp:89
Gecode::Float::FloatVarImp::med
FloatNum med(void) const
Return median of domain (closest representation).
Definition float.hpp:79
Gecode::Float::FloatVarImp::lq
ModEvent lq(Space &home, FloatNum n)
Restrict domain values to be less or equal than n.
Definition float.hpp:159
Gecode::Float::FloatVarImp::gq
ModEvent gq(Space &home, FloatNum n)
Restrict domain values to be greater or equal than n.
Definition float.hpp:133
Gecode::Float::FloatVarImp::assigned
bool assigned(void) const
Test whether variable is assigned.
Definition float.hpp:84
Gecode::Float::FloatVarImp::domain
FloatVal domain(void) const
Return domain.
Definition float.hpp:63
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarImp< Gecode::Float::FloatVarImpConf >::fail
ModEvent fail(Space &home)
Definition core.hpp:4570
Gecode::VarImp< Gecode::Float::FloatVarImpConf >::me
static ModEvent me(const ModEventDelta &med)
Definition core.hpp:4270
delta.hpp
float.hpp
GECODE_FLOAT_EXPORT
#define GECODE_FLOAT_EXPORT
Definition float.hh:68
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Gecode::FloatNum
double FloatNum
Floating point number base type.
Definition float.hh:106
Gecode::Float
Floating point numbers.
Gecode
Gecode toplevel namespace
Gecode::PropCond
int PropCond
Type for propagation conditions.
Definition core.hpp:72
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62