var.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2012
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode {
forceinline
SetVarBranch::SetVarBranch(void)
: s(SEL_NONE) {}
forceinline
SetVarBranch::SetVarBranch(Select s0, BranchTbl t)
: VarBranch<SetVar>(t), s(s0) {}
forceinline
SetVarBranch::SetVarBranch(Rnd r)
: VarBranch<SetVar>(r), s(SEL_RND) {}
forceinline
SetVarBranch::SetVarBranch(Select s0, double d, BranchTbl t)
: VarBranch<SetVar>(d,t), s(s0) {}
forceinline
SetVarBranch::SetVarBranch(Select s0, SetAFC a, BranchTbl t)
: VarBranch<SetVar>(a,t), s(s0) {}
forceinline
SetVarBranch::SetVarBranch(Select s0, SetAction a, BranchTbl t)
: VarBranch<SetVar>(a,t), s(s0) {}
forceinline
SetVarBranch::SetVarBranch(Select s0, SetCHB c, BranchTbl t)
: VarBranch<SetVar>(c,t), s(s0) {}
forceinline
SetVarBranch::SetVarBranch(Select s0, SetBranchMerit mf, BranchTbl t)
: VarBranch<SetVar>(mf,t), s(s0) {}
forceinline SetVarBranch::Select
SetVarBranch::select(void) const {
return s;
}
forceinline void
SetVarBranch::expand(Home home, const SetVarArgs& x) {
switch (select()) {
case SEL_AFC_MIN: case SEL_AFC_MAX:
case SEL_AFC_SIZE_MIN: case SEL_AFC_SIZE_MAX:
if (!_afc)
_afc = SetAFC(home,x,decay());
break;
case SEL_ACTION_MIN: case SEL_ACTION_MAX:
case SEL_ACTION_SIZE_MIN: case SEL_ACTION_SIZE_MAX:
if (!_act)
_act = SetAction(home,x,decay());
break;
case SEL_CHB_MIN: case SEL_CHB_MAX:
case SEL_CHB_SIZE_MIN: case SEL_CHB_SIZE_MAX:
if (!_chb)
_chb = SetCHB(home,x);
break;
default: ;
}
}
inline SetVarBranch
SET_VAR_NONE(void) {
return SetVarBranch(SetVarBranch::SEL_NONE,nullptr);
}
inline SetVarBranch
SET_VAR_RND(Rnd r) {
return SetVarBranch(r);
}
inline SetVarBranch
SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_MERIT_MIN,bm,tbl);
}
inline SetVarBranch
SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_MERIT_MAX,bm,tbl);
}
inline SetVarBranch
SET_VAR_DEGREE_MIN(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_DEGREE_MIN,tbl);
}
inline SetVarBranch
SET_VAR_DEGREE_MAX(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_DEGREE_MAX,tbl);
}
inline SetVarBranch
SET_VAR_AFC_MIN(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_MIN,d,tbl);
}
inline SetVarBranch
SET_VAR_AFC_MIN(SetAFC a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_MIN,a,tbl);
}
inline SetVarBranch
SET_VAR_AFC_MAX(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_MAX,d,tbl);
}
inline SetVarBranch
SET_VAR_AFC_MAX(SetAFC a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_MAX,a,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_MIN(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_MIN,d,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_MIN(SetAction a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_MIN,a,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_MAX(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_MAX,d,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_MAX(SetAction a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_MAX,a,tbl);
}
inline SetVarBranch
SET_VAR_CHB_MIN(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_MIN,tbl);
}
inline SetVarBranch
SET_VAR_CHB_MIN(SetCHB c, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_MIN,c,tbl);
}
inline SetVarBranch
SET_VAR_CHB_MAX(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_MAX,tbl);
}
inline SetVarBranch
SET_VAR_CHB_MAX(SetCHB c, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_MAX,c,tbl);
}
inline SetVarBranch
SET_VAR_MIN_MIN(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_MIN_MIN,tbl);
}
inline SetVarBranch
SET_VAR_MIN_MAX(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_MIN_MAX,tbl);
}
inline SetVarBranch
SET_VAR_MAX_MIN(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_MAX_MIN,tbl);
}
inline SetVarBranch
SET_VAR_MAX_MAX(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_MAX_MAX,tbl);
}
inline SetVarBranch
SET_VAR_SIZE_MIN(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_SIZE_MIN,tbl);
}
inline SetVarBranch
SET_VAR_SIZE_MAX(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_SIZE_MAX,tbl);
}
inline SetVarBranch
SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_DEGREE_SIZE_MIN,tbl);
}
inline SetVarBranch
SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_DEGREE_SIZE_MAX,tbl);
}
inline SetVarBranch
SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MIN,d,tbl);
}
inline SetVarBranch
SET_VAR_AFC_SIZE_MIN(SetAFC a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MIN,a,tbl);
}
inline SetVarBranch
SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MAX,d,tbl);
}
inline SetVarBranch
SET_VAR_AFC_SIZE_MAX(SetAFC a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MAX,a,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MIN,d,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_SIZE_MIN(SetAction a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MIN,a,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MAX,d,tbl);
}
inline SetVarBranch
SET_VAR_ACTION_SIZE_MAX(SetAction a, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MAX,a,tbl);
}
inline SetVarBranch
SET_VAR_CHB_SIZE_MIN(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MIN,tbl);
}
inline SetVarBranch
SET_VAR_CHB_SIZE_MIN(SetCHB c, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MIN,c,tbl);
}
inline SetVarBranch
SET_VAR_CHB_SIZE_MAX(BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MAX,tbl);
}
inline SetVarBranch
SET_VAR_CHB_SIZE_MAX(SetCHB c, BranchTbl tbl) {
return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MAX,c,tbl);
}
}
// STATISTICS: set-branch
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Rnd
Random number generator.
Definition rnd.hpp:42
Gecode::SetAFC
Recording AFC information for set variables.
Definition set.hh:1136
Gecode::SetAction
Recording actions for set variables.
Definition set.hh:1183
Gecode::SetCHB
Recording CHB for set variables.
Definition set.hh:1235
Gecode::SetVarArgs
Passing set variables.
Definition set.hh:488
Gecode::SetVarBranch
Which variable to select for branching.
Definition set.hh:1296
Gecode::SetVarBranch::expand
void expand(Home home, const SetVarArgs &x)
Expand AFC, action, and CHB.
Definition var.hpp:74
Gecode::SetVarBranch::Select
Select
Which variable selection.
Definition set.hh:1299
Gecode::SetVarBranch::SEL_ACTION_SIZE_MIN
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition set.hh:1322
Gecode::SetVarBranch::SEL_CHB_MIN
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition set.hh:1310
Gecode::SetVarBranch::SEL_CHB_MAX
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition set.hh:1311
Gecode::SetVarBranch::SEL_MERIT_MIN
@ SEL_MERIT_MIN
With least merit.
Definition set.hh:1302
Gecode::SetVarBranch::SEL_DEGREE_SIZE_MAX
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition set.hh:1319
Gecode::SetVarBranch::SEL_AFC_SIZE_MIN
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition set.hh:1320
Gecode::SetVarBranch::SEL_AFC_MIN
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition set.hh:1306
Gecode::SetVarBranch::SEL_CHB_SIZE_MAX
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition set.hh:1325
Gecode::SetVarBranch::SEL_NONE
@ SEL_NONE
First unassigned.
Definition set.hh:1300
Gecode::SetVarBranch::SEL_ACTION_SIZE_MAX
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition set.hh:1323
Gecode::SetVarBranch::SEL_DEGREE_MAX
@ SEL_DEGREE_MAX
With largest degree.
Definition set.hh:1305
Gecode::SetVarBranch::SEL_AFC_MAX
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition set.hh:1307
Gecode::SetVarBranch::SEL_CHB_SIZE_MIN
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition set.hh:1324
Gecode::SetVarBranch::SEL_MERIT_MAX
@ SEL_MERIT_MAX
With highest merit.
Definition set.hh:1303
Gecode::SetVarBranch::SEL_SIZE_MIN
@ SEL_SIZE_MIN
With smallest unknown set.
Definition set.hh:1316
Gecode::SetVarBranch::SEL_RND
@ SEL_RND
Random (uniform, for tie breaking).
Definition set.hh:1301
Gecode::SetVarBranch::SEL_ACTION_MAX
@ SEL_ACTION_MAX
With highest action.
Definition set.hh:1309
Gecode::SetVarBranch::SEL_AFC_SIZE_MAX
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition set.hh:1321
Gecode::SetVarBranch::SEL_ACTION_MIN
@ SEL_ACTION_MIN
With lowest action.
Definition set.hh:1308
Gecode::SetVarBranch::SEL_MIN_MAX
@ SEL_MIN_MAX
With largest minimum unknown element.
Definition set.hh:1313
Gecode::SetVarBranch::SEL_MAX_MAX
@ SEL_MAX_MAX
With largest maximum unknown element.
Definition set.hh:1315
Gecode::SetVarBranch::SEL_MAX_MIN
@ SEL_MAX_MIN
With smallest maximum unknown element.
Definition set.hh:1314
Gecode::SetVarBranch::SEL_DEGREE_SIZE_MIN
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition set.hh:1318
Gecode::SetVarBranch::SEL_MIN_MIN
@ SEL_MIN_MIN
With smallest minimum unknown element.
Definition set.hh:1312
Gecode::SetVarBranch::SEL_DEGREE_MIN
@ SEL_DEGREE_MIN
With smallest degree.
Definition set.hh:1304
Gecode::SetVarBranch::SEL_SIZE_MAX
@ SEL_SIZE_MAX
With largest unknown set.
Definition set.hh:1317
Gecode::SetVarBranch::SetVarBranch
SetVarBranch(void)
Initialize with strategy SEL_NONE.
Definition var.hpp:37
Gecode::SetVarBranch::s
Select s
Which variable to select.
Definition set.hh:1329
Gecode::SetVarBranch::select
Select select(void) const
Return selection strategy.
Definition var.hpp:69
Gecode::SetVar
Set variables
Definition set.hh:127
Gecode::VarBranch< SetVar >::VarBranch
VarBranch(void)
Definition var.hpp:116
Gecode::VarBranch< SetVar >::decay
double decay(void) const
Definition var.hpp:180
Gecode::VarBranch< SetVar >::_afc
AFC _afc
Definition var.hpp:67
Gecode::VarBranch< SetVar >::_chb
CHB _chb
Definition var.hpp:71
Gecode::VarBranch< SetVar >::_act
Action _act
Definition var.hpp:69
Gecode::BranchTbl
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition var.hpp:48
Gecode::SetBranchMerit
std::function< double(const Space &home, SetVar x, int i)> SetBranchMerit
Branch merit function type for set variables.
Definition set.hh:1095
Gecode
Gecode toplevel namespace
Gecode::SET_VAR_MERIT_MAX
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with highest merit according to branch merit function bm.
Definition var.hpp:111
Gecode::SET_VAR_ACTION_SIZE_MIN
SetVarBranch SET_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest action divided by domain size with decay factor d.
Definition var.hpp:246
Gecode::SET_VAR_CHB_SIZE_MIN
SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest CHB Q-score divided by domain size.
Definition var.hpp:266
Gecode::SET_VAR_ACTION_SIZE_MAX
SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest action divided by domain size with decay factor d.
Definition var.hpp:256
Gecode::SET_VAR_NONE
SetVarBranch SET_VAR_NONE(void)
Select first unassigned variable.
Definition var.hpp:96
Gecode::SET_VAR_DEGREE_SIZE_MAX
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree divided by domain size.
Definition var.hpp:221
Gecode::SET_VAR_CHB_MIN
SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl=nullptr)
Select variable with lowest CHB Q-score.
Definition var.hpp:166
Gecode::SET_VAR_MIN_MAX
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl=nullptr)
Select variable with largest minimum unknown element.
Definition var.hpp:191
Gecode::SET_VAR_CHB_MAX
SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl=nullptr)
Select variable with highest CHB Q-score.
Definition var.hpp:176
Gecode::SET_VAR_SIZE_MIN
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest unknown set.
Definition var.hpp:206
Gecode::SET_VAR_RND
SetVarBranch SET_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking).
Definition var.hpp:101
Gecode::SET_VAR_MAX_MAX
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl=nullptr)
Select variable with largest maximum unknown element.
Definition var.hpp:201
Gecode::SET_VAR_AFC_MAX
SetVarBranch SET_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count with decay factor d.
Definition var.hpp:136
Gecode::SET_VAR_MIN_MIN
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl=nullptr)
Select variable with smallest minimum unknown element.
Definition var.hpp:186
Gecode::SET_VAR_CHB_SIZE_MAX
SetVarBranch SET_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest CHB Q-score divided by domain size.
Definition var.hpp:276
Gecode::SET_VAR_DEGREE_MIN
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree.
Definition var.hpp:116
Gecode::SET_VAR_AFC_MIN
SetVarBranch SET_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest accumulated failure count with decay factor d.
Definition var.hpp:126
Gecode::SET_VAR_MAX_MIN
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl=nullptr)
Select variable with smallest maximum unknown element.
Definition var.hpp:196
Gecode::SET_VAR_DEGREE_MAX
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree.
Definition var.hpp:121
Gecode::SET_VAR_AFC_SIZE_MIN
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:226
Gecode::SET_VAR_AFC_SIZE_MAX
SetVarBranch SET_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:236
Gecode::SET_VAR_ACTION_MIN
SetVarBranch SET_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with lowest action with decay factor d.
Definition var.hpp:146
Gecode::SET_VAR_MERIT_MIN
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with least merit according to branch merit function bm.
Definition var.hpp:106
Gecode::SET_VAR_DEGREE_SIZE_MIN
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree divided by domain size.
Definition var.hpp:216
Gecode::SET_VAR_SIZE_MAX
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest unknown set.
Definition var.hpp:211
Gecode::SET_VAR_ACTION_MAX
SetVarBranch SET_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with highest action with decay factor d.
Definition var.hpp:156
forceinline
#define forceinline
Definition config.hpp:187