Generated on Sat Jul 29 2017 12:41:24 for Gecode by doxygen 1.8.13
view-sel.cpp
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: 2017-02-28 08:29:39 +0100 (Tue, 28 Feb 2017) $ by $Author: schulte $
11  * $Revision: 15527 $
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 #include <gecode/int/branch.hh>
39 
40 namespace Gecode { namespace Int { namespace Branch {
41 
42  ViewSel<IntView>*
43  viewsel(Space& home, const IntVarBranch& ivb) {
44  switch (ivb.select()) {
46  return new (home) ViewSelNone<IntView>(home,ivb);
48  return new (home) ViewSelRnd<IntView>(home,ivb);
49  default: break;
50  }
51  if (ivb.tbl() != NULL) {
52  switch (ivb.select()) {
54  return new (home) ViewSelMinTbl<MeritFunction<IntView>>(home,ivb);
56  return new (home) ViewSelMaxTbl<MeritFunction<IntView>>(home,ivb);
58  return new (home) ViewSelMinTbl<MeritMin<IntView>>(home,ivb);
60  return new (home) ViewSelMaxTbl<MeritMin<IntView>>(home,ivb);
62  return new (home) ViewSelMinTbl<MeritMax<IntView>>(home,ivb);
64  return new (home) ViewSelMaxTbl<MeritMax<IntView>>(home,ivb);
66  return new (home) ViewSelMinTbl<MeritSize<IntView>>(home,ivb);
68  return new (home) ViewSelMaxTbl<MeritSize<IntView>>(home,ivb);
70  return new (home) ViewSelMinTbl<MeritDegree<IntView>>(home,ivb);
72  return new (home) ViewSelMaxTbl<MeritDegree<IntView>>(home,ivb);
74  return new (home) ViewSelMinTbl<MeritAFC<IntView>>(home,ivb);
76  return new (home) ViewSelMaxTbl<MeritAFC<IntView>>(home,ivb);
78  return new (home) ViewSelMinTbl<MeritAction<IntView>>(home,ivb);
80  return new (home) ViewSelMaxTbl<MeritAction<IntView>>(home,ivb);
82  return new (home) ViewSelMinTbl<MeritCHB<IntView>>(home,ivb);
84  return new (home) ViewSelMaxTbl<MeritCHB<IntView>>(home,ivb);
86  return new (home) ViewSelMinTbl<MeritDegreeSize<IntView>>(home,ivb);
88  return new (home) ViewSelMaxTbl<MeritDegreeSize<IntView>>(home,ivb);
90  return new (home) ViewSelMinTbl<MeritAFCSize<IntView>>(home,ivb);
92  return new (home) ViewSelMaxTbl<MeritAFCSize<IntView>>(home,ivb);
94  return new (home) ViewSelMinTbl<MeritActionSize<IntView>>(home,ivb);
96  return new (home) ViewSelMaxTbl<MeritActionSize<IntView>>(home,ivb);
98  return new (home) ViewSelMinTbl<MeritCHBSize<IntView>>(home,ivb);
100  return new (home) ViewSelMaxTbl<MeritCHBSize<IntView>>(home,ivb);
102  return new (home) ViewSelMinTbl<MeritRegretMin<IntView>>(home,ivb);
104  return new (home) ViewSelMaxTbl<MeritRegretMin<IntView>>(home,ivb);
106  return new (home) ViewSelMinTbl<MeritRegretMax<IntView>>(home,ivb);
108  return new (home) ViewSelMaxTbl<MeritRegretMax<IntView>>(home,ivb);
109  default:
110  throw UnknownBranching("Int::branch");
111  }
112  } else {
113  switch (ivb.select()) {
115  return new (home) ViewSelMin<MeritFunction<IntView>>(home,ivb);
117  return new (home) ViewSelMax<MeritFunction<IntView>>(home,ivb);
119  return new (home) ViewSelMin<MeritMin<IntView>>(home,ivb);
121  return new (home) ViewSelMax<MeritMin<IntView>>(home,ivb);
123  return new (home) ViewSelMin<MeritMax<IntView>>(home,ivb);
125  return new (home) ViewSelMax<MeritMax<IntView>>(home,ivb);
127  return new (home) ViewSelMin<MeritSize<IntView>>(home,ivb);
129  return new (home) ViewSelMax<MeritSize<IntView>>(home,ivb);
131  return new (home) ViewSelMin<MeritDegree<IntView>>(home,ivb);
133  return new (home) ViewSelMax<MeritDegree<IntView>>(home,ivb);
135  return new (home) ViewSelMin<MeritAFC<IntView>>(home,ivb);
137  return new (home) ViewSelMax<MeritAFC<IntView>>(home,ivb);
139  return new (home) ViewSelMin<MeritAction<IntView>>(home,ivb);
141  return new (home) ViewSelMax<MeritAction<IntView>>(home,ivb);
143  return new (home) ViewSelMin<MeritCHB<IntView>>(home,ivb);
145  return new (home) ViewSelMax<MeritCHB<IntView>>(home,ivb);
147  return new (home) ViewSelMin<MeritDegreeSize<IntView>>(home,ivb);
149  return new (home) ViewSelMax<MeritDegreeSize<IntView>>(home,ivb);
151  return new (home) ViewSelMin<MeritAFCSize<IntView>>(home,ivb);
153  return new (home) ViewSelMax<MeritAFCSize<IntView>>(home,ivb);
155  return new (home) ViewSelMin<MeritActionSize<IntView>>(home,ivb);
157  return new (home) ViewSelMax<MeritActionSize<IntView>>(home,ivb);
159  return new (home) ViewSelMin<MeritCHBSize<IntView>>(home,ivb);
161  return new (home) ViewSelMax<MeritCHBSize<IntView>>(home,ivb);
163  return new (home) ViewSelMin<MeritRegretMin<IntView>>(home,ivb);
165  return new (home) ViewSelMax<MeritRegretMin<IntView>>(home,ivb);
167  return new (home) ViewSelMin<MeritRegretMax<IntView>>(home,ivb);
169  return new (home) ViewSelMax<MeritRegretMax<IntView>>(home,ivb);
170  default:
171  throw UnknownBranching("Int::branch");
172  }
173  }
174  GECODE_NEVER;
175  return NULL;
176  }
177 
179  viewsel(Space& home, const BoolVarBranch& bvb) {
180  switch (bvb.select()) {
182  return new (home) ViewSelNone<BoolView>(home,bvb);
184  return new (home) ViewSelRnd<BoolView>(home,bvb);
185  default: break;
186  }
187  if (bvb.tbl() != NULL) {
188  switch (bvb.select()) {
190  return new (home) ViewSelMinTbl<MeritFunction<BoolView>>(home,bvb);
192  return new (home) ViewSelMaxTbl<MeritFunction<BoolView>>(home,bvb);
194  return new (home) ViewSelMinTbl<MeritDegree<BoolView>>(home,bvb);
196  return new (home) ViewSelMaxTbl<MeritDegree<BoolView>>(home,bvb);
198  return new (home) ViewSelMinTbl<MeritAFC<BoolView>>(home,bvb);
200  return new (home) ViewSelMaxTbl<MeritAFC<BoolView>>(home,bvb);
202  return new (home) ViewSelMinTbl<MeritAction<BoolView>>(home,bvb);
204  return new (home) ViewSelMaxTbl<MeritAction<BoolView>>(home,bvb);
206  return new (home) ViewSelMinTbl<MeritCHB<BoolView>>(home,bvb);
208  return new (home) ViewSelMaxTbl<MeritCHB<BoolView>>(home,bvb);
209  default:
210  throw UnknownBranching("Int::branch");
211  }
212  } else {
213  switch (bvb.select()) {
215  return new (home) ViewSelMin<MeritFunction<BoolView>>(home,bvb);
217  return new (home) ViewSelMax<MeritFunction<BoolView>>(home,bvb);
219  return new (home) ViewSelMin<MeritDegree<BoolView>>(home,bvb);
221  return new (home) ViewSelMax<MeritDegree<BoolView>>(home,bvb);
223  return new (home) ViewSelMin<MeritAFC<BoolView>>(home,bvb);
225  return new (home) ViewSelMax<MeritAFC<BoolView>>(home,bvb);
227  return new (home) ViewSelMin<MeritAction<BoolView>>(home,bvb);
229  return new (home) ViewSelMax<MeritAction<BoolView>>(home,bvb);
231  return new (home) ViewSelMin<MeritCHB<BoolView>>(home,bvb);
233  return new (home) ViewSelMax<MeritCHB<BoolView>>(home,bvb);
234  default:
235  throw UnknownBranching("Int::branch");
236  }
237  }
238  GECODE_NEVER;
239  return NULL;
240  }
241 
242 }}}
243 
244 
245 // STATISTICS: int-branch
246 
Select view with largest merit.
With smallest accumulated failure count.
Definition: int.hh:4229
ViewSel< IntView > * viewsel(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition: view-sel.cpp:43
With largest min-regret.
Definition: int.hh:4260
With smallest accumulated failure count.
Definition: int.hh:4315
With smallest degree.
Definition: int.hh:4227
Which integer variable to select for branching.
Definition: int.hh:4219
With largest accumulated failure count.
Definition: int.hh:4230
Merit class for degree.
With largest accumulated failure count divided by domain size.
Definition: int.hh:4244
First unassigned.
Definition: int.hh:4223
Abstract class for view selection.
Merit class for CHB over size.
Definition: branch.hh:191
With highest action.
Definition: int.hh:4318
Merit class for degree over size.
Definition: branch.hh:123
With largest accumulated failure count.
Definition: int.hh:4316
With lowest action.
Definition: int.hh:4317
Computation spaces.
Definition: core.hpp:1748
With smallest min.
Definition: int.hh:4235
Select the first unassigned view.
With lowest action.
Definition: int.hh:4231
Select view with least merit.
Random (uniform, for tie breaking)
Definition: int.hh:4310
Exception: Unknown value or variable selection passed as argument
Definition: exception.hpp:112
With smallest max-regret.
Definition: int.hh:4266
With smallest degree.
Definition: int.hh:4313
With smallest min-regret.
Definition: int.hh:4254
With largest action divided by domain size.
Definition: int.hh:4246
Merit class for action over size.
Definition: branch.hh:166
Select view with largest merit taking tie-break limit into account.
Select select(void) const
Return selection strategy.
Definition: var.hpp:344
Merit class for user-defined merit function.
With largest max.
Definition: int.hh:4238
With largest domain size.
Definition: int.hh:4240
Merit class for mimimum of integer views.
Definition: branch.hh:69
Select view with least merit taking tie-break limit into account.
Which Boolean variable to select for branching.
Definition: int.hh:4305
Merit class for minimum regret.
Definition: branch.hh:216
With largest CHB Q-score divided by domain size.
Definition: int.hh:4248
Merit class for AFC over size.
Definition: branch.hh:141
Select a view randomly.
With largest degree divided by domain size.
Definition: int.hh:4242
With highest action.
Definition: int.hh:4232
With smallest CHB Q-score divided by domain size.
Definition: int.hh:4247
With largest degree.
Definition: int.hh:4228
Merit class for AFC.
With highest CHB.
Definition: int.hh:4320
With smallest degree divided by domain size.
Definition: int.hh:4241
With smallest max.
Definition: int.hh:4237
Merit class for size.
Definition: branch.hh:105
With highest CHB Q-score.
Definition: int.hh:4234
With lowest CHB Q-score.
Definition: int.hh:4233
BranchTbl tbl(void) const
Return tie-break limit function.
Definition: branch-var.hpp:172
With smallest action divided by domain size.
Definition: int.hh:4245
Select select(void) const
Return selection strategy.
Definition: var.hpp:73
Random (uniform, for tie breaking)
Definition: int.hh:4224
With largest degree.
Definition: int.hh:4314
Merit class for maximum regret.
Definition: branch.hh:234
Merit class for maximum.
Definition: branch.hh:87
With smallest domain size.
Definition: int.hh:4239
First unassigned.
Definition: int.hh:4309
With highest merit.
Definition: int.hh:4226
With largest min.
Definition: int.hh:4236
Gecode toplevel namespace
With highest merit.
Definition: int.hh:4312
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
With largest max-regret.
Definition: int.hh:4272
Merit class for action.
With smallest accumulated failure count divided by domain size.
Definition: int.hh:4243
Merit class for CHB.