Generated on Mon Feb 8 2021 00:00:00 for Gecode by doxygen 1.8.20
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<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 
69  SetVarBranch::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 = SetAFC(home,x,decay());
80  break;
81  case SEL_ACTION_MIN: case SEL_ACTION_MAX:
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
96  SET_VAR_NONE(void) {
97  return SetVarBranch(SetVarBranch::SEL_NONE,nullptr);
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
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition: set.hh:1324
Post propagator for SetVar x
Definition: set.hh:767
SetVarBranch SET_VAR_ACTION_MIN(double d, BranchTbl tbl)
Definition: var.hpp:146
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl)
Definition: var.hpp:106
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition: set.hh:1306
SetVarBranch SET_VAR_CHB_SIZE_MAX(BranchTbl tbl)
Definition: var.hpp:276
@ SEL_MIN_MAX
With largest minimum unknown element.
Definition: set.hh:1313
double decay(void) const
Return decay factor.
Definition: var.hpp:180
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition: set.hh:1319
@ SEL_SIZE_MAX
With largest unknown set.
Definition: set.hh:1317
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition: set.hh:1323
SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl)
Definition: var.hpp:176
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Definition: var.hpp:221
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition: set.hh:1325
Passing set variables.
Definition: set.hh:488
@ SEL_MAX_MAX
With largest maximum unknown element.
Definition: set.hh:1315
NodeType t
Type of node.
Definition: bool-expr.cpp:230
Action _act
Action information.
Definition: var.hpp:69
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
Definition: var.hpp:186
@ SEL_NONE
First unassigned.
Definition: set.hh:1300
SetVarBranch SET_VAR_NONE(void)
Definition: var.hpp:96
SetVarBranch SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Definition: var.hpp:236
SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl)
Definition: var.hpp:166
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Definition: var.hpp:226
SetVarBranch SET_VAR_AFC_MIN(double d, BranchTbl tbl)
Definition: var.hpp:126
SetVarBranch SET_VAR_AFC_MAX(double d, BranchTbl tbl)
Definition: var.hpp:136
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
Definition: var.hpp:116
Recording CHB for set variables.
Definition: set.hh:1235
Select
Definition: set.hh:1299
Recording AFC information for set variables.
Definition: set.hh:1136
Variable branching information.
Definition: var.hpp:55
Gecode toplevel namespace
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Definition: branch.cpp:61
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl)
Definition: var.hpp:191
CHB _chb
CHB 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:1095
@ SEL_MIN_MIN
With smallest minimum unknown element.
Definition: set.hh:1312
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition: set.hh:1321
@ SEL_MERIT_MIN
With least merit.
Definition: set.hh:1302
Which variable to select Select s
Definition: set.hh:1329
Home class for posting propagators
Definition: core.hpp:856
Initialize with strategy SEL_NONE SetVarBranch(void)
Definition: var.hpp:37
@ SEL_DEGREE_MAX
With largest degree.
Definition: set.hh:1305
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
@ SEL_ACTION_MAX
With highest action.
Definition: set.hh:1309
Set variables
Definition: set.hh:127
@ SEL_DEGREE_MIN
With smallest degree.
Definition: set.hh:1304
@ SEL_ACTION_MIN
With lowest action.
Definition: set.hh:1308
Random number generator.
Definition: rnd.hpp:42
SetVarBranch SET_VAR_ACTION_MAX(double d, BranchTbl tbl)
Definition: var.hpp:156
@ SEL_MERIT_MAX
With highest merit.
Definition: set.hh:1303
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition: set.hh:1311
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
AFC _afc
AFC information.
Definition: var.hpp:67
@ SEL_SIZE_MIN
With smallest unknown set.
Definition: set.hh:1316
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl)
Definition: var.hpp:211
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
Definition: var.hpp:121
SetVarBranch SET_VAR_RND(Rnd r)
Definition: var.hpp:101
SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
Definition: var.hpp:256
Recording actions for set variables.
Definition: set.hh:1183
Gecode::IntSet d(v, 7)
@ SEL_MAX_MIN
With smallest maximum unknown element.
Definition: set.hh:1314
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl)
Definition: var.hpp:196
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition: set.hh:1320
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl)
Definition: var.hpp:201
SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Definition: var.hpp:266
#define forceinline
Definition: config.hpp:192
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Definition: var.hpp:216
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
Definition: var.hpp:206
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition: var.hpp:48
Expand and CHB void expand(Home home, const SetVarArgs &x)
Definition: var.hpp:74
Gecode::FloatVal c(-8, 8)
Return selection strategy Select select(void) const
Definition: var.hpp:69
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition: set.hh:1318
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition: set.hh:1310
SetVarBranch SET_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl)
Definition: var.hpp:246
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl)
Definition: var.hpp:111
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition: set.hh:1307
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition: set.hh:1322
Which variable to select for branching.
Definition: set.hh:1296