40 namespace Gecode {
namespace Set {
namespace Channel {
48 :
Advisor(home,p,c), idx(index) {
50 p.
y.subscribe(home,*
this);
60 :
Advisor(home,share,a), idx(a.idx) {}
74 p.
y.cancel(home,*
this);
93 }
else if (
x[
i].
one()) {
105 if (
y.glbSize() ==
y.glbMax()-
y.glbMin()+1) {
117 :
Super(home,share,p), running(false) {
118 co.update(home, share, p.
co);
140 (void) Super::dispose(home);
141 return sizeof(*this);
154 if (zeros.size() > 0) {
159 if (ones.size() > 0) {
166 if (delta.glbMin() != 1 || delta.glbMax() != 0) {
167 if (!delta.glbAny()) {
168 for (
int i=delta.glbMin();
i<=delta.glbMax();
i++)
177 if (delta.lubMin() != 1 || delta.lubMax() != 0) {
178 if (!delta.lubAny()) {
179 for (
int i=delta.lubMin();
i<=delta.lubMax();
i++)
184 for (; cur < lub.min(); cur++) {
189 for (; cur <
x.size(); cur++) {
207 int index = a.
index();
208 if ( (running && index == -1 && me !=
ME_SET_VAL)
214 if (
x[index].zero()) {
216 zeros.include(home, index, index, dummy);
218 assert(
x[index].
one());
220 ones.include(home, index, index, dummy);
228 SetDelta(2,0, delta.lubMin(), delta.lubMax());
230 if (delta.glbMin() == 1 && delta.glbMax() == 0) {
233 delta.lubMin(), delta.lubMax());
235 if (delta.glbMin() != 2 || delta.glbMax() != 0) {
236 if ((delta.glbMin() <= d.
glbMin() && delta.glbMax() >= d.
glbMin())
238 (delta.glbMin() <= d.
glbMax() && delta.glbMax() >= d.
glbMax())
243 delta.lubMin(), delta.lubMax());
246 SetDelta(2, 0, delta.lubMin(), delta.lubMax());
255 SetDelta(delta.glbMin(), delta.glbMax(), 2,0);
257 if (delta.lubMin() == 1 && delta.lubMax() == 0) {
259 SetDelta(delta.glbMin(), delta.glbMax(),
262 if (delta.lubMin() != 2 || delta.lubMax() != 0) {
263 if ((delta.lubMin() <= d.
lubMin() && delta.lubMax() >= d.
lubMin())
265 (delta.lubMin() <= d.
lubMax() && delta.lubMax() >= d.
lubMax())
268 SetDelta(delta.lubMin(), delta.lubMax(),
274 SetDelta(delta.glbMin(), delta.glbMax(), 2, 0);
bool running
Flag whether propagation is currently running.
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
ExecStatus ES_SUBSUMED(Propagator &p)
const FloatNum max
Largest allowed float value.
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
void dummy(Space &home)
A dummy function for branching.
Multi _d(Gecode::IntArgs(3, 3, 2, 1))
const Gecode::ModEvent ME_SET_BB
Domain operation has changed both greatest lower and least upper bound.
int ModEvent
Type for modification events.
Council< IndexAdvisor > co
Council for managing advisors.
void dispose(Space &home, Council< A > &c)
Delete advisor.
GLBndSet zeros
Accumulated zero Booleans.
ExecStatus ES_NOFIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed and its propagator must be run
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_QUADRATIC_LO)
ViewArray< Gecode::Int::BoolView > x
Array of views.
static ExecStatus post(Home home, ViewArray< Gecode::Int::BoolView > &x, View y)
Post propagator for .
Propagation has computed fixpoint.
Base-class for both propagators and branchers.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
bool glbAny(void) const
Test whether delta represents any domain change in glb.
IndexAdvisor(Space &home, ChannelBool< View > &p, Council< A > &c, int index)
Constructor for creation.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
int glbMax(void) const
Return glb maximum.
int glbMin(void) const
Return glb minimum.
Value iterator from range iterator.
int index(void) const
Access index.
Range iterator for integer sets.
Advisor storing a single index
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
bool testSetEventLB(ModEvent me0, ModEvent me1, ModEvent me2)
int lubMin(void) const
Return lub minimum.
Node * x
Pointer to corresponding Boolean expression node.
Generic domain change information to be supplied to advisors.
void dispose(Space &home, Council< A > &c)
Dispose the advisor.
bool assigned(View x, int v)
Whether x is assigned to value v.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
int lubMax(void) const
Return lub maximum.
Propagation has not computed fixpoint.
GLBndSet ones
Accumulated one Booleans.
int size(void) const
Return size of array (number of elements)
Propagator for channelling between set variable and its characteristic function
Gecode toplevel namespace
static void schedule(Space &home, Propagator &p, ModEvent me)
Schedule propagator p with modification event me.
bool testSetEventUB(ModEvent me0, ModEvent me1, ModEvent me2)
SetDelta delta
Accumulated delta information.
const Gecode::ModEvent ME_SET_VAL
Domain operation has resulted in a value (assigned variable)
const Gecode::ModEvent ME_SET_CARD
Domain operation has changed the variable cardinality.
int ModEventDelta
Modification event deltas.
Home class for posting propagators
ChannelBool(Space &home, bool share, ChannelBool &p)
Constructor for cloning p.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
bool include(Space &home, int i, int j, SetDelta &d)
Include the set in this set.
bool lubAny(void) const
Test whether delta represents any domain change in lub.
const Gecode::ModEvent ME_BOOL_VAL
Domain operation has resulted in a value (assigned variable)
Finite set delta information for advisors.