Generated on Wed Jul 21 2021 00:00:00 for Gecode by doxygen 1.9.1
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 
46 namespace Gecode { namespace Float { namespace Branch {
47 
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);
138  MeritAFCSize(Space& home, MeritAFCSize& m);
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);
184  MeritCHBSize(Space& home, MeritCHBSize& m);
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 
197 namespace Gecode { namespace Float { namespace Branch {
198 
201  ViewSel<FloatView>* viewsel(Space& home, const FloatVarBranch& fvb);
202 
203 }}}
204 
205 namespace Gecode { namespace Float { namespace Branch {
206 
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 
278 namespace Gecode { namespace Float { namespace Branch {
279 
298  class ValCommitLqGq : public ValCommit<FloatView,FloatVal> {
299  public:
301  ValCommitLqGq(Space& home, const ValBranch<Var>& vb);
303  ValCommitLqGq(Space& home, ValCommitLqGq& vc);
305  ModEvent commit(Space& home, unsigned int a, FloatView x, int i,
306  FloatNumBranch n);
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 
319 namespace 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
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
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:1462
Merit class for AFC over size.
Definition: branch.hh:130
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
Merit class for action over size.
Definition: branch.hh:153
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
Merit class for CHB Q-score over size.
Definition: branch.hh:176
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
Merit class for degree over size.
Definition: branch.hh:114
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
Merit class for maximum of float view.
Definition: branch.hh:82
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
Merit class for mimimum.
Definition: branch.hh:66
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
Merit class for size of float view.
Definition: branch.hh:98
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
Value commit class for less or equal or greater or equal.
Definition: branch.hh:298
NGL * ngl(Space &home, unsigned int a, FloatView x, FloatNumBranch n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:63
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.
Definition: val-commit.hpp:47
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.
Definition: val-commit.hpp:67
ValCommitLqGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition: val-commit.hpp:41
Value selection class for values smaller than median of view.
Definition: branch.hh:241
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
Value selection class for values smaller than median of view.
Definition: branch.hh:225
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
Value selection class for random value of view.
Definition: branch.hh:257
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
Base-class for merit class.
Definition: merit.hpp:46
No-good literal recorded during search.
Definition: core.hpp:1340
Random number generator.
Definition: rnd.hpp:42
Computation spaces.
Definition: core.hpp:1742
Value branching information.
Definition: val.hpp:41
Base class for value commit.
Definition: val-commit.hpp:44
Base class for value selection.
Definition: val-sel.hpp:44
Variable branching information.
Definition: var.hpp:55
int ModEvent
Type for modification events.
Definition: core.hpp:62
#define GECODE_FLOAT_EXPORT
Definition: float.hh:68
ValSelCommitBase< FloatView, FloatNumBranch > * valselcommit(Space &home, const FloatValBranch &fvb)
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
Gecode::IntArgs i({1, 2, 3, 4})