37 namespace Test {
namespace Int {
62 for (
int i=
x.size();
i--; )
63 if ((
x[
i] < 0) || (
x[
i] >
x.size()-1))
68 for (
int i=
x.size();
i--; ) {
69 j=
x[j]; reachable |= (1 << j);
72 for (
int i=
x.size();
i--; )
73 if (!(reachable & (1 <<
i)))
81 for (
int i=
x.size();
i--;)
82 xx[
i] = Gecode::expr(home,
x[
i]+offset);
83 Gecode::circuit(home, offset, xx,
ipl);
85 Gecode::circuit(home,
x,
ipl);
105 int n =
x.size() - 2;
108 if ((s < 0) || (s >
n) || (e < 0) || (e >
n) || (
x[e] !=
n))
111 if ((
i != e) && ((
x[
i] < 0) || (
x[
i] >
n)))
113 int reachable = (1 << s);
116 for (
int i=
n;
i--; ) {
117 j=
x[j]; reachable |= (1 << j);
121 if (!(reachable & (1 <<
i)))
127 int n =
x.size() - 2;
131 xx[
i] = Gecode::expr(home,
x[
i]+offset);
132 Gecode::path(home, offset, xx,
133 Gecode::expr(home,
x[
n]+offset),
134 Gecode::expr(home,
x[
n+1]+offset),
ipl);
138 Gecode::path(home, xx,
x[
n],
x[
n+1],
ipl);
160 if ((
x[
i] < 0) || (
x[
i] >
n-1))
165 for (
int i=
n;
i--; ) {
166 j=
x[j]; reachable |= (1 << j);
170 if (!(reachable & (1 <<
i)))
179 using namespace Gecode;
182 for (
int i=0;
i<
n;
i++)
183 for (
int j=0; j<
n; j++)
191 for (
int i=0;
i<
n;
i++)
213 int n =
x.size() - 3;
217 if ((s < 0) || (s >
n) || (e < 0) || (e >
n) || (
x[e] !=
n))
220 if ((
i != e) && ((
x[
i] < 0) || (
x[
i] >
n)))
222 int reachable = (1 << s);
225 for (
int i=
n;
i--; ) {
226 j=
x[j]; reachable |= (1 << j);
230 if (!(reachable & (1 <<
i)))
238 using namespace Gecode;
241 for (
int i=0;
i<
n;
i++)
242 for (
int j=0; j<
n; j++)
250 expr(home,
x[
n+1]+offset),
253 for (
int i=0;
i<
n;
i++)
276 int n=(
x.size()-1) / 2;
278 if ((
x[
i] < 0) || (
x[
i] >
n-1))
283 for (
int i=
n;
i--; ) {
284 j=
x[j]; reachable |= (1 << j);
288 if (!(reachable & (1 <<
i)))
291 if ((
x[
i]/2) !=
x[
n+
i])
300 using namespace Gecode;
301 int n=(
x.size()-1)/2;
303 for (
int i=0;
i<
n;
i++)
304 for (
int j=0; j<
n; j++)
307 for (
int i=0;
i<
n;
i++) {
315 for (
int i=0;
i<
n;
i++)
327 for (
int i=1;
i<=6;
i++) {
333 for (
int i=1;
i<=4;
i++) {
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
Passing integer arguments.
Passing integer variables.
Base class for assignments
Simple test for circuit constraint with total cost.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post circuit constraint on x.
CircuitCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl)
Create and register test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Simple test for circuit constraint with full cost information.
CircuitFullCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl)
Create and register test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post circuit constraint on x.
Simple test for circuit constraint.
Circuit(int n, int min, int max, int off, Gecode::IntPropLevel ipl)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post circuit constraint on x.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Help class to create and register tests.
Create(void)
Perform creation and registration.
Simple test for path constraint with total cost.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
PathCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post circuit constraint on x.
Simple test for Hamiltonian path constraint.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post path constraint on x.
Path(int n, int min, int max, int off, Gecode::IntPropLevel ipl)
Create and register test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
bool testfix
Whether to perform fixpoint test.
Gecode::IntPropLevel ipl
Propagation level.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
ConTestLevel contest
Whether to test for certain consistency.
void circuit(Home home, int offset, const IntVarArgs &x, IntPropLevel ipl)
Post propagator such that x forms a circuit.
void path(Home home, int offset, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl)
Post propagator such that x forms a Hamiltonian path.
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Post propagator for SetVar SetOpType SetVar y
IntPropLevel
Propagation levels for integer propagators.
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
@ IPL_VAL
Value propagation.
const FloatNum max
Largest allowed float value.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i({1, 2, 3, 4})
@ CTL_NONE
No consistency-test.