Generated on Sat Feb 7 2015 02:01:15 for Gecode by doxygen 1.8.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  * Last modified:
12  * $Date: 2013-07-04 17:03:13 +0200 (Thu, 04 Jul 2013) $ by $Author: schulte $
13  * $Revision: 13801 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 #ifndef __GECODE_FLOAT_BRANCH_HH__
41 #define __GECODE_FLOAT_BRANCH_HH__
42 
43 #include <gecode/float.hh>
44 
50 namespace Gecode { namespace Float { namespace Branch {
51 
70  class MeritMin : public MeritBase<FloatView,double> {
71  public:
73  MeritMin(Space& home, const VarBranch& vb);
75  MeritMin(Space& home, bool shared, MeritMin& m);
77  double operator ()(const Space& home, FloatView x, int i);
78  };
79 
86  class MeritMax : public MeritBase<FloatView,double> {
87  public:
89  MeritMax(Space& home, const VarBranch& vb);
91  MeritMax(Space& home, bool shared, MeritMax& m);
93  double operator ()(const Space& home, FloatView x, int i);
94  };
95 
102  class MeritSize : public MeritBase<FloatView,double> {
103  public:
105  MeritSize(Space& home, const VarBranch& vb);
107  MeritSize(Space& home, bool shared, MeritSize& m);
109  double operator ()(const Space& home, FloatView x, int i);
110  };
111 
118  class MeritDegreeSize : public MeritBase<FloatView,double> {
119  public:
121  MeritDegreeSize(Space& home, const VarBranch& vb);
123  MeritDegreeSize(Space& home, bool shared, MeritDegreeSize& m);
125  double operator ()(const Space& home, FloatView x, int i);
126  };
127 
134  class MeritAFCSize : public MeritBase<FloatView,double> {
135  protected:
138  public:
140  MeritAFCSize(Space& home, const VarBranch& vb);
142  MeritAFCSize(Space& home, bool shared, MeritAFCSize& m);
144  double operator ()(const Space& home, FloatView x, int i);
146  bool notice(void) const;
148  void dispose(Space& home);
149  };
150 
157  class MeritActivitySize : public MeritBase<FloatView,double> {
158  protected:
161  public:
163  MeritActivitySize(Space& home, const VarBranch& vb);
167  double operator ()(const Space& home, FloatView x, int i);
169  bool notice(void) const;
171  void dispose(Space& home);
172  };
173 
174 }}}
175 
177 
178 namespace Gecode { namespace Float { namespace Branch {
179 
182  ViewSel<FloatView>* viewsel(Space& home, const FloatVarBranch& fvb);
183 
184 }}}
185 
186 namespace Gecode { namespace Float { namespace Branch {
187 
206  class ValSelLq : public ValSel<FloatView,FloatNumBranch> {
207  public:
209  ValSelLq(Space& home, const ValBranch& vb);
211  ValSelLq(Space& home, bool shared, ValSelLq& vs);
213  FloatNumBranch val(const Space& home, FloatView x, int i);
214  };
215 
222  class ValSelGq : public ValSel<FloatView,FloatNumBranch> {
223  public:
225  ValSelGq(Space& home, const ValBranch& vb);
227  ValSelGq(Space& home, bool shared, ValSelGq& vs);
229  FloatNumBranch val(const Space& home, FloatView x, int i);
230  };
231 
238  class ValSelRnd : public ValSel<FloatView,FloatNumBranch> {
239  protected:
242  public:
244  ValSelRnd(Space& home, const ValBranch& vb);
246  ValSelRnd(Space& home, bool shared, ValSelRnd& vs);
248  FloatNumBranch val(const Space& home, FloatView x, int i);
250  bool notice(void) const;
252  void dispose(Space& home);
253  };
254 
255 }}}
256 
258 
259 namespace Gecode { namespace Float { namespace Branch {
260 
279  class ValCommitLqGq : public ValCommit<FloatView,FloatVal> {
280  public:
282  ValCommitLqGq(Space& home, const ValBranch& vb);
284  ValCommitLqGq(Space& home, bool shared, ValCommitLqGq& vc);
286  ModEvent commit(Space& home, unsigned int a, FloatView x, int i,
287  FloatNumBranch n);
289  NGL* ngl(Space& home, unsigned int a, FloatView x, FloatNumBranch n) const;
291  void print(const Space& home, unsigned int a, FloatView x, int i,
292  FloatNumBranch n,
293  std::ostream& o) const;
294  };
295 
296 }}}
297 
299 
300 namespace Gecode { namespace Float { namespace Branch {
301 
304  ValSelCommitBase<FloatView,FloatNumBranch>*
305  valselcommit(Space& home, const FloatValBranch& svb);
306 
309  ValSelCommitBase<FloatView,FloatNumBranch>*
310  valselcommit(Space& home, const FloatAssign& ia);
311 
312 }}}
313 
314 #endif
315 
316 // STATISTICS: float-branch
#define GECODE_FLOAT_EXPORT
Definition: float.hh:70
double operator()(const Space &home, FloatView x, int i)
Return size over AFC as merit for view x at position i.
Definition: merit.hpp:103
Value selection class for random value of view.
Definition: branch.hh:238
Merit class for size over activity.
Definition: branch.hh:157
Rnd r
The used random number generator.
Definition: branch.hh:241
Merit class for size over afc.
Definition: branch.hh:134
ValSelGq(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-sel.hpp:70
double operator()(const Space &home, FloatView x, int i)
Return size over degree as merit for view x at position i.
Definition: merit.hpp:89
Value commit class for less or equal or greater or equal.
Definition: branch.hh:279
int ModEvent
Type for modification events.
Definition: core.hpp:146
ValCommitLqGq(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-commit.hpp:45
Base-class for merit class.
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:51
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:135
Computation spaces.
Definition: core.hpp:1362
Merit class for maximum of float view.
Definition: branch.hh:86
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:91
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:71
Base class for value commit.
ValSelLq(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-sel.hpp:57
AFC afc
AFC information.
Definition: branch.hh:137
Activity activity
Activity information.
Definition: branch.hh:160
Value selection class for values smaller than median of view.
Definition: branch.hh:206
Gecode::IntArgs i(4, 1, 2, 3, 4)
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:44
double operator()(const Space &home, FloatView x, int i)
Return size over activity as merit for view x at position i.
Definition: merit.hpp:127
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
double operator()(const Space &home, FloatView x, int i)
Return minimum as merit for view x at position i.
Definition: merit.hpp:52
Value description class for branching.
Definition: float.hh:1372
double operator()(const Space &home, FloatView x, int i)
Return size as merit for view x at position i.
Definition: merit.hpp:76
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:76
MeritDegreeSize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:82
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition: val-sel.hpp:63
MeritActivitySize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:117
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:131
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:111
ViewSel< FloatView > * viewsel(Space &home, const FloatVarBranch &fvb)
Return view selectors for float views.
Definition: view-sel.cpp:43
void dispose(Space &home)
Delete value selection.
Definition: val-sel.hpp:101
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:107
Float view for float variables.
Definition: view.hpp:56
Value selection class for values smaller than median of view.
Definition: branch.hh:222
MeritMin(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:46
Value branching information.
Definition: branch-val.hpp:44
Variable branching information.
Definition: branch-var.hpp:55
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
ValSelRnd(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-sel.hpp:83
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: val-sel.hpp:97
MeritSize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:70
NGL * ngl(Space &home, unsigned int a, FloatView x, FloatNumBranch n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:67
MeritAFCSize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:95
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
Definition: view.hpp:662
Merit class for size over degree.
Definition: branch.hh:118
Gecode toplevel namespace
Random number generator.
Definition: rnd.hpp:46
Class for activity management.
Definition: activity.hpp:44
MeritMax(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:58
Merit class for mimimum.
Definition: branch.hh:70
ValSelCommitBase< FloatView, FloatNumBranch > * valselcommit(Space &home, const FloatValBranch &fvb)
Return value and commit for float views.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
Merit class for size of float view.
Definition: branch.hh:102
Base class for value selection.
No-good literal recorded during search.
Definition: core.hpp:971