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  FloatVarBranch::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 = FloatAFC(home,x,decay());
80  break;
83  if (!_act.initialized())
84  _act = FloatActivity(home,x,decay());
85  break;
86  default: ;
87  }
88  }
89 
90 
91  inline FloatVarBranch
94  }
95 
96  inline FloatVarBranch
99  function_cast<VoidFunction>(bm),tbl);
100  }
101 
102  inline FloatVarBranch
105  function_cast<VoidFunction>(bm),tbl);
106  }
107 
108  inline FloatVarBranch
110  return FloatVarBranch(r);
111  }
112 
113  inline FloatVarBranch
116  }
117 
118  inline FloatVarBranch
121  }
122 
123  inline FloatVarBranch
126  }
127 
128  inline FloatVarBranch
131  }
132 
133  inline FloatVarBranch
136  }
137 
138  inline FloatVarBranch
141  }
142 
143  inline FloatVarBranch
146  }
147 
148  inline FloatVarBranch
151  }
152 
153  inline FloatVarBranch
156  }
157 
158  inline FloatVarBranch
161  }
162 
163  inline FloatVarBranch
166  }
167 
168  inline FloatVarBranch
171  }
172 
173  inline FloatVarBranch
176  }
177 
178  inline FloatVarBranch
181  }
182 
183  inline FloatVarBranch
186  }
187 
188  inline FloatVarBranch
191  }
192 
193  inline FloatVarBranch
196  }
197 
198  inline FloatVarBranch
201  }
202 
203  inline FloatVarBranch
206  }
207 
208  inline FloatVarBranch
211  }
212 
213  inline FloatVarBranch
216  }
217 
218  inline FloatVarBranch
221  }
222 
223  inline FloatVarBranch
226  }
227 
228  inline FloatVarBranch
231  }
232 
233  inline FloatVarBranch
236  }
237 
238  inline FloatVarBranch
241  }
242 
243 }
244 
245 // STATISTICS: float-branch
bool initialized(void) const
Test whether already initialized.
Definition: activity.hpp:338
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
Definition: var.hpp:119
NodeType t
Type of node.
Definition: bool-expr.cpp:234
FloatVarBranch(void)
Initialize with strategy SEL_NONE.
Definition: var.hpp:41
With smallest accumulated failure count.
Definition: float.hh:1526
With smallest domain size.
Definition: float.hh:1534
bool initialized(void) const
Test whether already initialized.
Definition: afc.hpp:123
Passing float variables.
Definition: float.hh:966
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Definition: var.hpp:199
double(* FloatBranchMerit)(const Space &home, FloatVar x, int i)
Branch merit function type for float variables.
Definition: float.hh:1365
void expand(Home home, const FloatVarArgs &x)
Expand decay factor into AFC or activity.
Definition: var.hpp:74
FloatVarBranch FLOAT_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
Definition: var.hpp:124
Which variable to select for branching.
Definition: float.hh:1516
FloatVarBranch FLOAT_VAR_ACTIVITY_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest activity divided by domain size with decay factor d. ...
Definition: var.hpp:234
FloatVarBranch FLOAT_VAR_ACTIVITY_MAX(double d, BranchTbl tbl)
Select variable with highest activity with decay factor d.
Definition: var.hpp:154
Activity _act
Activity information.
Definition: branch-var.hpp:66
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:92
AFC _afc
AFC information.
Definition: branch-var.hpp:64
Gecode::IntSet d(v, 7)
FloatVarBranch FLOAT_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:214
With smallest accumulated failure count divided by domain size.
Definition: float.hh:1538
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:44
With smallest degree.
Definition: float.hh:1524
FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smalllest accumulated failure count divided by domain size with decay factor d...
Definition: var.hpp:204
FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
Definition: var.hpp:114
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
double decay(void) const
Return decay factor.
Definition: branch-var.hpp:145
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Definition: var.hpp:194
With smallest degree divided by domain size.
Definition: float.hh:1536
With largest accumulated failure count.
Definition: float.hh:1527
void(* VoidFunction)(void)
Base type for any function pointer.
Definition: cast.hpp:45
FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Definition: var.hpp:103
Select
Which variable selection.
Definition: float.hh:1519
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest max.
Definition: var.hpp:179
FloatVarBranch FLOAT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
Definition: var.hpp:109
Recording activities for float variables.
Definition: float.hh:1454
Variable branching information.
Definition: branch-var.hpp:55
First unassigned.
Definition: float.hh:1520
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest min.
Definition: var.hpp:164
With smallest activity divided by domain size.
Definition: float.hh:1540
Select s
Which variable to select.
Definition: float.hh:1545
FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest max.
Definition: var.hpp:174
#define forceinline
Definition: config.hpp:132
With largest domain size.
Definition: float.hh:1535
With largest accumulated failure count divided by domain size.
Definition: float.hh:1539
With largest activity divided by domain size.
Definition: float.hh:1541
Gecode toplevel namespace
Random number generator.
Definition: rnd.hpp:46
FloatVarBranch FLOAT_VAR_ACTIVITY_MIN(double d, BranchTbl tbl)
Select variable with lowest activity with decay factor d.
Definition: var.hpp:144
FloatVarBranch FLOAT_VAR_ACTIVITY_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest activity divided by domain size with decay factor d.
Definition: var.hpp:224
Class for activity management.
Definition: activity.hpp:44
With largest degree divided by domain size.
Definition: float.hh:1537
FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest domain size.
Definition: var.hpp:189
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
FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest min.
Definition: var.hpp:169
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Definition: var.hpp:97
FloatVarBranch FLOAT_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Definition: var.hpp:134
Recording AFC information for float variables.
Definition: float.hh:1417
FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Definition: var.hpp:184
double(* BranchTbl)(const Space &home, double w, double b)
Tie-break limit function.
Definition: branch-var.hpp:49