Go to the documentation of this file.
40 namespace Gecode {
namespace Float {
namespace Linear {
46 template<
class P,
class N, PropCond pc>
50 x.subscribe(home,*
this,pc);
51 y.subscribe(home,*
this,pc);
54 template<
class P,
class N, PropCond pc>
58 x.update(home,share,
p.x);
62 template<
class P,
class N, PropCond pc>
68 template<
class P,
class N, PropCond pc>
71 x.reschedule(home,*
this,pc);
72 y.reschedule(home,*
this,pc);
75 template<
class P,
class N, PropCond pc>
78 x.cancel(home,*
this,pc);
79 y.cancel(home,*
this,pc);
80 (void) Propagator::dispose(home);
91 for (
int i =
n;
i--; ) {
105 for (
int i =
n;
i--; ) {
107 c +=
y[
i].val();
y[
i] =
y[--
n];
125 template<
class P,
class N>
130 template<
class P,
class N>
138 template<
class P,
class N>
143 template<
class P,
class N>
146 return new (home)
Eq<P,N>(home,share,*
this);
149 template<
class P,
class N>
154 eliminate_p<P>(med,
x,
c);
155 eliminate_n<N>(med,
y,
c);
173 for (
int i =
x.size();
i--; ) {
176 for (
int j =
x.size(); j--; ) {
177 if (
i == j)
continue;
178 sl =
r.sub_up(sl,
x[j].
min());
180 for (
int j =
y.size(); j--; )
181 sl =
r.add_up(sl,
y[j].
max());
191 for (
int i =
y.size();
i--; ) {
194 for (
int j =
x.size(); j--; )
195 sl =
r.add_down(sl,
x[j].
min());
196 for (
int j =
y.size(); j--; ) {
197 if (
i == j)
continue;
198 sl =
r.sub_down(sl,
y[j].
max());
210 for (
int i =
x.size();
i--; ) {
213 for (
int j =
x.size(); j--; ) {
214 if (
i == j)
continue;
215 su =
r.sub_down(su,
x[j].
max());
217 for (
int j =
y.size(); j--; )
218 su =
r.add_down(su,
y[j].
min());
228 for (
int i =
y.size();
i--; ) {
231 for (
int j =
x.size(); j--; )
232 su =
r.add_up(su,
x[j].
max());
233 for (
int j =
y.size(); j--; ) {
234 if (
i == j)
continue;
235 su =
r.sub_up(su,
y[j].
min());
255 template<
class P,
class N>
260 template<
class P,
class N>
267 template<
class P,
class N>
272 template<
class P,
class N>
275 return new (home)
Lq<P,N>(home,share,*
this);
278 template<
class P,
class N>
287 for (
int i =
x.size();
i--; ) {
289 c -=
x[
i].val();
x.move_lst(
i);
291 sl =
r.sub_up(sl,
x[
i].
min());
294 for (
int i =
y.size();
i--; ) {
296 c +=
y[
i].val();
y.move_lst(
i);
298 sl =
r.add_up(sl,
y[
i].
max());
301 if ((
x.size() +
y.size()) <= 1) {
313 for (
int i =
x.size();
i--; )
314 sl =
r.sub_up(sl,
x[
i].
min());
315 for (
int i =
y.size();
i--; )
316 sl =
r.add_up(sl,
y[
i].
max());
319 sl =
r.add_up(sl,
c.
max());
323 for (
int i =
x.size();
i--; ) {
335 for (
int i =
y.size();
i--; ) {
Post propagator for SetVar x
Post propagator for SetVar SetOpType SetVar y
friend FloatVal max(const FloatVal &x, const FloatVal &y)
Propagator for bounds consistent n-ary linear less or equal
bool me_failed(ModEvent me)
Check whether modification event me is failed.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
ExecStatus ES_SUBSUMED(Propagator &p)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
friend FloatVal min(const FloatVal &x, const FloatVal &y)
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.
Lq(Space &home, bool share, Lq &p)
Constructor for cloning p.
bool assigned(View x, int v)
Whether x is assigned to value v.
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Base-class for both propagators and branchers.
void update(Space &home, bool share, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Gecode toplevel namespace
Base-class for propagators.
Node * x
Pointer to corresponding Boolean expression node.
void reschedule(Space &home, Propagator &p, IntSet &y)
bool in(FloatNum n) const
Test whether n is included.
Home class for posting propagators
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Post propagator for SetVar SetOpType SetVar SetRelType r
double FloatNum
Floating point number base type.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Floating point rounding policy.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
int ModEvent
Type for modification events.
Base-class for n-ary linear propagators.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Propagator for bounds consistent n-ary linear equality
const int infinity
Infinity for integers.
@ ES_FIX
Propagation has computed fixpoint.
Eq(Space &home, bool share, Eq &p)
Constructor for cloning p.
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Gecode::FloatVal c(-8, 8)
int n
Number of negative literals for node type.
@ ES_FAILED
Execution has resulted in failure.
int ModEventDelta
Modification event deltas.
@ ES_NOFIX
Propagation has not computed fixpoint.
@ ES_OK
Execution is okay.
int p
Number of positive literals for node type.
void eliminate_p(ModEventDelta med, ViewArray< View > &x, FloatVal &c)
bool infty(const FloatNum &n)
void eliminate_n(ModEventDelta med, ViewArray< View > &y, FloatVal &c)
Lin(Space &home, bool share, Lin< P, N, pc > &p)
Constructor for cloning p.