46 namespace Gecode {
namespace Float {
namespace Linear {
52 est += t[
i].
a * t[
i].
x.domain();
85 et[
n].
a=-1.0; et[
n].
x=
x;
116 if (t[
i].
x.assigned()) {
131 Support::quicksort<Term,TermLess>(
t,
n,tl);
140 while ((++i < n) &&
same(t[i].x,x)) {
145 t[j].a =
a; t[j].x =
x; j++;
162 while ((t[j].
a < 0) && (--j >= 0)) ;
163 while ((t[i].
a > 0) && (++i < n)) ;
165 std::swap(t[i],t[j]);
168 t_n = t+n_p; n_n = n-n_p;
178 for (
int i=n_n;
i--; )
179 t_n[
i].
a = -t_n[
i].
a;
183 std::swap(n_p,n_n); std::swap(t_p,t_n); c = -
c;
209 for (
int i = n_p;
i--; )
212 for (
int i = n_n;
i--; )
214 post_nary<FloatView>(home,
x,y,frt,
c);
218 for (
int i = n_p;
i--; )
221 for (
int i = n_n;
i--; )
223 post_nary<ScaleView>(home,
x,y,frt,
c);
240 dopost(home, t, n, frt, c);
246 rel(home,
extend(home,re,t,n), frt, c, r);
Propagator for bounds consistent n-ary linear equality
FloatVal val(void) const
Return assigned value.
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
const FloatNum max
Largest allowed float value.
Exception: Value out of limits
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Propagator for bounds consistent n-ary linear less or equal
void post_nary(Home home, ViewArray< View > &x, ViewArray< View > &y, FloatRelType frt, FloatVal c)
Posting n-ary propagators.
Sort linear terms by view.
Gecode::FloatVal c(-8, 8)
bool same(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether two views are the same.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
FloatRelType
Relation types for floats.
bool before(const ViewA &x, const ViewB &y)
Reification specification.
bool operator()(const Term &a, const Term &b)
Exception: Unknown relation passed as argument
Float view for float variables.
void check(const FloatVal &n, const char *l)
Check whether float n is a valid number, otherwise throw out of limits exception with information l...
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Node * x
Pointer to corresponding Boolean expression node.
bool in(FloatNum n) const
Test whether n is included.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
void estimate(Term *t, int n, FloatVal c, FloatNum &l, FloatNum &u)
Estimate lower and upper bounds.
Class for describing linear term .
void fail(void)
Mark space as failed.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
friend FloatVal max(const FloatVal &x, const FloatVal &y)
FloatView extend(Home home, Region &r, Term *&t, int &n)
Extend terms by adding view for result.
friend FloatVal min(const FloatVal &x, const FloatVal &y)
Home class for posting propagators
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
void dopost(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
double FloatNum
Floating point number base type.
#define GECODE_NEVER
Assert that this command is never executed.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.