38 #ifndef __GECODE_FLOAT_HH__ 39 #define __GECODE_FLOAT_HH__ 54 #if !defined(GECODE_STATIC_LIBS) && \ 55 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER)) 57 #ifdef GECODE_BUILD_FLOAT 58 #define GECODE_FLOAT_EXPORT __declspec( dllexport ) 60 #define GECODE_FLOAT_EXPORT __declspec( dllimport ) 65 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY 66 #define GECODE_FLOAT_EXPORT __attribute__ ((visibility("default"))) 68 #define GECODE_FLOAT_EXPORT 74 #ifndef GECODE_BUILD_FLOAT 75 #define GECODE_LIBRARY_NAME "Float" 80 #include <boost/numeric/interval.hpp> 128 namespace Gecode {
namespace Float {
131 #if defined(_MSC_VER) && (defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP > 0))) 138 typedef boost::numeric::interval_lib::rounded_arith_std<FloatNum>
144 typedef boost::numeric::interval_lib::rounded_arith_opp<FloatNum>
198 #ifdef GECODE_HAS_MPFR 281 namespace Gecode {
namespace Float {
369 template<
class Char,
class Traits>
370 friend std::basic_ostream<Char,Traits>&
371 operator <<(std::basic_ostream<Char,Traits>& os,
const FloatVal&
x);
386 #ifdef GECODE_HAS_MPFR 416 typedef boost::numeric::interval_lib::save_state<Float::Rounding>
R;
418 typedef boost::numeric::interval_lib::checking_strict<FloatNum>
P;
420 typedef boost::numeric::interval
422 boost::numeric::interval_lib::policies<R, P> >
436 FloatVal(
const FloatNum&
l,
const FloatNum&
u);
441 FloatVal& operator =(
const FloatNum& n);
446 void assign(FloatNum
const &
l, FloatNum
const &
u);
451 FloatNum
min(
void)
const;
454 FloatNum
max(
void)
const;
456 FloatNum
size(
void)
const;
458 FloatNum med(
void)
const;
463 bool tight(
void)
const;
468 bool in(FloatNum n)
const;
470 bool zero_in(
void)
const;
487 FloatVal& operator +=(
const FloatNum& n);
490 FloatVal& operator -=(
const FloatNum& n);
492 FloatVal& operator *=(
const FloatNum& n);
494 FloatVal& operator /=(
const FloatNum& n);
677 template<
class Char,
class Traits>
678 std::basic_ostream<Char,Traits>&
679 operator <<(std::basic_ostream<Char,Traits>& os,
const FloatVal&
x);
738 #ifdef GECODE_HAS_MPFR 835 namespace Gecode {
namespace Float {
939 template<
class Char,
class Traits>
940 std::basic_ostream<Char,Traits>&
941 operator <<(std::basic_ostream<Char,Traits>& os,
const FloatVar&
x);
963 template<
class InputIterator>
992 template<
class InputIterator>
1215 #ifdef GECODE_HAS_MPFR 1438 typedef std::function<bool(const Space& home, FloatVar x, int i)>
1451 typedef std::function<double(const Space& home, FloatVar x, int i)>
1477 typedef std::function<FloatNumBranch(const Space& home, FloatVar x, int i)>
1491 typedef std::function<void(
Space& home,
unsigned int a,
1717 Select select(
void)
const;
1837 Select select(
void)
const;
1891 Select select(
void)
const;
2064 virtual void init(
const Space& home,
const FloatTraceRecorder&
t);
2066 virtual void prune(
const Space& home,
const FloatTraceRecorder&
t,
2069 virtual void fix(
const Space& home,
const FloatTraceRecorder&
t);
2071 virtual void fail(
const Space& home,
const FloatTraceRecorder&
t);
2073 virtual void done(
const Space& home,
const FloatTraceRecorder&
t);
2087 FloatTracer&
t = StdFloatTracer::def);
2095 FloatTracer&
t = StdFloatTracer::def);
boost::numeric::interval_lib::checking_strict< FloatNum > P
Used checking policy.
#define GECODE_FLOAT_EXPORT
FloatNum pi_half_upper(void)
Return upper bound of .
Select values greater than mean of smallest and largest value.
FloatVal operator-(const FloatVal &x)
With smallest degree divided by domain size.
SetExpr singleton(const LinIntExpr &e)
Singleton expression.
FloatVarBranch FLOAT_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Select variable with smallest CHB Q-score divided by domain size.
FloatNum atanh_down(FloatNum x)
Return lower bound of hyperbolic arctangent of x (domain: )
FloatNum tanh_up(FloatNum x)
Return upper bound of hyperbolic tangent of x (domain: )
Variables as interfaces to variable implementations.
FloatNum add_down(FloatNum x, FloatNum y)
Return lower bound of x plus y (domain: )
FloatNum asinh_down(FloatNum x)
Return lower bound of hyperbolic arcsine of x (domain: )
Select
Which value selection.
Tracer that process view trace information.
Combine variable selection criteria for tie-breaking.
FloatVarArgs(int n)
Allocate array with n elements.
Which values to select for branching first.
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatVarArgs(const std::vector< FloatVar > &a)
Initialize from vector a.
With smallest domain size.
FloatNum div_up(FloatNum x, FloatNum y)
Return upper bound of x divided y (domain: )
FloatNum mul_down(FloatNum x, FloatNum y)
Return lower bound of x times y (domain: )
FloatValBranch FLOAT_VAL_SPLIT_MAX(void)
Select values greater than mean of smallest and largest value.
FloatVarArgs(const FloatVarArgs &a)
Initialize from variable argument array a (copy elements)
bool valid(const FloatVal &n)
Return whether float n is a valid number.
With largest domain size.
FloatNum cosh_down(FloatNum x)
Return lower bound of hyperbolic cosine of x (domain: )
bool subset(const FloatVal &x, const FloatVal &y)
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
With smallest accumulated failure count divided by domain size.
FloatNum asinh_up(FloatNum x)
Return upper bound of hyperbolic arcsine of x (domain: )
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
const FloatNum max
Largest allowed float value.
FloatNum int_down(FloatNum x)
Return next downward-rounded integer of x (domain: )
FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl)
Select variable with largest CHB Q-score divided by domain size.
FloatVal operator/(const FloatVal &x, const FloatVal &y)
ViewTraceRecorder< Float::FloatView > FloatTraceRecorder
Trace recorder for float variables.
FloatAssign FLOAT_ASSIGN_MAX(void)
Select median value of the upper part.
Recording actions for float variables.
FloatNum tanh_down(FloatNum x)
Return lower bound of hyperbolic tangent of x (domain: )
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
FloatVal fmod(const FloatVal &x, const FloatVal &y)
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smalllest accumulated failure count divided by domain size with decay factor d...
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
boost::numeric::interval_lib::save_state< Float::Rounding > R
Used rounding policies.
bool overlap(const FloatVal &x, const FloatVal &y)
Select median value of a randomly chosen part.
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
FloatAssign FLOAT_ASSIGN_MIN(void)
Select median value of the lower part.
Select s
Which value to select.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
FloatVal hull(const FloatVal &x, const FloatVal &y)
FloatNum sqrt_down(FloatNum x)
Return lower bound of square root of x (domain: )
With largest accumulated failure count.
FloatNum asin_up(FloatNum x)
Return upper bound of arcsine of x (domain: )
Which variable to select for branching.
Select values randomly which are not greater or not smaller than mean of largest and smallest value...
Select
Which variable selection.
FloatNum sinh_up(FloatNum x)
Return upper bound of hyperbolic sine of x (domain: )
FloatNum sqrt_up(FloatNum x)
Return upper bound of square root of x (domain: )
With highest CHB Q-score.
FloatValBranch FLOAT_VAL(FloatBranchVal v, FloatBranchCommit c)
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest action divided by domain size with decay factor d.
ExecStatus prune(Space &home, ViewArray< VX > &x, ConstIntView)
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Select s
Which value to select.
FloatValBranch FLOAT_VAL_SPLIT_RND(Rnd r)
Select values randomly which are not greater or not smaller than mean of largest and smallest value...
With smallest action divided by domain size.
FloatValImpType x
Implementation of float value.
std::string expand(Gecode::IntRelType irt)
Expand relation to abbreviation.
FloatNum pi_twice_lower(void)
Return lower bound of .
Gecode::FloatVal c(-8, 8)
FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest domain size.
FloatNum log_down(FloatNum x)
Return lower bound of logarithm of x (domain: )
int p
Number of positive literals for node type.
Standard float variable tracer.
bool proper_subset(const FloatVal &x, const FloatVal &y)
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Base-class for branchers.
FloatNum n
The middle value for branching.
Class for AFC (accumulated failure count) management.
FloatNum asin_down(FloatNum x)
Return lower bound of arcsine of x (domain: )
int n
Number of negative literals for node type.
FloatNum sin_up(FloatNum x)
Return upper bound of sine of x (domain: )
FloatNum int_up(FloatNum x)
Return next upward-rounded integer of x (domain: )
Argument array for non-primitive types.
FloatVarArgs(const VarArray< FloatVar > &a)
Initialize from variable array a (copy elements)
FloatAssign FLOAT_ASSIGN_RND(Rnd r)
Select median value of a randomly chosen part.
FloatVal sinh(const FloatVal &x)
FloatNum pi_twice_upper(void)
Return upper bound of .
FloatVal intersect(const FloatVal &x, const FloatVal &y)
Value description class for branching.
FloatVal operator+(const FloatVal &x)
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatRelType
Relation types for floats.
FloatNum log_up(FloatNum x)
Return upper bound of logarithm of x (domain: )
bool operator!=(const FloatVal &x, const FloatVal &y)
New view Float::FloatView n
FloatNum cos_down(FloatNum x)
Return lower bound of cosine of x (domain: )
Output stream to use std::ostream & os
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
Class for CHB management.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Reification specification.
bool l
Whether to try the lower or upper half first.
FloatVal cosh(const FloatVal &x)
FloatNum pi_half_lower(void)
Return lower bound of .
FloatValBranch FLOAT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
union Gecode::@585::NNF::@62 u
Union depending on nodetype t.
std::function< void(Space &home, unsigned int a, FloatVar x, int i, FloatNumBranch nl)> FloatBranchCommit
Branch commit function type for float variables.
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
FloatVarBranch FLOAT_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
FloatNum atanh_up(FloatNum x)
Return upper bound of hyperbolic arctangent of x (domain: )
With largest accumulated failure count divided by domain size.
void asin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
ViewTracer< Float::FloatView > FloatTracer
Tracer for float variables.
With smallest CHB Q-score divided by domain size.
Select values not greater than mean of smallest and largest value.
FloatVarArgs(InputIterator first, InputIterator last)
Initialize from InputIterator first and last.
Floating point rounding policy.
Random (uniform, for tie breaking)
FloatNum tan_up(FloatNum x)
Return upper bound of tangent of x (domain: )
Recording CHB for float variables.
FloatNum atan_up(FloatNum x)
Return upper bound of arctangent of x (domain: )
Float view for float variables.
FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Boolean integer variables.
FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest min.
Post propagator for SetVar SetOpType SetVar SetRelType r
void check(const FloatVal &n, const char *l)
Check whether float n is a valid number, otherwise throw out of limits exception with information l...
Propagator for recording view trace information.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatNum cos_up(FloatNum x)
Return upper bound of cosine of x (domain: )
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Trace delta information for float variables.
FloatNum acosh_up(FloatNum x)
Return upper bound of hyperbolic arccosine of x (domain: )
Post propagator for SetVar SetOpType SetVar y
Value branching information.
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
const double base
Base for geometric restart sequence.
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Variable branching information.
FloatNum atan_down(FloatNum x)
Return lower bound of arctangent of x (domain: )
Rounding(void)
Default constructor (configures full rounding mode)
Generic domain change information to be supplied to advisors.
FloatNum sub_down(FloatNum x, FloatNum y)
Return lower bound of x minus y (domain: )
boost::numeric::interval_lib::rounded_arith_opp< FloatNum > RoundingBase
Rounding Base class (optimized version)
Select median value of the upper part.
FloatNum acosh_down(FloatNum x)
Return lower bound of hyperbolic arccosine of x (domain: )
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
With smallest accumulated failure count.
Select
Which value selection.
Select s
Which variable to select.
bool operator>=(const FloatVal &x, const FloatVal &y)
FloatVal acosh(const FloatVal &x)
FloatVarBranch FLOAT_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
FloatNum div_down(FloatNum x, FloatNum y)
Return lower bound of x divided by y (domain: )
FloatNum exp_up(FloatNum x)
Return upper bound of exponential of x (domain: )
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
FloatNum acos_up(FloatNum x)
Return upper bound of arccossine of x (domain: )
std::function< bool(const Space &home, FloatVar x, int i)> FloatBranchFilter
Branch filter function type for float variables.
With largest degree divided by domain size.
FloatVarBranch FLOAT_VAR_ACTION_MIN(double d, BranchTbl tbl)
Select variable with lowest action with decay factor d.
FloatVal atanh(const FloatVal &x)
FloatVal asinh(const FloatVal &x)
FloatVarBranch FLOAT_VAR_CHB_MIN(BranchTbl tbl)
Select variable with lowest CHB Q-score.
Which values to select for assignment.
boost::numeric::interval< FloatNum, boost::numeric::interval_lib::policies< R, P > > FloatValImpType
Implementation type for float value.
Delta information const Delta & d
Post propagator for SetVar x
FloatNum cosh_up(FloatNum x)
Return upper bound of hyperbolic cosine of x (domain: )
FloatNum exp_down(FloatNum x)
Return lower bound of exponential of x (domain: )
FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c)
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
Select median value of the lower part.
bool operator>(const FloatVal &x, const FloatVal &y)
FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest min.
FloatNum sinh_down(FloatNum x)
Return lower bound of hyperbolic sine of x (domain: )
FloatNum sub_up(FloatNum x, FloatNum y)
Return upper bound of x minus y (domain: )
std::function< void(const Space &home, const Brancher &b, unsigned int a, FloatVar x, int i, const FloatNumBranch &n, std::ostream &o)> FloatVarValPrint
Function type for explaining branching alternatives for float variables.
bool operator<(const FloatVal &x, const FloatVal &y)
bool operator==(const FloatVal &x, const FloatVal &y)
bool operator<=(const FloatVal &x, const FloatVal &y)
With largest action divided by domain size.
FloatNum add_up(FloatNum x, FloatNum y)
Return upper bound of x plus y (domain: )
Gecode toplevel namespace
Argument array for variables.
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum acos_down(FloatNum x)
Return lower bound of arccosine of x (domain: )
Class for action management.
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest action divided by domain size with decay factor d.
FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count divided by domain size with decay factor d...
void acos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum pi_lower(void)
Return lower bound of .
FloatNum mul_up(FloatNum x, FloatNum y)
Return upper bound of x times y (domain: )
void assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest max.
FloatVal tanh(const FloatVal &x)
Home class for posting propagators
FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
FloatVarBranch FLOAT_VAR_ACTION_MAX(double d, BranchTbl tbl)
Select variable with highest action with decay factor d.
double FloatNum
Floating point number base type.
FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest max.
Shared array with arbitrary number of elements.
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
~Rounding(void)
Destructor (restores previous rounding mode)
std::function< FloatNumBranch(const Space &home, FloatVar x, int i)> FloatBranchVal
Branch value function type for float variables.
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
FloatNum median(FloatNum x, FloatNum y)
Return median of x and y (domain: )
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum sin_down(FloatNum x)
Return lower bound of sine of x (domain: )
Recording AFC information for float variables.
FloatNum tan_down(FloatNum x)
Return lower bound of tangent of x (domain: )
FloatNum pi_upper(void)
Return upper bound of .
FloatVarBranch FLOAT_VAR_CHB_MAX(BranchTbl tbl)
Select variable with highest CHB Q-score.