Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
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  * 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 
38 #ifndef __GECODE_FLOAT_LINEAR_HH__
39 #define __GECODE_FLOAT_LINEAR_HH__
40 
41 #include <gecode/int.hh>
42 #include <gecode/float.hh>
43 
49 namespace Gecode { namespace Float { namespace Linear {
50 
56  template<class P, class N, PropCond pc>
57  class Lin : public Propagator {
58  protected:
65 
67  Lin(Space& home, Lin<P,N,pc>& p);
69  Lin(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
70  public:
72  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
74  virtual void reschedule(Space& home);
76  virtual size_t dispose(Space& home);
77  };
78 
84  template<class View>
86  FloatVal& c, FloatNum& sl, FloatNum& su);
87 
93  template<class View>
95  FloatVal& c, FloatNum& sl, FloatNum& su);
96 
105  template<class P, class N>
106  class Eq : public Lin<P,N,PC_FLOAT_BND> {
107  protected:
111 
113  Eq(Space& home, Eq& p);
114  public:
118  virtual Actor* copy(Space& home);
120  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
122  static ExecStatus
123  post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
124  };
125 
126 
135  template<class P, class N>
136  class Lq : public Lin<P,N,PC_FLOAT_BND> {
137  protected:
141 
143  Lq(Space& home, Lq& p);
144  public:
148  virtual Actor* copy(Space& home);
150  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
152  static ExecStatus
153  post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
154  };
155 
156 }}}
157 
159 
160 namespace Gecode { namespace Float { namespace Linear {
161 
166  class Term {
167  public:
172  };
173 
189  estimate(Term* t, int n, FloatVal c, FloatNum& l, FloatNum& u);
190 
208  post(Home home, Term* t, int n, FloatRelType frt, FloatVal c);
209 
228  post(Home home, Term* t, int n, FloatRelType frt, FloatVal c, Reify r);
229 
230 }}}
231 
232 #endif
233 
234 // STATISTICS: float-prop
#define GECODE_FLOAT_EXPORT
Definition: float.hh:68
Propagator for bounds consistent n-ary linear equality
Definition: linear.hh:106
NodeType t
Type of node.
Definition: bool-expr.cpp:230
virtual void reschedule(Space &home)
Schedule function.
Definition: nary.hpp:66
NNF * l
Left subtree.
Definition: bool-expr.cpp:240
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Definition: post.cpp:238
FloatVal a
Coefficient.
Definition: linear.hh:169
Propagator for bounds consistent n-ary linear less or equal
Definition: linear.hh:136
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: nary.hpp:73
Base-class for n-ary linear propagators.
Definition: linear.hh:57
Lin(Space &home, Lin< P, N, pc > &p)
Constructor for cloning p.
Definition: nary.hpp:52
Base-class for propagators.
Definition: core.hpp:1023
ViewArray< N > y
Array of negative views.
Definition: linear.hh:62
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: nary.hpp:60
Computation spaces.
Definition: core.hpp:1701
Base-class for both propagators and branchers.
Definition: core.hpp:627
ViewArray< P > x
Array of positive views.
Definition: linear.hh:60
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
FloatRelType
Relation types for floats.
Definition: float.hh:1068
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1034
Reification specification.
Definition: int.hh:876
FloatVal c
Constant value.
Definition: linear.hh:64
Float view for float variables.
Definition: view.hpp:52
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
Float value type.
Definition: float.hh:334
Propagation cost.
Definition: core.hpp:485
ExecStatus
Definition: core.hpp:471
void estimate(Term *t, int n, FloatVal c, FloatNum &l, FloatNum &u)
Estimate lower and upper bounds.
Definition: post.cpp:45
void bounds_n(ModEventDelta med, ViewArray< View > &y, FloatVal &c, FloatNum &sl, FloatNum &su)
Compute bounds information for negative views.
Class for describing linear term .
Definition: linear.hh:166
FloatView x
View.
Definition: linear.hh:171
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)=0
Propagation function.
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
double FloatNum
Floating point number base type.
Definition: float.hh:106
virtual Actor * copy(Space &home)=0
Create copy.
void bounds_p(ModEventDelta med, ViewArray< View > &x, FloatVal &c, FloatNum &sl, FloatNum &su)
Compute bounds information for positive views.