Generated on Sat Feb 7 2015 02:01:14 for Gecode by doxygen 1.8.9.1
arithmetic.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6  *
7  * Copyright:
8  * Christian Schulte, 2005
9  * Vincent Barichard, 2012
10  *
11  * Last modified:
12  * $Date: 2013-02-04 22:41:43 +0100 (Mon, 04 Feb 2013) $ by $Author: schulte $
13  * $Revision: 13264 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 #include "test/float.hh"
41 
42 #include <gecode/minimodel.hh>
43 
44 #include <cmath>
45 #include <algorithm>
46 
47 namespace Test { namespace Float {
48 
50  namespace Arithmetic {
51 
57  class MultXYZ : public Test {
59  public:
61  MultXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
62  : Test("Arithmetic::Mult::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
64  virtual MaybeType solution(const Assignment& x) const {
65  return eq(x[0] * x[1], x[2]);
66  }
68  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
69  if (flip())
70  Gecode::mult(home, x[0], x[1], x[2]);
71  else
72  Gecode::rel(home, x[0] * x[1] == x[2]);
73  }
74  };
75 
77  class MultXYZSol : public Test {
78  public:
80  MultXYZSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
81  : Test("Arithmetic::Mult::XYZ::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {}
83  virtual MaybeType solution(const Assignment& x) const {
84  return eq(x[0] * x[1], x[2]);
85  }
87  virtual bool extendAssignement(Assignment& x) const {
88  Gecode::FloatVal d = x[0]*x[1];
89  if (Gecode::Float::subset(d, dom)) {
90  x.set(2, d);
91  return true;
92  } else {
93  return false;
94  }
95  }
97  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
98  Gecode::mult(home, x[0], x[1], x[2]);
99  }
100  };
101 
103  class MultXXY : public Test {
104  public:
106  MultXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
107  : Test("Arithmetic::Mult::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
109  virtual MaybeType solution(const Assignment& x) const {
110  return eq(x[0] * x[0], x[1]);
111  }
113  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
114  Gecode::mult(home, x[0], x[0], x[1]);
115  }
116  };
117 
119  class MultXXYSol : public Test {
120  public:
122  MultXXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
123  : Test("Arithmetic::Mult::XXY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
125  virtual MaybeType solution(const Assignment& x) const {
126  return eq(x[0] * x[0], x[1]);
127  }
129  virtual bool extendAssignement(Assignment& x) const {
130  Gecode::FloatVal d = x[0]*x[0];
131  if (Gecode::Float::subset(d, dom)) {
132  x.set(1, d);
133  return true;
134  } else {
135  return false;
136  }
137  }
139  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
140  Gecode::mult(home, x[0], x[0], x[1]);
141  }
142  };
143 
145  class MultXYX : public Test {
146  public:
148  MultXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
149  : Test("Arithmetic::Mult::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
151  virtual MaybeType solution(const Assignment& x) const {
152  return eq(x[0] * x[1], x[0]);
153  }
155  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
156  Gecode::mult(home, x[0], x[1], x[0]);
157  }
158  };
159 
161  class MultXYY : public Test {
162  public:
164  MultXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
165  : Test("Arithmetic::Mult::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
167  virtual MaybeType solution(const Assignment& x) const {
168  return eq(x[0] * x[1], x[1]);
169  }
171  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
172  Gecode::mult(home, x[0], x[1], x[1]);
173  }
174  };
175 
177  class MultXXX : public Test {
178  public:
180  MultXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
181  : Test("Arithmetic::Mult::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
183  virtual MaybeType solution(const Assignment& x) const {
184  return eq(x[0] * x[0], x[0]);
185  }
187  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
188  Gecode::mult(home, x[0], x[0], x[0]);
189  }
190  };
191 
193  class Div : public Test {
194  public:
196  Div(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
197  : Test("Arithmetic::Div::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
199  virtual MaybeType solution(const Assignment& x) const {
200  return eq(x[0] / x[1], x[2]);
201  }
203  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
204  if (flip())
205  Gecode::div(home, x[0], x[1], x[2]);
206  else
207  Gecode::rel(home, x[0] / x[1] == x[2]);
208  }
209  };
210 
212  class DivSol : public Test {
213  public:
215  DivSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
216  : Test("Arithmetic::Div::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {}
218  virtual MaybeType solution(const Assignment& x) const {
219  return eq(x[0] / x[1], x[2]);
220  }
222  virtual bool extendAssignement(Assignment& x) const {
223  Gecode::FloatVal d = x[0]/x[1];
224  if (Gecode::Float::subset(d, dom)) {
225  x.set(2, d);
226  return true;
227  } else {
228  return false;
229  }
230  }
232  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
233  Gecode::div(home, x[0], x[1], x[2]);
234  }
235  };
236 
238  class SqrXY : public Test {
239  public:
241  SqrXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
242  : Test("Arithmetic::Sqr::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
244  virtual MaybeType solution(const Assignment& x) const {
245  return eq(x[0] * x[0], x[1]);
246  }
248  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
249  if (flip())
250  Gecode::sqr(home, x[0], x[1]);
251  else
252  Gecode::rel(home, sqr(x[0]) == x[1]);
253  }
254  };
255 
257  class SqrXYSol : public Test {
258  public:
260  SqrXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
261  : Test("Arithmetic::Sqr::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
263  virtual MaybeType solution(const Assignment& x) const {
264  return eq(x[0] * x[0], x[1]);
265  }
267  virtual bool extendAssignement(Assignment& x) const {
268  Gecode::FloatVal d = sqr(x[0]);
269  if (Gecode::Float::subset(d, dom)) {
270  x.set(1, d);
271  return true;
272  } else {
273  return false;
274  }
275  }
277  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
278  Gecode::sqr(home, x[0], x[1]);
279  }
280  };
281 
283  class SqrXX : public Test {
284  public:
286  SqrXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
287  : Test("Arithmetic::Sqr::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
289  virtual MaybeType solution(const Assignment& x) const {
290  return eq(x[0] * x[0], x[0]);
291  }
293  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
294  Gecode::sqr(home, x[0], x[0]);
295  }
296  };
297 
299  class SqrtXY : public Test {
300  public:
302  SqrtXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
303  : Test("Arithmetic::Sqrt::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
305  virtual MaybeType solution(const Assignment& x) const {
306  switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) {
307  case MT_FALSE: return MT_FALSE;
308  case MT_MAYBE: return MT_MAYBE;
309  default:
310  return eq(sqrt(x[0]), x[1]);
311  }
312  }
314  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
315  if (flip())
316  Gecode::sqrt(home, x[0], x[1]);
317  else
318  Gecode::rel(home, sqrt(x[0]) == x[1]);
319  }
320  };
321 
323  class SqrtXYSol : public Test {
324  public:
326  SqrtXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
327  : Test("Arithmetic::Sqrt::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
329  virtual MaybeType solution(const Assignment& x) const {
330  switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) {
331  case MT_FALSE: return MT_FALSE;
332  case MT_MAYBE: return MT_MAYBE;
333  default:
334  return eq(sqrt(x[0]), x[1]);
335  }
336  }
338  virtual bool extendAssignement(Assignment& x) const {
339  Gecode::FloatVal d = sqrt(abs(x[0]));
340  if (Gecode::Float::subset(d, dom)) {
341  x.set(1, d);
342  return true;
343  } else {
344  return false;
345  }
346  }
348  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
349  Gecode::sqrt(home, x[0], x[1]);
350  }
351  };
352 
354  class SqrtXX : public Test {
355  public:
357  SqrtXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
358  : Test("Arithmetic::Sqrt::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
360  virtual MaybeType solution(const Assignment& x) const {
361  switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) {
362  case MT_FALSE: return MT_FALSE;
363  case MT_MAYBE: return MT_MAYBE;
364  default:
365  return eq(sqrt(x[0]), x[0]);
366  }
367  }
369  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
370  Gecode::sqrt(home, x[0], x[0]);
371  }
372  };
373 
375  class PowXY : public Test {
376  unsigned int n;
377  public:
379  PowXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
380  : Test("Arithmetic::Pow::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {}
382  virtual MaybeType solution(const Assignment& x) const {
383  return eq(pow(x[0],n), x[1]);
384  }
386  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
387  if (flip())
388  Gecode::pow(home, x[0], n, x[1]);
389  else
390  Gecode::rel(home, pow(x[0],n) == x[1]);
391  }
392  };
393 
395  class PowXYSol : public Test {
396  unsigned int n;
397  public:
399  PowXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
400  : Test("Arithmetic::Pow::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {}
402  virtual MaybeType solution(const Assignment& x) const {
403  return eq(pow(x[0],n), x[1]);
404  }
406  virtual bool extendAssignement(Assignment& x) const {
407  Gecode::FloatVal d = pow(x[0],n);
408  if (Gecode::Float::subset(d, dom)) {
409  x.set(1, d);
410  return true;
411  } else {
412  return false;
413  }
414  }
416  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
417  Gecode::pow(home, x[0], n, x[1]);
418  }
419  };
420 
422  class PowXX : public Test {
423  unsigned int n;
424  public:
426  PowXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
427  : Test("Arithmetic::Pow::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
429  virtual MaybeType solution(const Assignment& x) const {
430  return eq(pow(x[0],n), x[0]);
431  }
433  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
434  Gecode::pow(home, x[0], n, x[0]);
435  }
436  };
437 
439  class NRootXY : public Test {
440  unsigned int n;
441  public:
443  NRootXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
444  : Test("Arithmetic::NRoot::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {}
446  virtual MaybeType solution(const Assignment& x) const {
447  if ((n == 0) || (x[0].max() < 0.0))
448  return MT_FALSE;
449  return eq(nroot(x[0],n), x[1]);
450  }
452  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
453  if (flip())
454  Gecode::nroot(home, x[0], n, x[1]);
455  else
456  Gecode::rel(home, nroot(x[0],n) == x[1]);
457  }
458  };
459 
461  class NRootXYSol : public Test {
462  unsigned int n;
463  public:
465  NRootXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
466  : Test("Arithmetic::NRoot::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {}
468  virtual MaybeType solution(const Assignment& x) const {
469  if ((n == 0) || (x[0].max() < 0.0))
470  return MT_FALSE;
471  return eq(nroot(x[0],n), x[1]);
472  }
474  virtual bool extendAssignement(Assignment& x) const {
475  if ((n == 0) || (x[0].max() < 0))
476  return false;
477  Gecode::FloatVal d = nroot(x[0],n);
478  if (Gecode::Float::subset(d, dom)) {
479  x.set(1, d);
480  return true;
481  } else {
482  return false;
483  }
484  }
486  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
487  Gecode::nroot(home, x[0], n, x[1]);
488  }
489  };
490 
492  class NRootXX : public Test {
493  unsigned int n;
494  public:
496  NRootXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
497  : Test("Arithmetic::NRoot::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
499  virtual MaybeType solution(const Assignment& x) const {
500  if ((n == 0) || (x[0].max() < 0))
501  return MT_FALSE;
502  return eq(nroot(x[0],n), x[0]);
503  }
505  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
506  Gecode::nroot(home, x[0], n, x[0]);
507  }
508  };
509 
511  class AbsXY : public Test {
512  public:
514  AbsXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
515  : Test("Arithmetic::Abs::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
517  virtual MaybeType solution(const Assignment& x) const {
518  return eq(abs(x[0]), x[1]);
519  }
521  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
522  if (flip())
523  Gecode::abs(home, x[0], x[1]);
524  else
525  Gecode::rel(home, abs(x[0]) == x[1]);
526  }
527  };
528 
530  class AbsXX : public Test {
531  public:
533  AbsXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
534  : Test("Arithmetic::Abs::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
536  virtual MaybeType solution(const Assignment& x) const {
537  return eq(abs(x[0]), x[0]);
538  }
540  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
541  Gecode::abs(home, x[0], x[0]);
542  }
543  };
544 
546  class MinXYZ : public Test {
547  public:
549  MinXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
550  : Test("Arithmetic::Min::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
552  virtual MaybeType solution(const Assignment& x) const {
553  return eq(min(x[0],x[1]), x[2]);
554  }
556  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
557  if (flip())
558  Gecode::min(home, x[0], x[1], x[2]);
559  else
560  Gecode::rel(home, min(x[0],x[1]) == x[2]);
561  }
562  };
563 
565  class MinXXY : public Test {
566  public:
568  MinXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
569  : Test("Arithmetic::Min::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
571  virtual MaybeType solution(const Assignment& x) const {
572  return eq(min(x[0],x[0]), x[1]);
573  }
575  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
576  Gecode::min(home, x[0], x[0], x[1]);
577  }
578  };
579 
581  class MinXYX : public Test {
582  public:
584  MinXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
585  : Test("Arithmetic::Min::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
587  virtual MaybeType solution(const Assignment& x) const {
588  return eq(min(x[0],x[1]), x[0]);
589  }
591  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
592  Gecode::min(home, x[0], x[1], x[0]);
593  }
594  };
595 
597  class MinXYY : public Test {
598  public:
600  MinXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
601  : Test("Arithmetic::Min::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
603  virtual MaybeType solution(const Assignment& x) const {
604  return eq(min(x[0],x[1]), x[1]);
605  }
607  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
608  Gecode::min(home, x[0], x[1], x[1]);
609  }
610  };
611 
613  class MinXXX : public Test {
614  public:
616  MinXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
617  : Test("Arithmetic::Min::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
619  virtual MaybeType solution(const Assignment& x) const {
620  return eq(min(x[0],x[0]), x[0]);
621  }
623  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
624  Gecode::min(home, x[0], x[0], x[0]);
625  }
626  };
627 
629  class MaxXYZ : public Test {
630  public:
632  MaxXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
633  : Test("Arithmetic::Max::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
635  virtual MaybeType solution(const Assignment& x) const {
636  return eq(max(x[0],x[1]), x[2]);
637  }
639  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
640  if (flip())
641  Gecode::max(home, x[0], x[1], x[2]);
642  else
643  Gecode::rel(home, max(x[0], x[1]) == x[2]);
644  }
645  };
646 
648  class MaxXXY : public Test {
649  public:
651  MaxXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
652  : Test("Arithmetic::Max::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
654  virtual MaybeType solution(const Assignment& x) const {
655  return eq(max(x[0],x[0]), x[1]);
656  }
658  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
659  Gecode::max(home, x[0], x[0], x[1]);
660  }
661  };
662 
664  class MaxXYX : public Test {
665  public:
667  MaxXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
668  : Test("Arithmetic::Max::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
670  virtual MaybeType solution(const Assignment& x) const {
671  return eq(max(x[0],x[1]), x[0]);
672  }
674  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
675  Gecode::max(home, x[0], x[1], x[0]);
676  }
677  };
678 
680  class MaxXYY : public Test {
681  public:
683  MaxXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
684  : Test("Arithmetic::Max::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
686  virtual MaybeType solution(const Assignment& x) const {
687  return eq(max(x[0],x[1]), x[1]);
688  }
690  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
691  Gecode::max(home, x[0], x[1], x[1]);
692  }
693  };
694 
696  class MaxXXX : public Test {
697  public:
699  MaxXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
700  : Test("Arithmetic::Max::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
702  virtual MaybeType solution(const Assignment& x) const {
703  return eq(max(x[0],x[0]), x[0]);
704  }
706  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
707  Gecode::max(home, x[0], x[0], x[0]);
708  }
709  };
710 
712  class MinNary : public Test {
713  public:
715  MinNary(void)
716  : Test("Arithmetic::Min::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
718  virtual MaybeType solution(const Assignment& x) const {
719  return eq(min(min(x[0],x[1]),x[2]), x[3]);
720  }
722  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
724  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
725  if (flip())
726  Gecode::min(home, m, x[3]);
727  else
728  Gecode::rel(home, min(m) == x[3]);
729  }
730  };
731 
733  class MinNaryShared : public Test {
734  public:
737  : Test("Arithmetic::Min::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
739  virtual MaybeType solution(const Assignment& x) const {
740  return eq(min(min(x[0],x[1]),x[2]), x[1]);
741  }
743  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
745  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
746  Gecode::min(home, m, x[1]);
747  }
748  };
749 
751  class MaxNary : public Test {
752  public:
754  MaxNary(void)
755  : Test("Arithmetic::Max::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
757  virtual MaybeType solution(const Assignment& x) const {
758  return eq(max(max(x[0],x[1]),x[2]), x[3]);
759  }
761  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
763  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
764  if (flip())
765  Gecode::max(home, m, x[3]);
766  else
767  Gecode::rel(home, max(m) == x[3]);
768  }
769  };
770 
772  class MaxNaryShared : public Test {
773  public:
776  : Test("Arithmetic::Max::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
778  virtual MaybeType solution(const Assignment& x) const {
779  return eq(max(max(x[0],x[1]),x[2]), x[1]);
780  }
782  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
784  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
785  Gecode::max(home, m, x[1]);
786  }
787  };
788 
789  const Gecode::FloatNum step = 0.15;
791  Gecode::FloatVal a(-8,5);
792  Gecode::FloatVal b(9,12);
793  Gecode::FloatVal c(-8,8);
794 
795  MultXXY mult_xxy_a("A",a,step);
796  MultXXY mult_xxy_b("B",b,step);
797  MultXXY mult_xxy_c("C",c,step);
798 
799  MultXXYSol mult_xxy_sol_a("A",a,step);
800  MultXXYSol mult_xxy_sol_b("B",b,step);
801  MultXXYSol mult_xxy_sol_c("C",c,step);
802 
803  MultXYX mult_xyx_a("A",a,step);
804  MultXYX mult_xyx_b("B",b,step);
805  MultXYX mult_xyx_c("C",c,step);
806 
807  MultXYY mult_xyy_a("A",a,step);
808  MultXYY mult_xyy_b("B",b,step);
809  MultXYY mult_xyy_c("C",c,step);
810 
811  MultXXX mult_xxx_a("A",a,step);
812  MultXXX mult_xxx_b("B",b,step);
813  MultXXX mult_xxx_c("C",c,step);
814 
815  MultXYZ mult_xyz_a("A",a,step);
816  MultXYZ mult_xyz_b("B",b,step);
817  MultXYZ mult_xyz_c("C",c,step);
818 
819  MultXYZSol mult_xyz_sol_a("A",a,step);
820  MultXYZSol mult_xyz_sol_b("B",b,step);
821  MultXYZSol mult_xyz_sol_c("C",c,step);
822 
823  Div div_a("A",a,step);
824  Div div_b("B",b,step);
825  Div div_c("C",c,step);
826 
827  DivSol div_sol_a("A",a,step);
828  DivSol div_sol_b("B",b,step);
829  DivSol div_sol_c("C",c,step);
830 
831  SqrXY sqr_xy_a("A",a,step);
832  SqrXY sqr_xy_b("B",b,step);
833  SqrXY sqr_xy_c("C",c,step);
834 
835  SqrXYSol sqr_xy_sol_a("A",a,step);
836  SqrXYSol sqr_xy_sol_b("B",b,step);
837  SqrXYSol sqr_xy_sol_c("C",c,step);
838 
839  SqrXX sqr_xx_a("A",a,step);
840  SqrXX sqr_xx_b("B",b,step);
841  SqrXX sqr_xx_c("C",c,step);
842 
843  SqrtXY sqrt_xy_a("A",a,step);
844  SqrtXY sqrt_xy_b("B",b,step);
845  SqrtXY sqrt_xy_c("C",c,step);
846 
847  SqrtXYSol sqrt_xy_sol_a("A",a,step);
848  SqrtXYSol sqrt_xy_sol_b("B",b,step);
849  SqrtXYSol sqrt_xy_sol_c("C",c,step);
850 
851  SqrtXX sqrt_xx_a("A",a,step);
852  SqrtXX sqrt_xx_b("B",b,step);
853  SqrtXX sqrt_xx_c("C",c,step);
854 
855  PowXY pow_xy_a_1("A",a,2,step);
856  PowXY pow_xy_b_1("B",b,2,step);
857  PowXY pow_xy_c_1("C",c,2,step);
858 
859  PowXYSol pow_xy_sol_a_1("A",a,2,step);
860  PowXYSol pow_xy_sol_b_1("B",b,2,step);
861  PowXYSol pow_xy_sol_c_1("C",c,2,step);
862 
863  PowXX pow_xx_a_1("A",a,2,step);
864  PowXX pow_xx_b_1("B",b,2,step);
865  PowXX pow_xx_c_1("C",c,2,step);
866 
867  PowXY pow_xy_a_2("A",a,3,step);
868  PowXY pow_xy_b_2("B",b,3,step);
869  PowXY pow_xy_c_2("C",c,3,step);
870 
871  PowXYSol pow_xy_sol_a_2("A",a,3,step);
872  PowXYSol pow_xy_sol_b_2("B",b,3,step);
873  PowXYSol pow_xy_sol_c_2("C",c,3,step);
874 
875  PowXX pow_xx_a_2("A",a,3,step);
876  PowXX pow_xx_b_2("B",b,3,step);
877  PowXX pow_xx_c_2("C",c,3,step);
878 
879  PowXY pow_xy_a_3("A",a,0,step);
880  PowXY pow_xy_b_3("B",b,0,step);
881  PowXY pow_xy_c_3("C",c,0,step);
882 
883  PowXYSol pow_xy_sol_a_3("A",a,0,step);
884  PowXYSol pow_xy_sol_b_3("B",b,0,step);
885  PowXYSol pow_xy_sol_c_3("C",c,0,step);
886 
887  PowXX pow_xx_a_3("A",a,0,step);
888  PowXX pow_xx_b_3("B",b,0,step);
889  PowXX pow_xx_c_3("C",c,0,step);
890 
891  NRootXY nroot_xy_a_1("A",a,2,step);
892  NRootXY nroot_xy_b_1("B",b,2,step);
893  NRootXY nroot_xy_c_1("C",c,2,step);
894 
895  NRootXYSol nroot_xy_sol_a_1("A",a,2,step);
896  NRootXYSol nroot_xy_sol_b_1("B",b,2,step);
897  NRootXYSol nroot_xy_sol_c_1("C",c,2,step);
898 
899  NRootXX nroot_xx_a_1("A",a,2,step);
900  NRootXX nroot_xx_b_1("B",b,2,step);
901  NRootXX nroot_xx_c_1("C",c,2,step);
902 
903  NRootXY nroot_xy_a_2("A",a,3,step);
904  NRootXY nroot_xy_b_2("B",b,3,step);
905  NRootXY nroot_xy_c_2("C",c,3,step);
906 
907  NRootXYSol nroot_xy_sol_a_2("A",a,3,step);
908  NRootXYSol nroot_xy_sol_b_2("B",b,3,step);
909  NRootXYSol nroot_xy_sol_c_2("C",c,3,step);
910 
911  NRootXX nroot_xx_a_2("A",a,3,step);
912  NRootXX nroot_xx_b_2("B",b,3,step);
913  NRootXX nroot_xx_c_2("C",c,3,step);
914 
915  NRootXY nroot_xy_a_3("A",a,0,step);
916  NRootXY nroot_xy_b_3("B",b,0,step);
917  NRootXY nroot_xy_c_3("C",c,0,step);
918 
919  NRootXYSol nroot_xy_sol_a_3("A",a,0,step);
920  NRootXYSol nroot_xy_sol_b_3("B",b,0,step);
921  NRootXYSol nroot_xy_sol_c_3("C",c,0,step);
922 
923  NRootXX nroot_xx_a_3("A",a,0,step);
924  NRootXX nroot_xx_b_3("B",b,0,step);
925  NRootXX nroot_xx_c_3("C",c,0,step);
926 
927  AbsXY abs_xy_a("A",a,step);
928  AbsXY abs_xy_b("B",b,step);
929  AbsXY abs_xy_c("C",c,step);
930 
931  AbsXX abs_xx_a("A",a,step);
932  AbsXX abs_xx_b("B",b,step);
933  AbsXX abs_xx_c("C",c,step);
934 
935  MinXYZ min_xyz_a("A",a,step);
936  MinXYZ min_xyz_b("B",b,step);
937  MinXYZ min_xyz_c("C",c,step);
938 
939  MinXXY min_xxy_a("A",a,step);
940  MinXXY min_xxy_b("B",b,step);
941  MinXXY min_xxy_c("C",c,step);
942 
943  MinXYX min_xyx_a("A",a,step);
944  MinXYX min_xyx_b("B",b,step);
945  MinXYX min_xyx_c("C",c,step);
946 
947  MinXYY min_xyy_a("A",a,step);
948  MinXYY min_xyy_b("B",b,step);
949  MinXYY min_xyy_c("C",c,step);
950 
951  MinXXX min_xxx_a("A",a,step);
952  MinXXX min_xxx_b("B",b,step);
953  MinXXX min_xxx_c("C",c,step);
954 
955  MaxXYZ max_xyz_a("A",a,step);
956  MaxXYZ max_xyz_b("B",b,step);
957  MaxXYZ max_xyz_c("C",c,step);
958 
959  MaxXXY max_xxy_a("A",a,step);
960  MaxXXY max_xxy_b("B",b,step);
961  MaxXXY max_xxy_c("C",c,step);
962 
963  MaxXYX max_xyx_a("A",a,step);
964  MaxXYX max_xyx_b("B",b,step);
965  MaxXYX max_xyx_c("C",c,step);
966 
967  MaxXYY max_xyy_a("A",a,step);
968  MaxXYY max_xyy_b("B",b,step);
969  MaxXYY max_xyy_c("C",c,step);
970 
971  MaxXXX max_xxx_a("A",a,step);
972  MaxXXX max_xxx_b("B",b,step);
973  MaxXXX max_xxx_c("C",c,step);
974 
980 
981  }
982 }}
983 
984 // STATISTICS: test-float
PowXYSol pow_xy_sol_c_3("C", c, 0, step)
Test for pow constraint with shared variables
Definition: arithmetic.cpp:422
MaxXYX max_xyx_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:416
PowXYSol pow_xy_sol_b_3("B", b, 0, step)
Test for binary minimum constraint
Definition: arithmetic.cpp:546
MinXXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:616
static MaybeType eq(Gecode::FloatVal x, Gecode::FloatVal y)
Whether x and y are equal.
Definition: float.hpp:272
MaxXXY max_xxy_c("C", c, step)
NRootXYSol nroot_xy_sol_a_3("A", a, 0, step)
MinXYZ min_xyz_b("B", b, step)
Test for division constraint
Definition: arithmetic.cpp:193
SqrXY sqr_xy_a("A", a, step)
SqrtXY sqrt_xy_a("A", a, step)
Test for multiplication constraint
Definition: arithmetic.cpp:58
const Gecode::FloatNum step
Definition: arithmetic.cpp:789
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:674
PowXX pow_xx_c_2("C", c, 3, step)
SqrXX sqr_xx_b("B", b, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:68
Test for n-ary minimmum constraint
Definition: arithmetic.cpp:712
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:96
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:277
SqrXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:286
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:556
PowXX pow_xx_b_2("B", b, 3, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:571
NRootXYSol nroot_xy_sol_b_1("B", b, 2, step)
MultXXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:106
MultXYY mult_xyy_b("B", b, step)
MinXYZ min_xyz_a("A", a, step)
bool subset(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:494
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:83
Div div_c("C", c, step)
MultXYX mult_xyx_b("B", b, step)
NRootXYSol nroot_xy_sol_a_1("A", a, 2, step)
Test for nroot constraint with shared variables
Definition: arithmetic.cpp:492
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:587
Div div_a("A", a, step)
MultXYX mult_xyx_c("C", c, step)
NRootXYSol nroot_xy_sol_c_3("C", c, 0, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:360
MaxXXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:651
PowXY(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:379
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:177
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:565
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:151
MinXYX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:584
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:305
PowXY pow_xy_c_2("C", c, 3, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:267
SqrtXX sqrt_xx_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:743
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:57
MultXXY mult_xxy_a("A", a, step)
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:49
MinXYX min_xyx_c("C", c, step)
Passing float variables.
Definition: float.hh:966
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:782
SqrXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:260
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:126
Test for multiplication constraint with shared variables when solution is ensured ...
Definition: arithmetic.cpp:119
DivSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:215
MultXXX mult_xxx_c("C", c, step)
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:117
NRootXY nroot_xy_a_2("A", a, 3, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:183
PowXY pow_xy_a_1("A", a, 2, step)
AbsXX abs_xx_c("C", c, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:686
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:369
NRootXY nroot_xy_a_3("A", a, 0, step)
MultXXYSol mult_xxy_sol_c("C", c, step)
PowXX pow_xx_a_2("A", a, 3, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:203
MinXXY min_xxy_b("B", b, step)
NRootXYSol nroot_xy_sol_b_2("B", b, 3, step)
static MaybeType cmp(Gecode::FloatVal x, Gecode::FloatRelType r, Gecode::FloatVal y)
Compare x and y with respect to r.
Definition: float.hpp:239
MaxXXY max_xxy_a("A", a, step)
PowXX(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:426
MultXXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:180
MaxXYX max_xyx_b("B", b, step)
NRootXY nroot_xy_b_3("B", b, 0, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:232
MaxXYY max_xyy_b("B", b, step)
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:161
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:619
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:690
NRootXX nroot_xx_a_3("A", a, 0, step)
Test for squaring constraint
Definition: arithmetic.cpp:238
void sqr(Home home, IntVar x0, IntVar x1, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:222
static std::string str(Gecode::FloatRelType frt)
Map float relation to string.
Definition: float.hpp:198
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:658
PowXX pow_xx_a_1("A", a, 2, step)
MultXYX mult_xyx_a("A", a, step)
MultXYZ(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:61
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:433
SqrtXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:326
Test for binary maximum constraint with shared variables
Definition: arithmetic.cpp:664
void min(Home home, const IntVarArgs &x, IntVar y, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:95
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:314
void pow(Home home, IntVar x0, int n, IntVar x1, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:250
PowXY pow_xy_c_3("C", c, 0, step)
MaxXXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:699
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:139
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:64
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:199
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:218
SqrXYSol sqr_xy_sol_c("C", c, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:575
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:757
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:552
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:702
Float variable array.
Definition: float.hh:1016
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:382
Computation spaces.
Definition: core.hpp:1362
MinXXY min_xxy_a("A", a, step)
SqrXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:241
PowXYSol pow_xy_sol_c_2("C", c, 3, step)
SqrXX sqr_xx_c("C", c, step)
MinNary(void)
Create and register test.
Definition: arithmetic.cpp:715
MultXXY mult_xxy_b("B", b, step)
MultXYZSol mult_xyz_sol_a("A", a, step)
MinXXX min_xxx_c("C", c, step)
Test for square root constraint with shared variables
Definition: arithmetic.cpp:354
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:222
AbsXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:514
NRootXYSol nroot_xy_sol_b_3("B", b, 0, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:486
NRootXYSol nroot_xy_sol_a_2("A", a, 3, step)
Gecode::IntSet d(v, 7)
virtual void set(int i, const Gecode::FloatVal &val)=0
Set assignment to value val for variable i.
NRootXX nroot_xx_a_2("A", a, 3, step)
Test for pow constraint
Definition: arithmetic.cpp:375
MinXYY min_xyy_b("B", b, step)
Gecode::FloatVal c(-8, 8)
MaxNaryShared(void)
Create and register test.
Definition: arithmetic.cpp:775
Greater or equal ( )
Definition: float.hh:1059
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:244
PowXYSol(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:399
NRootXX nroot_xx_c_2("C", c, 3, step)
MinNaryShared(void)
Create and register test.
Definition: arithmetic.cpp:736
MaxNaryShared max_s_nary
Definition: arithmetic.cpp:978
MaxXYZ max_xyz_b("B", b, step)
MaxXYX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:667
AbsXY abs_xy_c("C", c, step)
NRootXY nroot_xy_b_1("B", b, 2, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:386
PowXY pow_xy_a_3("A", a, 0, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:348
MinXYZ min_xyz_c("C", c, step)
AbsXX abs_xx_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:536
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:103
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:263
SqrtXX sqrt_xx_c("C", c, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:778
SqrXY sqr_xy_b("B", b, step)
Test for n-ary minimmum constraint with shared variables
Definition: arithmetic.cpp:733
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:468
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:187
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:623
AbsXY abs_xy_b("B", b, step)
SqrtXYSol sqrt_xy_sol_a("A", a, step)
MaxXYZ max_xyz_c("C", c, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:499
MaxXYZ(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:632
PowXYSol pow_xy_sol_a_2("A", a, 3, step)
Test for absolute value constraint with shared variables
Definition: arithmetic.cpp:530
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:670
MaxNary(void)
Create and register test.
Definition: arithmetic.cpp:754
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:97
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:110
Test for binary maximum constraint with shared variables
Definition: arithmetic.cpp:680
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:289
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:329
MinXYZ(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:549
SqrtXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:302
Div(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:196
MultXYY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:164
MinXYX min_xyx_b("B", b, step)
MaxXYX max_xyx_c("C", c, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:607
MaxXYZ max_xyz_a("A", a, step)
DivSol div_sol_b("B", b, step)
PowXY pow_xy_b_1("B", b, 2, step)
void max(Home home, const IntVarArgs &x, IntVar y, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:67
Test for square root constraint where solution is ensured
Definition: arithmetic.cpp:323
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:452
MultXYZSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:80
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:591
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:581
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:429
NRootXYSol nroot_xy_sol_c_2("C", c, 3, step)
MinXXX min_xxx_a("A", a, step)
MultXXYSol mult_xxy_sol_a("A", a, step)
MaxXXX max_xxx_c("C", c, step)
MultXYZ mult_xyz_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:402
Test for nroot constraint where solution is ensured
Definition: arithmetic.cpp:461
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:145
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:540
PowXYSol pow_xy_sol_b_1("B", b, 2, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:129
void sqrt(Home home, IntVar x0, IntVar x1, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:236
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:155
PowXYSol pow_xy_sol_c_1("C", c, 2, step)
SqrXYSol sqr_xy_sol_b("B", b, step)
Test for multiplication constraint when solution is ensured
Definition: arithmetic.cpp:77
PowXX pow_xx_b_3("B", b, 0, step)
MultXXX mult_xxx_b("B", b, step)
NRootXYSol(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:465
Test for squaring constraint where solution is ensured
Definition: arithmetic.cpp:257
MaxXXX max_xxx_a("A", a, step)
MultXYZ mult_xyz_c("C", c, step)
MaxXXX max_xxx_b("B", b, step)
MaxXYY max_xyy_a("A", a, step)
Test for binary maximum constraint with shared variables
Definition: arithmetic.cpp:696
Test for n-ary maximum constraint with shared variables
Definition: arithmetic.cpp:772
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:338
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:75
MinXYY min_xyy_c("C", c, step)
General test support.
Definition: afc.cpp:43
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:722
MinXYY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:600
Gecode::FloatVal b(9, 12)
NRootXY nroot_xy_c_3("C", c, 0, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:603
NRootXX(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:496
PowXX pow_xx_c_1("C", c, 2, step)
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:135
Float value type.
Definition: float.hh:321
Test for square root constraint
Definition: arithmetic.cpp:299
NRootXY(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:443
MultXYZSol mult_xyz_sol_c("C", c, step)
NRootXY nroot_xy_a_1("A", a, 2, step)
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
NRootXX nroot_xx_b_2("B", b, 3, step)
SqrXX sqr_xx_a("A", a, step)
Test for n-ary maximum constraint
Definition: arithmetic.cpp:751
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:446
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:761
PowXX pow_xx_c_3("C", c, 0, step)
SqrXY sqr_xy_c("C", c, step)
Test for binary maximum constraint
Definition: arithmetic.cpp:629
DivSol div_sol_c("C", c, step)
Gecode::FloatVal dom
Domain of variables.
Definition: float.hh:247
SqrtXYSol sqrt_xy_sol_b("B", b, step)
AbsXX abs_xx_a("A", a, step)
NRootXX nroot_xx_a_1("A", a, 2, step)
Test for pow constraint where solution is ensured
Definition: arithmetic.cpp:395
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:517
MaybeType
Type for comparisons and solutions.
Definition: float.hh:55
NRootXX nroot_xx_b_3("B", b, 0, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:171
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:47
SqrXYSol sqr_xy_sol_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:248
PowXY pow_xy_b_3("B", b, 0, step)
SqrtXX sqrt_xx_b("B", b, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:521
Gecode::FloatVal a(-8, 5)
PowXX pow_xx_b_1("B", b, 2, step)
Test for nroot constraint
Definition: arithmetic.cpp:439
MinXXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:568
MultXYY mult_xyy_a("A", a, step)
MinNaryShared min_s_nary
Definition: arithmetic.cpp:976
NRootXYSol nroot_xy_sol_c_1("C", c, 2, step)
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:597
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:103
NRootXY nroot_xy_b_2("B", b, 3, step)
MultXXX mult_xxx_a("A", a, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:406
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:109
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:113
PowXX pow_xx_a_3("A", a, 0, step)
Test for absolute value constraint
Definition: arithmetic.cpp:511
MultXYY mult_xyy_c("C", c, step)
SqrtXY sqrt_xy_c("C", c, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:654
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:474
MultXXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:122
PowXY pow_xy_a_2("A", a, 3, step)
Test for binary maximum constraint with shared variables
Definition: arithmetic.cpp:648
SqrtXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:357
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:706
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:167
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:635
PowXY pow_xy_c_1("C", c, 2, step)
NRootXX nroot_xx_c_3("C", c, 0, step)
PowXY pow_xy_b_2("B", b, 3, step)
MinXYY min_xyy_a("A", a, step)
PowXYSol pow_xy_sol_a_3("A", a, 0, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:125
void abs(Home home, IntVar x0, IntVar x1, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:43
DivSol div_sol_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:505
void nroot(Home home, IntVar x0, int n, IntVar x1, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:269
Test for squaring constraint with shared variables
Definition: arithmetic.cpp:283
MaxXYY max_xyy_c("C", c, step)
AbsXY abs_xy_a("A", a, step)
Div div_b("B", b, step)
SqrtXY sqrt_xy_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:739
MultXYZ mult_xyz_a("A", a, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:718
double FloatNum
Floating point number base type.
Definition: float.hh:108
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:613
MinXXY min_xxy_c("C", c, step)
MultXYZSol mult_xyz_sol_b("B", b, step)
Test for division constraint when solution is ensured
Definition: arithmetic.cpp:212
MinXYX min_xyx_a("A", a, step)
PowXYSol pow_xy_sol_b_2("B", b, 3, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:293
NRootXY nroot_xy_c_2("C", c, 3, step)
MultXYX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:148
NRootXY nroot_xy_c_1("C", c, 2, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:87
AbsXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:533
PowXYSol pow_xy_sol_a_1("A", a, 2, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:639
bool flip(void)
Flip a coin and return true or false randomly.
Definition: float.hpp:277
NRootXX nroot_xx_c_1("C", c, 2, step)
Base class for assignments
Definition: float.hh:84
MinXXX min_xxx_b("B", b, step)
MultXXYSol mult_xxy_sol_b("B", b, step)
const Gecode::FloatNum step2
Definition: arithmetic.cpp:790
MaxXYY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:683
NRootXX nroot_xx_b_1("B", b, 2, step)
MultXXY mult_xxy_c("C", c, step)
SqrtXYSol sqrt_xy_sol_c("C", c, step)
MaxXXY max_xxy_b("B", b, step)