38 namespace Gecode {
namespace Int {
namespace Linear {
63 class ResultIter :
public ViewValues<IntView> {
73 void operator ++(
void);
189 SupportSet::ResultIter::operator ++(
void) {
192 }
while (ViewValues<IntView>::operator ()() && s.supported(
p));
205 ResultIter
i(*
this,x);
222 int a0,
const IntView& x0, Val l0, Val u0) {
223 a=a0; x=x0;
l=l0;
u=u0;
234 return s.tell(home,x);
246 if (d + static_cast<Val>(
a)*x.
max() <
u)
251 while (d + static_cast<Val>(
a)*
i.max() <
u) {
259 while (d + static_cast<Val>(
a)*
c <
u) {
263 d +=
static_cast<Val
>(
a) *
c;
270 Val
v =
static_cast<Val
>(
a) *
c;
284 c =
i.min(); v =
static_cast<Val
>(
a) *
c;
303 if (d + static_cast<Val>(
a)*x.
min() <
u)
308 while (d + static_cast<Val>(
a)*
i.min() <
u) {
316 while (d + static_cast<Val>(
a)*
c <
u) {
320 d +=
static_cast<Val
>(
a) *
c;
327 Val
v =
static_cast<Val
>(
a) *
c;
341 c =
i.max(); v =
static_cast<Val
>(
a) *
c;
357 template<
class Val,
class View>
364 template<
class Val,
class View>
373 template<
class Val,
class View>
378 template<
class Val,
class View>
384 template<
class Val,
class View>
393 template<
class Val,
class View>
397 ExecStatus es = prop_bnd<Val,View,View>(home,med,*
this,
x,y,
c);
399 return home.ES_FIX_PARTIAL(*
this,View::med(
ME_INT_DOM));
417 for (
int j=m; j--; ) {
418 yp[j].
init(r,-y[j].scale(),y[j].base(),l,u);
419 l += y[j].max(); u += y[j].min();
421 for (
int i=n;
i--; ) {
422 xp[
i].
init(r,x[
i].scale(),x[
i].base(),l,u);
436 if (!xp[i].reset(d))
goto prev_i;
442 if (!yp[j].reset(d))
goto prev_j;
448 for (
int is=n; is--; ) xp[is].support();
449 for (
int js=m; js--; ) yp[js].support();
454 if (yp[j-1].adjust(d))
goto next_j;
460 if (xp[i-1].adjust(d))
goto next_i;
467 for (
int i=n;
i--; ) {
472 for (
int j=m; j--; ) {
bool get(unsigned int i) const
Access value at bit i.
bool reset(Val &d)
Reset iterator to beginning and adjust.
Val u
Upper bound information for value.
unsigned int p
Position of current value.
SupportSet(void)
Default constructor.
Some but not all bits set.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
VarImpType * varimp(void) const
Return variable implementation of view.
ExecStatus ES_SUBSUMED(Propagator &p)
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Propagator for domain consistent n-ary linear equality
bool adjust(Val &d)
Adjust.
bool supported(unsigned int i) const
Check whether position.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
int ModEvent
Type for modification events.
Val l
Lower bound information for value.
Set for support information
Value iterator for integer views.
Base-class for n-ary linear propagators.
Propagation has computed fixpoint.
SupportSet s
Set of support for values in x.
bool reset(Val &d)
Reset iterator to beginning and adjust.
Base-class for both propagators and branchers.
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
void operator++(void)
Move iterator to next value (if possible)
int max(void) const
Return maximum of domain.
const Gecode::ModEvent ME_INT_FAILED
Domain operation has resulted in failure.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
Gecode::FloatVal c(-8, 8)
Base-class for support-based iterator.
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.
unsigned int size(void) const
Return size (cardinality) of domain.
Range iterator for ranges of integer variable implementation.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
int min(void) const
Return minimum of domain.
Backward iterator for ranges of integer variable implementations.
ModEvent tell(Space &home)
Tell back new variable domain according to support found.
Support-based iterator for negative view.
void init(A &a, unsigned int s, bool setbits=false)
Initialize for s bits and allocator a (only after default constructor)
void set(unsigned int i)
Set bit i.
BitSetStatus status(void) const
Return status of bitset.
DomEq(Space &home, bool share, DomEq &p)
Constructor for cloning p.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
void support(unsigned int i)
Record that there is support at position i.
static ExecStatus post(Home home, ViewArray< View > &x, ViewArray< View > &y, Val c)
Post propagator for .
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
Integer view for integer variables.
void init(Region &r, unsigned int n)
Initialize support set with cardinality n.
Node * x
Pointer to corresponding Boolean expression node.
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
bool assigned(View x, int v)
Whether x is assigned to value v.
int a
Integer coefficient for view.
static PropCost crazy(PropCost::Mod m, unsigned int n)
Exponential complexity for modifier m and size measure n.
void init(Region &r, int a, const IntView &x, Val l, Val u)
Initialize view.
Support-based iterator for positive view.
void support(void)
Record value at current position as supported.
Gecode toplevel namespace
ModEvent tell(Space &home, IntView &x) const
Perform tell according to recorded support information on.
int ModEventDelta
Modification event deltas.
Home class for posting propagators
#define GECODE_NEVER
Assert that this command is never executed.
const Gecode::ModEvent ME_INT_NONE
Domain operation has not changed domain.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
bool adjust(Val &d)
Adjust.