41 namespace Gecode {
namespace Int {
namespace Linear {
46 long long int min =
c;
47 long long int max =
c;
48 for (
int i=n;
i--; ) {
49 long long int a = t[
i].
a;
51 min += a*t[
i].
x.min();
52 max += a*t[
i].
x.max();
54 max += a*t[
i].
x.min();
55 min += a*t[
i].
x.max();
62 l =
static_cast<int>(
min);
67 u =
static_cast<int>(
max);
86 int t =
b; b = a %
b; a =
t;
137 long long int a = t[
i].a;
139 while ((++i < n) &&
same(t[i].x,x)) {
144 t[j].a =
static_cast<int>(
a); t[j].x =
x; j++;
158 while ((t[j].
a < 0) && (--j >= 0)) ;
159 while ((t[i].
a > 0) && (++i <
n)) ;
161 std::swap(t[i],t[j]);
164 t_n = t+n_p; n_n = n-n_p;
174 for (
int i=n_n;
i--; )
175 t_n[
i].
a = -t_n[
i].
a;
181 if ((n > 0) && (g > 0)) {
183 for (
int i=1; (g > 1) && (
i < n);
i++)
Sort linear terms by view.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
bool before(const CachedView< View > &x, const CachedView< View > &y)
bool normalize(Term< View > *t, int &n, Term< View > *&t_p, int &n_p, Term< View > *&t_n, int &n_n, int &g)
Normalize linear integer constraints.
const int max
Largest allowed integer value.
const int min
Smallest allowed integer value.
bool same(const CachedView< View > &x, const CachedView< View > &y)
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
int gcd(int a, int b)
Compute the greatest common divisor of a and b.
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.
void estimate(Term< View > *t, int n, int c, int &l, int &u)
Estimate lower and upper bounds.
Class for describing linear term .
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
bool operator()(const Term< View > &a, const Term< View > &b)
void check(int n, const char *l)
Check whether n is in range, otherwise throw out of limits with information l.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.