Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
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  * This file is part of Gecode, the generic constraint
12  * development environment:
13  * http://www.gecode.org
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining
16  * a copy of this software and associated documentation files (the
17  * "Software"), to deal in the Software without restriction, including
18  * without limitation the rights to use, copy, modify, merge, publish,
19  * distribute, sublicense, and/or sell copies of the Software, and to
20  * permit persons to whom the Software is furnished to do so, subject to
21  * the following conditions:
22  *
23  * The above copyright notice and this permission notice shall be
24  * included in all copies or substantial portions of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34  */
35 
36 #include "test/float.hh"
37 
38 #include <gecode/minimodel.hh>
39 
40 #include <cmath>
41 #include <algorithm>
42 
43 namespace Test { namespace Float {
44 
46  namespace Arithmetic {
47 
53  class MultXYZ : public Test {
55  public:
57  MultXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
58  : Test("Arithmetic::Mult::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
60  virtual MaybeType solution(const Assignment& x) const {
61  return eq(x[0] * x[1], x[2]);
62  }
64  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
65  if (flip())
66  Gecode::mult(home, x[0], x[1], x[2]);
67  else
68  Gecode::rel(home, x[0] * x[1] == x[2]);
69  }
70  };
71 
73  class MultXYZSol : public Test {
74  public:
76  MultXYZSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
77  : Test("Arithmetic::Mult::XYZ::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {}
79  virtual MaybeType solution(const Assignment& x) const {
80  return eq(x[0] * x[1], x[2]);
81  }
83  virtual bool extendAssignement(Assignment& x) const {
84  Gecode::FloatVal d = x[0]*x[1];
85  if (Gecode::Float::subset(d, dom)) {
86  x.set(2, d);
87  return true;
88  } else {
89  return false;
90  }
91  }
93  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
94  Gecode::mult(home, x[0], x[1], x[2]);
95  }
96  };
97 
99  class MultXXY : public Test {
100  public:
102  MultXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
103  : Test("Arithmetic::Mult::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
105  virtual MaybeType solution(const Assignment& x) const {
106  return eq(x[0] * x[0], x[1]);
107  }
109  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
110  Gecode::mult(home, x[0], x[0], x[1]);
111  }
112  };
113 
115  class MultXXYSol : public Test {
116  public:
118  MultXXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
119  : Test("Arithmetic::Mult::XXY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
121  virtual MaybeType solution(const Assignment& x) const {
122  return eq(x[0] * x[0], x[1]);
123  }
125  virtual bool extendAssignement(Assignment& x) const {
126  Gecode::FloatVal d = x[0]*x[0];
127  if (Gecode::Float::subset(d, dom)) {
128  x.set(1, d);
129  return true;
130  } else {
131  return false;
132  }
133  }
135  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
136  Gecode::mult(home, x[0], x[0], x[1]);
137  }
138  };
139 
141  class MultXYX : public Test {
142  public:
144  MultXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
145  : Test("Arithmetic::Mult::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
147  virtual MaybeType solution(const Assignment& x) const {
148  return eq(x[0] * x[1], x[0]);
149  }
151  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
152  Gecode::mult(home, x[0], x[1], x[0]);
153  }
154  };
155 
157  class MultXYY : public Test {
158  public:
160  MultXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
161  : Test("Arithmetic::Mult::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
163  virtual MaybeType solution(const Assignment& x) const {
164  return eq(x[0] * x[1], x[1]);
165  }
167  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
168  Gecode::mult(home, x[0], x[1], x[1]);
169  }
170  };
171 
173  class MultXXX : public Test {
174  public:
176  MultXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
177  : Test("Arithmetic::Mult::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
179  virtual MaybeType solution(const Assignment& x) const {
180  return eq(x[0] * x[0], x[0]);
181  }
183  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
184  Gecode::mult(home, x[0], x[0], x[0]);
185  }
186  };
187 
189  class Div : public Test {
190  public:
192  Div(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
193  : Test("Arithmetic::Div::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
195  virtual MaybeType solution(const Assignment& x) const {
196  return eq(x[0] / x[1], x[2]);
197  }
199  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
200  if (flip())
201  Gecode::div(home, x[0], x[1], x[2]);
202  else
203  Gecode::rel(home, x[0] / x[1] == x[2]);
204  }
205  };
206 
208  class DivSol : public Test {
209  public:
211  DivSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
212  : Test("Arithmetic::Div::Sol::"+s,3,d,st,EXTEND_ASSIGNMENT,false) {}
214  virtual MaybeType solution(const Assignment& x) const {
215  return eq(x[0] / x[1], x[2]);
216  }
218  virtual bool extendAssignement(Assignment& x) const {
219  Gecode::FloatVal d = x[0]/x[1];
220  if (Gecode::Float::subset(d, dom)) {
221  x.set(2, d);
222  return true;
223  } else {
224  return false;
225  }
226  }
228  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
229  Gecode::div(home, x[0], x[1], x[2]);
230  }
231  };
232 
234  class SqrXY : public Test {
235  public:
237  SqrXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
238  : Test("Arithmetic::Sqr::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
240  virtual MaybeType solution(const Assignment& x) const {
241  return eq(x[0] * x[0], x[1]);
242  }
244  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
245  if (flip())
246  Gecode::sqr(home, x[0], x[1]);
247  else
248  Gecode::rel(home, sqr(x[0]) == x[1]);
249  }
250  };
251 
253  class SqrXYSol : public Test {
254  public:
256  SqrXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
257  : Test("Arithmetic::Sqr::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
259  virtual MaybeType solution(const Assignment& x) const {
260  return eq(x[0] * x[0], x[1]);
261  }
263  virtual bool extendAssignement(Assignment& x) const {
264  Gecode::FloatVal d = sqr(x[0]);
265  if (Gecode::Float::subset(d, dom)) {
266  x.set(1, d);
267  return true;
268  } else {
269  return false;
270  }
271  }
273  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
274  Gecode::sqr(home, x[0], x[1]);
275  }
276  };
277 
279  class SqrXX : public Test {
280  public:
282  SqrXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
283  : Test("Arithmetic::Sqr::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
285  virtual MaybeType solution(const Assignment& x) const {
286  return eq(x[0] * x[0], x[0]);
287  }
289  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
290  Gecode::sqr(home, x[0], x[0]);
291  }
292  };
293 
295  class SqrtXY : public Test {
296  public:
298  SqrtXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
299  : Test("Arithmetic::Sqrt::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
301  virtual MaybeType solution(const Assignment& x) const {
302  switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) {
303  case MT_FALSE: return MT_FALSE;
304  case MT_MAYBE: return MT_MAYBE;
305  default:
306  return eq(sqrt(x[0]), x[1]);
307  }
308  }
310  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
311  if (flip())
312  Gecode::sqrt(home, x[0], x[1]);
313  else
314  Gecode::rel(home, sqrt(x[0]) == x[1]);
315  }
316  };
317 
319  class SqrtXYSol : public Test {
320  public:
322  SqrtXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
323  : Test("Arithmetic::Sqrt::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
325  virtual MaybeType solution(const Assignment& x) const {
326  switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) {
327  case MT_FALSE: return MT_FALSE;
328  case MT_MAYBE: return MT_MAYBE;
329  default:
330  return eq(sqrt(x[0]), x[1]);
331  }
332  }
334  virtual bool extendAssignement(Assignment& x) const {
335  Gecode::FloatVal d = sqrt(abs(x[0]));
336  if (Gecode::Float::subset(d, dom)) {
337  x.set(1, d);
338  return true;
339  } else {
340  return false;
341  }
342  }
344  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
345  Gecode::sqrt(home, x[0], x[1]);
346  }
347  };
348 
350  class SqrtXX : public Test {
351  public:
353  SqrtXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
354  : Test("Arithmetic::Sqrt::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
356  virtual MaybeType solution(const Assignment& x) const {
357  switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) {
358  case MT_FALSE: return MT_FALSE;
359  case MT_MAYBE: return MT_MAYBE;
360  default:
361  return eq(sqrt(x[0]), x[0]);
362  }
363  }
365  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
366  Gecode::sqrt(home, x[0], x[0]);
367  }
368  };
369 
371  class PowXY : public Test {
372  unsigned int n;
373  public:
375  PowXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
376  : Test("Arithmetic::Pow::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {}
378  virtual MaybeType solution(const Assignment& x) const {
379  return eq(pow(x[0],n), x[1]);
380  }
382  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
383  if (flip())
384  Gecode::pow(home, x[0], n, x[1]);
385  else
386  Gecode::rel(home, pow(x[0],n) == x[1]);
387  }
388  };
389 
391  class PowXYSol : public Test {
392  unsigned int n;
393  public:
395  PowXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
396  : Test("Arithmetic::Pow::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {}
398  virtual MaybeType solution(const Assignment& x) const {
399  return eq(pow(x[0],n), x[1]);
400  }
402  virtual bool extendAssignement(Assignment& x) const {
403  Gecode::FloatVal d = pow(x[0],n);
404  if (Gecode::Float::subset(d, dom)) {
405  x.set(1, d);
406  return true;
407  } else {
408  return false;
409  }
410  }
412  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
413  Gecode::pow(home, x[0], n, x[1]);
414  }
415  };
416 
418  class PowXX : public Test {
419  unsigned int n;
420  public:
422  PowXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
423  : Test("Arithmetic::Pow::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
425  virtual MaybeType solution(const Assignment& x) const {
426  return eq(pow(x[0],n), x[0]);
427  }
429  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
430  Gecode::pow(home, x[0], n, x[0]);
431  }
432  };
433 
435  class NRootXY : public Test {
436  unsigned int n;
437  public:
439  NRootXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
440  : Test("Arithmetic::NRoot::N::"+str(_n)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), n(_n) {}
442  virtual MaybeType solution(const Assignment& x) const {
443  if ((n == 0) || (x[0].max() < 0.0))
444  return MT_FALSE;
445  return eq(nroot(x[0],n), x[1]);
446  }
448  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
449  if (flip())
450  Gecode::nroot(home, x[0], n, x[1]);
451  else
452  Gecode::rel(home, nroot(x[0],n) == x[1]);
453  }
454  };
455 
457  class NRootXYSol : public Test {
458  unsigned int n;
459  public:
461  NRootXYSol(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
462  : Test("Arithmetic::NRoot::N::"+str(_n)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), n(_n) {}
464  virtual MaybeType solution(const Assignment& x) const {
465  if ((n == 0) || (x[0].max() < 0.0))
466  return MT_FALSE;
467  return eq(nroot(x[0],n), x[1]);
468  }
470  virtual bool extendAssignement(Assignment& x) const {
471  if ((n == 0) || (x[0].max() < 0))
472  return false;
473  Gecode::FloatVal d = nroot(x[0],n);
474  if (Gecode::Float::subset(d, dom)) {
475  x.set(1, d);
476  return true;
477  } else {
478  return false;
479  }
480  }
482  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
483  Gecode::nroot(home, x[0], n, x[1]);
484  }
485  };
486 
488  class NRootXX : public Test {
489  unsigned int n;
490  public:
492  NRootXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st)
493  : Test("Arithmetic::NRoot::N::"+str(_n)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
495  virtual MaybeType solution(const Assignment& x) const {
496  if ((n == 0) || (x[0].max() < 0))
497  return MT_FALSE;
498  return eq(nroot(x[0],n), x[0]);
499  }
501  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
502  Gecode::nroot(home, x[0], n, x[0]);
503  }
504  };
505 
507  class AbsXY : public Test {
508  public:
510  AbsXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
511  : Test("Arithmetic::Abs::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
513  virtual MaybeType solution(const Assignment& x) const {
514  return eq(abs(x[0]), x[1]);
515  }
517  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
518  if (flip())
519  Gecode::abs(home, x[0], x[1]);
520  else
521  Gecode::rel(home, abs(x[0]) == x[1]);
522  }
523  };
524 
526  class AbsXX : public Test {
527  public:
529  AbsXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
530  : Test("Arithmetic::Abs::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
532  virtual MaybeType solution(const Assignment& x) const {
533  return eq(abs(x[0]), x[0]);
534  }
536  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
537  Gecode::abs(home, x[0], x[0]);
538  }
539  };
540 
542  class MinXYZ : public Test {
543  public:
545  MinXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
546  : Test("Arithmetic::Min::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
548  virtual MaybeType solution(const Assignment& x) const {
549  return eq(min(x[0],x[1]), x[2]);
550  }
552  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
553  if (flip())
554  Gecode::min(home, x[0], x[1], x[2]);
555  else
556  Gecode::rel(home, min(x[0],x[1]) == x[2]);
557  }
558  };
559 
561  class MinXXY : public Test {
562  public:
564  MinXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
565  : Test("Arithmetic::Min::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
567  virtual MaybeType solution(const Assignment& x) const {
568  return eq(min(x[0],x[0]), x[1]);
569  }
571  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
572  Gecode::min(home, x[0], x[0], x[1]);
573  }
574  };
575 
577  class MinXYX : public Test {
578  public:
580  MinXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
581  : Test("Arithmetic::Min::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
583  virtual MaybeType solution(const Assignment& x) const {
584  return eq(min(x[0],x[1]), x[0]);
585  }
587  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
588  Gecode::min(home, x[0], x[1], x[0]);
589  }
590  };
591 
593  class MinXYY : public Test {
594  public:
596  MinXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
597  : Test("Arithmetic::Min::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
599  virtual MaybeType solution(const Assignment& x) const {
600  return eq(min(x[0],x[1]), x[1]);
601  }
603  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
604  Gecode::min(home, x[0], x[1], x[1]);
605  }
606  };
607 
609  class MinXXX : public Test {
610  public:
612  MinXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
613  : Test("Arithmetic::Min::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
615  virtual MaybeType solution(const Assignment& x) const {
616  return eq(min(x[0],x[0]), x[0]);
617  }
619  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
620  Gecode::min(home, x[0], x[0], x[0]);
621  }
622  };
623 
625  class MaxXYZ : public Test {
626  public:
628  MaxXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
629  : Test("Arithmetic::Max::Bin::XYZ::"+s,3,d,st,CPLT_ASSIGNMENT,false) {}
631  virtual MaybeType solution(const Assignment& x) const {
632  return eq(max(x[0],x[1]), x[2]);
633  }
635  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
636  if (flip())
637  Gecode::max(home, x[0], x[1], x[2]);
638  else
639  Gecode::rel(home, max(x[0], x[1]) == x[2]);
640  }
641  };
642 
644  class MaxXXY : public Test {
645  public:
647  MaxXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
648  : Test("Arithmetic::Max::Bin::XXY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
650  virtual MaybeType solution(const Assignment& x) const {
651  return eq(max(x[0],x[0]), x[1]);
652  }
654  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
655  Gecode::max(home, x[0], x[0], x[1]);
656  }
657  };
658 
660  class MaxXYX : public Test {
661  public:
663  MaxXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
664  : Test("Arithmetic::Max::Bin::XYX::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
666  virtual MaybeType solution(const Assignment& x) const {
667  return eq(max(x[0],x[1]), x[0]);
668  }
670  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
671  Gecode::max(home, x[0], x[1], x[0]);
672  }
673  };
674 
676  class MaxXYY : public Test {
677  public:
679  MaxXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
680  : Test("Arithmetic::Max::Bin::XYY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
682  virtual MaybeType solution(const Assignment& x) const {
683  return eq(max(x[0],x[1]), x[1]);
684  }
686  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
687  Gecode::max(home, x[0], x[1], x[1]);
688  }
689  };
690 
692  class MaxXXX : public Test {
693  public:
695  MaxXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
696  : Test("Arithmetic::Max::Bin::XXX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
698  virtual MaybeType solution(const Assignment& x) const {
699  return eq(max(x[0],x[0]), x[0]);
700  }
702  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
703  Gecode::max(home, x[0], x[0], x[0]);
704  }
705  };
706 
708  class MinNary : public Test {
709  public:
711  MinNary(void)
712  : Test("Arithmetic::Min::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
714  virtual MaybeType solution(const Assignment& x) const {
715  return eq(min(min(x[0],x[1]),x[2]), x[3]);
716  }
718  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
720  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
721  if (flip())
722  Gecode::min(home, m, x[3]);
723  else
724  Gecode::rel(home, min(m) == x[3]);
725  }
726  };
727 
729  class MinNaryShared : public Test {
730  public:
733  : Test("Arithmetic::Min::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
735  virtual MaybeType solution(const Assignment& x) const {
736  return eq(min(min(x[0],x[1]),x[2]), x[1]);
737  }
739  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
741  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
742  Gecode::min(home, m, x[1]);
743  }
744  };
745 
747  class MaxNary : public Test {
748  public:
750  MaxNary(void)
751  : Test("Arithmetic::Max::Nary",4,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
753  virtual MaybeType solution(const Assignment& x) const {
754  return eq(max(max(x[0],x[1]),x[2]), x[3]);
755  }
757  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
759  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
760  if (flip())
761  Gecode::max(home, m, x[3]);
762  else
763  Gecode::rel(home, max(m) == x[3]);
764  }
765  };
766 
768  class MaxNaryShared : public Test {
769  public:
772  : Test("Arithmetic::Max::Nary::Shared",3,-4,4,0.5,CPLT_ASSIGNMENT,false) {}
774  virtual MaybeType solution(const Assignment& x) const {
775  return eq(max(max(x[0],x[1]),x[2]), x[1]);
776  }
778  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
780  m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
781  Gecode::max(home, m, x[1]);
782  }
783  };
784 
785  const Gecode::FloatNum step = 0.15;
787  Gecode::FloatVal a(-8,5);
788  Gecode::FloatVal b(9,12);
789  Gecode::FloatVal c(-8,8);
790 
791  MultXXY mult_xxy_a("A",a,step);
792  MultXXY mult_xxy_b("B",b,step);
793  MultXXY mult_xxy_c("C",c,step);
794 
795  MultXXYSol mult_xxy_sol_a("A",a,step);
796  MultXXYSol mult_xxy_sol_b("B",b,step);
797  MultXXYSol mult_xxy_sol_c("C",c,step);
798 
799  MultXYX mult_xyx_a("A",a,step);
800  MultXYX mult_xyx_b("B",b,step);
801  MultXYX mult_xyx_c("C",c,step);
802 
803  MultXYY mult_xyy_a("A",a,step);
804  MultXYY mult_xyy_b("B",b,step);
805  MultXYY mult_xyy_c("C",c,step);
806 
807  MultXXX mult_xxx_a("A",a,step);
808  MultXXX mult_xxx_b("B",b,step);
809  MultXXX mult_xxx_c("C",c,step);
810 
811  MultXYZ mult_xyz_a("A",a,step);
812  MultXYZ mult_xyz_b("B",b,step);
813  MultXYZ mult_xyz_c("C",c,step);
814 
815  MultXYZSol mult_xyz_sol_a("A",a,step);
816  MultXYZSol mult_xyz_sol_b("B",b,step);
817  MultXYZSol mult_xyz_sol_c("C",c,step);
818 
819  Div div_a("A",a,step);
820  Div div_b("B",b,step);
821  Div div_c("C",c,step);
822 
823  DivSol div_sol_a("A",a,step);
824  DivSol div_sol_b("B",b,step);
825  DivSol div_sol_c("C",c,step);
826 
827  SqrXY sqr_xy_a("A",a,step);
828  SqrXY sqr_xy_b("B",b,step);
829  SqrXY sqr_xy_c("C",c,step);
830 
831  SqrXYSol sqr_xy_sol_a("A",a,step);
832  SqrXYSol sqr_xy_sol_b("B",b,step);
833  SqrXYSol sqr_xy_sol_c("C",c,step);
834 
835  SqrXX sqr_xx_a("A",a,step);
836  SqrXX sqr_xx_b("B",b,step);
837  SqrXX sqr_xx_c("C",c,step);
838 
839  SqrtXY sqrt_xy_a("A",a,step);
840  SqrtXY sqrt_xy_b("B",b,step);
841  SqrtXY sqrt_xy_c("C",c,step);
842 
843  SqrtXYSol sqrt_xy_sol_a("A",a,step);
844  SqrtXYSol sqrt_xy_sol_b("B",b,step);
845  SqrtXYSol sqrt_xy_sol_c("C",c,step);
846 
847  SqrtXX sqrt_xx_a("A",a,step);
848  SqrtXX sqrt_xx_b("B",b,step);
849  SqrtXX sqrt_xx_c("C",c,step);
850 
851  PowXY pow_xy_a_1("A",a,2,step);
852  PowXY pow_xy_b_1("B",b,2,step);
853  PowXY pow_xy_c_1("C",c,2,step);
854 
855  PowXYSol pow_xy_sol_a_1("A",a,2,step);
856  PowXYSol pow_xy_sol_b_1("B",b,2,step);
857  PowXYSol pow_xy_sol_c_1("C",c,2,step);
858 
859  PowXX pow_xx_a_1("A",a,2,step);
860  PowXX pow_xx_b_1("B",b,2,step);
861  PowXX pow_xx_c_1("C",c,2,step);
862 
863  PowXY pow_xy_a_2("A",a,3,step);
864  PowXY pow_xy_b_2("B",b,3,step);
865  PowXY pow_xy_c_2("C",c,3,step);
866 
867  PowXYSol pow_xy_sol_a_2("A",a,3,step);
868  PowXYSol pow_xy_sol_b_2("B",b,3,step);
869  PowXYSol pow_xy_sol_c_2("C",c,3,step);
870 
871  PowXX pow_xx_a_2("A",a,3,step);
872  PowXX pow_xx_b_2("B",b,3,step);
873  PowXX pow_xx_c_2("C",c,3,step);
874 
875  PowXY pow_xy_a_3("A",a,0,step);
876  PowXY pow_xy_b_3("B",b,0,step);
877  PowXY pow_xy_c_3("C",c,0,step);
878 
879  PowXYSol pow_xy_sol_a_3("A",a,0,step);
880  PowXYSol pow_xy_sol_b_3("B",b,0,step);
881  PowXYSol pow_xy_sol_c_3("C",c,0,step);
882 
883  PowXX pow_xx_a_3("A",a,0,step);
884  PowXX pow_xx_b_3("B",b,0,step);
885  PowXX pow_xx_c_3("C",c,0,step);
886 
887  NRootXY nroot_xy_a_1("A",a,2,step);
888  NRootXY nroot_xy_b_1("B",b,2,step);
889  NRootXY nroot_xy_c_1("C",c,2,step);
890 
891  NRootXYSol nroot_xy_sol_a_1("A",a,2,step);
892  NRootXYSol nroot_xy_sol_b_1("B",b,2,step);
893  NRootXYSol nroot_xy_sol_c_1("C",c,2,step);
894 
895  NRootXX nroot_xx_a_1("A",a,2,step);
896  NRootXX nroot_xx_b_1("B",b,2,step);
897  NRootXX nroot_xx_c_1("C",c,2,step);
898 
899  NRootXY nroot_xy_a_2("A",a,3,step);
900  NRootXY nroot_xy_b_2("B",b,3,step);
901  NRootXY nroot_xy_c_2("C",c,3,step);
902 
903  NRootXYSol nroot_xy_sol_a_2("A",a,3,step);
904  NRootXYSol nroot_xy_sol_b_2("B",b,3,step);
905  NRootXYSol nroot_xy_sol_c_2("C",c,3,step);
906 
907  NRootXX nroot_xx_a_2("A",a,3,step);
908  NRootXX nroot_xx_b_2("B",b,3,step);
909  NRootXX nroot_xx_c_2("C",c,3,step);
910 
911  NRootXY nroot_xy_a_3("A",a,0,step);
912  NRootXY nroot_xy_b_3("B",b,0,step);
913  NRootXY nroot_xy_c_3("C",c,0,step);
914 
915  NRootXYSol nroot_xy_sol_a_3("A",a,0,step);
916  NRootXYSol nroot_xy_sol_b_3("B",b,0,step);
917  NRootXYSol nroot_xy_sol_c_3("C",c,0,step);
918 
919  NRootXX nroot_xx_a_3("A",a,0,step);
920  NRootXX nroot_xx_b_3("B",b,0,step);
921  NRootXX nroot_xx_c_3("C",c,0,step);
922 
923  AbsXY abs_xy_a("A",a,step);
924  AbsXY abs_xy_b("B",b,step);
925  AbsXY abs_xy_c("C",c,step);
926 
927  AbsXX abs_xx_a("A",a,step);
928  AbsXX abs_xx_b("B",b,step);
929  AbsXX abs_xx_c("C",c,step);
930 
931  MinXYZ min_xyz_a("A",a,step);
932  MinXYZ min_xyz_b("B",b,step);
933  MinXYZ min_xyz_c("C",c,step);
934 
935  MinXXY min_xxy_a("A",a,step);
936  MinXXY min_xxy_b("B",b,step);
937  MinXXY min_xxy_c("C",c,step);
938 
939  MinXYX min_xyx_a("A",a,step);
940  MinXYX min_xyx_b("B",b,step);
941  MinXYX min_xyx_c("C",c,step);
942 
943  MinXYY min_xyy_a("A",a,step);
944  MinXYY min_xyy_b("B",b,step);
945  MinXYY min_xyy_c("C",c,step);
946 
947  MinXXX min_xxx_a("A",a,step);
948  MinXXX min_xxx_b("B",b,step);
949  MinXXX min_xxx_c("C",c,step);
950 
951  MaxXYZ max_xyz_a("A",a,step);
952  MaxXYZ max_xyz_b("B",b,step);
953  MaxXYZ max_xyz_c("C",c,step);
954 
955  MaxXXY max_xxy_a("A",a,step);
956  MaxXXY max_xxy_b("B",b,step);
957  MaxXXY max_xxy_c("C",c,step);
958 
959  MaxXYX max_xyx_a("A",a,step);
960  MaxXYX max_xyx_b("B",b,step);
961  MaxXYX max_xyx_c("C",c,step);
962 
963  MaxXYY max_xyy_a("A",a,step);
964  MaxXYY max_xyy_b("B",b,step);
965  MaxXYY max_xyy_c("C",c,step);
966 
967  MaxXXX max_xxx_a("A",a,step);
968  MaxXXX max_xxx_b("B",b,step);
969  MaxXXX max_xxx_c("C",c,step);
970 
976 
977  }
978 }}
979 
980 // STATISTICS: test-float
PowXYSol pow_xy_sol_c_3("C", c, 0, step)
Test for pow constraint with shared variables
Definition: arithmetic.cpp:418
MaxXYX max_xyx_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:412
PowXYSol pow_xy_sol_b_3("B", b, 0, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:285
Test for binary minimum constraint
Definition: arithmetic.cpp:542
MinXXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:612
static MaybeType eq(Gecode::FloatVal x, Gecode::FloatVal y)
Whether x and y are equal.
Definition: float.hpp:268
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:325
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:60
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:189
SqrXY sqr_xy_a("A", a, step)
SqrtXY sqrt_xy_a("A", a, step)
Test for multiplication constraint
Definition: arithmetic.cpp:54
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:670
PowXX pow_xx_c_2("C", c, 3, step)
Gecode::FloatNum step
Step for going to next solution.
Definition: float.hh:251
SqrXX sqr_xx_b("B", b, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:64
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:698
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:378
Test for n-ary minimmum constraint
Definition: arithmetic.cpp:708
void min(Home home, const IntVarArgs &x, IntVar y, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:91
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:88
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:273
SqrXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:282
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:552
PowXX pow_xx_b_2("B", b, 3, step)
void sqrt(Home home, IntVar x0, IntVar x1, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:286
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:102
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:490
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:488
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:666
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:682
MaxXXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:647
PowXY(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:375
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:173
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:561
MinXYX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:580
PowXY pow_xy_c_2("C", c, 3, step)
SqrtXX sqrt_xx_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:739
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:49
MultXXY mult_xxy_a("A", a, step)
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:41
MinXYX min_xyx_c("C", c, step)
Passing float variables.
Definition: float.hh:979
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:778
SqrXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:256
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:118
Test for multiplication constraint with shared variables when solution is ensured ...
Definition: arithmetic.cpp:115
DivSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:211
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:109
NRootXY nroot_xy_a_2("A", a, 3, step)
PowXY pow_xy_a_1("A", a, 2, step)
AbsXX abs_xx_c("C", c, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:365
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:199
MinXXY min_xxy_b("B", b, step)
void abs(Home home, IntVar x0, IntVar x1, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:39
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:495
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:235
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:422
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:442
MultXXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:176
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:425
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:228
MaxXYY max_xyy_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:240
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:157
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:686
NRootXX nroot_xx_a_3("A", a, 0, step)
Test for squaring constraint
Definition: arithmetic.cpp:234
static std::string str(Gecode::FloatRelType frt)
Map float relation to string.
Definition: float.hpp:194
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:121
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:654
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:57
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:429
SqrtXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:322
Test for binary maximum constraint with shared variables
Definition: arithmetic.cpp:660
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:310
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:695
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:135
SqrXYSol sqr_xy_sol_c("C", c, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:571
Float variable array.
Definition: float.hh:1030
Computation spaces.
Definition: core.hpp:1701
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:237
PowXYSol pow_xy_sol_c_2("C", c, 3, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:179
SqrXX sqr_xx_c("C", c, step)
MinNary(void)
Create and register test.
Definition: arithmetic.cpp:711
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:350
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:105
AbsXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:510
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:482
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:371
MinXYY min_xyy_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:163
Gecode::FloatVal c(-8, 8)
MaxNaryShared(void)
Create and register test.
Definition: arithmetic.cpp:771
Greater or equal ( )
Definition: float.hh:1073
PowXYSol(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:395
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:714
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:470
NRootXX nroot_xx_c_2("C", c, 3, step)
MinNaryShared(void)
Create and register test.
Definition: arithmetic.cpp:732
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
MaxNaryShared max_s_nary
Definition: arithmetic.cpp:974
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:663
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:382
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:344
MinXYZ min_xyz_c("C", c, step)
AbsXX abs_xx_b("B", b, step)
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:95
SqrtXX sqrt_xx_c("C", c, step)
SqrXY sqr_xy_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:259
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:631
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:263
Test for n-ary minimmum constraint with shared variables
Definition: arithmetic.cpp:729
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:183
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:619
AbsXY abs_xy_b("B", b, step)
SqrtXYSol sqrt_xy_sol_a("A", a, step)
MaxXYZ max_xyz_c("C", c, step)
MaxXYZ(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:628
PowXYSol pow_xy_sol_a_2("A", a, 3, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:548
Test for absolute value constraint with shared variables
Definition: arithmetic.cpp:526
MaxNary(void)
Create and register test.
Definition: arithmetic.cpp:750
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:93
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:102
Test for binary maximum constraint with shared variables
Definition: arithmetic.cpp:676
MinXYZ(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:545
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:599
SqrtXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:298
Div(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:192
MultXYY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:160
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:603
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:334
MaxXYZ max_xyz_a("A", a, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:301
DivSol div_sol_b("B", b, step)
PowXY pow_xy_b_1("B", b, 2, step)
Test for square root constraint where solution is ensured
Definition: arithmetic.cpp:319
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:448
MultXYZSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:76
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:587
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:577
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)
Test for nroot constraint where solution is ensured
Definition: arithmetic.cpp:457
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:141
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:536
PowXYSol pow_xy_sol_b_1("B", b, 2, step)
void sqr(Home home, IntVar x0, IntVar x1, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:272
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:151
void nroot(Home home, IntVar x0, int n, IntVar x1, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:319
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:73
PowXX pow_xx_b_3("B", b, 0, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:464
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:461
Test for squaring constraint where solution is ensured
Definition: arithmetic.cpp:253
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:692
Test for n-ary maximum constraint with shared variables
Definition: arithmetic.cpp:768
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:67
MinXYY min_xyy_c("C", c, step)
General test support.
Definition: afc.cpp:39
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:718
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:615
MinXYY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:596
Gecode::FloatVal b(9, 12)
NRootXY nroot_xy_c_3("C", c, 0, step)
NRootXX(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:492
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:127
Float value type.
Definition: float.hh:334
void max(Home home, const IntVarArgs &x, IntVar y, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:63
Test for square root constraint
Definition: arithmetic.cpp:295
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:79
NRootXY(const std::string &s, const Gecode::FloatVal &d, unsigned int _n, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:439
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:249
NRootXX nroot_xx_b_2("B", b, 3, step)
SqrXX sqr_xx_a("A", a, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:356
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:567
Test for n-ary maximum constraint
Definition: arithmetic.cpp:747
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:650
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:757
PowXX pow_xx_c_3("C", c, 0, step)
SqrXY sqr_xy_c("C", c, step)
Test for binary maximum constraint
Definition: arithmetic.cpp:625
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:583
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:402
DivSol div_sol_c("C", c, step)
Gecode::FloatVal dom
Domain of variables.
Definition: float.hh:249
SqrtXYSol sqrt_xy_sol_b("B", b, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:83
AbsXX abs_xx_a("A", a, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:753
NRootXX nroot_xx_a_1("A", a, 2, step)
void pow(Home home, IntVar x0, int n, IntVar x1, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:300
Test for pow constraint where solution is ensured
Definition: arithmetic.cpp:391
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:147
MaybeType
Type for comparisons and solutions.
Definition: float.hh:51
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:167
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:43
SqrXYSol sqr_xy_sol_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:244
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:517
Gecode::FloatVal a(-8, 5)
PowXX pow_xx_b_1("B", b, 2, step)
Test for nroot constraint
Definition: arithmetic.cpp:435
MinXXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:564
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:513
MultXYY mult_xyy_a("A", a, step)
MinNaryShared min_s_nary
Definition: arithmetic.cpp:972
NRootXYSol nroot_xy_sol_c_1("C", c, 2, step)
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:593
Test for multiplication constraint with shared variables
Definition: arithmetic.cpp:99
NRootXY nroot_xy_b_2("B", b, 3, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:774
MultXXX mult_xxx_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:109
PowXX pow_xx_a_3("A", a, 0, step)
Test for absolute value constraint
Definition: arithmetic.cpp:507
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:398
MultXXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:118
PowXY pow_xy_a_2("A", a, 3, step)
Test for binary maximum constraint with shared variables
Definition: arithmetic.cpp:644
SqrtXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:353
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:702
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:214
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)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:218
PowXYSol pow_xy_sol_a_3("A", a, 0, step)
DivSol div_sol_a("A", a, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Definition: arithmetic.cpp:501
Test for squaring constraint with shared variables
Definition: arithmetic.cpp:279
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)
MultXYZ mult_xyz_a("A", a, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
Definition: arithmetic.cpp:125
double FloatNum
Floating point number base type.
Definition: float.hh:106
Test for binary minimum constraint with shared variables
Definition: arithmetic.cpp:609
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:208
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:289
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:144
NRootXY nroot_xy_c_1("C", c, 2, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:532
AbsXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:529
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:635
bool flip(void)
Flip a coin and return true or false randomly.
Definition: float.hpp:273
NRootXX nroot_xx_c_1("C", c, 2, step)
Base class for assignments
Definition: float.hh:80
MinXXX min_xxx_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:195
MultXXYSol mult_xxy_sol_b("B", b, step)
const Gecode::FloatNum step2
Definition: arithmetic.cpp:786
MaxXYY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Definition: arithmetic.cpp:679
NRootXX nroot_xx_b_1("B", b, 2, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Definition: arithmetic.cpp:735
MultXXY mult_xxy_c("C", c, step)
SqrtXYSol sqrt_xy_sol_c("C", c, step)
MaxXXY max_xxy_b("B", b, step)