Generated on Sat Jan 20 2018 22:21:12 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  * Last modified:
14  * $Date: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
15  * $Revision: 15137 $
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 void reschedule(Space& home);
80  virtual size_t dispose(Space& home);
81  };
82 
88  template<class View>
90  FloatVal& c, FloatNum& sl, FloatNum& su);
91 
97  template<class View>
99  FloatVal& c, FloatNum& sl, FloatNum& su);
100 
109  template<class P, class N>
110  class Eq : public Lin<P,N,PC_FLOAT_BND> {
111  protected:
115 
117  Eq(Space& home, bool share, Eq& p);
118  public:
122  virtual Actor* copy(Space& home, bool share);
124  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
126  static ExecStatus
127  post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
128  };
129 
130 
139  template<class P, class N>
140  class Lq : public Lin<P,N,PC_FLOAT_BND> {
141  protected:
145 
147  Lq(Space& home, bool share, Lq& p);
148  public:
152  virtual Actor* copy(Space& home, bool share);
154  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
156  static ExecStatus
157  post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
158  };
159 
160 }}}
161 
163 
164 namespace Gecode { namespace Float { namespace Linear {
165 
170  class Term {
171  public:
176  };
177 
193  estimate(Term* t, int n, FloatVal c, FloatNum& l, FloatNum& u);
194 
212  post(Home home, Term* t, int n, FloatRelType frt, FloatVal c);
213 
232  post(Home home, Term* t, int n, FloatRelType frt, FloatVal c, Reify r);
233 
234 }}}
235 
236 #endif
237 
238 // STATISTICS: float-prop
#define GECODE_FLOAT_EXPORT
Definition: float.hh:72
Propagator for bounds consistent n-ary linear equality
Definition: linear.hh:110
NodeType t
Type of node.
Definition: bool-expr.cpp:234
virtual void reschedule(Space &home)
Schedule function.
Definition: nary.hpp:70
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
virtual Actor * copy(Space &home, bool share)=0
Create copy.
FloatVal a
Coefficient.
Definition: linear.hh:173
Propagator for bounds consistent n-ary linear less or equal
Definition: linear.hh:140
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: nary.hpp:77
Base-class for n-ary linear propagators.
Definition: linear.hh:61
Base-class for propagators.
Definition: core.hpp:1092
ViewArray< N > y
Array of negative views.
Definition: linear.hh:66
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: nary.hpp:64
Computation spaces.
Definition: core.hpp:1748
Base-class for both propagators and branchers.
Definition: core.hpp:696
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
FloatRelType
Relation types for floats.
Definition: float.hh:1069
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1103
Reification specification.
Definition: int.hh:857
FloatVal c
Constant value.
Definition: linear.hh:68
Float view for float variables.
Definition: view.hpp:56
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:784
Float value type.
Definition: float.hh:338
Propagation cost.
Definition: core.hpp:554
ExecStatus
Definition: core.hpp:540
void estimate(Term *t, int n, FloatVal c, FloatNum &l, FloatNum &u)
Estimate lower and upper bounds.
Definition: post.cpp:49
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:170
Lin(Space &home, bool share, Lin< P, N, pc > &p)
Constructor for cloning p.
Definition: nary.hpp:56
FloatView x
View.
Definition: linear.hh:175
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)=0
Propagation function.
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
Home class for posting propagators
Definition: core.hpp:922
double FloatNum
Floating point number base type.
Definition: float.hh:110
void bounds_p(ModEventDelta med, ViewArray< View > &x, FloatVal &c, FloatNum &sl, FloatNum &su)
Compute bounds information for positive views.