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
FloatVarBranch::FloatVarBranch(void)
: s(SEL_NONE) {}
forceinline
FloatVarBranch::FloatVarBranch(Select s0, BranchTbl t)
: VarBranch<FloatVar>(t), s(s0) {}
forceinline
FloatVarBranch::FloatVarBranch(Rnd r)
: VarBranch<FloatVar>(r), s(SEL_RND) {}
forceinline
FloatVarBranch::FloatVarBranch(Select s0, double d, BranchTbl t)
: VarBranch<FloatVar>(d,t), s(s0) {}
forceinline
FloatVarBranch::FloatVarBranch(Select s0, FloatAFC a, BranchTbl t)
: VarBranch<FloatVar>(a,t), s(s0) {}
forceinline
FloatVarBranch::FloatVarBranch(Select s0, FloatAction a, BranchTbl t)
: VarBranch<FloatVar>(a,t), s(s0) {}
forceinline
FloatVarBranch::FloatVarBranch(Select s0, FloatCHB c, BranchTbl t)
: VarBranch<FloatVar>(c,t), s(s0) {}
forceinline
FloatVarBranch::FloatVarBranch(Select s0, FloatBranchMerit mf, BranchTbl t)
: VarBranch<FloatVar>(mf,t), s(s0) {}
forceinline FloatVarBranch::Select
FloatVarBranch::select(void) const {
return s;
}
forceinline void
FloatVarBranch::expand(Home home, const FloatVarArgs& x) {
switch (select()) {
case SEL_AFC_MIN: case SEL_AFC_MAX:
case SEL_AFC_SIZE_MIN: case SEL_AFC_SIZE_MAX:
if (!_afc)
_afc = FloatAFC(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 = FloatAction(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 = FloatCHB(home,x);
break;
default: ;
}
}
inline FloatVarBranch
FLOAT_VAR_NONE(void) {
return FloatVarBranch(FloatVarBranch::SEL_NONE,nullptr);
}
inline FloatVarBranch
FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_MERIT_MIN,bm,tbl);
}
inline FloatVarBranch
FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_MERIT_MAX,bm,tbl);
}
inline FloatVarBranch
FLOAT_VAR_RND(Rnd r) {
return FloatVarBranch(r);
}
inline FloatVarBranch
FLOAT_VAR_DEGREE_MIN(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_DEGREE_MIN,tbl);
}
inline FloatVarBranch
FLOAT_VAR_DEGREE_MAX(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_DEGREE_MAX,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_MIN(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_MIN,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_MIN(FloatAFC a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_MIN,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_MAX(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_MAX,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_MAX(FloatAFC a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_MAX,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_MIN(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_MIN,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_MIN(FloatAction a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_MIN,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_MAX(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_MAX,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_MAX(FloatAction a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_MAX,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_MIN(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_MIN,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_MIN(FloatCHB c, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_MIN,c,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_MAX(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_MAX,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_MAX(FloatCHB c, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_MAX,c,tbl);
}
inline FloatVarBranch
FLOAT_VAR_MIN_MIN(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_MIN_MIN,tbl);
}
inline FloatVarBranch
FLOAT_VAR_MIN_MAX(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_MIN_MAX,tbl);
}
inline FloatVarBranch
FLOAT_VAR_MAX_MIN(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_MAX_MIN,tbl);
}
inline FloatVarBranch
FLOAT_VAR_MAX_MAX(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_MAX_MAX,tbl);
}
inline FloatVarBranch
FLOAT_VAR_SIZE_MIN(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_SIZE_MIN,tbl);
}
inline FloatVarBranch
FLOAT_VAR_SIZE_MAX(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_SIZE_MAX,tbl);
}
inline FloatVarBranch
FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_DEGREE_SIZE_MIN,tbl);
}
inline FloatVarBranch
FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_DEGREE_SIZE_MAX,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_SIZE_MIN,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_SIZE_MIN(FloatAFC a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_SIZE_MIN,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_SIZE_MAX,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_AFC_SIZE_MAX(FloatAFC a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_AFC_SIZE_MAX,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_SIZE_MIN,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_SIZE_MIN(FloatAction a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_SIZE_MIN,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_SIZE_MAX,d,tbl);
}
inline FloatVarBranch
FLOAT_VAR_ACTION_SIZE_MAX(FloatAction a, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_ACTION_SIZE_MAX,a,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_SIZE_MIN(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_SIZE_MIN,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_SIZE_MIN(FloatCHB c, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_SIZE_MIN,c,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_SIZE_MAX,tbl);
}
inline FloatVarBranch
FLOAT_VAR_CHB_SIZE_MAX(FloatCHB c, BranchTbl tbl) {
return FloatVarBranch(FloatVarBranch::SEL_CHB_SIZE_MAX,c,tbl);
}
}
// STATISTICS: float-branch
Gecode::FloatAFC
Recording AFC information for float variables.
Definition float.hh:1509
Gecode::FloatAction
Recording actions for float variables.
Definition float.hh:1555
Gecode::FloatCHB
Recording CHB for float variables.
Definition float.hh:1607
Gecode::FloatVarArgs
Passing float variables.
Definition float.hh:979
Gecode::FloatVarBranch
Which variable to select for branching.
Definition float.hh:1668
Gecode::FloatVarBranch::select
Select select(void) const
Return selection strategy.
Definition var.hpp:69
Gecode::FloatVarBranch::FloatVarBranch
FloatVarBranch(void)
Initialize with strategy SEL_NONE.
Definition var.hpp:37
Gecode::FloatVarBranch::expand
void expand(Home home, const FloatVarArgs &x)
Expand AFC, action, and CHB.
Definition var.hpp:74
Gecode::FloatVarBranch::Select
Select
Which variable selection.
Definition float.hh:1671
Gecode::FloatVarBranch::SEL_ACTION_SIZE_MIN
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition float.hh:1694
Gecode::FloatVarBranch::SEL_ACTION_SIZE_MAX
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition float.hh:1695
Gecode::FloatVarBranch::SEL_MIN_MIN
@ SEL_MIN_MIN
With smallest min.
Definition float.hh:1684
Gecode::FloatVarBranch::SEL_AFC_SIZE_MIN
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition float.hh:1692
Gecode::FloatVarBranch::SEL_MAX_MAX
@ SEL_MAX_MAX
With largest max.
Definition float.hh:1687
Gecode::FloatVarBranch::SEL_AFC_SIZE_MAX
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition float.hh:1693
Gecode::FloatVarBranch::SEL_CHB_MAX
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition float.hh:1683
Gecode::FloatVarBranch::SEL_DEGREE_SIZE_MIN
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition float.hh:1690
Gecode::FloatVarBranch::SEL_MIN_MAX
@ SEL_MIN_MAX
With largest min.
Definition float.hh:1685
Gecode::FloatVarBranch::SEL_CHB_SIZE_MIN
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition float.hh:1696
Gecode::FloatVarBranch::SEL_NONE
@ SEL_NONE
First unassigned.
Definition float.hh:1672
Gecode::FloatVarBranch::SEL_MERIT_MIN
@ SEL_MERIT_MIN
With least merit.
Definition float.hh:1674
Gecode::FloatVarBranch::SEL_ACTION_MAX
@ SEL_ACTION_MAX
With highest action.
Definition float.hh:1681
Gecode::FloatVarBranch::SEL_CHB_MIN
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition float.hh:1682
Gecode::FloatVarBranch::SEL_DEGREE_MAX
@ SEL_DEGREE_MAX
With largest degree.
Definition float.hh:1677
Gecode::FloatVarBranch::SEL_DEGREE_SIZE_MAX
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition float.hh:1691
Gecode::FloatVarBranch::SEL_DEGREE_MIN
@ SEL_DEGREE_MIN
With smallest degree.
Definition float.hh:1676
Gecode::FloatVarBranch::SEL_MERIT_MAX
@ SEL_MERIT_MAX
With highest merit.
Definition float.hh:1675
Gecode::FloatVarBranch::SEL_MAX_MIN
@ SEL_MAX_MIN
With smallest max.
Definition float.hh:1686
Gecode::FloatVarBranch::SEL_CHB_SIZE_MAX
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition float.hh:1697
Gecode::FloatVarBranch::SEL_RND
@ SEL_RND
Random (uniform, for tie breaking).
Definition float.hh:1673
Gecode::FloatVarBranch::SEL_AFC_MAX
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition float.hh:1679
Gecode::FloatVarBranch::SEL_SIZE_MAX
@ SEL_SIZE_MAX
With largest domain size.
Definition float.hh:1689
Gecode::FloatVarBranch::SEL_AFC_MIN
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition float.hh:1678
Gecode::FloatVarBranch::SEL_ACTION_MIN
@ SEL_ACTION_MIN
With lowest action.
Definition float.hh:1680
Gecode::FloatVarBranch::SEL_SIZE_MIN
@ SEL_SIZE_MIN
With smallest domain size.
Definition float.hh:1688
Gecode::FloatVarBranch::s
Select s
Which variable to select.
Definition float.hh:1701
Gecode::FloatVar
Float variables.
Definition float.hh:870
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Rnd
Random number generator.
Definition rnd.hpp:42
Gecode::VarBranch< FloatVar >::VarBranch
VarBranch(void)
Definition var.hpp:116
Gecode::VarBranch< FloatVar >::decay
double decay(void) const
Definition var.hpp:180
Gecode::VarBranch< FloatVar >::_afc
AFC _afc
Definition var.hpp:67
Gecode::VarBranch< FloatVar >::_chb
CHB _chb
Definition var.hpp:71
Gecode::VarBranch< FloatVar >::_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::FloatBranchMerit
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition float.hh:1455
Gecode
Gecode toplevel namespace
Gecode::FLOAT_VAR_DEGREE_SIZE_MAX
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree divided by domain size.
Definition var.hpp:222
Gecode::FLOAT_VAR_DEGREE_SIZE_MIN
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree divided by domain size.
Definition var.hpp:217
Gecode::FLOAT_VAR_RND
FloatVarBranch FLOAT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking).
Definition var.hpp:112
Gecode::FLOAT_VAR_AFC_MIN
FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest accumulated failure count with decay factor d.
Definition var.hpp:127
Gecode::FLOAT_VAR_SIZE_MAX
FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest domain size.
Definition var.hpp:212
Gecode::FLOAT_VAR_MAX_MAX
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl=nullptr)
Select variable with largest max.
Definition var.hpp:202
Gecode::FLOAT_VAR_AFC_SIZE_MIN
FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smalllest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:227
Gecode::FLOAT_VAR_CHB_SIZE_MAX
FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest CHB Q-score divided by domain size.
Definition var.hpp:277
Gecode::FLOAT_VAR_CHB_MIN
FloatVarBranch FLOAT_VAR_CHB_MIN(BranchTbl tbl=nullptr)
Select variable with lowest CHB Q-score.
Definition var.hpp:167
Gecode::FLOAT_VAR_CHB_SIZE_MIN
FloatVarBranch FLOAT_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest CHB Q-score divided by domain size.
Definition var.hpp:267
Gecode::FLOAT_VAR_ACTION_MAX
FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with highest action with decay factor d.
Definition var.hpp:157
Gecode::FLOAT_VAR_CHB_MAX
FloatVarBranch FLOAT_VAR_CHB_MAX(BranchTbl tbl=nullptr)
Select variable with highest CHB Q-score.
Definition var.hpp:177
Gecode::FLOAT_VAR_MIN_MIN
FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl=nullptr)
Select variable with smallest min.
Definition var.hpp:187
Gecode::FLOAT_VAR_MAX_MIN
FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl=nullptr)
Select variable with smallest max.
Definition var.hpp:197
Gecode::FLOAT_VAR_ACTION_MIN
FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with lowest action with decay factor d.
Definition var.hpp:147
Gecode::FLOAT_VAR_NONE
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
Definition var.hpp:97
Gecode::FLOAT_VAR_DEGREE_MAX
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree.
Definition var.hpp:122
Gecode::FLOAT_VAR_ACTION_SIZE_MAX
FloatVarBranch FLOAT_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:257
Gecode::FLOAT_VAR_MIN_MAX
FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl=nullptr)
Select variable with largest min.
Definition var.hpp:192
Gecode::FLOAT_VAR_AFC_SIZE_MAX
FloatVarBranch FLOAT_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:237
Gecode::FLOAT_VAR_MERIT_MIN
FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with least merit according to branch merit function bm.
Definition var.hpp:102
Gecode::FLOAT_VAR_DEGREE_MIN
FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree.
Definition var.hpp:117
Gecode::FLOAT_VAR_SIZE_MIN
FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest domain size.
Definition var.hpp:207
Gecode::FLOAT_VAR_AFC_MAX
FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count with decay factor d.
Definition var.hpp:137
Gecode::FLOAT_VAR_ACTION_SIZE_MIN
FloatVarBranch FLOAT_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:247
Gecode::FLOAT_VAR_MERIT_MAX
FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with highest merit according to branch merit function bm.
Definition var.hpp:107
forceinline
#define forceinline
Definition config.hpp:187