38 namespace Gecode {
namespace Int {
namespace Channel {
56 bool doval(
void)
const;
58 bool dodom(
void)
const;
82 return !
a &&
view.assigned();
107 template<
class View,
class Offset,
class Info>
114 int j = ox(x[i].
view).val();
117 ModEvent me = oy(y[j].view).eq(home,i);
126 for (
int k=0; k<
i; k++) {
127 ModEvent me = ox(x[k].view).nq(home,j);
144 for (
int k=i+1; k<
n; k++) {
145 ModEvent me = ox(x[k].view).nq(home,j);
161 x[
i].assigned(); n_na--;
162 }
while (!xa.
empty());
167 template<
class View,
class Offset,
class Info>
173 return doprop_val<View,Offset,Info>(home,
n,
x,ox,
y,oy,n_na,xa,ya);
180 template<
class View,
class Offset,
bool shared>
186 template<
class View,
class Offset,
bool shared>
191 template<
class View,
class Offset,
bool shared>
197 template<
class View,
class Offset,
bool shared>
208 for (
int i=0;
i<
n;
i++) {
209 if (x[
i].doval()) xa.
push(
i);
210 if (y[
i].doval()) ya.
push(
i);
221 }
while (!xa.
empty());
228 template<
class View,
class Offset,
bool shared>
231 Offset&
ox, Offset&
oy) {
238 for (
int i=0;
i<
n;
i++) {
void push(const T &x)
Push element x on top of stack.
ExecStatus prop_val(Space &home, int n, Info *x, Offset &ox, Info *y, Offset &oy, int &n_na, ProcessStack &xa, ProcessStack &ya)
ExecStatus ES_SUBSUMED(Propagator &p)
Offset ox
Offset transformation for x variables.
bool a
Whether it has been propagated that view is assigned.
bool empty(void) const
Test whether stack is empty.
int ModEvent
Type for modification events.
ValInfo< View > * xy
View and information for both x and y.
void done(void)
Update the cardinality and bounds information after pruning.
static ExecStatus post(Home home, int n, ValInfo< View > *xy, Offset &ox, Offset &oy)
Post propagator for channeling.
Offset oy
Offset transformation for y variables.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Propagation has computed fixpoint.
bool dodom(void) const
Check whether propagation for domain is to be done.
Combine view with information for value propagation.
Naive channel propagator.
Base-class for both propagators and branchers.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
Gecode::IntArgs i({1, 2, 3, 4})
Execution has resulted in failure.
int n
Number of views (actually twice as many for both x and y)
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Converter with fixed offset.
Post propagator for SetVar SetOpType SetVar SetRelType r
Post propagator for SetVar SetOpType SetVar y
Val(Space &home, Val &p)
Constructor for cloning p.
void update(Space &home, ValInfo< View > &vi)
Update during cloning.
void removed(int i)
Record that one value got removed.
Base-class for channel propagators.
Stack with fixed number of elements.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
T pop(void)
Pop topmost element from stack and return it.
Post propagator for SetVar x
Propagation has not computed fixpoint.
bool doval(void) const
Check whether propagation for assignment is to be done.
void assigned(void)
Record that view got assigned.
Gecode toplevel namespace
bool shared(ViewArray< ViewX > x, ViewArray< ViewY > y)
void init(View x, int n)
Initialize.
int ModEventDelta
Modification event deltas.
Home class for posting propagators
ExecStatus doprop_val(Space &home, int n, Info *x, Offset &ox, Info *y, Offset &oy, int &n_na, ProcessStack &xa, ProcessStack &ya)
bool me_failed(ModEvent me)
Check whether modification event me is failed.
int n_na
Total number of not assigned views (not known to be assigned)
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)