main page
modules
namespaces
classes
files
Gecode home
Generated on Sat May 25 2013 18:00:33 for Gecode by
doxygen
1.8.3.1
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: 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
()) {
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_ACTIVITY_MIN
:
78
return
new
(home)
ViewSelMinTbl
<
MeritActivity<SetView>
>(home,svb);
79
case
SetVarBranch::SEL_ACTIVITY_MAX
:
80
return
new
(home)
ViewSelMaxTbl
<
MeritActivity<SetView>
>(home,svb);
81
case
SetVarBranch::SEL_DEGREE_SIZE_MIN
:
82
return
new
(home)
ViewSelMinTbl<MeritDegreeSize>
(home,svb);
83
case
SetVarBranch::SEL_DEGREE_SIZE_MAX
:
84
return
new
(home)
ViewSelMaxTbl<MeritDegreeSize>
(home,svb);
85
case
SetVarBranch::SEL_AFC_SIZE_MIN
:
86
return
new
(home)
ViewSelMinTbl<MeritAFCSize>
(home,svb);
87
case
SetVarBranch::SEL_AFC_SIZE_MAX
:
88
return
new
(home)
ViewSelMaxTbl<MeritAFCSize>
(home,svb);
89
case
SetVarBranch::SEL_ACTIVITY_SIZE_MIN
:
90
return
new
(home)
ViewSelMinTbl<MeritActivitySize>
(home,svb);
91
case
SetVarBranch::SEL_ACTIVITY_SIZE_MAX
:
92
return
new
(home)
ViewSelMaxTbl<MeritActivitySize>
(home,svb);
93
default
:
94
throw
UnknownBranching
(
"Set::branch"
);
95
}
96
}
else
{
97
switch
(svb.
select
()) {
98
case
SetVarBranch::SEL_MERIT_MIN
:
99
return
new
(home)
ViewSelMin
<
MeritFunction<SetView>
>(home,svb);
100
case
SetVarBranch::SEL_MERIT_MAX
:
101
return
new
(home)
ViewSelMax
<
MeritFunction<SetView>
>(home,svb);
102
case
SetVarBranch::SEL_MIN_MIN
:
103
return
new
(home)
ViewSelMin<MeritMin>
(home,svb);
104
case
SetVarBranch::SEL_MIN_MAX
:
105
return
new
(home)
ViewSelMax<MeritMin>
(home,svb);
106
case
SetVarBranch::SEL_MAX_MIN
:
107
return
new
(home)
ViewSelMin<MeritMax>
(home,svb);
108
case
SetVarBranch::SEL_MAX_MAX
:
109
return
new
(home)
ViewSelMax<MeritMax>
(home,svb);
110
case
SetVarBranch::SEL_SIZE_MIN
:
111
return
new
(home)
ViewSelMin<MeritSize>
(home,svb);
112
case
SetVarBranch::SEL_SIZE_MAX
:
113
return
new
(home)
ViewSelMax<MeritSize>
(home,svb);
114
case
SetVarBranch::SEL_DEGREE_MIN
:
115
return
new
(home)
ViewSelMin
<
MeritDegree<SetView>
>(home,svb);
116
case
SetVarBranch::SEL_DEGREE_MAX
:
117
return
new
(home)
ViewSelMax
<
MeritDegree<SetView>
>(home,svb);
118
case
SetVarBranch::SEL_AFC_MIN
:
119
return
new
(home)
ViewSelMin
<
MeritAFC<SetView>
>(home,svb);
120
case
SetVarBranch::SEL_AFC_MAX
:
121
return
new
(home)
ViewSelMax
<
MeritAFC<SetView>
>(home,svb);
122
case
SetVarBranch::SEL_ACTIVITY_MIN
:
123
return
new
(home)
ViewSelMin
<
MeritActivity<SetView>
>(home,svb);
124
case
SetVarBranch::SEL_ACTIVITY_MAX
:
125
return
new
(home)
ViewSelMax
<
MeritActivity<SetView>
>(home,svb);
126
case
SetVarBranch::SEL_DEGREE_SIZE_MIN
:
127
return
new
(home)
ViewSelMin<MeritDegreeSize>
(home,svb);
128
case
SetVarBranch::SEL_DEGREE_SIZE_MAX
:
129
return
new
(home)
ViewSelMax<MeritDegreeSize>
(home,svb);
130
case
SetVarBranch::SEL_AFC_SIZE_MIN
:
131
return
new
(home)
ViewSelMin<MeritAFCSize>
(home,svb);
132
case
SetVarBranch::SEL_AFC_SIZE_MAX
:
133
return
new
(home)
ViewSelMax<MeritAFCSize>
(home,svb);
134
case
SetVarBranch::SEL_ACTIVITY_SIZE_MIN
:
135
return
new
(home)
ViewSelMin<MeritActivitySize>
(home,svb);
136
case
SetVarBranch::SEL_ACTIVITY_SIZE_MAX
:
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