Generated on Sat Jul 29 2017 12:41:24 for Gecode by doxygen 1.8.13
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/float/branch.hh>
39 
40 namespace Gecode { namespace Float { namespace Branch {
41 
42  ViewSel<FloatView>*
43  viewsel(Space& home, const FloatVarBranch& fvb) {
44  switch (fvb.select()) {
46  return new (home) ViewSelNone<FloatView>(home,fvb);
48  return new (home) ViewSelRnd<FloatView>(home,fvb);
49  default: break;
50  }
51  if (fvb.tbl() != NULL) {
52  switch (fvb.select()) {
54  return new (home) ViewSelMinTbl<MeritFunction<FloatView>>(home,fvb);
56  return new (home) ViewSelMaxTbl<MeritFunction<FloatView>>(home,fvb);
58  return new (home) ViewSelMinTbl<MeritMin>(home,fvb);
60  return new (home) ViewSelMaxTbl<MeritMin>(home,fvb);
62  return new (home) ViewSelMinTbl<MeritMax>(home,fvb);
64  return new (home) ViewSelMaxTbl<MeritMax>(home,fvb);
66  return new (home) ViewSelMinTbl<MeritSize>(home,fvb);
68  return new (home) ViewSelMaxTbl<MeritSize>(home,fvb);
70  return new (home) ViewSelMinTbl<MeritDegree<FloatView>>(home,fvb);
72  return new (home) ViewSelMaxTbl<MeritDegree<FloatView>>(home,fvb);
74  return new (home) ViewSelMinTbl<MeritAFC<FloatView>>(home,fvb);
76  return new (home) ViewSelMaxTbl<MeritAFC<FloatView>>(home,fvb);
78  return new (home) ViewSelMinTbl<MeritAction<FloatView>>(home,fvb);
80  return new (home) ViewSelMaxTbl<MeritAction<FloatView>>(home,fvb);
82  return new (home) ViewSelMinTbl<MeritCHB<FloatView>>(home,fvb);
84  return new (home) ViewSelMaxTbl<MeritCHB<FloatView>>(home,fvb);
86  return new (home) ViewSelMinTbl<MeritDegreeSize>(home,fvb);
88  return new (home) ViewSelMaxTbl<MeritDegreeSize>(home,fvb);
90  return new (home) ViewSelMinTbl<MeritAFCSize>(home,fvb);
92  return new (home) ViewSelMaxTbl<MeritAFCSize>(home,fvb);
94  return new (home) ViewSelMinTbl<MeritActionSize>(home,fvb);
96  return new (home) ViewSelMaxTbl<MeritActionSize>(home,fvb);
98  return new (home) ViewSelMinTbl<MeritCHBSize>(home,fvb);
100  return new (home) ViewSelMaxTbl<MeritCHBSize>(home,fvb);
101  default:
102  throw UnknownBranching("Float::branch");
103  }
104  } else {
105  switch (fvb.select()) {
107  return new (home) ViewSelMin<MeritFunction<FloatView>>(home,fvb);
109  return new (home) ViewSelMax<MeritFunction<FloatView>>(home,fvb);
111  return new (home) ViewSelMin<MeritMin>(home,fvb);
113  return new (home) ViewSelMax<MeritMin>(home,fvb);
115  return new (home) ViewSelMin<MeritMax>(home,fvb);
117  return new (home) ViewSelMax<MeritMax>(home,fvb);
119  return new (home) ViewSelMin<MeritSize>(home,fvb);
121  return new (home) ViewSelMax<MeritSize>(home,fvb);
123  return new (home) ViewSelMin<MeritDegree<FloatView>>(home,fvb);
125  return new (home) ViewSelMax<MeritDegree<FloatView>>(home,fvb);
127  return new (home) ViewSelMin<MeritAFC<FloatView>>(home,fvb);
129  return new (home) ViewSelMax<MeritAFC<FloatView>>(home,fvb);
131  return new (home) ViewSelMin<MeritAction<FloatView>>(home,fvb);
133  return new (home) ViewSelMax<MeritAction<FloatView>>(home,fvb);
135  return new (home) ViewSelMin<MeritCHB<FloatView>>(home,fvb);
137  return new (home) ViewSelMax<MeritCHB<FloatView>>(home,fvb);
139  return new (home) ViewSelMin<MeritDegreeSize>(home,fvb);
141  return new (home) ViewSelMax<MeritDegreeSize>(home,fvb);
143  return new (home) ViewSelMin<MeritAFCSize>(home,fvb);
145  return new (home) ViewSelMax<MeritAFCSize>(home,fvb);
147  return new (home) ViewSelMin<MeritActionSize>(home,fvb);
149  return new (home) ViewSelMax<MeritActionSize>(home,fvb);
151  return new (home) ViewSelMin<MeritCHBSize>(home,fvb);
153  return new (home) ViewSelMax<MeritCHBSize>(home,fvb);
154  default:
155  throw UnknownBranching("Float::branch");
156  }
157  }
158  GECODE_NEVER;
159  return NULL;
160  }
161 
162 }}}
163 
164 
165 // STATISTICS: float-branch
166 
Select view with largest merit.
With smallest degree divided by domain size.
Definition: float.hh:1627
With smallest domain size.
Definition: float.hh:1625
First unassigned.
Definition: float.hh:1609
With largest domain size.
Definition: float.hh:1626
With largest CHB Q-score divided by domain size.
Definition: float.hh:1634
With smallest accumulated failure count divided by domain size.
Definition: float.hh:1629
With smallest degree.
Definition: float.hh:1613
Merit class for degree.
With largest accumulated failure count.
Definition: float.hh:1616
Which variable to select for branching.
Definition: float.hh:1605
Select select(void) const
Return selection strategy.
Definition: var.hpp:73
With highest CHB Q-score.
Definition: float.hh:1620
Computation spaces.
Definition: core.hpp:1748
Select the first unassigned view.
Select view with least merit.
With smallest action divided by domain size.
Definition: float.hh:1631
With lowest CHB Q-score.
Definition: float.hh:1619
Select view with largest merit taking tie-break limit into account.
Merit class for user-defined merit function.
ViewSel< FloatView > * viewsel(Space &home, const FloatVarBranch &fvb)
Return view selectors for float views.
Definition: view-sel.cpp:43
Select view with least merit taking tie-break limit into account.
Exception: Unknown value or variable selection passed as argument
Definition: exception.hpp:106
With largest accumulated failure count divided by domain size.
Definition: float.hh:1630
Select a view randomly.
With smallest CHB Q-score divided by domain size.
Definition: float.hh:1633
Random (uniform, for tie breaking)
Definition: float.hh:1610
Merit class for AFC.
With smallest accumulated failure count.
Definition: float.hh:1615
With largest degree divided by domain size.
Definition: float.hh:1628
BranchTbl tbl(void) const
Return tie-break limit function.
Definition: branch-var.hpp:172
With largest action divided by domain size.
Definition: float.hh:1632
Gecode toplevel namespace
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
Merit class for action.
Merit class for CHB.