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  IntVarBranch::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 = IntAFC(home,x,decay());
80  break;
83  if (!_act.initialized())
84  _act = IntActivity(home,x,decay());
85  break;
86  default: ;
87  }
88  }
89 
90  forceinline void
92  switch (select()) {
93  case SEL_AFC_MIN: case SEL_AFC_MAX:
95  if (!_afc.initialized())
96  _afc = IntAFC(home,x,decay());
97  break;
100  if (!_act.initialized())
101  _act = IntActivity(home,x,decay());
102  break;
103  default: ;
104  }
105  }
106 
107  inline IntVarBranch
108  INT_VAR_NONE(void) {
110  }
111 
112  inline IntVarBranch
114  return IntVarBranch(r);
115  }
116 
117  inline IntVarBranch
120  function_cast<VoidFunction>(bm),tbl);
121  }
122 
123  inline IntVarBranch
126  function_cast<VoidFunction>(bm),tbl);
127  }
128 
129  inline IntVarBranch
132  function_cast<VoidFunction>(bm),tbl);
133  }
134 
135  inline IntVarBranch
138  function_cast<VoidFunction>(bm),tbl);
139  }
140 
141  inline IntVarBranch
144  }
145 
146  inline IntVarBranch
149  }
150 
151  inline IntVarBranch
154  }
155 
156  inline IntVarBranch
159  }
160 
161  inline IntVarBranch
164  }
165 
166  inline IntVarBranch
169  }
170 
171  inline IntVarBranch
174  }
175 
176  inline IntVarBranch
179  }
180 
181  inline IntVarBranch
184  }
185 
186  inline IntVarBranch
189  }
190 
191  inline IntVarBranch
194  }
195 
196  inline IntVarBranch
199  }
200 
201  inline IntVarBranch
204  }
205 
206  inline IntVarBranch
209  }
210 
211  inline IntVarBranch
214  }
215 
216  inline IntVarBranch
219  }
220 
221  inline IntVarBranch
224  }
225 
226  inline IntVarBranch
229  }
230 
231  inline IntVarBranch
234  }
235 
236  inline IntVarBranch
239  }
240 
241  inline IntVarBranch
244  }
245 
246  inline IntVarBranch
249  }
250 
251  inline IntVarBranch
254  }
255 
256  inline IntVarBranch
259  }
260 
261  inline IntVarBranch
264  }
265 
266  inline IntVarBranch
269  }
270 
271  inline IntVarBranch
274  }
275 
276  inline IntVarBranch
279  }
280 
281  inline IntVarBranch
284  }
285 
286  inline IntVarBranch
289  }
290 
291 }
292 
293 // STATISTICS: int-branch
IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Definition: var.hpp:222
With smallest max-regret.
Definition: int.hh:3841
With lowest activity.
Definition: int.hh:3810
bool initialized(void) const
Test whether already initialized.
Definition: activity.hpp:338
NodeType t
Type of node.
Definition: bool-expr.cpp:234
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:108
IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Definition: var.hpp:130
Select s
Which variable to select.
Definition: int.hh:3851
With largest min-regret.
Definition: int.hh:3835
With smallest degree divided by domain size.
Definition: int.hh:3818
IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Definition: var.hpp:227
Which variable to select for branching.
Definition: int.hh:3798
bool initialized(void) const
Test whether already initialized.
Definition: afc.hpp:123
IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl)
Select variable with largest max-regret.
Definition: var.hpp:287
With smallest min-regret.
Definition: int.hh:3829
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Definition: var.hpp:212
IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest min.
Definition: var.hpp:192
IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl)
Select variable with smallest max-regret.
Definition: var.hpp:282
IntVarBranch INT_VAR_ACTIVITY_MAX(double d, BranchTbl tbl)
Select variable with highest activity with decay factor d.
Definition: var.hpp:182
With smallest min.
Definition: int.hh:3812
Activity _act
Activity information.
Definition: branch-var.hpp:66
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
With highest merit.
Definition: int.hh:3805
AFC _afc
AFC information.
Definition: branch-var.hpp:64
double(* IntBranchMerit)(const Space &home, IntVar x, int i)
Branch merit function type for integer variables.
Definition: int.hh:3588
IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl)
Select variable with largest min-regret.
Definition: var.hpp:277
IntVarBranch(void)
Initialize with strategy SEL_NONE.
Definition: var.hpp:41
Gecode::IntSet d(v, 7)
With largest max.
Definition: int.hh:3815
With largest accumulated failure count.
Definition: int.hh:3809
With highest activity.
Definition: int.hh:3811
IntVarBranch INT_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Definition: var.hpp:162
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:44
Select
Which variable selection.
Definition: int.hh:3801
IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
Definition: var.hpp:147
IntVarBranch INT_VAR_ACTIVITY_MIN(double d, BranchTbl tbl)
Select variable with lowest activity with decay factor d.
Definition: var.hpp:172
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
With smallest max.
Definition: int.hh:3814
double decay(void) const
Return decay factor.
Definition: branch-var.hpp:145
With smallest accumulated failure count.
Definition: int.hh:3808
Recording AFC information for integer and Boolean variables.
Definition: int.hh:3660
With largest degree.
Definition: int.hh:3807
With smallest degree.
Definition: int.hh:3806
With largest domain size.
Definition: int.hh:3817
IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest max.
Definition: var.hpp:207
IntVarBranch INT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
Definition: var.hpp:113
IntVarBranch INT_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
Definition: var.hpp:152
IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest activity divided by domain size with decay factor d. ...
Definition: var.hpp:262
IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest min.
Definition: var.hpp:197
void(* VoidFunction)(void)
Base type for any function pointer.
Definition: cast.hpp:45
With smallest domain size.
Definition: int.hh:3816
Recording activities for integer and Boolean variables.
Definition: int.hh:3707
Passing integer variables.
Definition: int.hh:636
With largest degree divided by domain size.
Definition: int.hh:3819
With largest max-regret.
Definition: int.hh:3847
Passing Boolean variables.
Definition: int.hh:690
double(* BoolBranchMerit)(const Space &home, BoolVar x, int i)
Branch merit function type for Boolean variables.
Definition: int.hh:3598
IntVarBranch INT_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:232
Variable branching information.
Definition: branch-var.hpp:55
void expand(Home home, const IntVarArgs &x)
Expand decay factor into AFC or activity.
Definition: var.hpp:74
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
First unassigned.
Definition: int.hh:3802
With largest activity divided by domain size.
Definition: int.hh:3823
IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Definition: var.hpp:118
With largest min.
Definition: int.hh:3813
#define forceinline
Definition: config.hpp:132
IntVarBranch INT_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:242
IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest activity divided by domain size with decay factor d.
Definition: var.hpp:252
Gecode toplevel namespace
IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest max.
Definition: var.hpp:202
Random number generator.
Definition: rnd.hpp:46
With largest accumulated failure count divided by domain size.
Definition: int.hh:3821
Class for activity management.
Definition: activity.hpp:44
Home class for posting propagators
Definition: core.hpp:717
With smallest activity divided by domain size.
Definition: int.hh:3822
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Definition: branch.cpp:65
With smallest accumulated failure count divided by domain size.
Definition: int.hh:3820
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest domain size.
Definition: var.hpp:217
IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl)
Select variable with smallest min-regret.
Definition: var.hpp:272
IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
Definition: var.hpp:142
double(* BranchTbl)(const Space &home, double w, double b)
Tie-break limit function.
Definition: branch-var.hpp:49