43 #ifdef GECODE_HAS_MPFR
48 namespace Test {
namespace Float {
51 namespace Transcendental {
61 return eq(
exp(x[0]), x[1]);
80 return eq(
exp(x[0]), x[1]);
106 return eq(
exp(x[0]), x[0]);
122 if (x[0].
max() < 0.0)
124 return eq(
log(x[0]), x[1]);
143 if (x[0].
max() < 0.0)
145 return eq(
log(x[0]), x[1]);
149 if (x[0].
max() < 0.0)
return false;
172 if (x[0].
max() < 0.0)
174 return eq(
log(x[0]), x[0]);
191 if ((x[0].
max() <= 0.0) || (base <= 0.0))
193 return eq(
log(x[0]) /
log(base), x[1]);
210 if ((x[0].
max() <= 0.0) || (base <= 0.0))
212 return eq(
log(x[0]) /
log(base), x[1]);
216 if ((x[0].
max() <= 0.0) || (base <= 0.0))
241 if ((x[0].
max() <= 0.0) || (base <= 0.0))
243 return eq(
log(x[0]) /
log(base), x[0]);
262 return eq(
exp(x[0] *
log(base)), x[1]);
281 return eq(
exp(x[0] *
log(base)), x[1]);
285 if (base <= 0.0)
return false;
309 if ((x[0].
max() <= 0.0) || (base <= 0.0))
311 return eq(
exp(x[0] *
log(base)), x[0]);
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.
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)
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post constraint on x.
const FloatNum max
Largest allowed float value.
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$.
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.
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.
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
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)
Test for logarithm constraint where solution is ensured
virtual MaybeType solution(const Assignment &x) const
Test whether x is solution
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.
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.
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.
const Gecode::FloatNum step2
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
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 .
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.
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.
Base class for assignments
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)