Generated on Tue Jan 26 2021 00:00:00 for Gecode by doxygen 1.9.1
var.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2012
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32  */
33 
34 namespace Gecode {
35 
38  : s(SEL_NONE) {}
39 
42  : VarBranch<FloatVar>(t), s(s0) {}
43 
46  : VarBranch<FloatVar>(r), s(SEL_RND) {}
47 
50  : VarBranch<FloatVar>(d,t), s(s0) {}
51 
54  : VarBranch<FloatVar>(a,t), s(s0) {}
55 
58  : VarBranch<FloatVar>(a,t), s(s0) {}
59 
62  : VarBranch<FloatVar>(c,t), s(s0) {}
63 
66  : VarBranch<FloatVar>(mf,t), s(s0) {}
67 
69  FloatVarBranch::select(void) const {
70  return s;
71  }
72 
73  forceinline void
75  switch (select()) {
76  case SEL_AFC_MIN: case SEL_AFC_MAX:
78  if (!_afc)
79  _afc = FloatAFC(home,x,decay());
80  break;
81  case SEL_ACTION_MIN: case SEL_ACTION_MAX:
83  if (!_act)
84  _act = FloatAction(home,x,decay());
85  break;
86  case SEL_CHB_MIN: case SEL_CHB_MAX:
88  if (!_chb)
89  _chb = FloatCHB(home,x);
90  break;
91  default: ;
92  }
93  }
94 
95 
96  inline FloatVarBranch
99  }
100 
101  inline FloatVarBranch
104  }
105 
106  inline FloatVarBranch
109  }
110 
111  inline FloatVarBranch
113  return FloatVarBranch(r);
114  }
115 
116  inline FloatVarBranch
119  }
120 
121  inline FloatVarBranch
124  }
125 
126  inline FloatVarBranch
129  }
130 
131  inline FloatVarBranch
134  }
135 
136  inline FloatVarBranch
139  }
140 
141  inline FloatVarBranch
144  }
145 
146  inline FloatVarBranch
149  }
150 
151  inline FloatVarBranch
154  }
155 
156  inline FloatVarBranch
159  }
160 
161  inline FloatVarBranch
164  }
165 
166  inline FloatVarBranch
169  }
170 
171  inline FloatVarBranch
174  }
175 
176  inline FloatVarBranch
179  }
180 
181  inline FloatVarBranch
184  }
185 
186  inline FloatVarBranch
189  }
190 
191  inline FloatVarBranch
194  }
195 
196  inline FloatVarBranch
199  }
200 
201  inline FloatVarBranch
204  }
205 
206  inline FloatVarBranch
209  }
210 
211  inline FloatVarBranch
214  }
215 
216  inline FloatVarBranch
219  }
220 
221  inline FloatVarBranch
224  }
225 
226  inline FloatVarBranch
229  }
230 
231  inline FloatVarBranch
234  }
235 
236  inline FloatVarBranch
239  }
240 
241  inline FloatVarBranch
244  }
245 
246  inline FloatVarBranch
249  }
250 
251  inline FloatVarBranch
254  }
255 
256  inline FloatVarBranch
259  }
260 
261  inline FloatVarBranch
264  }
265 
266  inline FloatVarBranch
269  }
270 
271  inline FloatVarBranch
274  }
275 
276  inline FloatVarBranch
279  }
280 
281  inline FloatVarBranch
284  }
285 
286 }
287 
288 // STATISTICS: float-branch
NodeType t
Type of node.
Definition: bool-expr.cpp:230
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
NNF * r
Right subtree.
Definition: bool-expr.cpp:242
Recording AFC information for float variables.
Definition: float.hh:1509
Recording actions for float variables.
Definition: float.hh:1555
Recording CHB for float variables.
Definition: float.hh:1607
Passing float variables.
Definition: float.hh:979
Which variable to select for branching.
Definition: float.hh:1668
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
FloatVarBranch(void)
Initialize with strategy SEL_NONE.
Definition: var.hpp:37
void expand(Home home, const FloatVarArgs &x)
Expand AFC, action, and CHB.
Definition: var.hpp:74
Select
Which variable selection.
Definition: float.hh:1671
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition: float.hh:1694
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition: float.hh:1695
@ SEL_MIN_MIN
With smallest min.
Definition: float.hh:1684
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition: float.hh:1692
@ SEL_MAX_MAX
With largest max.
Definition: float.hh:1687
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition: float.hh:1693
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition: float.hh:1683
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition: float.hh:1690
@ SEL_MIN_MAX
With largest min.
Definition: float.hh:1685
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition: float.hh:1696
@ SEL_NONE
First unassigned.
Definition: float.hh:1672
@ SEL_MERIT_MIN
With least merit.
Definition: float.hh:1674
@ SEL_ACTION_MAX
With highest action.
Definition: float.hh:1681
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition: float.hh:1682
@ SEL_DEGREE_MAX
With largest degree.
Definition: float.hh:1677
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition: float.hh:1691
@ SEL_DEGREE_MIN
With smallest degree.
Definition: float.hh:1676
@ SEL_MERIT_MAX
With highest merit.
Definition: float.hh:1675
@ SEL_MAX_MIN
With smallest max.
Definition: float.hh:1686
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition: float.hh:1697
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition: float.hh:1679
@ SEL_SIZE_MAX
With largest domain size.
Definition: float.hh:1689
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition: float.hh:1678
@ SEL_ACTION_MIN
With lowest action.
Definition: float.hh:1680
@ SEL_SIZE_MIN
With smallest domain size.
Definition: float.hh:1688
Select s
Which variable to select.
Definition: float.hh:1701
Float variables.
Definition: float.hh:870
Home class for posting propagators
Definition: core.hpp:856
Random number generator.
Definition: rnd.hpp:42
Variable branching information.
Definition: var.hpp:55
double decay(void) const
Return decay factor.
Definition: var.hpp:180
AFC _afc
AFC information.
Definition: var.hpp:67
CHB _chb
CHB information.
Definition: var.hpp:71
Action _act
Action information.
Definition: var.hpp:69
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Definition: var.hpp:222
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Definition: var.hpp:217
FloatVarBranch FLOAT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
Definition: var.hpp:112
FloatVarBranch FLOAT_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
Definition: var.hpp:127
FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest domain size.
Definition: var.hpp:212
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest max.
Definition: var.hpp:202
FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smalllest accumulated failure count divided by domain size with decay factor d.
Definition: var.hpp:227
FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl)
Select variable with largest CHB Q-score divided by domain size.
Definition: var.hpp:277
FloatVarBranch FLOAT_VAR_CHB_MIN(BranchTbl tbl)
Select variable with lowest CHB Q-score.
Definition: var.hpp:167
FloatVarBranch FLOAT_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Select variable with smallest CHB Q-score divided by domain size.
Definition: var.hpp:267
FloatVarBranch FLOAT_VAR_ACTION_MAX(double d, BranchTbl tbl)
Select variable with highest action with decay factor d.
Definition: var.hpp:157
FloatVarBranch FLOAT_VAR_CHB_MAX(BranchTbl tbl)
Select variable with highest CHB Q-score.
Definition: var.hpp:177
FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest min.
Definition: var.hpp:187
FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest max.
Definition: var.hpp:197
FloatVarBranch FLOAT_VAR_ACTION_MIN(double d, BranchTbl tbl)
Select variable with lowest action with decay factor d.
Definition: var.hpp:147
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:97
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
Definition: var.hpp:122
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest action divided by domain size with decay factor d.
Definition: var.hpp:257
FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest min.
Definition: var.hpp:192
FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count divided by domain size with decay factor d.
Definition: var.hpp:237
FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Definition: var.hpp:102
FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
Definition: var.hpp:117
FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Definition: var.hpp:207
FloatVarBranch FLOAT_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Definition: var.hpp:137
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest action divided by domain size with decay factor d.
Definition: var.hpp:247
FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Definition: var.hpp:107
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition: var.hpp:48
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition: float.hh:1455
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Definition: branch.cpp:61
Gecode::FloatVal c(-8, 8)
Gecode::IntSet d(v, 7)
#define forceinline
Definition: config.hpp:185