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);
59 y.update(home,share,p.
y);
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);
135 for (
int i = n;
i--; ) {
137 c -= x[
i].val(); x[
i] = x[--
n];
149 for (
int i = n;
i--; ) {
151 c += y[
i].val(); y[
i] = y[--
n];
169 template<
class P,
class N>
174 template<
class P,
class N>
182 template<
class P,
class N>
187 template<
class P,
class N>
190 return new (home)
Eq<P,N>(home,share,*
this);
193 template<
class P,
class N>
198 eliminate_p<P>(
med,
x,
c);
199 eliminate_n<N>(
med,
y,
c);
217 for (
int i = x.
size();
i--; ) {
220 for (
int j = x.size(); j--; ) {
221 if (
i == j)
continue;
224 for (
int j = y.size(); j--; )
225 sl = r.
add_up(sl,y[j].max());
235 for (
int i = y.
size();
i--; ) {
238 for (
int j = x.size(); j--; )
240 for (
int j = y.size(); j--; ) {
241 if (
i == j)
continue;
254 for (
int i = x.
size();
i--; ) {
257 for (
int j = x.size(); j--; ) {
258 if (
i == j)
continue;
261 for (
int j = y.size(); j--; )
272 for (
int i = y.
size();
i--; ) {
275 for (
int j = x.size(); j--; )
276 su = r.
add_up(su,x[j].max());
277 for (
int j = y.size(); j--; ) {
278 if (
i == j)
continue;
299 template<
class P,
class N>
304 template<
class P,
class N>
311 template<
class P,
class N>
316 template<
class P,
class N>
319 return new (home)
Lq<P,N>(home,share,*
this);
322 template<
class P,
class N>
331 for (
int i =
x.
size();
i--; ) {
338 for (
int i =
y.
size();
i--; ) {
367 for (
int i =
x.
size();
i--; ) {
379 for (
int i =
y.
size();
i--; ) {
Propagator for bounds consistent n-ary linear equality
Lq(Space &home, bool share, Lq &p)
Constructor for cloning p.
FloatNum add_down(FloatNum x, FloatNum y)
Return lower bound of x plus y (domain: )
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
int size(void) const
Return size of array (number of elements)
ExecStatus ES_SUBSUMED(Propagator &p)
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Propagator for bounds consistent n-ary linear less or equal
int ModEvent
Type for modification events.
Base-class for n-ary linear propagators.
Base-class for propagators.
const Gecode::ModEvent ME_FLOAT_FAILED
Domain operation has resulted in failure.
bool infty(const FloatNum &n)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
ViewArray< N > y
Array of negative views.
const Gecode::ModEvent ME_FLOAT_VAL
Domain operation has resulted in a value (assigned variable)
Propagation has computed fixpoint.
bool in(FloatNum n) const
Test whether n is included.
Base-class for both propagators and branchers.
Gecode::FloatVal c(-8, 8)
ViewArray< P > x
Array of positive views.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
Execution has resulted in failure.
Eq(Space &home, bool share, Eq &p)
Constructor for cloning p.
ModEventDelta med
A set of modification events (used during propagation)
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
FloatVal c
Constant value.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Floating point rounding policy.
void move_lst(int i)
Move view from position size()-1 to position i (truncate array by one)
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
const int infinity
Infinity for integers.
Node * x
Pointer to corresponding Boolean expression node.
FloatNum sub_down(FloatNum x, FloatNum y)
Return lower bound of x minus y (domain: )
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
bool assigned(View x, int v)
Whether x is assigned to value v.
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Propagation has not computed fixpoint.
Lin(Space &home, bool share, Lin< P, N, pc > &p)
Constructor for cloning p.
void eliminate_p(ModEventDelta med, ViewArray< View > &x, FloatVal &c)
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
void eliminate_n(ModEventDelta med, ViewArray< View > &y, FloatVal &c)
FloatNum sub_up(FloatNum x, FloatNum y)
Return upper bound of x minus y (domain: )
FloatNum add_up(FloatNum x, FloatNum y)
Return upper bound of x plus y (domain: )
Gecode toplevel namespace
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
void reschedule(Space &home, Propagator &p, IntSet &y)
friend FloatVal max(const FloatVal &x, const FloatVal &y)
int size(void) const
Return size of array (number of elements)
int ModEventDelta
Modification event deltas.
friend FloatVal min(const FloatVal &x, const FloatVal &y)
Home class for posting propagators
double FloatNum
Floating point number base type.
bool me_failed(ModEvent me)
Check whether modification event me is failed.