Generated on Thu Jul 21 2022 00:00:00 for Gecode by doxygen 1.9.4
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
34namespace Gecode {
35
38 : s(SEL_NONE) {}
39
42 : VarBranch<SetVar>(t), s(s0) {}
43
46 : VarBranch<SetVar>(r), s(SEL_RND) {}
47
50 : VarBranch<SetVar>(d,t), s(s0) {}
51
54 : VarBranch<SetVar>(a,t), s(s0) {}
55
58 : VarBranch<SetVar>(a,t), s(s0) {}
59
62 : VarBranch<SetVar>(c,t), s(s0) {}
63
66 : VarBranch<SetVar>(mf,t), s(s0) {}
67
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 = SetAFC(home,x,decay());
80 break;
83 if (!_act)
84 _act = SetAction(home,x,decay());
85 break;
86 case SEL_CHB_MIN: case SEL_CHB_MAX:
88 if (!_chb)
89 _chb = SetCHB(home,x);
90 break;
91 default: ;
92 }
93 }
94
95 inline SetVarBranch
98 }
99
100 inline SetVarBranch
102 return SetVarBranch(r);
103 }
104
105 inline SetVarBranch
108 }
109
110 inline SetVarBranch
113 }
114
115 inline SetVarBranch
118 }
119
120 inline SetVarBranch
123 }
124
125 inline SetVarBranch
128 }
129
130 inline SetVarBranch
133 }
134
135 inline SetVarBranch
138 }
139
140 inline SetVarBranch
143 }
144
145 inline SetVarBranch
148 }
149
150 inline SetVarBranch
153 }
154
155 inline SetVarBranch
158 }
159
160 inline SetVarBranch
163 }
164
165 inline SetVarBranch
168 }
169
170 inline SetVarBranch
173 }
174
175 inline SetVarBranch
178 }
179
180 inline SetVarBranch
183 }
184
185 inline SetVarBranch
188 }
189
190 inline SetVarBranch
193 }
194
195 inline SetVarBranch
198 }
199
200 inline SetVarBranch
203 }
204
205 inline SetVarBranch
208 }
209
210 inline SetVarBranch
213 }
214
215 inline SetVarBranch
218 }
219
220 inline SetVarBranch
223 }
224
225 inline SetVarBranch
228 }
229
230 inline SetVarBranch
233 }
234
235 inline SetVarBranch
238 }
239
240 inline SetVarBranch
243 }
244
245 inline SetVarBranch
248 }
249
250 inline SetVarBranch
253 }
254
255 inline SetVarBranch
258 }
259
260 inline SetVarBranch
263 }
264
265 inline SetVarBranch
268 }
269
270 inline SetVarBranch
273 }
274
275 inline SetVarBranch
278 }
279
280 inline SetVarBranch
283 }
284
285}
286
287// STATISTICS: set-branch
NodeType t
Type of node.
Definition: bool-expr.cpp:230
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Home class for posting propagators
Definition: core.hpp:856
Random number generator.
Definition: rnd.hpp:42
Recording AFC information for set variables.
Definition: set.hh:1136
Recording actions for set variables.
Definition: set.hh:1183
Recording CHB for set variables.
Definition: set.hh:1235
Passing set variables.
Definition: set.hh:488
Which variable to select for branching.
Definition: set.hh:1296
Expand and CHB void expand(Home home, const SetVarArgs &x)
Definition: var.hpp:74
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition: set.hh:1322
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition: set.hh:1310
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition: set.hh:1311
@ SEL_MERIT_MIN
With least merit.
Definition: set.hh:1302
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition: set.hh:1319
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition: set.hh:1320
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition: set.hh:1306
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition: set.hh:1325
@ SEL_NONE
First unassigned.
Definition: set.hh:1300
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition: set.hh:1323
@ SEL_DEGREE_MAX
With largest degree.
Definition: set.hh:1305
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition: set.hh:1307
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition: set.hh:1324
@ SEL_MERIT_MAX
With highest merit.
Definition: set.hh:1303
@ SEL_SIZE_MIN
With smallest unknown set.
Definition: set.hh:1316
@ SEL_ACTION_MAX
With highest action.
Definition: set.hh:1309
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition: set.hh:1321
@ SEL_ACTION_MIN
With lowest action.
Definition: set.hh:1308
@ SEL_MIN_MAX
With largest minimum unknown element.
Definition: set.hh:1313
@ SEL_MAX_MAX
With largest maximum unknown element.
Definition: set.hh:1315
@ SEL_MAX_MIN
With smallest maximum unknown element.
Definition: set.hh:1314
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition: set.hh:1318
@ SEL_MIN_MIN
With smallest minimum unknown element.
Definition: set.hh:1312
@ SEL_DEGREE_MIN
With smallest degree.
Definition: set.hh:1304
@ SEL_SIZE_MAX
With largest unknown set.
Definition: set.hh:1317
Initialize with strategy SEL_NONE SetVarBranch(void)
Definition: var.hpp:37
Which variable to select Select s
Definition: set.hh:1329
Return selection strategy Select select(void) const
Definition: var.hpp:69
Set variables
Definition: set.hh:127
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
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, SetVar x, int i)> SetBranchMerit
Branch merit function type for set variables.
Definition: set.hh:1095
Gecode toplevel namespace
Select variable with highest merit according to branch merit function a bm SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl=nullptr)
Definition: var.hpp:111
Select variable with smallest action divided by domain size with decay factor a d SetVarBranch SET_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:246
Select variable with smallest CHB Q score divided by domain size SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr)
Definition: var.hpp:266
Select variable with largest action divided by domain size with decay factor a d SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:256
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
Select first unassigned variable SetVarBranch SET_VAR_NONE(void)
Definition: var.hpp:96
Select variable with largest degree divided by domain size SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr)
Definition: var.hpp:221
Select variable with lowest CHB Q score SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl=nullptr)
Definition: var.hpp:166
Select variable with largest minimum unknown element SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl=nullptr)
Definition: var.hpp:191
Select variable with highest CHB Q score SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl=nullptr)
Definition: var.hpp:176
Select variable with smallest unknown set SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Definition: var.hpp:206
SetVarBranch SET_VAR_RND(Rnd r)
Definition: var.hpp:101
Select variable with largest maximum unknown element SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl=nullptr)
Definition: var.hpp:201
Select variable with largest accumulated failure count with decay factor a d SetVarBranch SET_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:136
Select variable with smallest minimum unknown element SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl=nullptr)
Definition: var.hpp:186
Select variable with largest CHB Q score divided by domain size SetVarBranch SET_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr)
Definition: var.hpp:276
Select variable with smallest degree SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl=nullptr)
Definition: var.hpp:116
Select variable with smallest accumulated failure count with decay factor a d SetVarBranch SET_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:126
Select variable with smallest maximum unknown element SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl=nullptr)
Definition: var.hpp:196
Select variable with largest degree SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Definition: var.hpp:121
Select variable with smallest accumulated failure count divided by domain size with decay factor a d SetVarBranch SET_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:226
Select variable with largest accumulated failure count divided by domain size with decay factor a d SetVarBranch SET_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:236
Select variable with lowest action with decay factor a d SetVarBranch SET_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:146
Select variable with least merit according to branch merit function a bm SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl=nullptr)
Definition: var.hpp:106
Post propagator for SetVar x
Definition: set.hh:767
Select variable with smallest degree divided by domain size SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr)
Definition: var.hpp:216
Select variable with largest unknown set SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl=nullptr)
Definition: var.hpp:211
Select variable with highest action with decay factor a d SetVarBranch SET_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr)
Definition: var.hpp:156
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:194