34namespace 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>
375 assert(!
x[
p].assigned());
377 for (
int i=
p+1; i<
x.size(); i++)
378 if (!
x[i].assigned()) {
379 double mi = merit(
x[i],i);
384 for (
int i=0; i<
y.size(); i++)
385 if (!
y[i].assigned()) {
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++)
395 if (!
y[i].assigned()) {
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>
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Base-class for both propagators and branchers.
virtual size_t dispose(Space &home)
Delete actor and return its size.
Recording AFC information for Boolean variables.
Recording actions for Boolean variables.
Recording CHB for Boolean variables.
Which values to select for branching first.
Passing Boolean variables.
Base-class for branchers.
Choice for performing commit
Base-class for brancher for integer and Boolean views.
ViewArray< Int::BoolView > y
Boolean views to branch on.
ViewArray< Int::IntView > x
Integer views to branch on.
IntBoolBrancherBase(Space &home, IntBoolBrancherBase &b)
Constructor for cloning b.
ValSelCommitBase< Int::BoolView, int > * yvsc
Boolean value selection and commit object.
ValSelCommitBase< Int::IntView, int > * xvsc
Integer value selection and commit object.
virtual size_t dispose(Space &home)
Delete brancher and return its size.
Brancher for integer and Boolean views.
virtual const Choice * choice(Space &home)
Return choice.
virtual Actor * copy(Space &home)
Perform cloning.
virtual size_t dispose(Space &home)
Delete brancher and return its size.
IntBoolBrancher(Space &home, IntBoolBrancher &b)
Constructor for cloning b.
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.
Which integer or Boolean variable to select for branching.
BoolCHB boolchb(void) const
Return Boolean AFC.
IntCHB intchb(void) const
Return integer CHB.
void expand(Home home, const IntVarArgs &x, const BoolVarArgs &y)
Expand AFC, action, and CHB.
Select s
Which variable to select.
IntBoolVarBranch(Select s, double d)
Initialize with selection strategy s and decay factor d.
IntAction intaction(void) const
Return integer action.
IntAFC intafc(void) const
Return integer AFC.
BoolAFC boolafc(void) const
Return Boolean AFC.
BoolAction boolaction(void) const
Return Boolean action.
Select select(void) const
Return selection strategy.
BoolAction baction
Boolean action.
IntAction iaction
Integer action.
Select
Which variable selection.
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
@ SEL_ACTION_MAX
With highest action.
@ SEL_AFC_MAX
With largest accumulated failure count.
@ SEL_CHB_MAX
With highest CHB Q-score.
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Select by maximal AFC over size.
IntAFC iafc
Integer AFC information.
double operator()(Int::IntView x, int i) const
Return merit.
BoolAFC bafc
Boolean AFC information.
MeritMaxAFCSize(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
void dispose(void)
Dispose.
MeritMaxAFC(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
void dispose(void)
Dispose.
double operator()(Int::IntView x, int i) const
Return merit.
BoolAFC bafc
Boolean AFC information.
IntAFC iafc
Integer AFC information.
Select by maximal Action over size.
void dispose(void)
Dispose.
double operator()(Int::IntView x, int i) const
Return merit.
BoolAction baction
Boolean Action information.
MeritMaxActionSize(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
IntAction iaction
Integer Action information.
Select by maximal Action.
void dispose(void)
Dispose.
double operator()(Int::IntView x, int i) const
Return merit.
BoolAction baction
Boolean Action information.
MeritMaxAction(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
IntAction iaction
Integer Action information.
Select by maximal CHB over size.
BoolCHB bchb
Boolean CHB information.
void dispose(void)
Dispose.
IntCHB ichb
Integer CHB information.
MeritMaxCHBSize(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
double operator()(Int::IntView x, int i) const
Return merit.
double operator()(Int::IntView x, int i) const
Return merit.
void dispose(void)
Dispose.
MeritMaxCHB(Space &home, const IntBoolVarBranch &ibvb)
Constructor for initialization.
BoolCHB bchb
Boolean CHB information.
IntCHB ichb
Integer CHB information.
Choice storing position and value
int pos(void) const
Return position of view to assign.
int val(void) const
Return value to assign to.
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.
Home class for posting propagators
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
Recording AFC information for integer variables.
Recording actions for integer variables.
Recording CHB for integer variables.
Which values to select for branching first.
@ SEL_RND
Select random value.
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
@ SEL_MIN
Select smallest value.
@ SEL_MAX
Select largest value.
@ SEL_RANGE_MAX
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
@ SEL_RANGE_MIN
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
@ SEL_MED
Select greatest value not greater than the median.
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Select select(void) const
Return selection strategy.
Passing integer variables.
Boolean view for Boolean variables.
Integer view for integer variables.
Rnd rnd(void) const
Return random number generator.
Base class for value selection and commit.
Variable branching information.
bool assigned(void) const
Test whether view is assigned.
double afc(void) const
Return accumulated failure count.
void update(Space &home, ViewArray< View > &a)
Update array to be a clone of array a.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
@ AP_DISPOSE
Actor must always be disposed.
IntBoolVarBranch INTBOOL_VAR_CHB_SIZE_MAX(double d=1.0)
Select variable with largest CHB Q-score divided by domain size.
IntBoolVarBranch INTBOOL_VAR_CHB_MAX(double d=1.0)
Select variable with largest CHB Q-score.
IntBoolVarBranch INTBOOL_VAR_ACTION_MAX(double d=1.0)
Select variable with highest action.
BoolValBranch i2b(const IntValBranch &ivb)
Map respective integer value selection to Boolean value selection.
IntBoolVarBranch INTBOOL_VAR_AFC_SIZE_MAX(double d=1.0)
Select variable with largest accumulated failure count divided by domain size.
IntBoolVarBranch INTBOOL_VAR_ACTION_SIZE_MAX(double d=1.0)
Select variable with largest action divided by domain size.
IntBoolVarBranch INTBOOL_VAR_AFC_MAX(double d=1.0)
Variable selection for both integer and Boolean variables.
Gecode toplevel namespace
IntPropLevel ba(IntPropLevel ipl)
Extract basic or advanced from propagation level.
BoolValBranch BOOL_VAL_MIN(void)
Select smallest value.
BoolValBranch BOOL_VAL_MAX(void)
Select largest value.
Post propagator for SetVar SetOpType SetVar y
BoolValBranch BOOL_VAL_RND(Rnd r)
Select random value.
Post propagator for SetVar x
#define GECODE_NEVER
Assert that this command is never executed.