Generated on Sat Feb 7 2015 02:01:15 for Gecode by doxygen 1.8.9.1
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: 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 #include <gecode/int/branch.hh>
39 
40 namespace Gecode { namespace Int { namespace Branch {
41 
42  ViewSel<IntView>*
43  viewselint(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<MeritActivity<IntView> >(home,ivb);
80  return new (home) ViewSelMaxTbl<MeritActivity<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<MeritActivitySize<IntView> >(home,ivb);
92  return new (home) ViewSelMaxTbl<MeritActivitySize<IntView> >(home,ivb);
94  return new (home) ViewSelMinTbl<MeritRegretMin<IntView> >(home,ivb);
96  return new (home) ViewSelMaxTbl<MeritRegretMin<IntView> >(home,ivb);
98  return new (home) ViewSelMinTbl<MeritRegretMax<IntView> >(home,ivb);
100  return new (home) ViewSelMaxTbl<MeritRegretMax<IntView> >(home,ivb);
101  default:
102  throw UnknownBranching("Int::branch");
103  }
104  } else {
105  switch (ivb.select()) {
107  return new (home) ViewSelMin<MeritFunction<IntView> >(home,ivb);
109  return new (home) ViewSelMax<MeritFunction<IntView> >(home,ivb);
111  return new (home) ViewSelMin<MeritMin<IntView> >(home,ivb);
113  return new (home) ViewSelMax<MeritMin<IntView> >(home,ivb);
115  return new (home) ViewSelMin<MeritMax<IntView> >(home,ivb);
117  return new (home) ViewSelMax<MeritMax<IntView> >(home,ivb);
119  return new (home) ViewSelMin<MeritSize<IntView> >(home,ivb);
121  return new (home) ViewSelMax<MeritSize<IntView> >(home,ivb);
123  return new (home) ViewSelMin<MeritDegree<IntView> >(home,ivb);
125  return new (home) ViewSelMax<MeritDegree<IntView> >(home,ivb);
127  return new (home) ViewSelMin<MeritAFC<IntView> >(home,ivb);
129  return new (home) ViewSelMax<MeritAFC<IntView> >(home,ivb);
131  return new (home) ViewSelMin<MeritActivity<IntView> >(home,ivb);
133  return new (home) ViewSelMax<MeritActivity<IntView> >(home,ivb);
135  return new (home) ViewSelMin<MeritDegreeSize<IntView> >(home,ivb);
137  return new (home) ViewSelMax<MeritDegreeSize<IntView> >(home,ivb);
139  return new (home) ViewSelMin<MeritAFCSize<IntView> >(home,ivb);
141  return new (home) ViewSelMax<MeritAFCSize<IntView> >(home,ivb);
143  return new (home) ViewSelMin<MeritActivitySize<IntView> >(home,ivb);
145  return new (home) ViewSelMax<MeritActivitySize<IntView> >(home,ivb);
147  return new (home) ViewSelMin<MeritRegretMin<IntView> >(home,ivb);
149  return new (home) ViewSelMax<MeritRegretMin<IntView> >(home,ivb);
151  return new (home) ViewSelMin<MeritRegretMax<IntView> >(home,ivb);
153  return new (home) ViewSelMax<MeritRegretMax<IntView> >(home,ivb);
154  default:
155  throw UnknownBranching("Int::branch");
156  }
157  }
158  GECODE_NEVER;
159  return NULL;
160  }
161 
163  viewselbool(Space& home, const IntVarBranch& ivb) {
164  switch (ivb.select()) {
166  return new (home) ViewSelNone<BoolView>(home,ivb);
168  return new (home) ViewSelRnd<BoolView>(home,ivb);
169  default: break;
170  }
171  if (ivb.tbl() != NULL) {
172  switch (ivb.select()) {
174  return new (home) ViewSelMinTbl<MeritFunction<BoolView> >(home,ivb);
176  return new (home) ViewSelMaxTbl<MeritFunction<BoolView> >(home,ivb);
187  return new (home) ViewSelNone<BoolView>(home,ivb);
189  return new (home) ViewSelMinTbl<MeritDegree<BoolView> >(home,ivb);
191  return new (home) ViewSelMaxTbl<MeritDegree<BoolView> >(home,ivb);
193  return new (home) ViewSelMinTbl<MeritAFC<BoolView> >(home,ivb);
195  return new (home) ViewSelMaxTbl<MeritAFC<BoolView> >(home,ivb);
197  return new (home) ViewSelMinTbl<MeritActivity<BoolView> >(home,ivb);
199  return new (home) ViewSelMaxTbl<MeritActivity<BoolView> >(home,ivb);
201  return new (home) ViewSelMinTbl<MeritDegreeSize<BoolView> >(home,ivb);
203  return new (home) ViewSelMaxTbl<MeritDegreeSize<BoolView> >(home,ivb);
205  return new (home) ViewSelMinTbl<MeritAFCSize<BoolView> >(home,ivb);
207  return new (home) ViewSelMaxTbl<MeritAFCSize<BoolView> >(home,ivb);
209  return new (home) ViewSelMinTbl<MeritActivitySize<BoolView> >(home,ivb);
211  return new (home) ViewSelMaxTbl<MeritActivitySize<BoolView> >(home,ivb);
212  default:
213  throw UnknownBranching("Int::branch");
214  }
215  } else {
216  switch (ivb.select()) {
218  return new (home) ViewSelMin<MeritFunction<BoolView> >(home,ivb);
220  return new (home) ViewSelMax<MeritFunction<BoolView> >(home,ivb);
231  return new (home) ViewSelNone<BoolView>(home,ivb);
234  return new (home) ViewSelMin<MeritDegree<BoolView> >(home,ivb);
237  return new (home) ViewSelMax<MeritDegree<BoolView> >(home,ivb);
240  return new (home) ViewSelMin<MeritAFC<BoolView> >(home,ivb);
243  return new (home) ViewSelMax<MeritAFC<BoolView> >(home,ivb);
246  return new (home) ViewSelMin<MeritActivity<BoolView> >(home,ivb);
249  return new (home) ViewSelMax<MeritActivity<BoolView> >(home,ivb);
250  default:
251  throw UnknownBranching("Int::branch");
252  }
253  }
254  GECODE_NEVER;
255  return NULL;
256  }
257 
258 }}}
259 
260 
261 // STATISTICS: int-branch
262 
Select view with largest merit.
With smallest max-regret.
Definition: int.hh:3841
With lowest activity.
Definition: int.hh:3810
With largest min-regret.
Definition: int.hh:3835
With smallest degree divided by domain size.
Definition: int.hh:3818
Which variable to select for branching.
Definition: int.hh:3798
With smallest min-regret.
Definition: int.hh:3829
Merit class for degree.
Abstract class for view selection.
Merit class for size over degree.
Definition: branch.hh:120
Merit class for size over activity.
Definition: branch.hh:161
ViewSel< IntView > * viewselint(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition: view-sel.cpp:43
BranchTbl tbl(void) const
Return tie-break limit function.
Definition: branch-var.hpp:135
With smallest min.
Definition: int.hh:3812
Computation spaces.
Definition: core.hpp:1362
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
With highest merit.
Definition: int.hh:3805
Select the first unassigned view.
Select view with least merit.
Merit class for activity.
With largest max.
Definition: int.hh:3815
With largest accumulated failure count.
Definition: int.hh:3809
Exception: Unknown value or variable selection passed as argument
Definition: exception.hpp:112
With highest activity.
Definition: int.hh:3811
With smallest max.
Definition: int.hh:3814
With smallest accumulated failure count.
Definition: int.hh:3808
Select view with largest merit taking tie-break limit into account.
With largest degree.
Definition: int.hh:3807
With smallest degree.
Definition: int.hh:3806
Merit class for user-defined merit function.
With largest domain size.
Definition: int.hh:3817
Merit class for mimimum of integer views.
Definition: branch.hh:69
ViewSel< BoolView > * viewselbool(Space &home, const IntVarBranch &ivb)
Return view selectors for Boolean views.
Definition: view-sel.cpp:163
Select view with least merit taking tie-break limit into account.
Merit class for minimum regret.
Definition: branch.hh:185
With smallest domain size.
Definition: int.hh:3816
Merit class for size over afc.
Definition: branch.hh:137
Select a view randomly.
With largest degree divided by domain size.
Definition: int.hh:3819
With largest max-regret.
Definition: int.hh:3847
Merit class for AFC.
Merit class for size.
Definition: branch.hh:103
Random (uniform, for tie breaking)
Definition: int.hh:3803
First unassigned.
Definition: int.hh:3802
With largest activity divided by domain size.
Definition: int.hh:3823
With largest min.
Definition: int.hh:3813
Merit class for maximum regret.
Definition: branch.hh:202
Merit class for maximum.
Definition: branch.hh:86
Gecode toplevel namespace
With largest accumulated failure count divided by domain size.
Definition: int.hh:3821
With smallest activity divided by domain size.
Definition: int.hh:3822
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
With smallest accumulated failure count divided by domain size.
Definition: int.hh:3820