Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
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/set/branch.hh>
35
36namespace Gecode { namespace Set { namespace Branch {
37
38 ViewSel<SetView>*
39 viewsel(Space& home, const SetVarBranch& svb) {
40 switch (svb.select()) {
42 return new (home) ViewSelNone<SetView>(home,svb);
44 return new (home) ViewSelRnd<SetView>(home,svb);
45 default: break;
46 }
47 if (svb.tbl() != NULL) {
48 switch (svb.select()) {
50 return new (home) ViewSelMinTbl<MeritFunction<SetView>>(home,svb);
52 return new (home) ViewSelMaxTbl<MeritFunction<SetView>>(home,svb);
54 return new (home) ViewSelMinTbl<MeritMin>(home,svb);
56 return new (home) ViewSelMaxTbl<MeritMin>(home,svb);
58 return new (home) ViewSelMinTbl<MeritMax>(home,svb);
60 return new (home) ViewSelMaxTbl<MeritMax>(home,svb);
62 return new (home) ViewSelMinTbl<MeritSize>(home,svb);
64 return new (home) ViewSelMaxTbl<MeritSize>(home,svb);
66 return new (home) ViewSelMinTbl<MeritDegree<SetView>>(home,svb);
68 return new (home) ViewSelMaxTbl<MeritDegree<SetView>>(home,svb);
70 return new (home) ViewSelMinTbl<MeritAFC<SetView>>(home,svb);
72 return new (home) ViewSelMaxTbl<MeritAFC<SetView>>(home,svb);
74 return new (home) ViewSelMinTbl<MeritAction<SetView>>(home,svb);
76 return new (home) ViewSelMaxTbl<MeritAction<SetView>>(home,svb);
78 return new (home) ViewSelMinTbl<MeritCHB<SetView>>(home,svb);
80 return new (home) ViewSelMaxTbl<MeritCHB<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<MeritActionSize>(home,svb);
92 return new (home) ViewSelMaxTbl<MeritActionSize>(home,svb);
94 return new (home) ViewSelMinTbl<MeritCHBSize>(home,svb);
96 return new (home) ViewSelMaxTbl<MeritCHBSize>(home,svb);
97 default:
98 throw UnknownBranching("Set::branch");
99 }
100 } else {
101 switch (svb.select()) {
103 return new (home) ViewSelMin<MeritFunction<SetView>>(home,svb);
105 return new (home) ViewSelMax<MeritFunction<SetView>>(home,svb);
107 return new (home) ViewSelMin<MeritMin>(home,svb);
109 return new (home) ViewSelMax<MeritMin>(home,svb);
111 return new (home) ViewSelMin<MeritMax>(home,svb);
113 return new (home) ViewSelMax<MeritMax>(home,svb);
115 return new (home) ViewSelMin<MeritSize>(home,svb);
117 return new (home) ViewSelMax<MeritSize>(home,svb);
119 return new (home) ViewSelMin<MeritDegree<SetView>>(home,svb);
121 return new (home) ViewSelMax<MeritDegree<SetView>>(home,svb);
123 return new (home) ViewSelMin<MeritAFC<SetView>>(home,svb);
125 return new (home) ViewSelMax<MeritAFC<SetView>>(home,svb);
127 return new (home) ViewSelMin<MeritAction<SetView>>(home,svb);
129 return new (home) ViewSelMax<MeritAction<SetView>>(home,svb);
131 return new (home) ViewSelMin<MeritCHB<SetView>>(home,svb);
133 return new (home) ViewSelMax<MeritCHB<SetView>>(home,svb);
135 return new (home) ViewSelMin<MeritDegreeSize>(home,svb);
137 return new (home) ViewSelMax<MeritDegreeSize>(home,svb);
139 return new (home) ViewSelMin<MeritAFCSize>(home,svb);
141 return new (home) ViewSelMax<MeritAFCSize>(home,svb);
143 return new (home) ViewSelMin<MeritActionSize>(home,svb);
145 return new (home) ViewSelMax<MeritActionSize>(home,svb);
147 return new (home) ViewSelMin<MeritCHBSize>(home,svb);
149 return new (home) ViewSelMax<MeritCHBSize>(home,svb);
150 default:
151 throw UnknownBranching("Set::branch");
152 }
153 }
155 return NULL;
156 }
157
158}}}
159
160
161// STATISTICS: set-branch
162
Exception: Unknown value or variable selection passed as argument
Merit class for AFC.
Definition merit.hpp:108
Merit class for action.
Definition merit.hpp:130
Merit class for CHB.
Definition merit.hpp:153
Merit class for degree.
Definition merit.hpp:93
Merit class for user-defined merit function.
Definition merit.hpp:68
Which variable to select for branching.
Definition set.hh:1296
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition set.hh:1322
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition set.hh:1310
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition set.hh:1311
@ SEL_MERIT_MIN
With least merit.
Definition set.hh:1302
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition set.hh:1319
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition set.hh:1320
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition set.hh:1306
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition set.hh:1325
@ SEL_NONE
First unassigned.
Definition set.hh:1300
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition set.hh:1323
@ SEL_DEGREE_MAX
With largest degree.
Definition set.hh:1305
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition set.hh:1307
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition set.hh:1324
@ SEL_MERIT_MAX
With highest merit.
Definition set.hh:1303
@ SEL_SIZE_MIN
With smallest unknown set.
Definition set.hh:1316
@ SEL_RND
Random (uniform, for tie breaking)
Definition set.hh:1301
@ SEL_ACTION_MAX
With highest action.
Definition set.hh:1309
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition set.hh:1321
@ SEL_ACTION_MIN
With lowest action.
Definition set.hh:1308
@ SEL_MIN_MAX
With largest minimum unknown element.
Definition set.hh:1313
@ SEL_MAX_MAX
With largest maximum unknown element.
Definition set.hh:1315
@ SEL_MAX_MIN
With smallest maximum unknown element.
Definition set.hh:1314
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition set.hh:1318
@ SEL_MIN_MIN
With smallest minimum unknown element.
Definition set.hh:1312
@ SEL_DEGREE_MIN
With smallest degree.
Definition set.hh:1304
@ SEL_SIZE_MAX
With largest unknown set.
Definition set.hh:1317
Return selection strategy Select select(void) const
Definition var.hpp:69
Computation spaces.
Definition core.hpp:1742
BranchTbl tbl(void) const
Return tie-break limit function.
Definition var.hpp:168
Select view with largest merit taking tie-break limit into account.
Definition view-sel.hpp:355
Select view with largest merit.
Definition view-sel.hpp:335
Select view with least merit taking tie-break limit into account.
Definition view-sel.hpp:315
Select view with least merit.
Definition view-sel.hpp:295
Select the first unassigned view.
Definition view-sel.hpp:109
Select a view randomly.
Definition view-sel.hpp:149
ViewSel< IntView > * viewsel(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition view-sel.cpp:39
Gecode toplevel namespace
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56