Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
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  * Last modified:
10  * $Date$ by $Author$
11  * $Revision$
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 namespace Gecode {
39 
42  : s(SEL_NONE) {}
43 
46  : VarBranch<SetVar>(t), s(s0) {}
47 
50  : VarBranch<SetVar>(r), s(SEL_RND) {}
51 
54  : VarBranch<SetVar>(d,t), s(s0) {}
55 
58  : VarBranch<SetVar>(a,t), s(s0) {}
59 
62  : VarBranch<SetVar>(a,t), s(s0) {}
63 
66  : VarBranch<SetVar>(c,t), s(s0) {}
67 
70  : VarBranch<SetVar>(mf,t), s(s0) {}
71 
73  SetVarBranch::select(void) const {
74  return s;
75  }
76 
77  forceinline void
79  switch (select()) {
80  case SEL_AFC_MIN: case SEL_AFC_MAX:
82  if (!_afc)
83  _afc = SetAFC(home,x,decay());
84  break;
85  case SEL_ACTION_MIN: case SEL_ACTION_MAX:
87  if (!_act)
88  _act = SetAction(home,x,decay());
89  break;
90  case SEL_CHB_MIN: case SEL_CHB_MAX:
92  if (!_chb)
93  _chb = SetCHB(home,x);
94  break;
95  default: ;
96  }
97  }
98 
99  inline SetVarBranch
100  SET_VAR_NONE(void) {
101  return SetVarBranch(SetVarBranch::SEL_NONE,nullptr);
102  }
103 
104  inline SetVarBranch
106  return SetVarBranch(r);
107  }
108 
109  inline SetVarBranch
112  }
113 
114  inline SetVarBranch
117  }
118 
119  inline SetVarBranch
122  }
123 
124  inline SetVarBranch
127  }
128 
129  inline SetVarBranch
132  }
133 
134  inline SetVarBranch
137  }
138 
139  inline SetVarBranch
142  }
143 
144  inline SetVarBranch
147  }
148 
149  inline SetVarBranch
152  }
153 
154  inline SetVarBranch
157  }
158 
159  inline SetVarBranch
162  }
163 
164  inline SetVarBranch
167  }
168 
169  inline SetVarBranch
172  }
173 
174  inline SetVarBranch
177  }
178 
179  inline SetVarBranch
182  }
183 
184  inline SetVarBranch
187  }
188 
189  inline SetVarBranch
192  }
193 
194  inline SetVarBranch
197  }
198 
199  inline SetVarBranch
202  }
203 
204  inline SetVarBranch
207  }
208 
209  inline SetVarBranch
212  }
213 
214  inline SetVarBranch
217  }
218 
219  inline SetVarBranch
222  }
223 
224  inline SetVarBranch
227  }
228 
229  inline SetVarBranch
232  }
233 
234  inline SetVarBranch
237  }
238 
239  inline SetVarBranch
242  }
243 
244  inline SetVarBranch
247  }
248 
249  inline SetVarBranch
252  }
253 
254  inline SetVarBranch
257  }
258 
259  inline SetVarBranch
262  }
263 
264  inline SetVarBranch
267  }
268 
269  inline SetVarBranch
272  }
273 
274  inline SetVarBranch
277  }
278 
279  inline SetVarBranch
282  }
283 
284  inline SetVarBranch
287  }
288 
289 }
290 
291 // STATISTICS: set-branch
Initialize with strategy SEL_NONE SetVarBranch(void)
Definition: var.hpp:41
Recording actions for set variables.
Definition: set.hh:1185
SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Definition: var.hpp:270
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
Definition: var.hpp:210
NodeType t
Type of node.
Definition: bool-expr.cpp:234
With highest action.
Definition: set.hh:1311
With lowest CHB Q-score.
Definition: set.hh:1312
CHB _chb
CHB information.
Definition: var.hpp:75
Initialize with selection strategy a CHB a c
Definition: set.hh:1345
With largest maximum unknown element.
Definition: set.hh:1317
With largest minimum unknown element.
Definition: set.hh:1315
First unassigned.
Definition: set.hh:1302
With largest action divided by domain size.
Definition: set.hh:1325
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl)
Definition: var.hpp:115
With smallest accumulated failure count divided by domain size.
Definition: set.hh:1322
AFC _afc
AFC information.
Definition: var.hpp:71
std::function< double(const Space &home, SetVar x, int i)> SetBranchMerit
Branch merit function type for set variables.
Definition: set.hh:1097
With largest accumulated failure count divided by domain size.
Definition: set.hh:1323
With smallest degree.
Definition: set.hh:1306
Expand and CHB void expand(Home home, const SetVarArgs &x)
Definition: var.hpp:78
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Definition: var.hpp:225
With smallest CHB Q-score divided by domain size.
Definition: set.hh:1326
With highest CHB Q-score.
Definition: set.hh:1313
With smallest accumulated failure count.
Definition: set.hh:1308
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl)
Definition: var.hpp:205
Action _act
Action information.
Definition: var.hpp:73
#define forceinline
Definition: config.hpp:182
With largest degree divided by domain size.
Definition: set.hh:1321
SetVarBranch SET_VAR_NONE(void)
Definition: var.hpp:100
With smallest action divided by domain size.
Definition: set.hh:1324
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Definition: var.hpp:220
Which variable to select Select s
Definition: set.hh:1331
With largest unknown set.
Definition: set.hh:1319
SetVarBranch SET_VAR_AFC_MAX(double d, BranchTbl tbl)
Definition: var.hpp:140
SetVarBranch SET_VAR_CHB_SIZE_MAX(BranchTbl tbl)
Definition: var.hpp:280
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
Definition: var.hpp:120
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
Definition: var.hpp:125
With largest CHB Q-score divided by domain size.
Definition: set.hh:1327
double decay(void) const
Return decay factor.
Definition: var.hpp:184
SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl)
Definition: var.hpp:180
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition: var.hpp:52
Recording CHB for set variables.
Definition: set.hh:1237
SetVarBranch SET_VAR_AFC_MIN(double d, BranchTbl tbl)
Definition: var.hpp:130
With smallest degree divided by domain size.
Definition: set.hh:1320
SetVarBranch SET_VAR_RND(Rnd r)
Definition: var.hpp:105
Recording AFC information for set variables.
Definition: set.hh:1138
Initialize with selection strategy a branch merit function a mf
Definition: set.hh:1347
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl)
Definition: var.hpp:110
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl)
Definition: var.hpp:195
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:769
With smallest maximum unknown element.
Definition: set.hh:1316
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl)
Definition: var.hpp:200
Passing set variables.
Definition: set.hh:492
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl)
Definition: var.hpp:215
Variable branching information.
Definition: var.hpp:59
Set variables
Definition: set.hh:131
With largest degree.
Definition: set.hh:1307
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Definition: var.hpp:230
With lowest action.
Definition: set.hh:1310
BranchTbl tbl(void) const
Return tie-break limit function.
Definition: var.hpp:172
Return selection strategy Select select(void) const
Definition: var.hpp:73
Post propagator for SetVar x
Definition: set.hh:769
Initialize with selection strategy a decay factor a d
Definition: set.hh:1339
Random (uniform, for tie breaking)
Definition: set.hh:1303
Gecode toplevel namespace
With highest merit.
Definition: set.hh:1305
SetVarBranch SET_VAR_ACTION_MAX(double d, BranchTbl tbl)
Definition: var.hpp:160
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
Definition: var.hpp:190
SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl)
Definition: var.hpp:170
Which variable to select for branching.
Definition: set.hh:1298
Random number generator.
Definition: rnd.hpp:46
SetVarBranch SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Definition: var.hpp:240
Home class for posting propagators
Definition: core.hpp:846
With largest accumulated failure count.
Definition: set.hh:1309
SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
Definition: var.hpp:260
SetVarBranch SET_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl)
Definition: var.hpp:250
Initialize with selection strategy a afc a a
Definition: set.hh:1341
With smallest unknown set.
Definition: set.hh:1318
With smallest minimum unknown element.
Definition: set.hh:1314
SetVarBranch SET_VAR_ACTION_MIN(double d, BranchTbl tbl)
Definition: var.hpp:150