this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 *
6 * Copyright:
7 * Christian Schulte, 2005
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34#include "test/int.hh"
35
36#include <cmath>
37#include <algorithm>
38
39#include <gecode/minimodel.hh>
40
41namespace Test { namespace Int {
42
43 /// %Tests for arithmetic constraints
44 namespace Arithmetic {
45
46 /**
47 * \defgroup TaskTestIntArithmetic Arithmetic constraints
48 * \ingroup TaskTestInt
49 */
50 //@{
51 /// %Test for multiplication constraint
52 class MultXYZ : public Test {
53 public:
54 /// Create and register test
55 MultXYZ(const std::string& s, const Gecode::IntSet& d,
56 Gecode::IntPropLevel ipl)
57 : Test("Arithmetic::Mult::XYZ::"+str(ipl)+"::"+s,3,d,false,ipl) {}
58 /// %Test whether \a x is solution
59 virtual bool solution(const Assignment& x) const {
60 double d0 = static_cast<double>(x[0]);
61 double d1 = static_cast<double>(x[1]);
62 double d2 = static_cast<double>(x[2]);
63 return d0*d1 == d2;
64 }
65 /// Post constraint on \a x
66 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
67 Gecode::mult(home, x[0], x[1], x[2], ipl);
68 }
69 };
70
71 /// %Test for multiplication constraint with shared variables
72 class MultXXY : public Test {
73 public:
74 /// Create and register test
75 MultXXY(const std::string& s, const Gecode::IntSet& d,
76 Gecode::IntPropLevel ipl)
77 : Test("Arithmetic::Mult::XXY::"+str(ipl)+"::"+s,2,d,false,ipl) {}
78 /// %Test whether \a x is solution
79 virtual bool solution(const Assignment& x) const {
80 double d0 = static_cast<double>(x[0]);
81 double d1 = static_cast<double>(x[0]);
82 double d2 = static_cast<double>(x[1]);
83 return d0*d1 == d2;
84 }
85 /// Post constraint on \a x
86 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
87 Gecode::mult(home, x[0], x[0], x[1], ipl);
88 }
89 };
90
91 /// %Test for multiplication constraint with shared variables
92 class MultXYX : public Test {
93 public:
94 /// Create and register test
95 MultXYX(const std::string& s, const Gecode::IntSet& d,
96 Gecode::IntPropLevel ipl)
97 : Test("Arithmetic::Mult::XYX::"+str(ipl)+"::"+s,2,d,false,ipl) {}
98 /// %Test whether \a x is solution
99 virtual bool solution(const Assignment& x) const {
100 double d0 = static_cast<double>(x[0]);
101 double d1 = static_cast<double>(x[1]);
102 double d2 = static_cast<double>(x[0]);
103 return d0*d1 == d2;
104 }
105 /// Post constraint on \a x
106 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
107 Gecode::mult(home, x[0], x[1], x[0], ipl);
108 }
109 };
110
111 /// %Test for multiplication constraint with shared variables
112 class MultXYY : public Test {
113 public:
114 /// Create and register test
115 MultXYY(const std::string& s, const Gecode::IntSet& d,
116 Gecode::IntPropLevel ipl)
117 : Test("Arithmetic::Mult::XYY::"+str(ipl)+"::"+s,2,d,false,ipl) {}
118 /// %Test whether \a x is solution
119 virtual bool solution(const Assignment& x) const {
120 double d0 = static_cast<double>(x[0]);
121 double d1 = static_cast<double>(x[1]);
122 double d2 = static_cast<double>(x[1]);
123 return d0*d1 == d2;
124 }
125 /// Post constraint on \a x
126 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
127 Gecode::mult(home, x[0], x[1], x[1], ipl);
128 }
129 };
130
131 /// %Test for multiplication constraint with shared variables
132 class MultXXX : public Test {
133 public:
134 /// Create and register test
135 MultXXX(const std::string& s, const Gecode::IntSet& d,
136 Gecode::IntPropLevel ipl)
137 : Test("Arithmetic::Mult::XXX::"+str(ipl)+"::"+s,1,d,false,ipl) {}
138 /// %Test whether \a x is solution
139 virtual bool solution(const Assignment& x) const {
140 double d0 = static_cast<double>(x[0]);
141 double d1 = static_cast<double>(x[0]);
142 double d2 = static_cast<double>(x[0]);
143 return d0*d1 == d2;
144 }
145 /// Post constraint on \a x
146 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
147 Gecode::mult(home, x[0], x[0], x[0], ipl);
148 }
149 };
150
151 /// %Test for squaring constraint
152 class SqrXY : public Test {
153 public:
154 /// Create and register test
155 SqrXY(const std::string& s, const Gecode::IntSet& d,
156 Gecode::IntPropLevel ipl)
157 : Test("Arithmetic::Sqr::XY::"+str(ipl)+"::"+s,2,d,false,ipl) {}
158 /// %Test whether \a x is solution
159 virtual bool solution(const Assignment& x) const {
160 double d0 = static_cast<double>(x[0]);
161 double d1 = static_cast<double>(x[1]);
162 return d0*d0 == d1;
163 }
164 /// Post constraint on \a x
165 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
166 Gecode::sqr(home, x[0], x[1], ipl);
167 }
168 };
169
170 /// %Test for squaring constraint with shared variables
171 class SqrXX : public Test {
172 public:
173 /// Create and register test
174 SqrXX(const std::string& s, const Gecode::IntSet& d,
175 Gecode::IntPropLevel ipl)
176 : Test("Arithmetic::Sqr::XX::"+str(ipl)+"::"+s,1,d,false,ipl) {}
177 /// %Test whether \a x is solution
178 virtual bool solution(const Assignment& x) const {
179 double d0 = static_cast<double>(x[0]);
180 return d0*d0 == d0;
181 }
182 /// Post constraint on \a x
183 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
184 Gecode::sqr(home, x[0], x[0], ipl);
185 }
186 };
187
188 /// %Test for square root constraint
189 class SqrtXY : public Test {
190 public:
191 /// Create and register test
192 SqrtXY(const std::string& s, const Gecode::IntSet& d,
193 Gecode::IntPropLevel ipl)
194 : Test("Arithmetic::Sqrt::XY::"+str(ipl)+"::"+s,2,d,false,ipl) {}
195 /// %Test whether \a x is solution
196 virtual bool solution(const Assignment& x) const {
197 double d0 = static_cast<double>(x[0]);
198 double d1 = static_cast<double>(x[1]);
199 return (d0 >= 0) && (d0 >= d1*d1) && (d0 < (d1+1)*(d1+1));
200 }
201 /// Post constraint on \a x
202 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
203 Gecode::sqrt(home, x[0], x[1], ipl);
204 }
205 };
206
207 /// %Test for square root constraint with shared variables
208 class SqrtXX : public Test {
209 public:
210 /// Create and register test
211 SqrtXX(const std::string& s, const Gecode::IntSet& d,
212 Gecode::IntPropLevel ipl)
213 : Test("Arithmetic::Sqrt::XX::"+str(ipl)+"::"+s,1,d,false,ipl) {}
214 /// %Test whether \a x is solution
215 virtual bool solution(const Assignment& x) const {
216 double d0 = static_cast<double>(x[0]);
217 return (d0 >= 0) && (d0 >= d0*d0) && (d0 < (d0+1)*(d0+1));
218 }
219 /// Post constraint on \a x
220 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
221 Gecode::sqrt(home, x[0], x[0], ipl);
222 }
223 };
224
225 /// %Test for power constraint
226 class PowXY : public Test {
227 protected:
228 /// The exponent
229 int n;
230 public:
231 /// Create and register test
232 PowXY(const std::string& s, int n0, const Gecode::IntSet& d,
233 Gecode::IntPropLevel ipl)
234 : Test("Arithmetic::Pow::XY::"+str(n0)+"::"+str(ipl)+"::"+s,
235 2,d,false,ipl), n(n0) {}
236 /// %Test whether \a x is solution
237 virtual bool solution(const Assignment& x) const {
238 long long int p = 1;
239 for (int i=0; i<n; i++) {
240 p *= x[0];
241 if ((p < Gecode::Int::Limits::min) ||
242 (p > Gecode::Int::Limits::max))
243 return false;
244 }
245 return p == x[1];
246 }
247 /// Post constraint on \a x
248 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
249 using namespace Gecode;
250 if (n > 4)
251 pow(home, x[0], n, x[1], ipl);
252 else
253 rel(home, expr(home, pow(x[0],n), ipl), IRT_EQ, x[1], ipl);
254 }
255 };
256
257 /// %Test for power constraint with shared variables
258 class PowXX : public Test {
259 protected:
260 /// The exponent
261 int n;
262 public:
263 /// Create and register test
264 PowXX(const std::string& s, int n0, const Gecode::IntSet& d,
265 Gecode::IntPropLevel ipl)
266 : Test("Arithmetic::Pow::XX::"+str(n0)+"::"+str(ipl)+"::"+s,
267 1,d,false,ipl), n(n0) {}
268 /// %Test whether \a x is solution
269 virtual bool solution(const Assignment& x) const {
270 long long int p = 1;
271 for (int i=0; i<n; i++) {
272 p *= x[0];
273 if ((p < Gecode::Int::Limits::min) ||
274 (p > Gecode::Int::Limits::max))
275 return false;
276 }
277 return p == x[0];
278 }
279 /// Post constraint on \a x
280 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
281 Gecode::pow(home, x[0], n, x[0], ipl);
282 }
283 };
284
285 bool powgr(int n, long long int r, int x) {
286 assert(r >= 0);
287 long long int y = r;
288 long long int p = 1;
289 do {
290 p *= y; n--;
291 if (p > x)
292 return true;
293 } while (n > 0);
294 return false;
295 }
296
297 int fnroot(int n, int x) {
298 if (x < 2)
299 return x;
300 /*
301 * We look for l such that: l^n <= x < (l+1)^n
302 */
303 long long int l = 1;
304 long long int u = x;
305 do {
306 long long int m = (l + u) >> 1;
307 if (powgr(n,m,x)) u=m; else l=m;
308 } while (l+1 < u);
309 return static_cast<int>(l);
310 }
311
312 bool powle(int n, long long int r, int x) {
313 assert(r >= 0);
314 long long int y = r;
315 long long int p = 1;
316 do {
317 p *= y; n--;
318 if (p >= x)
319 return false;
320 } while (n > 0);
321 assert(y < x);
322 return true;
323 }
324
325 int cnroot(int n, int x) {
326 if (x < 2)
327 return x;
328 /*
329 * We look for u such that: (u-1)^n < x <= u^n
330 */
331 long long int l = 1;
332 long long int u = x;
333 do {
334 long long int m = (l + u) >> 1;
335 if (powle(n,m,x)) l=m; else u=m;
336 } while (l+1 < u);
337 return static_cast<int>(u);
338 }
339
340 /// %Test for nroot constraint
341 class NrootXY : public Test {
342 protected:
343 /// The root index
344 int n;
345 /// Floor
346 public:
347 /// Create and register test
348 NrootXY(const std::string& s, int n0, const Gecode::IntSet& d,
349 Gecode::IntPropLevel ipl)
350 : Test("Arithmetic::Nroot::XY::"+str(n0)+"::"+str(ipl)+"::"+s,
351 2,d,false,ipl), n(n0) {}
352 /// %Test whether \a x is solution
353 virtual bool solution(const Assignment& x) const {
354 if (n == 1)
355 return x[0] == x[1];
356 if ((n % 2 == 0) && ((x[0] < 0) || (x[1] < 0)))
357 return false;
358 int r = (x[0] < 0) ? -cnroot(n,-x[0]) : fnroot(n,x[0]);
359 return r == x[1];
360 }
361 /// Post constraint on \a x
362 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
363 using namespace Gecode;
364 if (n > 4)
365 nroot(home, x[0], n, x[1], ipl);
366 else
367 rel(home, expr(home, nroot(x[0],n), ipl), IRT_EQ, x[1], ipl);
368 }
369 };
370
371 /// %Test for nroot constraint with shared variables
372 class NrootXX : public Test {
373 protected:
374 /// The root index
375 int n;
376 public:
377 /// Create and register test
378 NrootXX(const std::string& s, int n0, const Gecode::IntSet& d,
379 Gecode::IntPropLevel ipl)
380 : Test("Arithmetic::Nroot::XX::"+str(n0)+"::"+str(ipl)+"::"+s,
381 1,d,false,ipl), n(n0) {}
382 /// %Test whether \a x is solution
383 virtual bool solution(const Assignment& x) const {
384 if (n == 1)
385 return true;
386 if (n % 2 == 0) {
387 return (x[0] >= 0) && (x[0] <= 1);
388 } else {
389 return (x[0] >= -2) && (x[0] <= 1);
390 }
391 }
392 /// Post constraint on \a x
393 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
394 Gecode::nroot(home, x[0], n, x[0], ipl);
395 }
396 };
397
398 /// %Test for division/modulo constraint
399 class DivMod : public Test {
400 private:
401 /// Return the absolute value of \a a
402 static int abs(int a) { return a<0 ? -a:a; }
403 /// Return the sign of \a a
404 static int sgn(int a) { return a<0 ? -1:1; }
405 public:
406 /// Create and register test
407 DivMod(const std::string& s, const Gecode::IntSet& d)
408 : Test("Arithmetic::DivMod::"+s,4,d) {}
409 /// %Test whether \a x is solution
410 virtual bool solution(const Assignment& x) const {
411 return x[0] == x[1]*x[2]+x[3] &&
412 abs(x[3]) < abs(x[1]) &&
413 (x[3] == 0 || sgn(x[3]) == sgn(x[0]));
414 }
415 /// Post constraint on \a x
416 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
417 Gecode::divmod(home, x[0], x[1], x[2], x[3]);
418 }
419 };
420
421 /// %Test for division constraint
422 class Div : public Test {
423 public:
424 /// Create and register test
425 Div(const std::string& s, const Gecode::IntSet& d)
426 : Test("Arithmetic::Div::"+s,3,d) {}
427 /// %Test whether \a x is solution
428 virtual bool solution(const Assignment& x) const {
429 if (x[1] == 0)
430 return false;
431 int divsign = (x[0] / x[1] < 0) ? -1 : 1;
432 int divresult =
433 divsign *
434 static_cast<int>(floor(static_cast<double>(std::abs(x[0]))/
435 static_cast<double>(std::abs(x[1]))));
436 return x[2] == divresult;
437 }
438 /// Post constraint on \a x
439 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
440 Gecode::div(home, x[0], x[1], x[2]);
441 }
442 };
443
444 /// %Test for modulo constraint
445 class Mod : public Test {
446 public:
447 /// Create and register test
448 Mod(const std::string& s, const Gecode::IntSet& d)
449 : Test("Arithmetic::Mod::"+s,3,d) {}
450 /// %Test whether \a x is solution
451 virtual bool solution(const Assignment& x) const {
452 if (x[1] == 0)
453 return false;
454 int divsign = (x[0] / x[1] < 0) ? -1 : 1;
455 int divresult =
456 divsign *
457 static_cast<int>(floor(static_cast<double>(std::abs(x[0]))/
458 static_cast<double>(std::abs(x[1]))));
459 return x[0] == x[1]*divresult+x[2];
460 }
461 /// Post constraint on \a x
462 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
463 Gecode::mod(home, x[0], x[1], x[2]);
464 }
465 };
466
467 /// %Test for absolute value constraint
468 class AbsXY : public Test {
469 public:
470 /// Create and register test
471 AbsXY(const std::string& s, const Gecode::IntSet& d,
472 Gecode::IntPropLevel ipl)
473 : Test("Arithmetic::Abs::XY::"+str(ipl)+"::"+s,2,d,false,ipl) {}
474 /// %Test whether \a x is solution
475 virtual bool solution(const Assignment& x) const {
476 double d0 = static_cast<double>(x[0]);
477 double d1 = static_cast<double>(x[1]);
478 return (d0<0 ? -d0 : d0) == d1;
479 }
480 /// Post constraint on \a x
481 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
482 Gecode::abs(home, x[0], x[1], ipl);
483 }
484 };
485
486 /// %Test for absolute value constraint with shared variables
487 class AbsXX : public Test {
488 public:
489 /// Create and register test
490 AbsXX(const std::string& s, const Gecode::IntSet& d,
491 Gecode::IntPropLevel ipl)
492 : Test("Arithmetic::Abs::XX::"+str(ipl)+"::"+s,1,d,false,ipl) {}
493 /// %Test whether \a x is solution
494 virtual bool solution(const Assignment& x) const {
495 double d0 = static_cast<double>(x[0]);
496 double d1 = static_cast<double>(x[0]);
497 return (d0<0 ? -d0 : d0) == d1;
498 }
499 /// Post constraint on \a x
500 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
501 Gecode::abs(home, x[0], x[0], ipl);
502 }
503 };
504
505 /// %Test for binary minimum constraint
506 class MinXYZ : public Test {
507 public:
508 /// Create and register test
509 MinXYZ(const std::string& s, const Gecode::IntSet& d,
510 Gecode::IntPropLevel ipl)
511 : Test("Arithmetic::Min::Bin::XYZ::"+str(ipl)+"::"+s,3,d,false,ipl) {}
512 /// %Test whether \a x is solution
513 virtual bool solution(const Assignment& x) const {
514 return std::min(x[0],x[1]) == x[2];
515 }
516 /// Post constraint on \a x
517 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
518 Gecode::min(home, x[0], x[1], x[2], ipl);
519 }
520 };
521
522 /// %Test for binary minimum constraint with shared variables
523 class MinXXY : public Test {
524 public:
525 /// Create and register test
526 MinXXY(const std::string& s, const Gecode::IntSet& d,
527 Gecode::IntPropLevel ipl)
528 : Test("Arithmetic::Min::Bin::XYX::"+str(ipl)+"::"+s,2,d) {}
529 /// %Test whether \a x is solution
530 virtual bool solution(const Assignment& x) const {
531 return std::min(x[0],x[0]) == x[1];
532 }
533 /// Post constraint on \a x
534 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
535 Gecode::min(home, x[0], x[0], x[1], ipl);
536 }
537 };
538
539 /// %Test for binary minimum constraint with shared variables
540 class MinXYX : public Test {
541 public:
542 /// Create and register test
543 MinXYX(const std::string& s, const Gecode::IntSet& d,
544 Gecode::IntPropLevel ipl)
545 : Test("Arithmetic::Min::Bin::XYX::"+str(ipl)+"::"+s,2,d) {}
546 /// %Test whether \a x is solution
547 virtual bool solution(const Assignment& x) const {
548 return std::min(x[0],x[1]) == x[0];
549 }
550 /// Post constraint on \a x
551 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
552 Gecode::min(home, x[0], x[1], x[0], ipl);
553 }
554 };
555
556 /// %Test for binary minimum constraint with shared variables
557 class MinXYY : public Test {
558 public:
559 /// Create and register test
560 MinXYY(const std::string& s, const Gecode::IntSet& d,
561 Gecode::IntPropLevel ipl)
562 : Test("Arithmetic::Min::Bin::XYY::"+str(ipl)+"::"+s,2,d) {}
563 /// %Test whether \a x is solution
564 virtual bool solution(const Assignment& x) const {
565 return std::min(x[0],x[1]) == x[1];
566 }
567 /// Post constraint on \a x
568 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
569 Gecode::min(home, x[0], x[1], x[1], ipl);
570 }
571 };
572
573 /// %Test for binary minimum constraint with shared variables
574 class MinXXX : public Test {
575 public:
576 /// Create and register test
577 MinXXX(const std::string& s, const Gecode::IntSet& d,
578 Gecode::IntPropLevel ipl)
579 : Test("Arithmetic::Min::Bin::XXX::"+str(ipl)+"::"+s,1,d) {}
580 /// %Test whether \a x is solution
581 virtual bool solution(const Assignment& x) const {
582 return std::min(x[0],x[0]) == x[0];
583 }
584 /// Post constraint on \a x
585 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
586 Gecode::min(home, x[0], x[0], x[0], ipl);
587 }
588 };
589
590 /// %Test for binary maximum constraint
591 class MaxXYZ : public Test {
592 public:
593 /// Create and register test
594 MaxXYZ(const std::string& s, const Gecode::IntSet& d,
595 Gecode::IntPropLevel ipl)
596 : Test("Arithmetic::Max::Bin::XYZ::"+str(ipl)+"::"+s,3,d) {
597 contest = CTL_BOUNDS_Z;
598 }
599 /// %Test whether \a x is solution
600 virtual bool solution(const Assignment& x) const {
601 return std::max(x[0],x[1]) == x[2];
602 }
603 /// Post constraint on \a x
604 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
605 Gecode::max(home, x[0], x[1], x[2], ipl);
606 }
607 };
608
609 /// %Test for binary maximum constraint with shared variables
610 class MaxXXY : public Test {
611 public:
612 /// Create and register test
613 MaxXXY(const std::string& s, const Gecode::IntSet& d,
614 Gecode::IntPropLevel ipl)
615 : Test("Arithmetic::Max::Bin::XXY::"+str(ipl)+"::"+s,2,d) {}
616 /// %Test whether \a x is solution
617 virtual bool solution(const Assignment& x) const {
618 return std::max(x[0],x[0]) == x[1];
619 }
620 /// Post constraint on \a x
621 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
622 Gecode::max(home, x[0], x[0], x[1], ipl);
623 }
624 };
625
626 /// %Test for binary maximum constraint with shared variables
627 class MaxXYX : public Test {
628 public:
629 /// Create and register test
630 MaxXYX(const std::string& s, const Gecode::IntSet& d,
631 Gecode::IntPropLevel ipl)
632 : Test("Arithmetic::Max::Bin::XYX::"+str(ipl)+"::"+s,2,d) {}
633 /// %Test whether \a x is solution
634 virtual bool solution(const Assignment& x) const {
635 return std::max(x[0],x[1]) == x[0];
636 }
637 /// Post constraint on \a x
638 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
639 Gecode::max(home, x[0], x[1], x[0], ipl);
640 }
641 };
642
643 /// %Test for binary maximum constraint with shared variables
644 class MaxXYY : public Test {
645 public:
646 /// Create and register test
647 MaxXYY(const std::string& s, const Gecode::IntSet& d,
648 Gecode::IntPropLevel ipl)
649 : Test("Arithmetic::Max::Bin::XYY::"+str(ipl)+"::"+s,2,d) {}
650 /// %Test whether \a x is solution
651 virtual bool solution(const Assignment& x) const {
652 return std::max(x[0],x[1]) == x[1];
653 }
654 /// Post constraint on \a x
655 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
656 Gecode::max(home, x[0], x[1], x[1], ipl);
657 }
658 };
659
660 /// %Test for binary maximum constraint with shared variables
661 class MaxXXX : public Test {
662 public:
663 /// Create and register test
664 MaxXXX(const std::string& s, const Gecode::IntSet& d,
665 Gecode::IntPropLevel ipl)
666 : Test("Arithmetic::Max::Bin::XXX::"+str(ipl)+"::"+s,1,d) {}
667 /// %Test whether \a x is solution
668 virtual bool solution(const Assignment& x) const {
669 return std::max(x[0],x[0]) == x[0];
670 }
671 /// Post constraint on \a x
672 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
673 Gecode::max(home, x[0], x[0], x[0], ipl);
674 }
675 };
676
677 /// %Test for n-ary minimmum constraint
678 class MinNary : public Test {
679 public:
680 /// Create and register test
681 MinNary(Gecode::IntPropLevel ipl)
682 : Test("Arithmetic::Min::Nary::"+str(ipl),4,-4,4,false,ipl) {}
683 /// %Test whether \a x is solution
684 virtual bool solution(const Assignment& x) const {
685 return std::min(std::min(x[0],x[1]), x[2]) == x[3];
686 }
687 /// Post constraint on \a x
688 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
689 Gecode::IntVarArgs m(3);
690 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
691 Gecode::min(home, m, x[3], ipl);
692 }
693 };
694
695 /// %Test for n-ary minimmum constraint with shared variables
696 class MinNaryShared : public Test {
697 public:
698 /// Create and register test
699 MinNaryShared(Gecode::IntPropLevel ipl)
700 : Test("Arithmetic::Min::Nary::Shared::"+str(ipl),3,-4,4,false,ipl) {}
701 /// %Test whether \a x is solution
702 virtual bool solution(const Assignment& x) const {
703 return std::min(std::min(x[0],x[1]), x[2]) == x[1];
704 }
705 /// Post constraint on \a x
706 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
707 Gecode::IntVarArgs m(3);
708 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
709 Gecode::min(home, m, x[1], ipl);
710 }
711 };
712
713 /// %Test for n-ary maximum constraint
714 class MaxNary : public Test {
715 public:
716 /// Create and register test
717 MaxNary(Gecode::IntPropLevel ipl)
718 : Test("Arithmetic::Max::Nary::"+str(ipl),4,-4,4,false,ipl) {}
719 /// %Test whether \a x is solution
720 virtual bool solution(const Assignment& x) const {
721 return std::max(std::max(x[0],x[1]), x[2]) == x[3];
722 }
723 /// Post constraint on \a x
724 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
725 Gecode::IntVarArgs m(3);
726 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
727 Gecode::max(home, m, x[3], ipl);
728 }
729 };
730
731 /// %Test for n-ary maximum constraint with shared variables
732 class MaxNaryShared : public Test {
733 public:
734 /// Create and register test
735 MaxNaryShared(Gecode::IntPropLevel ipl)
736 : Test("Arithmetic::Max::Nary::Shared::"+str(ipl),3,-4,4,false,ipl) {}
737 /// %Test whether \a x is solution
738 virtual bool solution(const Assignment& x) const {
739 return std::max(std::max(x[0],x[1]), x[2]) == x[1];
740 }
741 /// Post constraint on \a x
742 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
743 Gecode::IntVarArgs m(3);
744 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
745 Gecode::max(home, m, x[1], ipl);
746 }
747 };
748
749 /// %Test for argument maximum constraint
750 class ArgMax : public Test {
751 protected:
752 /// Offset to be used
753 int offset;
754 /// Whether to use tie-breaking
755 bool tiebreak;
756 public:
757 /// Create and register test
758 ArgMax(int n, int o, bool tb)
759 : Test("Arithmetic::ArgMax::"+str(o)+"::"+str(tb)+"::"+str(n),
760 n+1,0,n+1,
761 false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM),
762 offset(o), tiebreak(tb) {}
763 /// %Test whether \a x is solution
764 virtual bool solution(const Assignment& x) const {
765 int n=x.size()-1;
766 if ((x[n] < offset) || (x[n] >= n + offset))
767 return false;
768 int m=x[0]; int p=0;
769 for (int i=1; i<n; i++)
770 if (x[i] > m) {
771 p=i; m=x[i];
772 }
773 return tiebreak ? (p + offset == x[n]) : (m == x[x[n]-offset]);
774 }
775 /// Post constraint on \a x
776 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
777 int n=x.size()-1;
778 Gecode::IntVarArgs m(n);
779 for (int i=0; i<n; i++)
780 m[i]=x[i];
781 Gecode::argmax(home, m, offset, x[n], tiebreak);
782 }
783 };
784
785 /// %Test for argument maximum constraint with shared variables
786 class ArgMaxShared : public Test {
787 protected:
788 /// Whether to use tie-breaking
789 bool tiebreak;
790 public:
791 /// Create and register test
792 ArgMaxShared(int n, bool tb)
793 : Test("Arithmetic::ArgMax::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1,
794 false),
795 tiebreak(tb) {
796 testfix=false;
797 }
798 /// %Test whether \a x is solution
799 virtual bool solution(const Assignment& x) const {
800 int n=x.size()-1;
801 if ((x[n] < 0) || (x[n] >= 2*n))
802 return false;
803 Gecode::IntArgs y(2*n);
804 for (int i=0; i<n; i++)
805 y[2*i+0]=y[2*i+1]=x[i];
806 int m=y[0]; int p=0;
807 for (int i=1; i<2*n; i++)
808 if (y[i] > m) {
809 p=i; m=y[i];
810 }
811 return tiebreak ? (p == x[n]) : (m == y[x[n]]);
812 }
813 /// Post constraint on \a x
814 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
815 int n=x.size()-1;
816 Gecode::IntVarArgs m(2*n);
817 for (int i=0; i<n; i++)
818 m[2*i+0]=m[2*i+1]=x[i];
819 Gecode::argmax(home, m, x[n], tiebreak);
820 }
821 };
822
823 /// %Test for argument minimum constraint
824 class ArgMin : public Test {
825 protected:
826 /// Which offset to use
827 int offset;
828 /// Whether to use tie-breaking
829 bool tiebreak;
830 public:
831 /// Create and register test
832 ArgMin(int n, int o, bool tb)
833 : Test("Arithmetic::ArgMin::"+str(o)+"::"+str(tb)+"::"+str(n),
834 n+1,0,n+1,
835 false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM),
836 offset(o), tiebreak(tb) {}
837 /// %Test whether \a x is solution
838 virtual bool solution(const Assignment& x) const {
839 int n=x.size()-1;
840 if ((x[n] < offset) || (x[n] >= n + offset))
841 return false;
842 int m=x[0]; int p=0;
843 for (int i=1; i<n; i++)
844 if (x[i] < m) {
845 p=i; m=x[i];
846 }
847 return tiebreak ? (p+offset == x[n]) : (m == x[x[n]-offset]);
848 }
849 /// Post constraint on \a x
850 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
851 int n=x.size()-1;
852 Gecode::IntVarArgs m(n);
853 for (int i=0; i<n; i++)
854 m[i]=x[i];
855 Gecode::argmin(home, m, offset, x[n], tiebreak);
856 }
857 };
858
859 /// %Test for argument minimum constraint with shared variables
860 class ArgMinShared : public Test {
861 protected:
862 /// Whether to use tie-breaking
863 bool tiebreak;
864 public:
865 /// Create and register test
866 ArgMinShared(int n, bool tb)
867 : Test("Arithmetic::ArgMin::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1,
868 false),
869 tiebreak(tb) {
870 testfix=false;
871 }
872 /// %Test whether \a x is solution
873 virtual bool solution(const Assignment& x) const {
874 int n=x.size()-1;
875 if ((x[n] < 0) || (x[n] >= 2*n))
876 return false;
877 Gecode::IntArgs y(2*n);
878 for (int i=0; i<n; i++)
879 y[2*i+0]=y[2*i+1]=x[i];
880 int m=y[0]; int p=0;
881 for (int i=1; i<2*n; i++)
882 if (y[i] < m) {
883 p=i; m=y[i];
884 }
885 return tiebreak ? (p == x[n]) : (m == y[x[n]]);
886 }
887 /// Post constraint on \a x
888 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
889 int n=x.size()-1;
890 Gecode::IntVarArgs m(2*n);
891 for (int i=0; i<n; i++)
892 m[2*i+0]=m[2*i+1]=x[i];
893 Gecode::argmin(home, m, x[n], tiebreak);
894 }
895 };
896
897 /// %Test for Boolean argument maximum constraint
898 class ArgMaxBool : public Test {
899 protected:
900 /// Offset to be used
901 int offset;
902 /// Whether to use tie-breaking
903 bool tiebreak;
904 public:
905 /// Create and register test
906 ArgMaxBool(int n, int o, bool tb)
907 : Test("Arithmetic::ArgMaxBool::"+str(o)+"::"+str(tb)+"::"+str(n),
908 n+1,0,n+1,
909 false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM),
910 offset(o), tiebreak(tb) {}
911 /// %Test whether \a x is solution
912 virtual bool solution(const Assignment& x) const {
913 int n=x.size()-1;
914 if ((x[n] < offset) || (x[n] >= n + offset))
915 return false;
916 int m=x[0]; int p=0;
917 if (x[0] > 1)
918 return false;
919 for (int i=1; i<n; i++) {
920 if (x[i] > 1)
921 return false;
922 if (x[i] > m) {
923 p=i; m=x[i];
924 }
925 }
926 return tiebreak ? (p + offset == x[n]) : (m == x[x[n]-offset]);
927 }
928 /// Post constraint on \a x
929 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
930 int n=x.size()-1;
931 Gecode::BoolVarArgs m(n);
932 for (int i=0; i<n; i++)
933 m[i]=channel(home,x[i]);
934 Gecode::argmax(home, m, offset, x[n], tiebreak);
935 }
936 };
937
938 /// %Test for argument maximum constraint with shared variables
939 class ArgMaxBoolShared : public Test {
940 protected:
941 /// Whether to use tie-breaking
942 bool tiebreak;
943 public:
944 /// Create and register test
945 ArgMaxBoolShared(int n, bool tb)
946 : Test("Arithmetic::ArgMaxBool::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1,
947 false),
948 tiebreak(tb) {
949 testfix=false;
950 }
951 /// %Test whether \a x is solution
952 virtual bool solution(const Assignment& x) const {
953 int n=x.size()-1;
954 if ((x[n] < 0) || (x[n] >= 2*n))
955 return false;
956 Gecode::IntArgs y(2*n);
957 for (int i=0; i<n; i++)
958 y[2*i+0]=y[2*i+1]=x[i];
959 int m=y[0]; int p=0;
960 if (y[0] > 1)
961 return false;
962 for (int i=1; i<2*n; i++) {
963 if (y[i] > 1)
964 return false;
965 if (y[i] > m) {
966 p=i; m=y[i];
967 }
968 }
969 return tiebreak ? (p == x[n]) : (m == y[x[n]]);
970 }
971 /// Post constraint on \a x
972 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
973 int n=x.size()-1;
974 Gecode::BoolVarArgs m(2*n);
975 for (int i=0; i<n; i++)
976 m[2*i+0]=m[2*i+1]=channel(home,x[i]);
977 Gecode::argmax(home, m, x[n], tiebreak);
978 }
979 };
980
981 /// %Test for argument minimum constraint
982 class ArgMinBool : public Test {
983 protected:
984 /// Which offset to use
985 int offset;
986 /// Whether to use tie-breaking
987 bool tiebreak;
988 public:
989 /// Create and register test
990 ArgMinBool(int n, int o, bool tb)
991 : Test("Arithmetic::ArgMinBool::"+str(o)+"::"+str(tb)+"::"+str(n),
992 n+1,0,n+1,
993 false,tb ? Gecode::IPL_DEF : Gecode::IPL_DOM),
994 offset(o), tiebreak(tb) {}
995 /// %Test whether \a x is solution
996 virtual bool solution(const Assignment& x) const {
997 int n=x.size()-1;
998 if ((x[n] < offset) || (x[n] >= n + offset))
999 return false;
1000 int m=x[0]; int p=0;
1001 if (x[0] < 0 || x[0] > 1)
1002 return false;
1003 for (int i=1; i<n; i++) {
1004 if (x[i] < 0 || x[i] > 1)
1005 return false;
1006 if (x[i] < m) {
1007 p=i; m=x[i];
1008 }
1009 }
1010 return tiebreak ? (p+offset == x[n]) : (m == x[x[n]-offset]);
1011 }
1012 /// Post constraint on \a x
1013 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
1014 int n=x.size()-1;
1015 Gecode::BoolVarArgs m(n);
1016 for (int i=0; i<n; i++)
1017 m[i]=channel(home,x[i]);
1018 Gecode::argmin(home, m, offset, x[n], tiebreak);
1019 }
1020 };
1021
1022 /// %Test for argument minimum constraint with shared variables
1023 class ArgMinBoolShared : public Test {
1024 protected:
1025 /// Whether to use tie-breaking
1026 bool tiebreak;
1027 public:
1028 /// Create and register test
1029 ArgMinBoolShared(int n, bool tb)
1030 : Test("Arithmetic::ArgMinBool::Shared::"+str(tb)+"::"+str(n),n+1,0,n+1,
1031 false),
1032 tiebreak(tb) {
1033 testfix=false;
1034 }
1035 /// %Test whether \a x is solution
1036 virtual bool solution(const Assignment& x) const {
1037 int n=x.size()-1;
1038 if ((x[n] < 0) || (x[n] >= 2*n))
1039 return false;
1040 Gecode::IntArgs y(2*n);
1041 for (int i=0; i<n; i++)
1042 y[2*i+0]=y[2*i+1]=x[i];
1043 int m=y[0]; int p=0;
1044 if (y[0] > 1)
1045 return false;
1046 for (int i=1; i<2*n; i++) {
1047 if (y[i] > 1)
1048 return false;
1049 if (y[i] < m) {
1050 p=i; m=y[i];
1051 }
1052 }
1053 return tiebreak ? (p == x[n]) : (m == y[x[n]]);
1054 }
1055 /// Post constraint on \a x
1056 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
1057 int n=x.size()-1;
1058 Gecode::BoolVarArgs m(2*n);
1059 for (int i=0; i<n; i++)
1060 m[2*i+0]=m[2*i+1]=channel(home,x[i]);
1061 Gecode::argmin(home, m, x[n], tiebreak);
1062 }
1063 };
1064
1065 /// Help class to create and register tests
1066 class Create {
1067 public:
1068 /// Perform creation and registration
1069 Create(void) {
1070
1071 const int va[7] = {
1072 Gecode::Int::Limits::min, Gecode::Int::Limits::min+1,
1073 -1,0,1,
1074 Gecode::Int::Limits::max-1, Gecode::Int::Limits::max
1075 };
1076 const int vb[9] = {
1077 static_cast<int>(-sqrt(static_cast<double>
1078 (-Gecode::Int::Limits::min))),
1079 -4,-2,-1,0,1,2,4,
1080 static_cast<int>(sqrt(static_cast<double>
1081 (Gecode::Int::Limits::max)))
1082 };
1083
1084 Gecode::IntSet a(va,7);
1085 Gecode::IntSet b(vb,9);
1086 Gecode::IntSet c(-8,8);
1087 Gecode::IntSet d(-70,70);
1088
1089 (void) new DivMod("A",a);
1090 (void) new DivMod("B",b);
1091 (void) new DivMod("C",c);
1092
1093 (void) new Div("A",a);
1094 (void) new Div("B",b);
1095 (void) new Div("C",c);
1096
1097 (void) new Mod("A",a);
1098 (void) new Mod("B",b);
1099 (void) new Mod("C",c);
1100
1101
1102 for (IntPropLevels ipls; ipls(); ++ipls) {
1103 (void) new AbsXY("A",a,ipls.ipl());
1104 (void) new AbsXY("B",b,ipls.ipl());
1105 (void) new AbsXY("C",c,ipls.ipl());
1106
1107 (void) new AbsXX("A",a,ipls.ipl());
1108 (void) new AbsXX("B",b,ipls.ipl());
1109 (void) new AbsXX("C",c,ipls.ipl());
1110 if (ipls.ipl() != Gecode::IPL_VAL) {
1111 (void) new MultXYZ("A",a,ipls.ipl());
1112 (void) new MultXYZ("B",b,ipls.ipl());
1113 (void) new MultXYZ("C",c,ipls.ipl());
1114
1115 (void) new MultXXY("A",a,ipls.ipl());
1116 (void) new MultXXY("B",b,ipls.ipl());
1117 (void) new MultXXY("C",c,ipls.ipl());
1118
1119 (void) new MultXYX("A",a,ipls.ipl());
1120 (void) new MultXYX("B",b,ipls.ipl());
1121 (void) new MultXYX("C",c,ipls.ipl());
1122
1123 (void) new MultXYY("A",a,ipls.ipl());
1124 (void) new MultXYY("B",b,ipls.ipl());
1125 (void) new MultXYY("C",c,ipls.ipl());
1126
1127 (void) new MultXXX("A",a,ipls.ipl());
1128 (void) new MultXXX("B",b,ipls.ipl());
1129 (void) new MultXXX("C",c,ipls.ipl());
1130
1131 (void) new SqrXY("A",a,ipls.ipl());
1132 (void) new SqrXY("B",b,ipls.ipl());
1133 (void) new SqrXY("C",c,ipls.ipl());
1134
1135 (void) new SqrXX("A",a,ipls.ipl());
1136 (void) new SqrXX("B",b,ipls.ipl());
1137 (void) new SqrXX("C",c,ipls.ipl());
1138
1139 for (int n=0; n<=6; n++) {
1140 (void) new PowXY("A",n,a,ipls.ipl());
1141 (void) new PowXY("B",n,b,ipls.ipl());
1142 (void) new PowXY("C",n,c,ipls.ipl());
1143 (void) new PowXY("D",n,d,ipls.ipl());
1144
1145 (void) new PowXX("A",n,a,ipls.ipl());
1146 (void) new PowXX("B",n,b,ipls.ipl());
1147 (void) new PowXX("C",n,c,ipls.ipl());
1148 (void) new PowXX("D",n,d,ipls.ipl());
1149 }
1150
1151 for (int n=1; n<=6; n++) {
1152 (void) new NrootXY("A",n,a,ipls.ipl());
1153 (void) new NrootXY("B",n,b,ipls.ipl());
1154 (void) new NrootXY("C",n,c,ipls.ipl());
1155 (void) new NrootXY("D",n,d,ipls.ipl());
1156
1157 (void) new NrootXX("A",n,a,ipls.ipl());
1158 (void) new NrootXX("B",n,b,ipls.ipl());
1159 (void) new NrootXX("C",n,c,ipls.ipl());
1160 (void) new NrootXX("D",n,d,ipls.ipl());
1161 }
1162
1163 for (int n=30; n<=34; n++) {
1164 (void) new PowXY("C",n,c,ipls.ipl());
1165 (void) new PowXX("C",n,c,ipls.ipl());
1166 (void) new NrootXY("C",n,c,ipls.ipl());
1167 (void) new NrootXX("C",n,c,ipls.ipl());
1168 }
1169
1170 (void) new SqrtXY("A",a,ipls.ipl());
1171 (void) new SqrtXY("B",b,ipls.ipl());
1172 (void) new SqrtXY("C",c,ipls.ipl());
1173
1174 (void) new SqrtXX("A",a,ipls.ipl());
1175 (void) new SqrtXX("B",b,ipls.ipl());
1176 (void) new SqrtXX("C",c,ipls.ipl());
1177
1178 (void) new MinXYZ("A",a,ipls.ipl());
1179 (void) new MinXYZ("B",b,ipls.ipl());
1180 (void) new MinXYZ("C",c,ipls.ipl());
1181
1182 (void) new MinXXY("A",a,ipls.ipl());
1183 (void) new MinXXY("B",b,ipls.ipl());
1184 (void) new MinXXY("C",c,ipls.ipl());
1185
1186 (void) new MinXYX("A",a,ipls.ipl());
1187 (void) new MinXYX("B",b,ipls.ipl());
1188 (void) new MinXYX("C",c,ipls.ipl());
1189
1190 (void) new MinXYY("A",a,ipls.ipl());
1191 (void) new MinXYY("B",b,ipls.ipl());
1192 (void) new MinXYY("C",c,ipls.ipl());
1193
1194 (void) new MinXXX("A",a,ipls.ipl());
1195 (void) new MinXXX("B",b,ipls.ipl());
1196 (void) new MinXXX("C",c,ipls.ipl());
1197
1198 (void) new MaxXYZ("A",a,ipls.ipl());
1199 (void) new MaxXYZ("B",b,ipls.ipl());
1200 (void) new MaxXYZ("C",c,ipls.ipl());
1201
1202 (void) new MaxXXY("A",a,ipls.ipl());
1203 (void) new MaxXXY("B",b,ipls.ipl());
1204 (void) new MaxXXY("C",c,ipls.ipl());
1205
1206 (void) new MaxXYX("A",a,ipls.ipl());
1207 (void) new MaxXYX("B",b,ipls.ipl());
1208 (void) new MaxXYX("C",c,ipls.ipl());
1209
1210 (void) new MaxXYY("A",a,ipls.ipl());
1211 (void) new MaxXYY("B",b,ipls.ipl());
1212 (void) new MaxXYY("C",c,ipls.ipl());
1213
1214 (void) new MaxXXX("A",a,ipls.ipl());
1215 (void) new MaxXXX("B",b,ipls.ipl());
1216 (void) new MaxXXX("C",c,ipls.ipl());
1217
1218 (void) new MinNary(ipls.ipl());
1219 (void) new MinNaryShared(ipls.ipl());
1220 (void) new MaxNary(ipls.ipl());
1221 (void) new MaxNaryShared(ipls.ipl());
1222 }
1223 }
1224
1225 for (int i=1; i<5; i++) {
1226 (void) new ArgMax(i,0,true);
1227 (void) new ArgMax(i,1,true);
1228 (void) new ArgMaxShared(i,true);
1229 (void) new ArgMin(i,0,true);
1230 (void) new ArgMin(i,1,true);
1231 (void) new ArgMinShared(i,true);
1232 (void) new ArgMax(i,0,false);
1233 (void) new ArgMax(i,1,false);
1234 (void) new ArgMaxShared(i,false);
1235 (void) new ArgMin(i,0,false);
1236 (void) new ArgMin(i,1,false);
1237 (void) new ArgMinShared(i,false);
1238
1239 (void) new ArgMaxBool(i,0,true);
1240 (void) new ArgMaxBool(i,1,true);
1241 (void) new ArgMaxBoolShared(i,true);
1242 (void) new ArgMinBool(i,0,true);
1243 (void) new ArgMinBool(i,1,true);
1244 (void) new ArgMinBoolShared(i,true);
1245 (void) new ArgMaxBool(i,0,false);
1246 (void) new ArgMaxBool(i,1,false);
1247 (void) new ArgMaxBoolShared(i,false);
1248 (void) new ArgMinBool(i,0,false);
1249 (void) new ArgMinBool(i,1,false);
1250 (void) new ArgMinBoolShared(i,false);
1251 }
1252 }
1253 };
1254
1255 Create c;
1256 //@}
1257
1258 }
1259}}
1260
1261// STATISTICS: test-int