main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Jan 28 2020 00:00:00 for Gecode by
doxygen
1.8.17
gecode
set
branch
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/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
()) {
45
case
SetVarBranch::SEL_NONE
:
46
return
new
(home)
ViewSelNone<SetView>
(home,svb);
47
case
SetVarBranch::SEL_RND
:
48
return
new
(home)
ViewSelRnd<SetView>
(home,svb);
49
default
:
break
;
50
}
51
if
(svb.
tbl
() != NULL) {
52
switch
(svb.
select
()) {
53
case
SetVarBranch::SEL_MERIT_MIN
:
54
return
new
(home)
ViewSelMinTbl
<
MeritFunction<SetView>
>(home,svb);
55
case
SetVarBranch::SEL_MERIT_MAX
:
56
return
new
(home)
ViewSelMaxTbl
<
MeritFunction<SetView>
>(home,svb);
57
case
SetVarBranch::SEL_MIN_MIN
:
58
return
new
(home)
ViewSelMinTbl<MeritMin>
(home,svb);
59
case
SetVarBranch::SEL_MIN_MAX
:
60
return
new
(home)
ViewSelMaxTbl<MeritMin>
(home,svb);
61
case
SetVarBranch::SEL_MAX_MIN
:
62
return
new
(home)
ViewSelMinTbl<MeritMax>
(home,svb);
63
case
SetVarBranch::SEL_MAX_MAX
:
64
return
new
(home)
ViewSelMaxTbl<MeritMax>
(home,svb);
65
case
SetVarBranch::SEL_SIZE_MIN
:
66
return
new
(home)
ViewSelMinTbl<MeritSize>
(home,svb);
67
case
SetVarBranch::SEL_SIZE_MAX
:
68
return
new
(home)
ViewSelMaxTbl<MeritSize>
(home,svb);
69
case
SetVarBranch::SEL_DEGREE_MIN
:
70
return
new
(home)
ViewSelMinTbl
<
MeritDegree<SetView>
>(home,svb);
71
case
SetVarBranch::SEL_DEGREE_MAX
:
72
return
new
(home)
ViewSelMaxTbl
<
MeritDegree<SetView>
>(home,svb);
73
case
SetVarBranch::SEL_AFC_MIN
:
74
return
new
(home)
ViewSelMinTbl
<
MeritAFC<SetView>
>(home,svb);
75
case
SetVarBranch::SEL_AFC_MAX
:
76
return
new
(home)
ViewSelMaxTbl
<
MeritAFC<SetView>
>(home,svb);
77
case
SetVarBranch::SEL_ACTION_MIN
:
78
return
new
(home)
ViewSelMinTbl
<
MeritAction<SetView>
>(home,svb);
79
case
SetVarBranch::SEL_ACTION_MAX
:
80
return
new
(home)
ViewSelMaxTbl
<
MeritAction<SetView>
>(home,svb);
81
case
SetVarBranch::SEL_CHB_MIN
:
82
return
new
(home)
ViewSelMinTbl
<
MeritCHB<SetView>
>(home,svb);
83
case
SetVarBranch::SEL_CHB_MAX
:
84
return
new
(home)
ViewSelMaxTbl
<
MeritCHB<SetView>
>(home,svb);
85
case
SetVarBranch::SEL_DEGREE_SIZE_MIN
:
86
return
new
(home)
ViewSelMinTbl<MeritDegreeSize>
(home,svb);
87
case
SetVarBranch::SEL_DEGREE_SIZE_MAX
:
88
return
new
(home)
ViewSelMaxTbl<MeritDegreeSize>
(home,svb);
89
case
SetVarBranch::SEL_AFC_SIZE_MIN
:
90
return
new
(home)
ViewSelMinTbl<MeritAFCSize>
(home,svb);
91
case
SetVarBranch::SEL_AFC_SIZE_MAX
:
92
return
new
(home)
ViewSelMaxTbl<MeritAFCSize>
(home,svb);
93
case
SetVarBranch::SEL_ACTION_SIZE_MIN
:
94
return
new
(home)
ViewSelMinTbl<MeritActionSize>
(home,svb);
95
case
SetVarBranch::SEL_ACTION_SIZE_MAX
:
96
return
new
(home)
ViewSelMaxTbl<MeritActionSize>
(home,svb);
97
case
SetVarBranch::SEL_CHB_SIZE_MIN
:
98
return
new
(home)
ViewSelMinTbl<MeritCHBSize>
(home,svb);
99
case
SetVarBranch::SEL_CHB_SIZE_MAX
:
100
return
new
(home)
ViewSelMaxTbl<MeritCHBSize>
(home,svb);
101
default
:
102
throw
UnknownBranching
(
"Set::branch"
);
103
}
104
}
else
{
105
switch
(svb.
select
()) {
106
case
SetVarBranch::SEL_MERIT_MIN
:
107
return
new
(home)
ViewSelMin
<
MeritFunction<SetView>
>(home,svb);
108
case
SetVarBranch::SEL_MERIT_MAX
:
109
return
new
(home)
ViewSelMax
<
MeritFunction<SetView>
>(home,svb);
110
case
SetVarBranch::SEL_MIN_MIN
:
111
return
new
(home)
ViewSelMin<MeritMin>
(home,svb);
112
case
SetVarBranch::SEL_MIN_MAX
:
113
return
new
(home)
ViewSelMax<MeritMin>
(home,svb);
114
case
SetVarBranch::SEL_MAX_MIN
:
115
return
new
(home)
ViewSelMin<MeritMax>
(home,svb);
116
case
SetVarBranch::SEL_MAX_MAX
:
117
return
new
(home)
ViewSelMax<MeritMax>
(home,svb);
118
case
SetVarBranch::SEL_SIZE_MIN
:
119
return
new
(home)
ViewSelMin<MeritSize>
(home,svb);
120
case
SetVarBranch::SEL_SIZE_MAX
:
121
return
new
(home)
ViewSelMax<MeritSize>
(home,svb);
122
case
SetVarBranch::SEL_DEGREE_MIN
:
123
return
new
(home)
ViewSelMin
<
MeritDegree<SetView>
>(home,svb);
124
case
SetVarBranch::SEL_DEGREE_MAX
:
125
return
new
(home)
ViewSelMax
<
MeritDegree<SetView>
>(home,svb);
126
case
SetVarBranch::SEL_AFC_MIN
:
127
return
new
(home)
ViewSelMin
<
MeritAFC<SetView>
>(home,svb);
128
case
SetVarBranch::SEL_AFC_MAX
:
129
return
new
(home)
ViewSelMax
<
MeritAFC<SetView>
>(home,svb);
130
case
SetVarBranch::SEL_ACTION_MIN
:
131
return
new
(home)
ViewSelMin
<
MeritAction<SetView>
>(home,svb);
132
case
SetVarBranch::SEL_ACTION_MAX
:
133
return
new
(home)
ViewSelMax
<
MeritAction<SetView>
>(home,svb);
134
case
SetVarBranch::SEL_CHB_MIN
:
135
return
new
(home)
ViewSelMin
<
MeritCHB<SetView>
>(home,svb);
136
case
SetVarBranch::SEL_CHB_MAX
:
137
return
new
(home)
ViewSelMax
<
MeritCHB<SetView>
>(home,svb);
138
case
SetVarBranch::SEL_DEGREE_SIZE_MIN
:
139
return
new
(home)
ViewSelMin<MeritDegreeSize>
(home,svb);
140
case
SetVarBranch::SEL_DEGREE_SIZE_MAX
:
141
return
new
(home)
ViewSelMax<MeritDegreeSize>
(home,svb);
142
case
SetVarBranch::SEL_AFC_SIZE_MIN
:
143
return
new
(home)
ViewSelMin<MeritAFCSize>
(home,svb);
144
case
SetVarBranch::SEL_AFC_SIZE_MAX
:
145
return
new
(home)
ViewSelMax<MeritAFCSize>
(home,svb);
146
case
SetVarBranch::SEL_ACTION_SIZE_MIN
:
147
return
new
(home)
ViewSelMin<MeritActionSize>
(home,svb);
148
case
SetVarBranch::SEL_ACTION_SIZE_MAX
:
149
return
new
(home)
ViewSelMax<MeritActionSize>
(home,svb);
150
case
SetVarBranch::SEL_CHB_SIZE_MIN
:
151
return
new
(home)
ViewSelMin<MeritCHBSize>
(home,svb);
152
case
SetVarBranch::SEL_CHB_SIZE_MAX
:
153
return
new
(home)
ViewSelMax<MeritCHBSize>
(home,svb);
154
default
:
155
throw
UnknownBranching
(
"Set::branch"
);
156
}
157
}
158
GECODE_NEVER
;
159
return
NULL;
160
}
161
162
}}}
163
164
165
// STATISTICS: set-branch
166
Gecode::SetVarBranch::SEL_CHB_SIZE_MIN
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition:
set.hh:1361
Gecode::ViewSelMinTbl
Select view with least merit taking tie-break limit into account.
Definition:
brancher-view-sel.hpp:320
Gecode::ViewSelRnd
Select a view randomly.
Definition:
brancher-view-sel.hpp:153
Gecode::ViewSelNone
Select the first unassigned view.
Definition:
brancher-view-sel.hpp:113
Gecode::SetVarBranch::SEL_AFC_MIN
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition:
set.hh:1343
Gecode::SetVarBranch::SEL_MIN_MAX
@ SEL_MIN_MAX
With largest minimum unknown element.
Definition:
set.hh:1350
Gecode::SetVarBranch::SEL_DEGREE_SIZE_MAX
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition:
set.hh:1356
Gecode::MeritDegree
Merit class for degree.
Definition:
brancher-merit.hpp:97
Gecode::MeritFunction
Merit class for user-defined merit function.
Definition:
brancher-merit.hpp:72
Gecode::SetVarBranch::SEL_SIZE_MAX
@ SEL_SIZE_MAX
With largest unknown set.
Definition:
set.hh:1354
Gecode::SetVarBranch::SEL_ACTION_SIZE_MAX
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition:
set.hh:1360
Gecode::SetVarBranch::SEL_CHB_SIZE_MAX
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition:
set.hh:1362
Gecode::SetVarBranch::SEL_MAX_MAX
@ SEL_MAX_MAX
With largest maximum unknown element.
Definition:
set.hh:1352
Gecode::Space
Computation spaces.
Definition:
core.hpp:1748
Gecode::SetVarBranch::SEL_NONE
@ SEL_NONE
First unassigned.
Definition:
set.hh:1337
Gecode::Int::UnknownBranching
Exception: Unknown value or variable selection passed as argument
Definition:
exception.hpp:112
Gecode
Gecode toplevel namespace
Gecode::SetVarBranch::SEL_MIN_MIN
@ SEL_MIN_MIN
With smallest minimum unknown element.
Definition:
set.hh:1349
Gecode::MeritAFC
Merit class for AFC.
Definition:
brancher-merit.hpp:112
Gecode::SetVarBranch::SEL_AFC_SIZE_MAX
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition:
set.hh:1358
Gecode::SetVarBranch::SEL_MERIT_MIN
@ SEL_MERIT_MIN
With least merit.
Definition:
set.hh:1339
Gecode::ViewSelMax
Select view with largest merit.
Definition:
brancher-view-sel.hpp:340
Gecode::SetVarBranch::SEL_DEGREE_MAX
@ SEL_DEGREE_MAX
With largest degree.
Definition:
set.hh:1342
Gecode::VarBranch::tbl
BranchTbl tbl(void) const
Return tie-break limit function.
Definition:
branch-var.hpp:172
Gecode::SetVarBranch::SEL_ACTION_MAX
@ SEL_ACTION_MAX
With highest action.
Definition:
set.hh:1346
Gecode::Set::Branch::viewsel
ViewSel< SetView > * viewsel(Space &home, const SetVarBranch &svb)
Return view selectors for set views.
Definition:
view-sel.cpp:43
Gecode::SetVarBranch::SEL_DEGREE_MIN
@ SEL_DEGREE_MIN
With smallest degree.
Definition:
set.hh:1341
Gecode::SetVarBranch::SEL_ACTION_MIN
@ SEL_ACTION_MIN
With lowest action.
Definition:
set.hh:1345
Gecode::SetVarBranch::SEL_MERIT_MAX
@ SEL_MERIT_MAX
With highest merit.
Definition:
set.hh:1340
Gecode::SetVarBranch::SEL_CHB_MAX
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition:
set.hh:1348
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition:
macros.hpp:60
Gecode::SetVarBranch::SEL_SIZE_MIN
@ SEL_SIZE_MIN
With smallest unknown set.
Definition:
set.hh:1353
Gecode::SetVarBranch::SEL_MAX_MIN
@ SEL_MAX_MIN
With smallest maximum unknown element.
Definition:
set.hh:1351
Gecode::ViewSelMaxTbl
Select view with largest merit taking tie-break limit into account.
Definition:
brancher-view-sel.hpp:360
Gecode::SetVarBranch::SEL_AFC_SIZE_MIN
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition:
set.hh:1357
branch.hh
Gecode::SetVarBranch::select
Return selection strategy Select select(void) const
Definition:
var.hpp:73
Gecode::ViewSelMin
Select view with least merit.
Definition:
brancher-view-sel.hpp:300
Gecode::SetVarBranch::SEL_DEGREE_SIZE_MIN
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition:
set.hh:1355
Gecode::SetVarBranch::SEL_CHB_MIN
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition:
set.hh:1347
Gecode::MeritCHB
Merit class for CHB.
Definition:
brancher-merit.hpp:157
Gecode::MeritAction
Merit class for action.
Definition:
brancher-merit.hpp:134
Gecode::SetVarBranch::SEL_AFC_MAX
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition:
set.hh:1344
Gecode::SetVarBranch::SEL_ACTION_SIZE_MIN
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition:
set.hh:1359
Gecode::SetVarBranch::SEL_RND
@ SEL_RND
Random (uniform, for tie breaking)
Definition:
set.hh:1338
Gecode::SetVarBranch
Which variable to select for branching.
Definition:
set.hh:1333