39namespace Test {
namespace Int {
65 int n = xy.
size() / 2;
66 for (
int i=0; i<
n; i++) {
67 int xi=xy[2*i+0],
yi=xy[2*i+1];
68 for (
int j=i+1; j<
n; j++) {
69 int xj=xy[2*j+0],
yj=xy[2*j+1];
70 if (!((
xi +
w[i] <=
xj) || (
xj +
w[j] <=
xi) ||
80 int n = xy.
size() / 2;
82 for (
int i=0; i<
n; i++) {
83 x[i]=xy[2*i+0]; y[i]=xy[2*i+1];
85 nooverlap(home,
x,
w, y,
h);
99 3*
w0.size(), 0, m-1),
w(
w0),
h(
h0) {}
102 int n =
xyo.size() / 3;
103 for (
int i=0; i<
n; i++) {
106 for (
int j=i+1; j<
n; j++) {
109 if ((
oi > 0) && (
oj > 0) &&
120 int n =
xyo.size() / 3;
123 for (
int i=0; i<
n; i++) {
124 x[i]=
xyo[3*i+0]; y[i]=
xyo[3*i+1];
125 o[i]=expr(home,
xyo[3*i+2] > 0);
127 nooverlap(home,
x,
w, y,
h, o);
136 :
Test(
"NoOverlap::Var::2::"+
str(m)+
"::"+
str(
n), 4*
n, 0, m) {}
139 int n =
xwyh.size() / 4;
140 for (
int i=0; i<
n; i++) {
143 for (
int j=i+1; j<
n; j++) {
156 int n =
xwyh.size() / 4;
158 for (
int i=0; i<
n; i++) {
159 x0[i]=
xwyh[4*i+0]; w[i]=
xwyh[4*i+1];
160 x1[i]=expr(home, x0[i] + w[i]);
161 y0[i]=
xwyh[4*i+2]; h[i]=
xwyh[4*i+3];
162 y1[i]=expr(home, y0[i] + h[i]);
164 nooverlap(home, x0, w, x1, y0, h, y1);
173 :
Test(
"NoOverlap::Var::Opt::2::"+
str(m)+
"::"+
str(
n), 5*
n, 0, m) {
179 for (
int i=0; i<
n; i++) {
183 for (
int j=i+1; j<
n; j++) {
187 if ((
oi > 0) && (
oj > 0) &&
201 for (
int i=0; i<
n; i++) {
203 x1[i]=expr(home, x0[i] + w[i]);
205 y1[i]=expr(home, y0[i] + h[i]);
206 o[i]=expr(home,
xwyho[5*i+4] > 0);
208 nooverlap(home, x0, w, x1, y0, h, y1, o);
217 :
Test(
"NoOverlap::Var::Opt::Shared::2::"+
223 int n = (
xwyho.size() - 2) / 2;
224 for (
int i=0; i<
n; i++) {
228 for (
int j=i+1; j<
n; j++) {
232 if ((
oi > 0) && (
oj > 0) &&
243 int n = (
xwyho.size() - 2) / 2;
246 for (
int i=0; i<
n; i++) {
248 x1[i]=expr(home, x0[i] + w[i]);
250 y1[i]=expr(home, y0[i] + h[i]);
251 o[i]=expr(home,
xwyho[2*
n + (i % 2)] > 0);
253 nooverlap(home, x0, w, x1, y0, h, y1, o);
270 for (
int m=2; m<3; m++) {
271 (void)
new Int2(m, s1, s1);
272 (void)
new Int2(m, s2, s2);
273 (void)
new Int2(m, s3, s3);
274 (void)
new Int2(m, s2, s3);
275 (void)
new Int2(m, s4, s4);
276 (void)
new Int2(m, s4, s2);
281 (void)
new Var2(2, 2);
282 (void)
new Var2(3, 2);
283 (void)
new Var2(1, 3);
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
Passing Boolean variables.
Passing integer arguments.
Passing integer variables.
int size(void) const
Return size of array (number of elements)
Base class for assignments
int size(void) const
Return number of variables.
Help class to create and register tests.
Create(void)
Perform creation and registration.
Test for no-overlap with integer dimensions (rectangles)
Int2(int m, const Gecode::IntArgs &w0, const Gecode::IntArgs &h0)
Create and register test with maximal coordinate value m.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xy)
Post constraint on xy.
virtual bool solution(const Assignment &xy) const
Test whether xy is solution
Test for no-overlap with optional rectangles
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xyo)
Post constraint on xwyho.
IntOpt2(int m, const Gecode::IntArgs &w0, const Gecode::IntArgs &h0)
Create and register test with maximal value m and n rectangles.
virtual bool solution(const Assignment &xyo) const
Test whether xyo is solution
Test for no-overlap with variable dimensions (rectangles)
Var2(int m, int n)
Create and register test with maximal value m and n rectangles.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xwyh)
Post constraint on xwyh.
virtual bool solution(const Assignment &xwyh) const
Test whether xwyh is solution
Test for no-overlap with optional rectangles
virtual bool solution(const Assignment &xwyho) const
Test whether xwyho is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xwyho)
Post constraint on xwyho.
VarOpt2(int m, int n)
Create and register test with maximal value m and n rectangles.
Test for no-overlap with optional rectangles and shared variables
VarOptShared2(int m, int n)
Create and register test with maximal value m and n rectangles.
virtual bool solution(const Assignment &xwyho) const
Test whether xwyho is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xwyho)
Post constraint on xwyho.
virtual bool run(void)
Perform test.
bool testfix
Whether to perform fixpoint test.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Gecode toplevel namespace