Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
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
38namespace 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) {}
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
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()) {}
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
148 return true;
149 }
150 forceinline void
152 chb.~CHB();
153 }
154
155}}}
156
157// STATISTICS: float-branch
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
void dispose(Space &home)
Dispose view selection.
Definition merit.hpp:105
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition merit.hpp:101
MeritAFCSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:91
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition merit.hpp:124
void dispose(Space &home)
Dispose view selection.
Definition merit.hpp:128
Action action
Action information.
Definition branch.hh:156
MeritActionSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:112
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
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition merit.hpp:147
void dispose(Space &home)
Dispose view selection.
Definition merit.hpp:151
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
MeritCHBSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:135
MeritDegreeSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:78
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
double operator()(const Space &home, FloatView x, int i)
Return maximum as merit for view x at position i.
Definition merit.hpp:60
MeritMax(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:54
double operator()(const Space &home, FloatView x, int i)
Return minimum as merit for view x at position i.
Definition merit.hpp:48
MeritMin(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:42
MeritSize(Space &home, const VarBranch< Var > &vb)
Constructor for initialization.
Definition merit.hpp:66
double operator()(const Space &home, FloatView x, int i)
Return size as merit for view x at position i.
Definition merit.hpp:72
Float view for float variables.
Definition view.hpp:52
MeritBase(Space &home, const VarBranch< Var > &vb)
Definition merit.hpp:176
Computation spaces.
Definition core.hpp:1744
Variable branching information.
Definition var.hpp:55
Float branchers.
Floating point numbers.
Gecode toplevel namespace
Post propagator for SetVar x
Definition set.hh:773
#define forceinline
Definition config.hpp:194