Generated on Sat Oct 20 2018 12:43:45 for Gecode by doxygen 1.8.13
merit.hpp
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  * Contributing authors:
7  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
8  *
9  * Copyright:
10  * Christian Schulte, 2012
11  * Vincent Barichard, 2012
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 namespace Gecode { namespace Float { namespace Branch {
39 
40  // Minimum merit
43  : MeritBase<FloatView,double>(home,vb) {}
46  : MeritBase<FloatView,double>(home,m) {}
47  forceinline double
49  return x.min();
50  }
51 
52  // Maximum merit
55  : MeritBase<FloatView,double>(home,vb) {}
58  : MeritBase<FloatView,double>(home,m) {}
59  forceinline double
61  return x.max();
62  }
63 
64  // Size merit
67  : MeritBase<FloatView,double>(home,vb) {}
70  : MeritBase<FloatView,double>(home,m) {}
71  forceinline double
73  return x.size();
74  }
75 
76  // Degree over size merit
79  : MeritBase<FloatView,double>(home,vb) {}
82  MeritDegreeSize& m)
83  : MeritBase<FloatView,double>(home,m) {}
84  forceinline double
86  return x.size() / static_cast<double>(x.degree());
87  }
88 
89  // AFC over size merit
92  : MeritBase<FloatView,double>(home,vb), afc(vb.afc()) {}
95  : MeritBase<FloatView,double>(home,m), afc(m.afc) {}
96  forceinline double
98  return x.afc() / static_cast<double>(x.size());
99  }
100  forceinline bool
101  MeritAFCSize::notice(void) const {
102  return false;
103  }
104  forceinline void
106  // Not needed
107  afc.~AFC();
108  }
109 
110  // Action over size merit
113  const VarBranch<Var>& vb)
114  : MeritBase<FloatView,double>(home,vb), action(vb.action()) {}
117  MeritActionSize& m)
118  : MeritBase<FloatView,double>(home,m), action(m.action) {}
119  forceinline double
121  return action[i] / static_cast<double>(x.size());
122  }
123  forceinline bool
125  return true;
126  }
127  forceinline void
129  action.~Action();
130  }
131 
132 
133  // CHB Q-score over size merit
136  const VarBranch<Var>& vb)
137  : MeritBase<FloatView,double>(home,vb), chb(vb.chb()) {}
140  MeritCHBSize& m)
141  : MeritBase<FloatView,double>(home,m), chb(m.chb) {}
142  forceinline double
144  return chb[i] / static_cast<double>(x.size());
145  }
146  forceinline bool
147  MeritCHBSize::notice(void) const {
148  return true;
149  }
150  forceinline void
152  chb.~CHB();
153  }
154 
155 }}}
156 
157 // STATISTICS: float-branch
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:101
double operator()(const Space &home, FloatView x, int i)
Return AFC over size as merit for view x at position i.
Definition: merit.hpp:97
CHB chb
CHB information.
Definition: branch.hh:179
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:124
Merit class for AFC over size.
Definition: branch.hh:130
double operator()(const Space &home, FloatView x, int i)
Return degree over size as merit for view x at position i.
Definition: merit.hpp:85
MeritMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:54
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:128
~Action(void)
Destructor.
Definition: action.cpp:55
AFC afc
Definition: afc.cpp:135
MeritMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:42
Base-class for merit class.
Definition: merit.hpp:46
~AFC(void)
Destructor.
Definition: afc.hpp:157
#define forceinline
Definition: config.hpp:185
double operator()(const Space &home, FloatView x, int i)
Return action over size as merit for view x at position i.
Definition: merit.hpp:120
Computation spaces.
Definition: core.hpp:1701
Merit class for maximum of float view.
Definition: branch.hh:82
MeritSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:66
AFC afc
AFC information.
Definition: branch.hh:133
double operator()(const Space &home, FloatView x, int i)
Return minimum as merit for view x at position i.
Definition: merit.hpp:48
Gecode::IntArgs i({1, 2, 3, 4})
MeritDegreeSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:78
double operator()(const Space &home, FloatView x, int i)
Return size as merit for view x at position i.
Definition: merit.hpp:72
FloatNum min(void) const
Return minimum of domain.
Definition: float.hpp:60
Merit class for CHB Q-score over size.
Definition: branch.hh:176
double operator()(const Space &home, FloatView x, int i)
Return maximum as merit for view x at position i.
Definition: merit.hpp:60
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:105
~CHB(void)
Destructor.
Definition: chb.cpp:55
Float view for float variables.
Definition: view.hpp:52
MeritCHBSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:135
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:147
Variable branching information.
Definition: var.hpp:55
FloatNum max(void) const
Return maximum of domain.
Definition: float.hpp:64
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:151
MeritAFCSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:91
double operator()(const Space &home, FloatView x, int i)
Return CHB Q-score over size as merit for view x at position i.
Definition: merit.hpp:143
Post propagator for SetVar x
Definition: set.hh:767
unsigned int degree(void) const
Return degree (number of subscribed propagators and advisors)
Definition: view.hpp:499
Merit class for degree over size.
Definition: branch.hh:114
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: float.hpp:77
Gecode toplevel namespace
Action action
Action information.
Definition: branch.hh:156
Merit class for mimimum.
Definition: branch.hh:66
Merit class for action over size.
Definition: branch.hh:153
MeritActionSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:112
double afc(void) const
Return accumulated failure count.
Definition: view.hpp:504
Merit class for size of float view.
Definition: branch.hh:98