Generated on Sat Feb 7 2015 02:01:15 for Gecode by doxygen 1.8.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  * Last modified:
10  * $Date: 2013-02-19 13:26:08 +0100 (Tue, 19 Feb 2013) $ by $Author: schulte $
11  * $Revision: 13313 $
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  : VarBranch(NULL), s(SEL_NONE) {}
43 
46  : VarBranch(t), s(s0) {}
47 
50  : VarBranch(r), s(SEL_RND) {}
51 
54  : VarBranch(d,t), s(s0) {}
55 
58  : VarBranch(a,t), s(s0) {}
59 
62  : VarBranch(a,t), s(s0) {}
63 
66  : VarBranch(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.initialized())
79  _afc = SetAFC(home,x,decay());
80  break;
83  if (!_act.initialized())
84  _act = SetActivity(home,x,decay());
85  break;
86  default: ;
87  }
88  }
89 
90  inline SetVarBranch
91  SET_VAR_NONE(void) {
93  }
94 
95  inline SetVarBranch
97  return SetVarBranch(r);
98  }
99 
100  inline SetVarBranch
103  function_cast<VoidFunction>(bm),tbl);
104  }
105 
106  inline SetVarBranch
109  function_cast<VoidFunction>(bm),tbl);
110  }
111 
112  inline SetVarBranch
115  }
116 
117  inline SetVarBranch
120  }
121 
122  inline SetVarBranch
125  }
126 
127  inline SetVarBranch
130  }
131 
132  inline SetVarBranch
135  }
136 
137  inline SetVarBranch
140  }
141 
142  inline SetVarBranch
145  }
146 
147  inline SetVarBranch
150  }
151 
152  inline SetVarBranch
155  }
156 
157  inline SetVarBranch
160  }
161 
162  inline SetVarBranch
165  }
166 
167  inline SetVarBranch
170  }
171 
172  inline SetVarBranch
175  }
176 
177  inline SetVarBranch
180  }
181 
182  inline SetVarBranch
185  }
186 
187  inline SetVarBranch
190  }
191 
192  inline SetVarBranch
195  }
196 
197  inline SetVarBranch
200  }
201 
202  inline SetVarBranch
205  }
206 
207  inline SetVarBranch
210  }
211 
212  inline SetVarBranch
215  }
216 
217  inline SetVarBranch
220  }
221 
222  inline SetVarBranch
225  }
226 
227  inline SetVarBranch
230  }
231 
232  inline SetVarBranch
235  }
236 
237  inline SetVarBranch
240  }
241 
242 }
243 
244 // STATISTICS: set-branch
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest unknown set.
Definition: var.hpp:183
SetVarBranch SET_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
Definition: var.hpp:123
bool initialized(void) const
Test whether already initialized.
Definition: activity.hpp:338
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest minimum unknown element.
Definition: var.hpp:168
With highest activity.
Definition: set.hh:1266
NodeType t
Type of node.
Definition: bool-expr.cpp:234
SetVarBranch SET_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:91
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
Definition: var.hpp:113
With smallest minimum unknown element.
Definition: set.hh:1267
bool initialized(void) const
Test whether already initialized.
Definition: afc.hpp:123
SetVarBranch SET_VAR_ACTIVITY_MIN(double d, BranchTbl tbl)
Select variable with lowest activity with decay factor d.
Definition: var.hpp:143
SetVarBranch SET_VAR_ACTIVITY_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest activity divided by domain size with decay factor d.
Definition: var.hpp:223
With largest degree divided by domain size.
Definition: set.hh:1274
Recording activities for set variables.
Definition: set.hh:1191
Activity _act
Activity information.
Definition: branch-var.hpp:66
AFC _afc
AFC information.
Definition: branch-var.hpp:64
With largest maximum unknown element.
Definition: set.hh:1270
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest unknown set.
Definition: var.hpp:188
Gecode::IntSet d(v, 7)
With smallest accumulated failure count.
Definition: set.hh:1263
With largest degree.
Definition: set.hh:1262
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Definition: var.hpp:193
With smallest maximum unknown element.
Definition: set.hh:1269
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:44
With smallest degree.
Definition: set.hh:1261
First unassigned.
Definition: set.hh:1257
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Definition: var.hpp:107
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
double decay(void) const
Return decay factor.
Definition: branch-var.hpp:145
With smallest degree divided by domain size.
Definition: set.hh:1273
SetVarBranch SET_VAR_ACTIVITY_MAX(double d, BranchTbl tbl)
Select variable with highest activity with decay factor d.
Definition: var.hpp:153
With largest accumulated failure count divided by domain size.
Definition: set.hh:1276
SetVarBranch(void)
Initialize with strategy SEL_NONE.
Definition: var.hpp:41
With largest accumulated failure count.
Definition: set.hh:1264
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
Definition: var.hpp:118
With smallest activity divided by domain size.
Definition: set.hh:1277
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest maximum unknown element.
Definition: var.hpp:178
double(* SetBranchMerit)(const Space &home, SetVar x, int i)
Branch merit function type for set variables.
Definition: set.hh:1114
void(* VoidFunction)(void)
Base type for any function pointer.
Definition: cast.hpp:45
With largest activity divided by domain size.
Definition: set.hh:1278
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count divided by domain size with decay factor d...
Definition: var.hpp:203
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest maximum unknown element.
Definition: var.hpp:173
Recording AFC information for set variables.
Definition: set.hh:1153
With largest unknown set.
Definition: set.hh:1272
SetVarBranch SET_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:213
With highest merit.
Definition: set.hh:1260
With lowest activity.
Definition: set.hh:1265
Passing set variables.
Definition: set.hh:490
SetVarBranch SET_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
Definition: var.hpp:96
Variable branching information.
Definition: branch-var.hpp:55
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Definition: var.hpp:198
void expand(Home home, const SetVarArgs &x)
Expand decay factor into AFC or activity.
Definition: var.hpp:74
#define forceinline
Definition: config.hpp:132
With smallest unknown set.
Definition: set.hh:1271
With largest minimum unknown element.
Definition: set.hh:1268
Gecode toplevel namespace
Select
Which variable selection.
Definition: set.hh:1256
SetVarBranch SET_VAR_ACTIVITY_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest activity divided by domain size with decay factor d. ...
Definition: var.hpp:233
Which variable to select for branching.
Definition: set.hh:1253
Random number generator.
Definition: rnd.hpp:46
Select s
Which variable to select.
Definition: set.hh:1282
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest minimum unknown element.
Definition: var.hpp:163
Class for activity management.
Definition: activity.hpp:44
Home class for posting propagators
Definition: core.hpp:717
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Definition: branch.cpp:65
SetVarBranch SET_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Definition: var.hpp:133
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Definition: var.hpp:101
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
With smallest accumulated failure count divided by domain size.
Definition: set.hh:1275
double(* BranchTbl)(const Space &home, double w, double b)
Tie-break limit function.
Definition: branch-var.hpp:49