40 namespace Gecode {
namespace Float {
namespace Linear {
46 template<
class P,
class N, PropCond pc>
54 template<
class P,
class N, PropCond pc>
62 template<
class P,
class N, PropCond pc>
68 template<
class P,
class N, PropCond pc>
71 x.cancel(home,*
this,pc);
72 y.cancel(home,*
this,pc);
128 for (
int i = n;
i--; ) {
130 c -= x[
i].val(); x[
i] = x[--
n];
142 for (
int i = n;
i--; ) {
144 c += y[
i].val(); y[
i] = y[--
n];
162 template<
class P,
class N>
167 template<
class P,
class N>
175 template<
class P,
class N>
180 template<
class P,
class N>
183 return new (home)
Eq<P,N>(home,share,*
this);
186 template<
class P,
class N>
191 eliminate_p<P>(med,
x,
c);
192 eliminate_n<N>(med, y,
c);
210 for (
int i = x.
size();
i--; ) {
213 for (
int j = x.size(); j--; ) {
214 if (
i == j)
continue;
217 for (
int j = y.size(); j--; )
218 sl = r.
add_up(sl,y[j].max());
228 for (
int i = y.
size();
i--; ) {
231 for (
int j = x.size(); j--; )
233 for (
int j = y.size(); j--; ) {
234 if (
i == j)
continue;
247 for (
int i = x.
size();
i--; ) {
250 for (
int j = x.size(); j--; ) {
251 if (
i == j)
continue;
254 for (
int j = y.size(); j--; )
265 for (
int i = y.
size();
i--; ) {
268 for (
int j = x.size(); j--; )
269 su = r.
add_up(su,x[j].max());
270 for (
int j = y.size(); j--; ) {
271 if (
i == j)
continue;
292 template<
class P,
class N>
297 template<
class P,
class N>
304 template<
class P,
class N>
309 template<
class P,
class N>
312 return new (home)
Lq<P,N>(home,share,*
this);
315 template<
class P,
class N>
324 for (
int i =
x.size();
i--; ) {
326 c -=
x[
i].val();
x.move_lst(
i);
331 for (
int i = y.
size();
i--; ) {
333 c += y[
i].val(); y.move_lst(
i);
338 if ((
x.size() + y.size()) <= 1) {
350 for (
int i =
x.size();
i--; )
352 for (
int i = y.
size();
i--; )
360 for (
int i =
x.size();
i--; ) {
372 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.
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
FloatNum add_down(FloatNum x, FloatNum y)
Return lower bound of x plus y (domain: )
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
ExecStatus ES_SUBSUMED(Propagator &p)
int size(void) const
Return size of array (number of elements)
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Propagator for bounds consistent n-ary linear less or equal
virtual size_t dispose(Space &home)
Delete propagator and return its size.
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.
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.
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
Eq(Space &home, bool share, Eq &p)
Constructor for cloning p.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Floating point rounding policy.
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.
virtual size_t dispose(Space &home)
Delete actor and return its size.
bool in(FloatNum n) const
Test whether n is included.
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: )
int size(void) const
Return size of array (number of elements)
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 .
friend FloatVal max(const FloatVal &x, const FloatVal &y)
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.