Generated on Thu Apr 5 2018 19:44:19 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  * Last modified:
14  * $Date$ by $Author$
15  * $Revision$
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 namespace Gecode { namespace Float { namespace Branch {
43 
44  // Minimum merit
47  : MeritBase<FloatView,double>(home,vb) {}
50  : MeritBase<FloatView,double>(home,m) {}
51  forceinline double
53  return x.min();
54  }
55 
56  // Maximum merit
59  : MeritBase<FloatView,double>(home,vb) {}
62  : MeritBase<FloatView,double>(home,m) {}
63  forceinline double
65  return x.max();
66  }
67 
68  // Size merit
71  : MeritBase<FloatView,double>(home,vb) {}
74  : MeritBase<FloatView,double>(home,m) {}
75  forceinline double
77  return x.size();
78  }
79 
80  // Degree over size merit
83  : MeritBase<FloatView,double>(home,vb) {}
86  MeritDegreeSize& m)
87  : MeritBase<FloatView,double>(home,m) {}
88  forceinline double
90  return x.size() / static_cast<double>(x.degree());
91  }
92 
93  // AFC over size merit
96  : MeritBase<FloatView,double>(home,vb), afc(vb.afc()) {}
99  : MeritBase<FloatView,double>(home,m), afc(m.afc) {}
100  forceinline double
102  return x.afc() / static_cast<double>(x.size());
103  }
104  forceinline bool
105  MeritAFCSize::notice(void) const {
106  return false;
107  }
108  forceinline void
110  // Not needed
111  afc.~AFC();
112  }
113 
114  // Action over size merit
117  const VarBranch<Var>& vb)
118  : MeritBase<FloatView,double>(home,vb), action(vb.action()) {}
121  MeritActionSize& m)
122  : MeritBase<FloatView,double>(home,m), action(m.action) {}
123  forceinline double
125  return action[i] / static_cast<double>(x.size());
126  }
127  forceinline bool
129  return true;
130  }
131  forceinline void
133  action.~Action();
134  }
135 
136 
137  // CHB Q-score over size merit
140  const VarBranch<Var>& vb)
141  : MeritBase<FloatView,double>(home,vb), chb(vb.chb()) {}
144  MeritCHBSize& m)
145  : MeritBase<FloatView,double>(home,m), chb(m.chb) {}
146  forceinline double
148  return chb[i] / static_cast<double>(x.size());
149  }
150  forceinline bool
151  MeritCHBSize::notice(void) const {
152  return true;
153  }
154  forceinline void
156  chb.~CHB();
157  }
158 
159 }}}
160 
161 // STATISTICS: float-branch
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:105
double operator()(const Space &home, FloatView x, int i)
Return AFC over size as merit for view x at position i.
Definition: merit.hpp:101
CHB chb
CHB information.
Definition: branch.hh:183
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:128
Merit class for AFC over size.
Definition: branch.hh:134
double operator()(const Space &home, FloatView x, int i)
Return degree over size as merit for view x at position i.
Definition: merit.hpp:89
MeritMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:58
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:132
~Action(void)
Destructor.
Definition: action.cpp:59
AFC afc
Definition: afc.cpp:139
MeritMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:46
Base-class for merit class.
Definition: merit.hpp:50
~AFC(void)
Destructor.
Definition: afc.hpp:161
#define forceinline
Definition: config.hpp:182
double operator()(const Space &home, FloatView x, int i)
Return action over size as merit for view x at position i.
Definition: merit.hpp:124
Computation spaces.
Definition: core.hpp:1668
Merit class for maximum of float view.
Definition: branch.hh:86
MeritSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:70
AFC afc
AFC information.
Definition: branch.hh:137
Gecode::IntArgs i(4, 1, 2, 3, 4)
double operator()(const Space &home, FloatView x, int i)
Return minimum as merit for view x at position i.
Definition: merit.hpp:52
MeritDegreeSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:82
double operator()(const Space &home, FloatView x, int i)
Return size as merit for view x at position i.
Definition: merit.hpp:76
FloatNum min(void) const
Return minimum of domain.
Definition: float.hpp:64
Merit class for CHB Q-score over size.
Definition: branch.hh:180
double operator()(const Space &home, FloatView x, int i)
Return maximum as merit for view x at position i.
Definition: merit.hpp:64
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:109
~CHB(void)
Destructor.
Definition: chb.cpp:59
Float view for float variables.
Definition: view.hpp:56
MeritCHBSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:139
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:151
Variable branching information.
Definition: var.hpp:59
FloatNum max(void) const
Return maximum of domain.
Definition: float.hpp:68
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:155
MeritAFCSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:95
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:147
Post propagator for SetVar x
Definition: set.hh:769
unsigned int degree(void) const
Return degree (number of subscribed propagators and advisors)
Definition: view.hpp:468
Merit class for degree over size.
Definition: branch.hh:118
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: float.hpp:81
Gecode toplevel namespace
Action action
Action information.
Definition: branch.hh:160
Merit class for mimimum.
Definition: branch.hh:70
Merit class for action over size.
Definition: branch.hh:157
MeritActionSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition: merit.hpp:116
double afc(void) const
Return accumulated failure count.
Definition: view.hpp:473
Merit class for size of float view.
Definition: branch.hh:102