Go to the documentation of this file.
34 namespace Gecode {
namespace FlatZinc {
42 : s(s0), iafc(
i), bafc(
b) {}
46 : s(s0), iaction(
i), baction(
b) {}
50 : s(s0), ichb(
i), bchb(
b) {}
117 inline IntBoolVarBranch
121 inline IntBoolVarBranch
125 inline IntBoolVarBranch
129 inline IntBoolVarBranch
133 inline IntBoolVarBranch
137 inline IntBoolVarBranch
141 inline IntBoolVarBranch
145 inline IntBoolVarBranch
149 inline IntBoolVarBranch
153 inline IntBoolVarBranch
157 inline IntBoolVarBranch
166 : iafc(ibvb.intafc()), bafc(ibvb.boolafc()) {}
169 : iafc(m.iafc), bafc(m.bafc) {}
187 : iafc(ibvb.intafc()), bafc(ibvb.boolafc()) {}
190 : iafc(m.iafc), bafc(m.bafc) {}
193 return x.
afc() /
x.size();
197 return x.
afc() / 2.0;
208 : iaction(ibvb.intaction()), baction(ibvb.boolaction()) {}
211 : iaction(m.iaction), baction(m.baction) {}
229 : iaction(ibvb.intaction()), baction(ibvb.boolaction()) {}
232 : iaction(m.iaction), baction(m.baction) {}
250 : ichb(ibvb.intchb()), bchb(ibvb.boolchb()) {}
253 : ichb(m.ichb), bchb(m.bchb) {}
271 : ichb(ibvb.intchb()), bchb(ibvb.boolchb()) {}
274 : ichb(m.ichb), bchb(m.bchb) {}
277 return ichb[
i] /
x.size();
281 return bchb[
i] / 2.0;
310 :
Brancher(home),
x(x0),
y(y0), start(0), xvsc(xvsc0), yvsc(yvsc0) {
318 xvsc(
b.xvsc->copy(home)), yvsc(
b.yvsc->copy(home)) {
333 template<
class Merit>
344 template<
class Merit>
356 template<
class Merit>
363 template<
class Merit>
369 template<
class Merit>
377 for (
int i=
p+1;
i<
x.size();
i++)
379 double mi = merit(
x[
i],
i);
384 for (
int i=0;
i<
y.size();
i++)
386 double mi = merit(
y[
i],
i);
393 m=merit(
y[
p-
x.size()],
p-
x.size());
394 for (
int i=
p-
x.size()+1;
i<
y.size();
i++)
396 double mi = merit(
y[
i],
i);
404 v=xvsc->val(home,
x[
p],
p);
406 v=yvsc->val(home,
y[
p-
x.size()],
p-
x.size());
411 template<
class Merit>
Which integer or Boolean variable to select for branching.
ValSelCommitBase< Int::IntView, int > * xvsc
Integer value selection and commit object.
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
@ SEL_AFC_MAX
With largest accumulated failure count.
Post propagator for SetVar x
Post propagator for SetVar SetOpType SetVar y
@ SEL_RANGE_MAX
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Select by maximal Action over size.
IntBoolVarBranch INTBOOL_VAR_AFC_MAX(double d=1.0)
Variable selection for both integer and Boolean variables.
IntBoolBrancher(Space &home, IntBoolBrancher &b)
Constructor for cloning b.
IntBoolVarBranch INTBOOL_VAR_CHB_MAX(double d=1.0)
Select variable with largest CHB Q-score.
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
double decay(void) const
Return decay factor.
IntAFC iafc
Integer AFC information.
Passing integer variables.
Select s
Which variable to select.
MeritMaxCHBSize(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
Recording actions for Boolean variables.
int val(void) const
Return value to assign to.
BoolAFC bafc
Boolean AFC information.
bool assigned(View x, int v)
Whether x is assigned to value v.
BoolValBranch i2b(const IntValBranch &ivb)
Map respective integer value selection to Boolean value selection.
static void post(Home home, ViewArray< Int::IntView > x, ViewArray< Int::BoolView > y, Merit &m, ValSelCommitBase< Int::IntView, int > *xvsc, ValSelCommitBase< Int::BoolView, int > *yvsc)
Post brancher.
IntBoolVarBranch(Select s, double d)
Initialize with selection strategy s and decay factor d.
BoolAction baction
Boolean Action information.
BoolAFC boolafc(void) const
Return Boolean AFC.
Which values to select for branching first.
MeritMaxActionSize(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Base-class for both propagators and branchers.
Recording AFC information for integer variables.
BoolValBranch BOOL_VAL_RND(Rnd r)
Select random value.
bool assigned(void) const
Test whether view is assigned.
IntAction iaction
Integer Action information.
virtual size_t dispose(Space &home)
Delete brancher and return its size.
Select
Which variable selection.
void dispose(void)
Dispose.
IntAction iaction
Integer Action information.
void dispose(void)
Dispose.
void dispose(void)
Dispose.
MeritMaxAFCSize(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
double operator()(Int::IntView x, int i) const
Return merit.
IntAction intaction(void) const
Return integer action.
PosIntChoice(const Brancher &b, unsigned int a, int p, int n)
Initialize choice for brancher b, number of alternatives a, position p, and value n.
Boolean view for Boolean variables.
IntBoolVarBranch INTBOOL_VAR_AFC_SIZE_MAX(double d=1.0)
Select variable with largest accumulated failure count divided by domain size.
Recording CHB for integer variables.
Variable branching information.
MeritMaxAFC(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
double operator()(Int::IntView x, int i) const
Return merit.
Gecode toplevel namespace
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
IntPropLevel ba(IntPropLevel ipl)
Extract basic or advanced from propagation level.
ViewArray< Int::BoolView > y
Boolean views to branch on.
Recording AFC information for Boolean variables.
Select by maximal Action.
@ SEL_CHB_MAX
With highest CHB Q-score.
void update(Space &home, ViewArray< View > &a)
Update array to be a clone of array a.
IntAction iaction
Integer action.
BoolAction boolaction(void) const
Return Boolean action.
Base-class for branchers.
Passing Boolean variables.
Home class for posting propagators
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
IntBoolVarBranch INTBOOL_VAR_ACTION_MAX(double d=1.0)
Select variable with highest action.
@ AP_DISPOSE
Actor must always be disposed.
Select by maximal AFC over size.
@ SEL_MAX
Select largest value.
Brancher for integer and Boolean views.
Select select(void) const
Return selection strategy.
BoolAction baction
Boolean Action information.
IntBoolVarBranch INTBOOL_VAR_CHB_SIZE_MAX(double d=1.0)
Select variable with largest CHB Q-score divided by domain size.
@ SEL_RND
Select random value.
double operator()(Int::IntView x, int i) const
Return merit.
ViewArray< Int::IntView > x
Integer views to branch on.
double operator()(Int::IntView x, int i) const
Return merit.
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
double operator()(Int::IntView x, int i) const
Return merit.
virtual Actor * copy(Space &home)
Perform cloning.
IntBoolBrancherBase(Space &home, IntBoolBrancherBase &b)
Constructor for cloning b.
IntCHB intchb(void) const
Return integer CHB.
BoolValBranch BOOL_VAL_MAX(void)
Select largest value.
void dispose(void)
Dispose.
BoolValBranch BOOL_VAL_MIN(void)
Select smallest value.
#define GECODE_NEVER
Assert that this command is never executed.
IntBoolVarBranch INTBOOL_VAR_ACTION_SIZE_MAX(double d=1.0)
Select variable with largest action divided by domain size.
Base class for value selection and commit.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Recording actions for integer variables.
double operator()(Int::IntView x, int i) const
Return merit.
Select by maximal CHB over size.
Choice storing position and value
@ SEL_RANGE_MIN
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
Rnd rnd(void) const
Return random number generator.
IntAFC iafc
Integer AFC information.
@ SEL_MED
Select greatest value not greater than the median.
Select select(void) const
Return selection strategy.
BoolAction baction
Boolean action.
MeritMaxCHB(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
@ SEL_ACTION_MAX
With highest action.
BoolCHB bchb
Boolean CHB information.
Recording CHB for Boolean variables.
MeritMaxAction(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
void dispose(void)
Dispose.
Integer view for integer variables.
IntCHB ichb
Integer CHB information.
int pos(void) const
Return position of view to assign.
ValSelCommitBase< Int::BoolView, int > * yvsc
Boolean value selection and commit object.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
BoolCHB boolchb(void) const
Return Boolean AFC.
virtual size_t dispose(Space &home)
Delete actor and return its size.
virtual size_t dispose(Space &home)
Delete brancher and return its size.
BoolAFC bafc
Boolean AFC information.
IntCHB ichb
Integer CHB information.
int n
Number of negative literals for node type.
Choice for performing commit
Base-class for brancher for integer and Boolean views.
IntAFC intafc(void) const
Return integer AFC.
void expand(Home home, const IntVarArgs &x, const BoolVarArgs &y)
Expand AFC, action, and CHB.
Gecode::IntArgs i({1, 2, 3, 4})
double afc(void) const
Return accumulated failure count.
virtual const Choice * choice(Space &home)
Return choice.
@ SEL_MIN
Select smallest value.
int p
Number of positive literals for node type.
void dispose(void)
Dispose.
BoolCHB bchb
Boolean CHB information.
Which values to select for branching first.