Generated on Sat Feb 7 2015 02:01:32 for Gecode by doxygen 1.8.9.1
transcendental.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 #include <gecode/minimodel.hh>
42 
43 #ifdef GECODE_HAS_MPFR
44 
45 #include <cmath>
46 #include <algorithm>
47 
48 namespace Test { namespace Float {
49 
51  namespace Transcendental {
52 
54  class ExpXY : public Test {
55  public:
57  ExpXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
58  : Test("Transcendental::Exp::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
60  virtual MaybeType solution(const Assignment& x) const {
61  return eq(exp(x[0]), x[1]);
62  }
64  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
65  if (flip())
66  Gecode::exp(home, x[0], x[1]);
67  else
68  Gecode::rel(home, exp(x[0]) == x[1]);
69  }
70  };
71 
73  class ExpXYSol : public Test {
74  public:
76  ExpXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
77  : Test("Transcendental::Exp::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
79  virtual MaybeType solution(const Assignment& x) const {
80  return eq(exp(x[0]), x[1]);
81  }
83  virtual bool extendAssignement(Assignment& x) const {
84  Gecode::FloatVal d = exp(x[0]);
85  if (Gecode::Float::subset(d, dom)) {
86  x.set(1, d);
87  return true;
88  } else {
89  return false;
90  }
91  }
93  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
94  Gecode::exp(home, x[0], x[1]);
95  }
96  };
97 
99  class ExpXX : public Test {
100  public:
102  ExpXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
103  : Test("Transcendental::Exp::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
105  virtual MaybeType solution(const Assignment& x) const {
106  return eq(exp(x[0]), x[0]);
107  }
109  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
110  Gecode::exp(home, x[0], x[0]);
111  }
112  };
113 
115  class LogXY : public Test {
116  public:
118  LogXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
119  : Test("Transcendental::Log::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false) {}
121  virtual MaybeType solution(const Assignment& x) const {
122  if (x[0].max() < 0.0)
123  return MT_FALSE;
124  return eq(log(x[0]), x[1]);
125  }
127  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
128  if (flip())
129  Gecode::log(home, x[0], x[1]);
130  else
131  Gecode::rel(home, log(x[0]) == x[1]);
132  }
133  };
134 
136  class LogXYSol : public Test {
137  public:
139  LogXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
140  : Test("Transcendental::Log::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false) {}
142  virtual MaybeType solution(const Assignment& x) const {
143  if (x[0].max() < 0.0)
144  return MT_FALSE;
145  return eq(log(x[0]), x[1]);
146  }
148  virtual bool extendAssignement(Assignment& x) const {
149  if (x[0].max() < 0.0) return false;
150  Gecode::FloatVal d = log(x[0]);
151  if (Gecode::Float::subset(d, dom)) {
152  x.set(1, d);
153  return true;
154  } else {
155  return false;
156  }
157  }
159  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
160  Gecode::log(home, x[0], x[1]);
161  }
162  };
163 
165  class LogXX : public Test {
166  public:
168  LogXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st)
169  : Test("Transcendental::Log::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false) {}
171  virtual MaybeType solution(const Assignment& x) const {
172  if (x[0].max() < 0.0)
173  return MT_FALSE;
174  return eq(log(x[0]), x[0]);
175  }
177  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
178  Gecode::log(home, x[0], x[0]);
179  }
180  };
181 
183  class LogNXY : public Test {
184  Gecode::FloatNum base;
185  public:
187  LogNXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st)
188  : Test("Transcendental::Log::N::"+str(_base)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), base(_base) {}
190  virtual MaybeType solution(const Assignment& x) const {
191  if ((x[0].max() <= 0.0) || (base <= 0.0))
192  return MT_FALSE;
193  return eq(log(x[0]) / log(base), x[1]);
194  }
196  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
197  Gecode::log(home, base, x[0], x[1]);
198  }
199  };
200 
202  class LogNXYSol : public Test {
203  Gecode::FloatNum base;
204  public:
206  LogNXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st)
207  : Test("Transcendental::Log::N::"+str(_base)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), base(_base) {}
209  virtual MaybeType solution(const Assignment& x) const {
210  if ((x[0].max() <= 0.0) || (base <= 0.0))
211  return MT_FALSE;
212  return eq(log(x[0]) / log(base), x[1]);
213  }
215  virtual bool extendAssignement(Assignment& x) const {
216  if ((x[0].max() <= 0.0) || (base <= 0.0))
217  return false;
218  Gecode::FloatVal d = log(x[0])/log(base);
219  if (Gecode::Float::subset(d, dom)) {
220  x.set(1, d);
221  return true;
222  } else {
223  return false;
224  }
225  }
227  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
228  Gecode::log(home, base, x[0], x[1]);
229  }
230  };
231 
233  class LogNXX : public Test {
234  Gecode::FloatNum base;
235  public:
237  LogNXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st)
238  : Test("Transcendental::Log::N::"+str(_base)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), base(_base) {}
240  virtual MaybeType solution(const Assignment& x) const {
241  if ((x[0].max() <= 0.0) || (base <= 0.0))
242  return MT_FALSE;
243  return eq(log(x[0]) / log(base), x[0]);
244  }
246  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
247  Gecode::log(home, base, x[0], x[0]);
248  }
249  };
250 
252  class PowXY : public Test {
253  Gecode::FloatNum base;
254  public:
256  PowXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st)
257  : Test("Transcendental::Pow::N::"+str(_base)+"::XY::"+s,2,d,st,CPLT_ASSIGNMENT,false), base(_base) {}
259  virtual MaybeType solution(const Assignment& x) const {
260  if (base <= 0.0)
261  return MT_FALSE;
262  return eq(exp(x[0] * log(base)), x[1]);
263  }
265  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
266  Gecode::pow(home, base, x[0], x[1]);
267  }
268  };
269 
271  class PowXYSol : public Test {
272  Gecode::FloatNum base;
273  public:
275  PowXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st)
276  : Test("Transcendental::Pow::N::"+str(_base)+"::XY::Sol::"+s,2,d,st,EXTEND_ASSIGNMENT,false), base(_base) {}
278  virtual MaybeType solution(const Assignment& x) const {
279  if (base <= 0.0)
280  return MT_FALSE;
281  return eq(exp(x[0] * log(base)), x[1]);
282  }
284  virtual bool extendAssignement(Assignment& x) const {
285  if (base <= 0.0) return false;
286  Gecode::FloatVal d = exp(x[0]*log(base));
287  if (Gecode::Float::subset(d, dom)) {
288  x.set(1, d);
289  return true;
290  } else {
291  return false;
292  }
293  }
295  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
296  Gecode::pow(home, base, x[0], x[1]);
297  }
298  };
299 
301  class PowXX : public Test {
302  Gecode::FloatNum base;
303  public:
305  PowXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st)
306  : Test("Transcendental::Pow::N::"+str(_base)+"::XX::"+s,1,d,st,CPLT_ASSIGNMENT,false), base(_base) {}
308  virtual MaybeType solution(const Assignment& x) const {
309  if ((x[0].max() <= 0.0) || (base <= 0.0))
310  return MT_FALSE;
311  return eq(exp(x[0] * log(base)), x[0]);
312  }
314  virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
315  Gecode::pow(home, base, x[0], x[0]);
316  }
317  };
318 
319  const Gecode::FloatNum step = 0.15;
321  Gecode::FloatVal a(-8,5);
322  Gecode::FloatVal b(9,12);
323  Gecode::FloatVal c(-8,8);
324 
325  ExpXY exp_xy_a("A",a,step);
326  ExpXY exp_xy_b("B",b,step);
327  ExpXY exp_xy_c("C",c,step);
328 
329  ExpXYSol exp_xy_sol_a("A",a,step);
330  ExpXYSol exp_xy_sol_b("B",b,step);
331  ExpXYSol exp_xy_sol_c("C",c,step);
332 
333  ExpXX exp_xx_a("A",a,step);
334  ExpXX exp_xx_b("B",b,step);
335  ExpXX exp_xx_c("C",c,step);
336 
337  LogXY log_xy_a("A",a,step);
338  LogXY log_xy_b("B",b,step);
339  LogXY log_xy_c("C",c,step);
340 
341  LogXYSol log_xy_sol_a("A",a,step);
342  LogXYSol log_xy_sol_b("B",b,step);
343  LogXYSol log_xy_sol_c("C",c,step);
344 
345  LogXX log_xx_a("A",a,step);
346  LogXX log_xx_b("B",b,step);
347  LogXX log_xx_c("C",c,step);
348 
349  LogNXY logn_xy_a_1("A",a,-1.5,step);
350  LogNXY logn_xy_b_1("B",b,-1.5,step);
351  LogNXY logn_xy_c_1("C",c,-1.5,step);
352 
353  LogNXYSol logn_xy_sol_a_1("A",a,-1.5,step);
354  LogNXYSol logn_xy_sol_b_1("B",b,-1.5,step);
355  LogNXYSol logn_xy_sol_c_1("C",c,-1.5,step);
356 
357  LogNXX logn_xx_a_1("A",a,-1.5,step);
358  LogNXX logn_xx_b_1("B",b,-1.5,step);
359  LogNXX logn_xx_c_1("C",c,-1.5,step);
360 
361  LogNXY logn_xy_a_2("A",a,1.5,step);
362  LogNXY logn_xy_b_2("B",b,1.5,step);
363  LogNXY logn_xy_c_2("C",c,1.5,step);
364 
365  LogNXYSol logn_xy_sol_a_2("A",a,1.5,step);
366  LogNXYSol logn_xy_sol_b_2("B",b,1.5,step);
367  LogNXYSol logn_xy_sol_c_2("C",c,1.5,step);
368 
369  LogNXX logn_xx_a_2("A",a,1.5,step);
370  LogNXX logn_xx_b_2("B",b,1.5,step);
371  LogNXX logn_xx_c_2("C",c,1.5,step);
372 
373  LogNXY logn_xy_a_3("A",a,0,step);
374  LogNXY logn_xy_b_3("B",b,0,step);
375  LogNXY logn_xy_c_3("C",c,0,step);
376 
377  LogNXYSol logn_xy_sol_a_3("A",a,0,step);
378  LogNXYSol logn_xy_sol_b_3("B",b,0,step);
379  LogNXYSol logn_xy_sol_c_3("C",c,0,step);
380 
381  LogNXX logn_xx_a_3("A",a,0,step);
382  LogNXX logn_xx_b_3("B",b,0,step);
383  LogNXX logn_xx_c_3("C",c,0,step);
384 
385  PowXY pow_xy_a_1("A",a,-1.5,step);
386  PowXY pow_xy_b_1("B",b,-1.5,step);
387  PowXY pow_xy_c_1("C",c,-1.5,step);
388 
389  PowXYSol pow_xy_sol_a_1("A",a,-1.5,step);
390  PowXYSol pow_xy_sol_b_1("B",b,-1.5,step);
391  PowXYSol pow_xy_sol_c_1("C",c,-1.5,step);
392 
393  PowXX pow_xx_a_1("A",a,-1.5,step);
394  PowXX pow_xx_b_1("B",b,-1.5,step);
395  PowXX pow_xx_c_1("C",c,-1.5,step);
396 
397  PowXY pow_xy_a_2("A",a,1.5,step);
398  PowXY pow_xy_b_2("B",b,1.5,step);
399  PowXY pow_xy_c_2("C",c,1.5,step);
400 
401  PowXYSol pow_xy_sol_a_2("A",a,1.5,step);
402  PowXYSol pow_xy_sol_b_2("B",b,1.5,step);
403  PowXYSol pow_xy_sol_c_2("C",c,1.5,step);
404 
405  PowXX pow_xx_a_2("A",a,1.5,step);
406  PowXX pow_xx_b_2("B",b,1.5,step);
407  PowXX pow_xx_c_2("C",c,1.5,step);
408 
409  PowXY pow_xy_a_3("A",a,0,step);
410  PowXY pow_xy_b_3("B",b,0,step);
411  PowXY pow_xy_c_3("C",c,0,step);
412 
413  PowXYSol pow_xy_sol_a_3("A",a,0,step);
414  PowXYSol pow_xy_sol_b_3("B",b,0,step);
415  PowXYSol pow_xy_sol_c_3("C",c,0,step);
416 
417  PowXX pow_xx_a_3("A",a,0,step);
418  PowXX pow_xx_b_3("B",b,0,step);
419  PowXX pow_xx_c_3("C",c,0,step);
420 
422 
423  }
424 }}
425 
426 #endif
427 // STATISTICS: test-float
LogNXY logn_xy_a_2("A", a, 1.5, step)
static MaybeType eq(Gecode::FloatVal x, Gecode::FloatVal y)
Whether x and y are equal.
Definition: float.hpp:272
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
PowXY pow_xy_a_3("A", a, 0, step)
LogNXX logn_xx_b_3("B", b, 0, step)
PowXYSol pow_xy_sol_c_1("C", c,-1.5, step)
PowXX pow_xx_a_3("A", a, 0, step)
LogXX log_xx_c("C", c, step)
Test for exponent constraint
ExpXY exp_xy_b("B", b, step)
LogNXX logn_xx_c_1("C", c,-1.5, step)
LogXYSol log_xy_sol_c("C", c, step)
LogNXX logn_xx_b_1("B", b,-1.5, step)
PowXYSol pow_xy_sol_b_2("B", b, 1.5, step)
bool subset(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:494
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:151
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
const FloatNum max
Largest allowed float value.
Definition: float.hh:831
PowXX pow_xx_b_2("B", b, 1.5, step)
ExpXX exp_xx_c("C", c, step)
Gecode::FloatVal a(-8, 5)
PowXYSol pow_xy_sol_a_1("A", a,-1.5, step)
LogXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
PowXY pow_xy_a_2("A", a, 1.5, step)
PowXX pow_xx_b_1("B", b,-1.5, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
LogNXYSol logn_xy_sol_b_1("B", b,-1.5, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
LogNXYSol logn_xy_sol_c_3("C", c, 0, step)
ExpXYSol exp_xy_sol_a("A", a, step)
LogNXX logn_xx_a_3("A", a, 0, step)
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:117
PowXX pow_xx_b_3("B", b, 0, step)
PowXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum _base, Gecode::FloatNum st)
Create and register test.
LogNXY logn_xy_c_1("C", c,-1.5, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
LogNXY logn_xy_b_1("B", b,-1.5, step)
LogNXY logn_xy_b_3("B", b, 0, step)
PowXY pow_xy_b_3("B", b, 0, step)
LogNXYSol logn_xy_sol_b_3("B", b, 0, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
ExpXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
PowXY pow_xy_b_2("B", b, 1.5, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
LogNXYSol logn_xy_sol_a_3("A", a, 0, step)
static std::string str(Gecode::FloatRelType frt)
Map float relation to string.
Definition: float.hpp:198
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
LogNXY logn_xy_c_3("C", c, 0, step)
PowXX pow_xx_a_1("A", a,-1.5, step)
PowXX pow_xx_c_2("C", c, 1.5, step)
LogNXYSol logn_xy_sol_b_2("B", b, 1.5, step)
LogXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
ExpXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Float variable array.
Definition: float.hh:1016
Computation spaces.
Definition: core.hpp:1362
PowXY pow_xy_b_1("B", b,-1.5, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
PowXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum _base, Gecode::FloatNum st)
Create and register test.
PowXYSol pow_xy_sol_a_3("A", a, 0, step)
Test for logarithm constraint
Gecode::IntSet d(v, 7)
virtual void set(int i, const Gecode::FloatVal &val)=0
Set assignment to value val for variable i.
PowXYSol pow_xy_sol_b_1("B", b,-1.5, step)
LogNXY logn_xy_b_2("B", b, 1.5, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
ExpXX exp_xx_b("B", b, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
LogXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
Test for logarithm base n constraint with shared variables
LogNXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum _base, Gecode::FloatNum st)
Create and register test.
LogNXX(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum _base, Gecode::FloatNum st)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Test for pow exponent n constraint with shared variables
ExpXY exp_xy_a("A", a, step)
ExpXYSol(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum st)
Create and register test.
LogNXX logn_xx_a_1("A", a,-1.5, step)
LogNXX logn_xx_c_2("C", c, 1.5, step)
Gecode::FloatVal b(9, 12)
LogNXX logn_xx_c_3("C", c, 0, step)
LogNXY logn_xy_c_2("C", c, 1.5, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
ExpXY exp_xy_c("C", c, step)
Test for logarithm base n constraint where solution is ensured
PowXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum _base, Gecode::FloatNum st)
Create and register test.
LogNXYSol logn_xy_sol_a_2("A", a, 1.5, step)
LogNXX logn_xx_b_2("B", b, 1.5, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
PowXYSol pow_xy_sol_c_2("C", c, 1.5, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
PowXY pow_xy_c_1("C", c,-1.5, step)
LogXYSol log_xy_sol_b("B", b, step)
LogNXY logn_xy_a_3("A", a, 0, step)
General test support.
Definition: afc.cpp:43
Test for logarithm constraint where solution is ensured
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
Float value type.
Definition: float.hh:321
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
ExpXX exp_xx_a("A", a, step)
Test for pow exponent n constraint where solution is ensured
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
PowXY pow_xy_c_3("C", c, 0, step)
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
PowXX pow_xx_c_1("C", c,-1.5, step)
Test for exponent constraint with shared variables
Gecode::FloatVal dom
Domain of variables.
Definition: float.hh:247
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
PowXY pow_xy_c_2("C", c, 1.5, step)
MaybeType
Type for comparisons and solutions.
Definition: float.hh:55
const Gecode::FloatNum step2
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:47
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
LogNXY(const std::string &s, const Gecode::FloatVal &d, Gecode::FloatNum _base, Gecode::FloatNum st)
Create and register test.
Test for logarithm base n constraint
ExpXYSol exp_xy_sol_c("C", c, step)
PowXYSol pow_xy_sol_b_3("B", b, 0, step)
LogXY log_xy_a("A", a, step)
PowXX pow_xx_a_2("A", a, 1.5, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
LogXX log_xx_b("B", b, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
Gecode::FloatVal c(-8, 8)
ExpXYSol exp_xy_sol_b("B", b, step)
Test for pow exponent n constraint
LogNXYSol logn_xy_sol_c_2("C", c, 1.5, step)
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
const Gecode::FloatNum step
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:144
PowXYSol pow_xy_sol_a_2("A", a, 1.5, step)
LogNXYSol logn_xy_sol_c_1("C", c,-1.5, step)
LogNXYSol logn_xy_sol_a_1("A", a,-1.5, step)
PowXY pow_xy_a_1("A", a,-1.5, step)
double FloatNum
Floating point number base type.
Definition: float.hh:108
LogXX log_xx_a("A", a, step)
LogXYSol log_xy_sol_a("A", a, step)
Test for exponent constraint where solution is ensured
PowXYSol pow_xy_sol_c_3("C", c, 0, step)
virtual bool extendAssignement(Assignment &x) const
Extend assignment x.
LogNXY logn_xy_a_1("A", a,-1.5, step)
LogXY log_xy_c("C", c, step)
bool flip(void)
Flip a coin and return true or false randomly.
Definition: float.hpp:277
Base class for assignments
Definition: float.hh:84
LogNXX logn_xx_a_2("A", a, 1.5, step)
Test for logarithm constraint with shared variables
PowXX pow_xx_c_3("C", c, 0, step)
LogXY log_xy_b("B", b, step)