42 template<
class P,
class N, PropCond pc>
46 x.subscribe(home,*
this,pc);
47 y.subscribe(home,*
this,pc);
50 template<
class P,
class N, PropCond pc>
58 template<
class P,
class N, PropCond pc>
64 template<
class P,
class N, PropCond pc>
67 x.reschedule(home,*
this,pc);
68 y.reschedule(home,*
this,pc);
71 template<
class P,
class N, PropCond pc>
74 x.cancel(home,*
this,pc);
75 y.cancel(home,*
this,pc);
87 for (
int i = n; i--; ) {
88 if (
x[i].assigned()) {
89 c -=
x[i].val();
x[i] =
x[--n];
101 for (
int i = n; i--; ) {
102 if (
y[i].assigned()) {
103 c +=
y[i].val();
y[i] =
y[--n];
112 return ((n == std::numeric_limits<FloatNum>::infinity()) ||
113 (n == -std::numeric_limits<FloatNum>::infinity()));
121 template<
class P,
class N>
126 template<
class P,
class N>
134 template<
class P,
class N>
139 template<
class P,
class N>
142 return new (home)
Eq<P,N>(home,*
this);
145 template<
class P,
class N>
166 bool assigned =
true;
169 for (
int i =
x.size(); i--; ) {
172 for (
int j =
x.size(); j--; ) {
173 if (i == j)
continue;
174 sl =
r.sub_up(sl,
x[j].
min());
176 for (
int j =
y.size(); j--; )
177 sl =
r.add_up(sl,
y[j].
max());
187 for (
int i =
y.size(); i--; ) {
190 for (
int j =
x.size(); j--; )
191 sl =
r.add_down(sl,
x[j].
min());
192 for (
int j =
y.size(); j--; ) {
193 if (i == j)
continue;
194 sl =
r.sub_down(sl,
y[j].
max());
206 for (
int i =
x.size(); i--; ) {
209 for (
int j =
x.size(); j--; ) {
210 if (i == j)
continue;
211 su =
r.sub_down(su,
x[j].
max());
213 for (
int j =
y.size(); j--; )
214 su =
r.add_down(su,
y[j].
min());
224 for (
int i =
y.size(); i--; ) {
227 for (
int j =
x.size(); j--; )
228 su =
r.add_up(su,
x[j].
max());
229 for (
int j =
y.size(); j--; ) {
230 if (i == j)
continue;
231 su =
r.sub_up(su,
y[j].
min());
251 template<
class P,
class N>
256 template<
class P,
class N>
263 template<
class P,
class N>
268 template<
class P,
class N>
271 return new (home)
Lq<P,N>(home,*
this);
274 template<
class P,
class N>
283 for (
int i =
x.size(); i--; ) {
284 if (
x[i].assigned()) {
285 c -=
x[i].val();
x.move_lst(i);
287 sl =
r.sub_up(sl,
x[i].
min());
290 for (
int i =
y.size(); i--; ) {
291 if (
y[i].assigned()) {
292 c +=
y[i].val();
y.move_lst(i);
294 sl =
r.add_up(sl,
y[i].
max());
297 if ((
x.size() +
y.size()) <= 1) {
309 for (
int i =
x.size(); i--; )
310 sl =
r.sub_up(sl,
x[i].
min());
311 for (
int i =
y.size(); i--; )
312 sl =
r.add_up(sl,
y[i].
max());
315 sl =
r.add_up(sl,
c.max());
318 bool assigned =
true;
319 for (
int i =
x.size(); i--; ) {
320 assert(!
x[i].assigned());
331 for (
int i =
y.size(); i--; ) {
332 assert(!
y[i].assigned());
Base-class for both propagators and branchers.
virtual size_t dispose(Space &home)
Delete actor and return its size.
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
virtual Actor * copy(Space &home)
Create copy during cloning.
Eq(Space &home, Eq &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Lin(Space &home, Lin< P, N, pc > &p)
Constructor for cloning p.
ViewArray< P > x
Array of positive views.
virtual void reschedule(Space &home)
Schedule function.
ViewArray< N > y
Array of negative views.
FloatVal c
Constant value.
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
virtual Actor * copy(Space &home)
Create copy during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Lq(Space &home, Lq &p)
Constructor for cloning p.
Floating point rounding policy.
Home class for posting propagators
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
ModEventDelta med
A set of modification events (used during propagation)
Propagator(Home home)
Constructor for posting.
static ModEvent me(const ModEventDelta &med)
ExecStatus ES_SUBSUMED(Propagator &p)
Propagator p is subsumed
int ModEventDelta
Modification event deltas.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
double FloatNum
Floating point number base type.
void eliminate_n(ModEventDelta med, ViewArray< View > &y, FloatVal &c)
void eliminate_p(ModEventDelta med, ViewArray< View > &x, FloatVal &c)
bool infty(const FloatNum &n)
const Gecode::ModEvent ME_FLOAT_VAL
Domain operation has resulted in a value (assigned variable)
const Gecode::ModEvent ME_FLOAT_FAILED
Domain operation has resulted in failure.
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar SetOpType SetVar y
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_FAILED
Execution has resulted in failure.
@ ES_NOFIX
Propagation has not computed fixpoint.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar x
int ModEvent
Type for modification events.