Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
branch.hh
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 * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6 *
7 * Copyright:
8 * Christian Schulte, 2012
9 * Vincent Barichard, 2012
10 *
11 * This file is part of Gecode, the generic constraint
12 * development environment:
13 * http://www.gecode.org
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining
16 * a copy of this software and associated documentation files (the
17 * "Software"), to deal in the Software without restriction, including
18 * without limitation the rights to use, copy, modify, merge, publish,
19 * distribute, sublicense, and/or sell copies of the Software, and to
20 * permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be
24 * included in all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 *
34 */
35
36#ifndef __GECODE_FLOAT_BRANCH_HH__
37#define __GECODE_FLOAT_BRANCH_HH__
38
39#include <gecode/float.hh>
40
45
46namespace Gecode { namespace Float { namespace Branch {
47
59
66 class MeritMin : public MeritBase<FloatView,double> {
67 public:
69 MeritMin(Space& home, const VarBranch<Var>& vb);
71 MeritMin(Space& home, MeritMin& m);
73 double operator ()(const Space& home, FloatView x, int i);
74 };
75
82 class MeritMax : public MeritBase<FloatView,double> {
83 public:
85 MeritMax(Space& home, const VarBranch<Var>& vb);
87 MeritMax(Space& home, MeritMax& m);
89 double operator ()(const Space& home, FloatView x, int i);
90 };
91
98 class MeritSize : public MeritBase<FloatView,double> {
99 public:
101 MeritSize(Space& home, const VarBranch<Var>& vb);
103 MeritSize(Space& home, MeritSize& m);
105 double operator ()(const Space& home, FloatView x, int i);
106 };
107
114 class MeritDegreeSize : public MeritBase<FloatView,double> {
115 public:
117 MeritDegreeSize(Space& home, const VarBranch<Var>& vb);
121 double operator ()(const Space& home, FloatView x, int i);
122 };
123
130 class MeritAFCSize : public MeritBase<FloatView,double> {
131 protected:
134 public:
136 MeritAFCSize(Space& home, const VarBranch<Var>& vb);
140 double operator ()(const Space& home, FloatView x, int i);
142 bool notice(void) const;
144 void dispose(Space& home);
145 };
146
153 class MeritActionSize : public MeritBase<FloatView,double> {
154 protected:
157 public:
159 MeritActionSize(Space& home, const VarBranch<Var>& vb);
163 double operator ()(const Space& home, FloatView x, int i);
165 bool notice(void) const;
167 void dispose(Space& home);
168 };
169
176 class MeritCHBSize : public MeritBase<FloatView,double> {
177 protected:
180 public:
182 MeritCHBSize(Space& home, const VarBranch<Var>& vb);
186 double operator ()(const Space& home, FloatView x, int i);
188 bool notice(void) const;
190 void dispose(Space& home);
191 };
192
193}}}
194
196
197namespace Gecode { namespace Float { namespace Branch {
198
201 ViewSel<FloatView>* viewsel(Space& home, const FloatVarBranch& fvb);
202
203}}}
204
205namespace Gecode { namespace Float { namespace Branch {
206
218
225 class ValSelLq : public ValSel<FloatView,FloatNumBranch> {
226 public:
228 ValSelLq(Space& home, const ValBranch<Var>& vb);
230 ValSelLq(Space& home, ValSelLq& vs);
232 FloatNumBranch val(const Space& home, FloatView x, int i);
233 };
234
241 class ValSelGq : public ValSel<FloatView,FloatNumBranch> {
242 public:
244 ValSelGq(Space& home, const ValBranch<Var>& vb);
246 ValSelGq(Space& home, ValSelGq& vs);
248 FloatNumBranch val(const Space& home, FloatView x, int i);
249 };
250
257 class ValSelRnd : public ValSel<FloatView,FloatNumBranch> {
258 protected:
261 public:
263 ValSelRnd(Space& home, const ValBranch<Var>& vb);
265 ValSelRnd(Space& home, ValSelRnd& vs);
267 FloatNumBranch val(const Space& home, FloatView x, int i);
269 bool notice(void) const;
271 void dispose(Space& home);
272 };
273
274}}}
275
277
278namespace Gecode { namespace Float { namespace Branch {
279
291
298 class ValCommitLqGq : public ValCommit<FloatView,FloatVal> {
299 public:
301 ValCommitLqGq(Space& home, const ValBranch<Var>& vb);
305 ModEvent commit(Space& home, unsigned int a, FloatView x, int i,
308 NGL* ngl(Space& home, unsigned int a, FloatView x, FloatNumBranch n) const;
310 void print(const Space& home, unsigned int a, FloatView x, int i,
312 std::ostream& o) const;
313 };
314
315}}}
316
318
319namespace Gecode { namespace Float { namespace Branch {
320
323 ValSelCommitBase<FloatView,FloatNumBranch>*
324 valselcommit(Space& home, const FloatValBranch& svb);
325
328 ValSelCommitBase<FloatView,FloatNumBranch>*
329 valselcommit(Space& home, const FloatAssign& ia);
330
331}}}
332
333#endif
334
335// STATISTICS: float-branch
Class for AFC (accumulated failure count) management.
Definition afc.hpp:40
Class for action management.
Definition action.hpp:42
Class for CHB management.
Definition chb.hpp:46
Value description class for branching.
Definition float.hh:1468
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
NGL * ngl(Space &home, unsigned int a, FloatView x, FloatNumBranch n) const
Create no-good literal for alternative a.
ModEvent commit(Space &home, unsigned int a, FloatView x, int i, FloatNumBranch n)
Commit view x at position i to value n for alternative a.
void print(const Space &home, unsigned int a, FloatView x, int i, FloatNumBranch n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
ValCommitLqGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:72
ValSelGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:66
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:59
ValSelLq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:53
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:86
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition val-sel.hpp:92
ValSelRnd(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:79
void dispose(Space &home)
Delete value selection.
Definition val-sel.hpp:96
Rnd r
The used random number generator.
Definition branch.hh:260
Float view for float variables.
Definition view.hpp:52
MeritBase(Space &home, const VarBranch< Var > &vb)
Definition merit.hpp:176
No-good literal recorded during search.
Definition core.hpp:1342
Random number generator.
Definition rnd.hpp:42
Computation spaces.
Definition core.hpp:1744
Value branching information.
Definition val.hpp:41
ValCommit(Space &home, const ValBranch< Var > &vb)
ValSel(Space &home, const ValBranch< Var > &vb)
Definition val-sel.hpp:98
Variable branching information.
Definition var.hpp:55
#define GECODE_FLOAT_EXPORT
Definition float.hh:68
Float branchers.
ValSelCommitBase< FloatView, FloatNumBranch > * valselcommit(Space &home, const FloatValBranch &svb)
Return value and commit for float views.
ViewSel< FloatView > * viewsel(Space &home, const FloatVarBranch &fvb)
Return view selectors for float views.
Definition view-sel.cpp:39
Floating point numbers.
Gecode toplevel namespace
Post propagator for SetVar x
Definition set.hh:773
int ModEvent
Type for modification events.
Definition core.hpp:62