Generated on Sat Jan 12 2019 20:58:51 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  * 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 #include <gecode/int/branch.hh>
35 
36 namespace Gecode { namespace Int { namespace Branch {
37 
38  ViewSel<IntView>*
39  viewsel(Space& home, const IntVarBranch& ivb) {
40  switch (ivb.select()) {
42  return new (home) ViewSelNone<IntView>(home,ivb);
44  return new (home) ViewSelRnd<IntView>(home,ivb);
45  default: break;
46  }
47  if (ivb.tbl() != NULL) {
48  switch (ivb.select()) {
50  return new (home) ViewSelMinTbl<MeritFunction<IntView>>(home,ivb);
52  return new (home) ViewSelMaxTbl<MeritFunction<IntView>>(home,ivb);
54  return new (home) ViewSelMinTbl<MeritMin<IntView>>(home,ivb);
56  return new (home) ViewSelMaxTbl<MeritMin<IntView>>(home,ivb);
58  return new (home) ViewSelMinTbl<MeritMax<IntView>>(home,ivb);
60  return new (home) ViewSelMaxTbl<MeritMax<IntView>>(home,ivb);
62  return new (home) ViewSelMinTbl<MeritSize<IntView>>(home,ivb);
64  return new (home) ViewSelMaxTbl<MeritSize<IntView>>(home,ivb);
66  return new (home) ViewSelMinTbl<MeritDegree<IntView>>(home,ivb);
68  return new (home) ViewSelMaxTbl<MeritDegree<IntView>>(home,ivb);
70  return new (home) ViewSelMinTbl<MeritAFC<IntView>>(home,ivb);
72  return new (home) ViewSelMaxTbl<MeritAFC<IntView>>(home,ivb);
74  return new (home) ViewSelMinTbl<MeritAction<IntView>>(home,ivb);
76  return new (home) ViewSelMaxTbl<MeritAction<IntView>>(home,ivb);
78  return new (home) ViewSelMinTbl<MeritCHB<IntView>>(home,ivb);
80  return new (home) ViewSelMaxTbl<MeritCHB<IntView>>(home,ivb);
82  return new (home) ViewSelMinTbl<MeritDegreeSize<IntView>>(home,ivb);
84  return new (home) ViewSelMaxTbl<MeritDegreeSize<IntView>>(home,ivb);
86  return new (home) ViewSelMinTbl<MeritAFCSize<IntView>>(home,ivb);
88  return new (home) ViewSelMaxTbl<MeritAFCSize<IntView>>(home,ivb);
90  return new (home) ViewSelMinTbl<MeritActionSize<IntView>>(home,ivb);
92  return new (home) ViewSelMaxTbl<MeritActionSize<IntView>>(home,ivb);
94  return new (home) ViewSelMinTbl<MeritCHBSize<IntView>>(home,ivb);
96  return new (home) ViewSelMaxTbl<MeritCHBSize<IntView>>(home,ivb);
98  return new (home) ViewSelMinTbl<MeritRegretMin<IntView>>(home,ivb);
100  return new (home) ViewSelMaxTbl<MeritRegretMin<IntView>>(home,ivb);
102  return new (home) ViewSelMinTbl<MeritRegretMax<IntView>>(home,ivb);
104  return new (home) ViewSelMaxTbl<MeritRegretMax<IntView>>(home,ivb);
105  default:
106  throw UnknownBranching("Int::branch");
107  }
108  } else {
109  switch (ivb.select()) {
111  return new (home) ViewSelMin<MeritFunction<IntView>>(home,ivb);
113  return new (home) ViewSelMax<MeritFunction<IntView>>(home,ivb);
115  return new (home) ViewSelMin<MeritMin<IntView>>(home,ivb);
117  return new (home) ViewSelMax<MeritMin<IntView>>(home,ivb);
119  return new (home) ViewSelMin<MeritMax<IntView>>(home,ivb);
121  return new (home) ViewSelMax<MeritMax<IntView>>(home,ivb);
123  return new (home) ViewSelMin<MeritSize<IntView>>(home,ivb);
125  return new (home) ViewSelMax<MeritSize<IntView>>(home,ivb);
127  return new (home) ViewSelMin<MeritDegree<IntView>>(home,ivb);
129  return new (home) ViewSelMax<MeritDegree<IntView>>(home,ivb);
131  return new (home) ViewSelMin<MeritAFC<IntView>>(home,ivb);
133  return new (home) ViewSelMax<MeritAFC<IntView>>(home,ivb);
135  return new (home) ViewSelMin<MeritAction<IntView>>(home,ivb);
137  return new (home) ViewSelMax<MeritAction<IntView>>(home,ivb);
139  return new (home) ViewSelMin<MeritCHB<IntView>>(home,ivb);
141  return new (home) ViewSelMax<MeritCHB<IntView>>(home,ivb);
143  return new (home) ViewSelMin<MeritDegreeSize<IntView>>(home,ivb);
145  return new (home) ViewSelMax<MeritDegreeSize<IntView>>(home,ivb);
147  return new (home) ViewSelMin<MeritAFCSize<IntView>>(home,ivb);
149  return new (home) ViewSelMax<MeritAFCSize<IntView>>(home,ivb);
151  return new (home) ViewSelMin<MeritActionSize<IntView>>(home,ivb);
153  return new (home) ViewSelMax<MeritActionSize<IntView>>(home,ivb);
155  return new (home) ViewSelMin<MeritCHBSize<IntView>>(home,ivb);
157  return new (home) ViewSelMax<MeritCHBSize<IntView>>(home,ivb);
159  return new (home) ViewSelMin<MeritRegretMin<IntView>>(home,ivb);
161  return new (home) ViewSelMax<MeritRegretMin<IntView>>(home,ivb);
163  return new (home) ViewSelMin<MeritRegretMax<IntView>>(home,ivb);
165  return new (home) ViewSelMax<MeritRegretMax<IntView>>(home,ivb);
166  default:
167  throw UnknownBranching("Int::branch");
168  }
169  }
170  GECODE_NEVER;
171  return NULL;
172  }
173 
175  viewsel(Space& home, const BoolVarBranch& bvb) {
176  switch (bvb.select()) {
178  return new (home) ViewSelNone<BoolView>(home,bvb);
180  return new (home) ViewSelRnd<BoolView>(home,bvb);
181  default: break;
182  }
183  if (bvb.tbl() != NULL) {
184  switch (bvb.select()) {
186  return new (home) ViewSelMinTbl<MeritFunction<BoolView>>(home,bvb);
188  return new (home) ViewSelMaxTbl<MeritFunction<BoolView>>(home,bvb);
190  return new (home) ViewSelMinTbl<MeritDegree<BoolView>>(home,bvb);
192  return new (home) ViewSelMaxTbl<MeritDegree<BoolView>>(home,bvb);
194  return new (home) ViewSelMinTbl<MeritAFC<BoolView>>(home,bvb);
196  return new (home) ViewSelMaxTbl<MeritAFC<BoolView>>(home,bvb);
198  return new (home) ViewSelMinTbl<MeritAction<BoolView>>(home,bvb);
200  return new (home) ViewSelMaxTbl<MeritAction<BoolView>>(home,bvb);
202  return new (home) ViewSelMinTbl<MeritCHB<BoolView>>(home,bvb);
204  return new (home) ViewSelMaxTbl<MeritCHB<BoolView>>(home,bvb);
205  default:
206  throw UnknownBranching("Int::branch");
207  }
208  } else {
209  switch (bvb.select()) {
211  return new (home) ViewSelMin<MeritFunction<BoolView>>(home,bvb);
213  return new (home) ViewSelMax<MeritFunction<BoolView>>(home,bvb);
215  return new (home) ViewSelMin<MeritDegree<BoolView>>(home,bvb);
217  return new (home) ViewSelMax<MeritDegree<BoolView>>(home,bvb);
219  return new (home) ViewSelMin<MeritAFC<BoolView>>(home,bvb);
221  return new (home) ViewSelMax<MeritAFC<BoolView>>(home,bvb);
223  return new (home) ViewSelMin<MeritAction<BoolView>>(home,bvb);
225  return new (home) ViewSelMax<MeritAction<BoolView>>(home,bvb);
227  return new (home) ViewSelMin<MeritCHB<BoolView>>(home,bvb);
229  return new (home) ViewSelMax<MeritCHB<BoolView>>(home,bvb);
230  default:
231  throw UnknownBranching("Int::branch");
232  }
233  }
234  GECODE_NEVER;
235  return NULL;
236  }
237 
238 }}}
239 
240 
241 // STATISTICS: int-branch
242 
Select view with largest merit.
Definition: view-sel.hpp:335
With smallest accumulated failure count.
Definition: int.hh:4517
ViewSel< IntView > * viewsel(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition: view-sel.cpp:39
With largest min-regret.
Definition: int.hh:4548
With smallest accumulated failure count.
Definition: int.hh:4603
With smallest degree.
Definition: int.hh:4515
Which integer variable to select for branching.
Definition: int.hh:4507
With largest accumulated failure count.
Definition: int.hh:4518
Merit class for degree.
Definition: merit.hpp:93
With largest accumulated failure count divided by domain size.
Definition: int.hh:4532
First unassigned.
Definition: int.hh:4511
Abstract class for view selection.
Definition: view-sel.hpp:44
Merit class for CHB over size.
Definition: branch.hh:191
With highest action.
Definition: int.hh:4606
Merit class for degree over size.
Definition: branch.hh:123
With largest accumulated failure count.
Definition: int.hh:4604
With lowest action.
Definition: int.hh:4605
Computation spaces.
Definition: core.hpp:1701
With smallest min.
Definition: int.hh:4523
Select the first unassigned view.
Definition: view-sel.hpp:109
With lowest action.
Definition: int.hh:4519
Select view with least merit.
Definition: view-sel.hpp:295
Random (uniform, for tie breaking)
Definition: int.hh:4598
Exception: Unknown value or variable selection passed as argument
Definition: exception.hpp:108
With smallest max-regret.
Definition: int.hh:4554
With smallest degree.
Definition: int.hh:4601
With smallest min-regret.
Definition: int.hh:4542
With largest action divided by domain size.
Definition: int.hh:4534
Merit class for action over size.
Definition: branch.hh:166
Select view with largest merit taking tie-break limit into account.
Definition: view-sel.hpp:355
Select select(void) const
Return selection strategy.
Definition: var.hpp:340
Merit class for user-defined merit function.
Definition: merit.hpp:68
With largest max.
Definition: int.hh:4526
With largest domain size.
Definition: int.hh:4528
Merit class for mimimum of integer views.
Definition: branch.hh:69
Select view with least merit taking tie-break limit into account.
Definition: view-sel.hpp:315
Which Boolean variable to select for branching.
Definition: int.hh:4593
Merit class for minimum regret.
Definition: branch.hh:216
With largest CHB Q-score divided by domain size.
Definition: int.hh:4536
Merit class for AFC over size.
Definition: branch.hh:141
Select a view randomly.
Definition: view-sel.hpp:149
With largest degree divided by domain size.
Definition: int.hh:4530
With highest action.
Definition: int.hh:4520
With smallest CHB Q-score divided by domain size.
Definition: int.hh:4535
With largest degree.
Definition: int.hh:4516
Merit class for AFC.
Definition: merit.hpp:108
With highest CHB.
Definition: int.hh:4608
With smallest degree divided by domain size.
Definition: int.hh:4529
With smallest max.
Definition: int.hh:4525
Merit class for size.
Definition: branch.hh:105
With highest CHB Q-score.
Definition: int.hh:4522
With lowest CHB Q-score.
Definition: int.hh:4521
BranchTbl tbl(void) const
Return tie-break limit function.
Definition: var.hpp:168
With smallest action divided by domain size.
Definition: int.hh:4533
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
Random (uniform, for tie breaking)
Definition: int.hh:4512
With largest degree.
Definition: int.hh:4602
Merit class for maximum regret.
Definition: branch.hh:234
Merit class for maximum.
Definition: branch.hh:87
With smallest domain size.
Definition: int.hh:4527
First unassigned.
Definition: int.hh:4597
With highest merit.
Definition: int.hh:4514
With largest min.
Definition: int.hh:4524
Gecode toplevel namespace
With highest merit.
Definition: int.hh:4600
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56
With largest max-regret.
Definition: int.hh:4560
Merit class for action.
Definition: merit.hpp:130
With smallest accumulated failure count divided by domain size.
Definition: int.hh:4531
Merit class for CHB.
Definition: merit.hpp:153