38 namespace Gecode {
namespace Int {
namespace Branch {
93 return (x.width() == 2U) ? x.min() : ((x.min()+x.max()) / 2);
109 unsigned int p =
r(x.size());
112 return i.min() +
static_cast<int>(
p);
165 template<
class View,
bool min>
171 template<
class View,
bool min>
178 template<
class View,
bool min>
182 if (x.max() <=
n)
return x.
max();
183 if (x.min() >=
n)
return x.
min();
184 if (x.range())
return n;
189 }
while (r.
max() <
n);
191 if ((pmax >= n) || (r.
min() <=
n))
193 assert((pmax < n) && (n < r.
min()));
194 unsigned int dmin =
static_cast<unsigned int>(n - pmax);
195 unsigned int dmax =
static_cast<unsigned int>(r.
min() -
n);
197 return min ? pmax : r.
min();
198 else if (dmin < dmax)
203 template<
class View,
bool min>
208 template<
class View,
bool min>
214 template<
class View,
bool inc>
220 template<
class View,
bool inc>
227 template<
class View,
bool inc>
231 if (x.max() <=
n)
return x.
max();
232 if (x.min() >=
n)
return x.
min();
233 if (x.range())
return n;
239 return (r.
min() <=
n) ? n : r.
min();
245 }
while (r.
max() <
n);
247 return (r.
min() <=
n) ? n : pmax;
250 template<
class View,
bool inc>
255 template<
class View,
bool inc>
int val(const Space &home, View x, int i)
Return value of view x at position i.
ValSelRnd(Space &home, const ValBranch &vb)
Constructor for initialization.
void dispose(Space &home)
Delete value selection.
Value selection class for nearest value.
Which values to select for branching first.
int val(const Space &home, View x, int i)
Return value of view x at position i.
Rnd r
The used random number generator.
Range iterator for integer variable views
ValSelMed(Space &home, const ValBranch &vb)
Constructor for initialization.
IntSharedArray c
The used values.
Range iterator for integer views.
Value selection class for mimimum of view.
Value selection class for average of view.
int max(void) const
Return maximum of domain.
Value selection class for random value of view.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
int min(void) const
Return smallest value of range.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
int val(const Space &home, View x, int i)
Return value of view x at position i.
Value selection class for minimum range of integer view.
Value selection class for maximum of view.
int min(void) const
Return minimum of domain.
int min(void) const
Return smallest value of range.
void dispose(Space &home)
Delete value selection.
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
ValSelRangeMin(Space &home, const ValBranch &vb)
Constructor for initialization.
int val(const Space &home, View x, int i)
Return value of view x at position i.
ValSelMin(Space &home, const ValBranch &vb)
Constructor for initialization.
int val(const Space &home, View x, int i)
Return value of view x at position i.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void update(Space &home, bool share, SharedHandle &sh)
Updating during cloning.
void values(Home home, const IntVarArgs &x, IntSet y, IntConLevel icl=ICL_DEF)
Post constraint .
Integer view for integer variables.
int val(const Space &home, View x, int i)
Return value of view x at position i.
Value branching information.
Node * x
Pointer to corresponding Boolean expression node.
ValSelRangeMax(Space &home, const ValBranch &vb)
Constructor for initialization.
IntSharedArray c
The used values.
Value selection class for median of view.
int val(const Space &home, IntView x, int i)
Return value of integer view x at position i.
void dispose(Space &home)
Delete value selection.
ValSelNearMinMax(Space &home, const ValBranch &vb)
Constructor for initialization.
ValSelNearIncDec(Space &home, const ValBranch &vb)
Constructor for initialization.
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
int val(const Space &home, View x, int i)
Return value of view x at position i.
bool range(void) const
Test whether domain is a range.
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
Value selection class for nearest value.
int max(void) const
Return largest value of range.
Gecode toplevel namespace
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Value selection class for maximum range of integer view.
friend FloatVal max(const FloatVal &x, const FloatVal &y)
ValSelMax(Space &home, const ValBranch &vb)
Constructor for initialization.
ValSelAvg(Space &home, const ValBranch &vb)
Constructor for initialization.
friend FloatVal min(const FloatVal &x, const FloatVal &y)
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
#define GECODE_NEVER
Assert that this command is never executed.
Base class for value selection.
int val(const Space &home, IntView x, int i)
Return value of integer view x at position i.