Generated on Sat Feb 7 2015 02:01:16 for Gecode by doxygen 1.8.9.1
linear.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  * Guido Tack <tack@gecode.org>
6  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
7  *
8  * Copyright:
9  * Christian Schulte, 2002
10  * Guido Tack, 2004
11  * Vincent Barichard, 2012
12  *
13  * Last modified:
14  * $Date: 2013-01-24 19:28:06 +0100 (Thu, 24 Jan 2013) $ by $Author: schulte $
15  * $Revision: 13235 $
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 #ifndef __GECODE_FLOAT_LINEAR_HH__
43 #define __GECODE_FLOAT_LINEAR_HH__
44 
45 #include <gecode/int.hh>
46 #include <gecode/float.hh>
47 
53 namespace Gecode { namespace Float { namespace Linear {
54 
60  template<class P, class N, PropCond pc>
61  class Lin : public Propagator {
62  protected:
69 
71  Lin(Space& home, bool share, Lin<P,N,pc>& p);
73  Lin(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
74  public:
76  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
78  virtual size_t dispose(Space& home);
79  };
80 
86  template<class View>
88  FloatVal& c, FloatNum& sl, FloatNum& su);
89 
95  template<class View>
97  FloatVal& c, FloatNum& sl, FloatNum& su);
98 
107  template<class P, class N>
108  class Eq : public Lin<P,N,PC_FLOAT_BND> {
109  protected:
113 
115  Eq(Space& home, bool share, Eq& p);
116  public:
120  virtual Actor* copy(Space& home, bool share);
122  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
124  static ExecStatus
125  post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
126  };
127 
128 
137  template<class P, class N>
138  class Lq : public Lin<P,N,PC_FLOAT_BND> {
139  protected:
143 
145  Lq(Space& home, bool share, Lq& p);
146  public:
150  virtual Actor* copy(Space& home, bool share);
152  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
154  static ExecStatus
155  post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
156  };
157 
158 }}}
159 
161 
162 namespace Gecode { namespace Float { namespace Linear {
163 
168  class Term {
169  public:
174  };
175 
190  GECODE_FLOAT_EXPORT void
191  estimate(Term* t, int n, FloatVal c, FloatNum& l, FloatNum& u);
192 
210  post(Home home, Term* t, int n, FloatRelType frt, FloatVal c);
211 
230  post(Home home, Term* t, int n, FloatRelType frt, FloatVal c, Reify r);
231 
232 }}}
233 
234 #endif
235 
236 // STATISTICS: float-prop
#define GECODE_FLOAT_EXPORT
Definition: float.hh:70
Propagator for bounds consistent n-ary linear equality
Definition: linear.hh:108
Lq(Space &home, bool share, Lq &p)
Constructor for cloning p.
Definition: nary.hpp:306
NodeType t
Type of node.
Definition: bool-expr.cpp:234
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Definition: post.cpp:228
FloatVal a
Coefficient.
Definition: linear.hh:171
Propagator for bounds consistent n-ary linear less or equal
Definition: linear.hh:138
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: nary.hpp:70
Base-class for n-ary linear propagators.
Definition: linear.hh:61
Base-class for propagators.
Definition: core.hpp:755
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nary.hpp:188
ViewArray< N > y
Array of negative views.
Definition: linear.hh:66
Computation spaces.
Definition: core.hpp:1362
Base-class for both propagators and branchers.
Definition: core.hpp:666
Gecode::FloatVal c(-8, 8)
ViewArray< P > x
Array of positive views.
Definition: linear.hh:64
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nary.hpp:317
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
Definition: nary.hpp:169
void bounds_n(ModEventDelta med, ViewArray< View > &y, Val &c, Val &sl, Val &su)
Definition: int-nary.hpp:150
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
FloatRelType
Relation types for floats.
Definition: float.hh:1054
Eq(Space &home, bool share, Eq &p)
Constructor for cloning p.
Definition: nary.hpp:177
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:764
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: nary.hpp:311
Reification specification.
Definition: int.hh:854
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: nary.hpp:64
void bounds_p(ModEventDelta med, ViewArray< View > &x, Val &c, Val &sl, Val &su)
Definition: int-nary.hpp:129
FloatVal c
Constant value.
Definition: linear.hh:68
Float view for float variables.
Definition: view.hpp:56
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
Float value type.
Definition: float.hh:321
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: nary.hpp:182
Propagation cost.
Definition: core.hpp:537
ExecStatus
Definition: core.hpp:523
void estimate(Term *t, int n, FloatVal c, FloatNum &l, FloatNum &u)
Estimate lower and upper bounds.
Definition: post.cpp:49
Class for describing linear term .
Definition: linear.hh:168
Lin(Space &home, bool share, Lin< P, N, pc > &p)
Constructor for cloning p.
Definition: nary.hpp:56
FloatView x
View.
Definition: linear.hh:173
Gecode toplevel namespace
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
Definition: nary.hpp:299
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
double FloatNum
Floating point number base type.
Definition: float.hh:108