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/set/branch.hh>
39 
40 namespace Gecode { namespace Set { namespace Branch {
41 
42  ViewSel<SetView>*
43  viewsel(Space& home, const SetVarBranch& svb) {
44  switch (svb.select()) {
46  return new (home) ViewSelNone<SetView>(home,svb);
48  return new (home) ViewSelRnd<SetView>(home,svb);
49  default: break;
50  }
51  if (svb.tbl() != NULL) {
52  switch (svb.select()) {
54  return new (home) ViewSelMinTbl<MeritFunction<SetView> >(home,svb);
56  return new (home) ViewSelMaxTbl<MeritFunction<SetView> >(home,svb);
58  return new (home) ViewSelMinTbl<MeritMin>(home,svb);
60  return new (home) ViewSelMaxTbl<MeritMin>(home,svb);
62  return new (home) ViewSelMinTbl<MeritMax>(home,svb);
64  return new (home) ViewSelMaxTbl<MeritMax>(home,svb);
66  return new (home) ViewSelMinTbl<MeritSize>(home,svb);
68  return new (home) ViewSelMaxTbl<MeritSize>(home,svb);
70  return new (home) ViewSelMinTbl<MeritDegree<SetView> >(home,svb);
72  return new (home) ViewSelMaxTbl<MeritDegree<SetView> >(home,svb);
74  return new (home) ViewSelMinTbl<MeritAFC<SetView> >(home,svb);
76  return new (home) ViewSelMaxTbl<MeritAFC<SetView> >(home,svb);
78  return new (home) ViewSelMinTbl<MeritActivity<SetView> >(home,svb);
80  return new (home) ViewSelMaxTbl<MeritActivity<SetView> >(home,svb);
82  return new (home) ViewSelMinTbl<MeritDegreeSize>(home,svb);
84  return new (home) ViewSelMaxTbl<MeritDegreeSize>(home,svb);
86  return new (home) ViewSelMinTbl<MeritAFCSize>(home,svb);
88  return new (home) ViewSelMaxTbl<MeritAFCSize>(home,svb);
90  return new (home) ViewSelMinTbl<MeritActivitySize>(home,svb);
92  return new (home) ViewSelMaxTbl<MeritActivitySize>(home,svb);
93  default:
94  throw UnknownBranching("Set::branch");
95  }
96  } else {
97  switch (svb.select()) {
99  return new (home) ViewSelMin<MeritFunction<SetView> >(home,svb);
101  return new (home) ViewSelMax<MeritFunction<SetView> >(home,svb);
103  return new (home) ViewSelMin<MeritMin>(home,svb);
105  return new (home) ViewSelMax<MeritMin>(home,svb);
107  return new (home) ViewSelMin<MeritMax>(home,svb);
109  return new (home) ViewSelMax<MeritMax>(home,svb);
111  return new (home) ViewSelMin<MeritSize>(home,svb);
113  return new (home) ViewSelMax<MeritSize>(home,svb);
115  return new (home) ViewSelMin<MeritDegree<SetView> >(home,svb);
117  return new (home) ViewSelMax<MeritDegree<SetView> >(home,svb);
119  return new (home) ViewSelMin<MeritAFC<SetView> >(home,svb);
121  return new (home) ViewSelMax<MeritAFC<SetView> >(home,svb);
123  return new (home) ViewSelMin<MeritActivity<SetView> >(home,svb);
125  return new (home) ViewSelMax<MeritActivity<SetView> >(home,svb);
127  return new (home) ViewSelMin<MeritDegreeSize>(home,svb);
129  return new (home) ViewSelMax<MeritDegreeSize>(home,svb);
131  return new (home) ViewSelMin<MeritAFCSize>(home,svb);
133  return new (home) ViewSelMax<MeritAFCSize>(home,svb);
135  return new (home) ViewSelMin<MeritActivitySize>(home,svb);
137  return new (home) ViewSelMax<MeritActivitySize>(home,svb);
138  default:
139  throw UnknownBranching("Set::branch");
140  }
141  }
142  GECODE_NEVER;
143  return NULL;
144  }
145 
146 }}}
147 
148 
149 // STATISTICS: set-branch
150 
Select view with largest merit.
With highest activity.
Definition: set.hh:1266
With smallest minimum unknown element.
Definition: set.hh:1267
Merit class for degree.
With largest degree divided by domain size.
Definition: set.hh:1274
BranchTbl tbl(void) const
Return tie-break limit function.
Definition: branch-var.hpp:135
Computation spaces.
Definition: core.hpp:1362
With largest maximum unknown element.
Definition: set.hh:1270
Select the first unassigned view.
Select view with least merit.
Merit class for activity.
With smallest accumulated failure count.
Definition: set.hh:1263
Exception: Unknown value or variable selection passed as argument
Definition: exception.hpp:112
With largest degree.
Definition: set.hh:1262
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
With smallest maximum unknown element.
Definition: set.hh:1269
With smallest degree.
Definition: set.hh:1261
First unassigned.
Definition: set.hh:1257
ViewSel< SetView > * viewsel(Space &home, const SetVarBranch &svb)
Return view selectors for set views.
Definition: view-sel.cpp:43
With smallest degree divided by domain size.
Definition: set.hh:1273
Select view with largest merit taking tie-break limit into account.
Merit class for user-defined merit function.
With largest accumulated failure count divided by domain size.
Definition: set.hh:1276
With largest accumulated failure count.
Definition: set.hh:1264
With smallest activity divided by domain size.
Definition: set.hh:1277
Select view with least merit taking tie-break limit into account.
With largest activity divided by domain size.
Definition: set.hh:1278
Select a view randomly.
With largest unknown set.
Definition: set.hh:1272
Merit class for AFC.
With highest merit.
Definition: set.hh:1260
With lowest activity.
Definition: set.hh:1265
Random (uniform, for tie breaking)
Definition: set.hh:1258
With smallest unknown set.
Definition: set.hh:1271
With largest minimum unknown element.
Definition: set.hh:1268
Gecode toplevel namespace
Which variable to select for branching.
Definition: set.hh:1253
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
With smallest accumulated failure count divided by domain size.
Definition: set.hh:1275