Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
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
48
49namespace 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);
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:
108 using Lin<P,N,PC_FLOAT_BND>::x;
109 using Lin<P,N,PC_FLOAT_BND>::y;
110 using Lin<P,N,PC_FLOAT_BND>::c;
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
124 };
125
126
135 template<class P, class N>
136 class Lq : public Lin<P,N,PC_FLOAT_BND> {
137 protected:
138 using Lin<P,N,PC_FLOAT_BND>::x;
139 using Lin<P,N,PC_FLOAT_BND>::y;
140 using Lin<P,N,PC_FLOAT_BND>::c;
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
154 };
155
156}}}
157
159
160namespace 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
Float value type.
Definition float.hh:334
Float view for float variables.
Definition view.hpp:52
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
Definition nary.hpp:128
virtual Actor * copy(Space &home)
Create copy during cloning.
Definition nary.hpp:141
Eq(Space &home, Eq &p)
Constructor for cloning p.
Definition nary.hpp:136
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nary.hpp:147
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition nary.hpp:60
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition nary.hpp:73
void bounds_n(ModEventDelta med, ViewArray< View > &y, FloatVal &c, FloatNum &sl, FloatNum &su)
Compute bounds information for negative views.
void bounds_p(ModEventDelta med, ViewArray< View > &x, FloatVal &c, FloatNum &sl, FloatNum &su)
Compute bounds information for positive views.
Lin(Space &home, Lin< P, N, pc > &p)
Constructor for cloning p.
Definition nary.hpp:52
ViewArray< P > x
Array of positive views.
Definition linear.hh:60
virtual void reschedule(Space &home)
Schedule function.
Definition nary.hpp:66
ViewArray< N > y
Array of negative views.
Definition linear.hh:62
FloatVal c
Constant value.
Definition linear.hh:64
static ExecStatus post(Home home, ViewArray< P > &x, ViewArray< N > &y, FloatVal c)
Post propagator for .
Definition nary.hpp:258
virtual Actor * copy(Space &home)
Create copy during cloning.
Definition nary.hpp:270
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nary.hpp:276
Lq(Space &home, Lq &p)
Constructor for cloning p.
Definition nary.hpp:265
Class for describing linear term .
Definition linear.hh:166
FloatVal a
Coefficient.
Definition linear.hh:169
Home class for posting propagators
Definition core.hpp:856
Propagation cost.
Definition core.hpp:486
friend class Space
Definition core.hpp:1068
ModEventDelta med
A set of modification events (used during propagation)
Definition core.hpp:1077
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3505
Reification specification.
Definition int.hh:891
View arrays.
Definition array.hpp:253
#define GECODE_FLOAT_EXPORT
Definition float.hh:68
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Definition post.cpp:238
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
double FloatNum
Floating point number base type.
Definition float.hh:106
FloatRelType
Relation types for floats.
Definition float.hh:1074
Linear propagators
void estimate(Term *t, int n, FloatVal c, FloatNum &l, FloatNum &u)
Estimate lower and upper bounds.
Definition post.cpp:45
Floating point numbers.
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Definition var-type.hpp:292
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition set.hh:773
ExecStatus
Definition core.hpp:472