Generated on Mon Jul 27 2020 00:00:00 for Gecode by doxygen 1.8.18
float.hh
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  * Guido Tack <tack@gecode.org>
6  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
7  *
8  * Copyright:
9  * Christian Schulte, 2002
10  * Guido Tack, 2004
11  * Vincent Barichard, 2012
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #ifndef __GECODE_FLOAT_HH__
39 #define __GECODE_FLOAT_HH__
40 
41 #include <climits>
42 #include <cfloat>
43 #include <iostream>
44 
45 #include <functional>
46 
47 #include <gecode/kernel.hh>
48 #include <gecode/int.hh>
49 
50 /*
51  * Configure linking
52  *
53  */
54 #if !defined(GECODE_STATIC_LIBS) && \
55  (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
56 
57 #ifdef GECODE_BUILD_FLOAT
58 #define GECODE_FLOAT_EXPORT __declspec( dllexport )
59 #else
60 #define GECODE_FLOAT_EXPORT __declspec( dllimport )
61 #endif
62 
63 #else
64 
65 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
66 #define GECODE_FLOAT_EXPORT __attribute__ ((visibility("default")))
67 #else
68 #define GECODE_FLOAT_EXPORT
69 #endif
70 
71 #endif
72 
73 // Configure auto-linking
74 #ifndef GECODE_BUILD_FLOAT
75 #define GECODE_LIBRARY_NAME "Float"
77 #endif
78 
79 // Include interval implementation
80 #include <gecode/third-party/boost/numeric/interval.hpp>
81 
94 
96 
97 namespace Gecode {
98 
106  typedef double FloatNum;
107 
109  FloatNum pi_half_lower(void);
111  FloatNum pi_half_upper(void);
113  FloatNum pi_lower(void);
115  FloatNum pi_upper(void);
117  FloatNum pi_twice_lower(void);
119  FloatNum pi_twice_upper(void);
120 
121  // Forward declaration
122  class FloatVal;
123 
124 }
125 
126 #include <gecode/float/num.hpp>
127 
128 namespace Gecode { namespace Float {
129 
130 
131 #if defined(_MSC_VER) && (defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP > 0)))
132 
133  /*
134  * This is used for the MSVC compiler for x64 or x86 with SSE enabled.
135  *
136  */
138  typedef gecode_boost::numeric::interval_lib::save_state< gecode_boost::numeric::interval_lib::rounded_arith_std<FloatNum> >
139  RoundingBase;
140 
141 #else
142 
144  typedef gecode_boost::numeric::interval_lib::rounded_arith_opp<FloatNum>
146 
147 #endif
148 
154  class Rounding : public RoundingBase {
155  public:
157 
158  Rounding(void);
161  ~Rounding(void);
163 
165 
187 
189 
197 
198 #ifdef GECODE_HAS_MPFR
199 
210 
212 
226 
228 
242 
244 
258 
260 
274 #endif
275  };
276 
277 }}
278 
279 #include <gecode/float/rounding.hpp>
280 
281 namespace Gecode { namespace Float {
282 
287  bool subset(const FloatVal& x, const FloatVal& y);
292  bool proper_subset(const FloatVal& x, const FloatVal& y);
297  bool overlap(const FloatVal& x, const FloatVal& y);
298 
303  FloatVal intersect(const FloatVal& x, const FloatVal& y);
308  FloatVal hull(const FloatVal& x, const FloatVal& y);
313  FloatVal hull(const FloatVal& x, const FloatNum& y);
318  FloatVal hull(const FloatNum& x, const FloatVal& y);
323  FloatVal hull(const FloatNum& x, const FloatNum& y);
324 
325 }}
326 
327 namespace Gecode {
328 
334  class FloatVal {
335  friend FloatVal operator +(const FloatVal& x);
336  friend FloatVal operator -(const FloatVal& x);
337  friend FloatVal operator +(const FloatVal& x, const FloatVal& y);
338  friend FloatVal operator +(const FloatVal& x, const FloatNum& y);
339  friend FloatVal operator +(const FloatNum& x, const FloatVal& y);
340  friend FloatVal operator -(const FloatVal& x, const FloatVal& y);
341  friend FloatVal operator -(const FloatVal& x, const FloatNum& y);
342  friend FloatVal operator -(const FloatNum& x, const FloatVal& y);
343  friend FloatVal operator *(const FloatVal& x, const FloatVal& y);
344  friend FloatVal operator *(const FloatVal& x, const FloatNum& y);
345  friend FloatVal operator *(const FloatNum& x, const FloatVal& y);
346  friend FloatVal operator /(const FloatVal& x, const FloatVal& y);
347  friend FloatVal operator /(const FloatVal& x, const FloatNum& y);
348  friend FloatVal operator /(const FloatNum& x, const FloatVal& y);
349 
350  friend bool operator <(const FloatVal& x, const FloatVal& y);
351  friend bool operator <(const FloatVal& x, const FloatNum& y);
352  friend bool operator <(const FloatNum& x, const FloatVal& y);
353  friend bool operator <=(const FloatVal& x, const FloatVal& y);
354  friend bool operator <=(const FloatVal& x, const FloatNum& y);
355  friend bool operator <=(const FloatNum& x, const FloatVal& y);
356  friend bool operator >(const FloatVal& x, const FloatVal& y);
357  friend bool operator >(const FloatVal& x, const FloatNum& y);
358  friend bool operator >(const FloatNum& x, const FloatVal& y);
359  friend bool operator >=(const FloatVal& x, const FloatVal& y);
360  friend bool operator >=(const FloatVal& x, const FloatNum& y);
361  friend bool operator >=(const FloatNum& x, const FloatVal& y);
362  friend bool operator ==(const FloatVal& x, const FloatVal& y);
363  friend bool operator ==(const FloatVal& x, const FloatNum& y);
364  friend bool operator ==(const FloatNum& x, const FloatVal& y);
365  friend bool operator !=(const FloatVal& x, const FloatVal& y);
366  friend bool operator !=(const FloatVal& x, const FloatNum& y);
367  friend bool operator !=(const FloatNum& x, const FloatVal& y);
368 
369  template<class Char, class Traits>
370  friend std::basic_ostream<Char,Traits>&
371  operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
372 
373  friend FloatVal abs(const FloatVal& x);
374  friend FloatVal sqrt(const FloatVal& x);
375  friend FloatVal sqr(const FloatVal& x);
376  friend FloatVal pow(const FloatVal& x, int n);
377  friend FloatVal nroot(const FloatVal& x, int n);
378 
379  friend FloatVal max(const FloatVal& x, const FloatVal& y);
380  friend FloatVal max(const FloatVal& x, const FloatNum& y);
381  friend FloatVal max(const FloatNum& x, const FloatVal& y);
382  friend FloatVal min(const FloatVal& x, const FloatVal& y);
383  friend FloatVal min(const FloatVal& x, const FloatNum& y);
384  friend FloatVal min(const FloatNum& x, const FloatVal& y);
385 
386 #ifdef GECODE_HAS_MPFR
387  friend FloatVal exp(const FloatVal& x);
388  friend FloatVal log(const FloatVal& x);
389  friend FloatVal fmod(const FloatVal& x, const FloatVal& y);
390  friend FloatVal fmod(const FloatVal& x, const FloatNum& y);
391  friend FloatVal fmod(const FloatNum& x, const FloatVal& y);
392  friend FloatVal sin(const FloatVal& x);
393  friend FloatVal cos(const FloatVal& x);
394  friend FloatVal tan(const FloatVal& x);
395  friend FloatVal asin(const FloatVal& x);
396  friend FloatVal acos(const FloatVal& x);
397  friend FloatVal atan(const FloatVal& x);
398  friend FloatVal sinh(const FloatVal& x);
399  friend FloatVal cosh(const FloatVal& x);
400  friend FloatVal tanh(const FloatVal& x);
401  friend FloatVal asinh(const FloatVal& x);
402  friend FloatVal acosh(const FloatVal& x);
403  friend FloatVal atanh(const FloatVal& x);
404 #endif
405 
406  friend bool Float::subset(const FloatVal& x, const FloatVal& y);
407  friend bool Float::proper_subset(const FloatVal& x, const FloatVal& y);
408  friend bool Float::overlap(const FloatVal& x, const FloatVal& y);
409  friend FloatVal Float::intersect(const FloatVal& x, const FloatVal& y);
410  friend FloatVal Float::hull(const FloatVal& x, const FloatVal& y);
411  friend FloatVal Float::hull(const FloatVal& x, const FloatNum& y);
412  friend FloatVal Float::hull(const FloatNum& x, const FloatVal& y);
413  friend FloatVal Float::hull(const FloatNum& x, const FloatNum& y);
414  protected:
416  typedef gecode_boost::numeric::interval_lib::save_state<Float::Rounding> R;
418  typedef gecode_boost::numeric::interval_lib::checking_strict<FloatNum> P;
420  typedef gecode_boost::numeric::interval
421  <FloatNum,
422  gecode_boost::numeric::interval_lib::policies<R, P> >
427  explicit FloatVal(const FloatValImpType& i);
428  public:
430 
431  FloatVal(void);
434  FloatVal(const FloatNum& n);
436  FloatVal(const FloatNum& l, const FloatNum& u);
438  FloatVal(const FloatVal& v);
439 
441  FloatVal& operator =(const FloatNum& n);
443  FloatVal& operator =(const FloatVal& v);
444 
446  void assign(FloatNum const &l, FloatNum const &u);
448 
450 
451  FloatNum min(void) const;
454  FloatNum max(void) const;
456  FloatNum size(void) const;
458  FloatNum med(void) const;
460 
462 
463  bool tight(void) const;
466  bool singleton(void) const;
468  bool in(FloatNum n) const;
470  bool zero_in(void) const;
472 
474 
475  static FloatVal hull(FloatNum x, FloatNum y);
478  static FloatVal pi_half(void);
480  static FloatVal pi(void);
482  static FloatVal pi_twice(void);
484 
486 
487  FloatVal& operator +=(const FloatNum& n);
490  FloatVal& operator -=(const FloatNum& n);
492  FloatVal& operator *=(const FloatNum& n);
494  FloatVal& operator /=(const FloatNum& n);
496  FloatVal& operator +=(const FloatVal& v);
498  FloatVal& operator -=(const FloatVal& v);
500  FloatVal& operator *=(const FloatVal& v);
502  FloatVal& operator /=(const FloatVal& v);
504  };
505 
510  FloatVal operator +(const FloatVal& x);
515  FloatVal operator -(const FloatVal& x);
516 
521  FloatVal operator +(const FloatVal& x, const FloatVal& y);
526  FloatVal operator +(const FloatVal& x, const FloatNum& y);
531  FloatVal operator +(const FloatNum& x, const FloatVal& y);
536  FloatVal operator -(const FloatVal& x, const FloatVal& y);
541  FloatVal operator -(const FloatVal& x, const FloatNum& y);
546  FloatVal operator -(const FloatNum& x, const FloatVal& y);
551  FloatVal operator *(const FloatVal& x, const FloatVal& y);
556  FloatVal operator *(const FloatVal& x, const FloatNum& y);
561  FloatVal operator *(const FloatNum& x, const FloatVal& y);
566  FloatVal operator /(const FloatVal& x, const FloatVal& y);
571  FloatVal operator /(const FloatVal& x, const FloatNum& y);
576  FloatVal operator /(const FloatNum& r, const FloatVal& x);
577 
582  bool operator <(const FloatVal& x, const FloatVal& y);
587  bool operator <(const FloatVal& x, const FloatNum& y);
592  bool operator <(const FloatNum& x, const FloatVal& y);
593 
598  bool operator <=(const FloatVal& x, const FloatVal& y);
603  bool operator <=(const FloatVal& x, const FloatNum& y);
608  bool operator <=(const FloatNum& x, const FloatVal& y);
609 
614  bool operator >(const FloatVal& x, const FloatVal& y);
619  bool operator >(const FloatVal& x, const FloatNum& y);
624  bool operator >(const FloatNum& x, const FloatVal& y);
625 
630  bool operator >=(const FloatVal& x, const FloatVal& y);
635  bool operator >=(const FloatVal& x, const FloatNum& y);
640  bool operator >=(const FloatNum& x, const FloatVal& y);
645  bool operator ==(const FloatVal& x, const FloatVal& y);
650  bool operator ==(const FloatVal& x, const FloatNum& y);
655  bool operator ==(const FloatNum& x, const FloatVal& y);
656 
661  bool operator !=(const FloatVal& x, const FloatVal& y);
666  bool operator !=(const FloatVal& x, const FloatNum& y);
671  bool operator !=(const FloatNum& x, const FloatVal& y);
672 
677  template<class Char, class Traits>
678  std::basic_ostream<Char,Traits>&
679  operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
680 
685  FloatVal abs(const FloatVal& x);
690  FloatVal sqrt(const FloatVal& x);
695  FloatVal sqr(const FloatVal& x);
700  FloatVal pow(const FloatVal& x, int n);
705  FloatVal nroot(const FloatVal& x, int n);
706 
711  FloatVal max(const FloatVal& x, const FloatVal& y);
716  FloatVal max(const FloatVal& x, const FloatNum& y);
721  FloatVal max(const FloatNum& x, const FloatVal& y);
726  FloatVal min(const FloatVal& x, const FloatVal& y);
731  FloatVal min(const FloatVal& x, const FloatNum& y);
736  FloatVal min(const FloatNum& x, const FloatVal& y);
737 
738 #ifdef GECODE_HAS_MPFR
739  /* transcendental functions: exp, log */
744  FloatVal exp(const FloatVal& x);
749  FloatVal log(const FloatVal& x);
750 
755  FloatVal fmod(const FloatVal& x, const FloatVal& y);
760  FloatVal fmod(const FloatVal& x, const FloatNum& y);
765  FloatVal fmod(const FloatNum& x, const FloatVal& y);
766 
771  FloatVal sin(const FloatVal& x);
776  FloatVal cos(const FloatVal& x);
781  FloatVal tan(const FloatVal& x);
786  FloatVal asin(const FloatVal& x);
791  FloatVal acos(const FloatVal& x);
796  FloatVal atan(const FloatVal& x);
797 
802  FloatVal sinh(const FloatVal& x);
807  FloatVal cosh(const FloatVal& x);
812  FloatVal tanh(const FloatVal& x);
817  FloatVal asinh(const FloatVal& x);
822  FloatVal acosh(const FloatVal& x);
827  FloatVal atanh(const FloatVal& x);
828 
829 #endif
830 
831 }
832 
833 #include <gecode/float/val.hpp>
834 
835 namespace Gecode { namespace Float {
836 
842  namespace Limits {
846  const FloatNum min = -max;
848  bool valid(const FloatVal& n);
850  void check(const FloatVal& n, const char* l);
851  }
852 
853 }}
854 
855 #include <gecode/float/limits.hpp>
856 
857 #include <gecode/float/var-imp.hpp>
858 
859 namespace Gecode {
860 
861  namespace Float {
862  class FloatView;
863  }
864 
870  class FloatVar : public VarImpVar<Float::FloatVarImp> {
871  friend class FloatVarArray;
872  friend class FloatVarArgs;
873  private:
881  void _init(Space& home, FloatNum min, FloatNum max);
882  public:
884 
885  FloatVar(void);
888  FloatVar(const FloatVar& y);
890  FloatVar(const Float::FloatView& y);
904 
906 
907  FloatVal domain(void) const;
910  FloatNum min(void) const;
912  FloatNum max(void) const;
914  FloatNum med(void) const;
916  FloatNum size(void) const;
924  FloatVal val(void) const;
925 
927 
929 
930  bool in(const FloatVal& n) const;
933  };
934 
939  template<class Char, class Traits>
940  std::basic_ostream<Char,Traits>&
941  operator <<(std::basic_ostream<Char,Traits>& os, const FloatVar& x);
942 }
943 
944 #include <gecode/float/view.hpp>
946 
947 namespace Gecode {
948 
950  class FloatValArgs : public ArgArray<FloatVal> {
951  public:
953 
954  FloatValArgs(void);
957  explicit FloatValArgs(int n);
961  FloatValArgs(const std::vector<FloatVal>& x);
963  FloatValArgs(std::initializer_list<FloatVal> x);
965  template<class InputIterator>
966  FloatValArgs(InputIterator first, InputIterator last);
968  FloatValArgs(int n, const FloatVal* e);
971 
974  static FloatValArgs create(int n, FloatVal start, int inc=1);
976  };
977 
979  class FloatVarArgs : public VarArgArray<FloatVar> {
980  public:
982 
983  FloatVarArgs(void);
986  explicit FloatVarArgs(int n);
988  FloatVarArgs(const FloatVarArgs& a);
992  FloatVarArgs(const std::vector<FloatVar>& a);
994  FloatVarArgs(std::initializer_list<FloatVar> a);
996  template<class InputIterator>
997  FloatVarArgs(InputIterator first, InputIterator last);
1010  FloatVarArgs(Space& home, int n, FloatNum min, FloatNum max);
1012  };
1014 
1030  class FloatVarArray : public VarArray<FloatVar> {
1031  public:
1033 
1034  FloatVarArray(void);
1037  FloatVarArray(Space& home, int n);
1039  FloatVarArray(const FloatVarArray& a);
1041  FloatVarArray(Space& home, const FloatVarArgs& a);
1054  FloatVarArray(Space& home, int n, FloatNum min, FloatNum max);
1056  };
1057 
1058 }
1059 
1060 #include <gecode/float/array.hpp>
1061 
1062 namespace Gecode {
1063 
1074  FRT_GR
1075  };
1076 
1084  GECODE_FLOAT_EXPORT void
1086  dom(Home home, FloatVar x, FloatVal n);
1088  GECODE_FLOAT_EXPORT void
1089  dom(Home home, const FloatVarArgs& x, FloatVal n);
1091  GECODE_FLOAT_EXPORT void
1092  dom(Home home, FloatVar x, FloatNum l, FloatNum m);
1094  GECODE_FLOAT_EXPORT void
1095  dom(Home home, const FloatVarArgs& x, FloatNum l, FloatNum u);
1097  GECODE_FLOAT_EXPORT void
1098  dom(Home home, FloatVar x, FloatVal n, Reify r);
1100  GECODE_FLOAT_EXPORT void
1101  dom(Home home, FloatVar x, FloatNum l, FloatNum u, Reify r);
1103  GECODE_FLOAT_EXPORT void
1104  dom(Home home, FloatVar x, FloatVar d);
1106  GECODE_FLOAT_EXPORT void
1107  dom(Home home, const FloatVarArgs& x, const FloatVarArgs& d);
1109 
1118  GECODE_FLOAT_EXPORT void
1119  rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1);
1123  GECODE_FLOAT_EXPORT void
1124  rel(Home home, FloatVar x, FloatRelType frt, FloatVal c);
1128  GECODE_FLOAT_EXPORT void
1129  rel(Home home, FloatVar x, FloatRelType frt, FloatVal c, Reify r);
1133  GECODE_FLOAT_EXPORT void
1134  rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1, Reify r);
1138  GECODE_FLOAT_EXPORT void
1139  rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVal c);
1143  GECODE_FLOAT_EXPORT void
1144  rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVar y);
1151  GECODE_FLOAT_EXPORT void
1152  ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z);
1153 
1154 }
1155 
1156 
1157 namespace Gecode {
1158 
1167  GECODE_FLOAT_EXPORT void
1168  min(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1172  GECODE_FLOAT_EXPORT void
1173  min(Home home, const FloatVarArgs& x, FloatVar y);
1176  GECODE_FLOAT_EXPORT void
1177  max(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1181  GECODE_FLOAT_EXPORT void
1182  max(Home home, const FloatVarArgs& x, FloatVar y);
1183 
1186  GECODE_FLOAT_EXPORT void
1187  abs(Home home, FloatVar x0, FloatVar x1);
1188 
1191  GECODE_FLOAT_EXPORT void
1192  mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1193 
1196  GECODE_FLOAT_EXPORT void
1197  sqr(Home home, FloatVar x0, FloatVar x1);
1198 
1201  GECODE_FLOAT_EXPORT void
1202  sqrt(Home home, FloatVar x0, FloatVar x1);
1203 
1206  GECODE_FLOAT_EXPORT void
1207  pow(Home home, FloatVar x0, int n, FloatVar x1);
1208 
1211  GECODE_FLOAT_EXPORT void
1212  nroot(Home home, FloatVar x0, int n, FloatVar x1);
1213 
1216  GECODE_FLOAT_EXPORT void
1217  div(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1218 #ifdef GECODE_HAS_MPFR
1219 
1221  GECODE_FLOAT_EXPORT void
1222  exp(Home home, FloatVar x0, FloatVar x1);
1225  GECODE_FLOAT_EXPORT void
1226  log(Home home, FloatVar x0, FloatVar x1);
1229  GECODE_FLOAT_EXPORT void
1230  pow(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1233  GECODE_FLOAT_EXPORT void
1234  log(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1237  GECODE_FLOAT_EXPORT void
1238  asin(Home home, FloatVar x0, FloatVar x1);
1241  GECODE_FLOAT_EXPORT void
1242  sin(Home home, FloatVar x0, FloatVar x1);
1245  GECODE_FLOAT_EXPORT void
1246  acos(Home home, FloatVar x0, FloatVar x1);
1249  GECODE_FLOAT_EXPORT void
1250  cos(Home home, FloatVar x0, FloatVar x1);
1253  GECODE_FLOAT_EXPORT void
1254  atan(Home home, FloatVar x0, FloatVar x1);
1257  GECODE_FLOAT_EXPORT void
1258  tan(Home home, FloatVar x0, FloatVar x1);
1260 #endif
1261 
1276  GECODE_FLOAT_EXPORT void
1277  linear(Home home, const FloatVarArgs& x,
1278  FloatRelType frt, FloatVal c);
1289  GECODE_FLOAT_EXPORT void
1290  linear(Home home, const FloatVarArgs& x,
1291  FloatRelType frt, FloatVar y);
1302  GECODE_FLOAT_EXPORT void
1303  linear(Home home, const FloatVarArgs& x,
1304  FloatRelType frt, FloatVal c, Reify r);
1315  GECODE_FLOAT_EXPORT void
1316  linear(Home home, const FloatVarArgs& x,
1317  FloatRelType frt, FloatVar y, Reify r);
1330  GECODE_FLOAT_EXPORT void
1331  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1332  FloatRelType frt, FloatVal c);
1346  GECODE_FLOAT_EXPORT void
1347  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1348  FloatRelType frt, FloatVar y);
1362  GECODE_FLOAT_EXPORT void
1363  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1364  FloatRelType frt, FloatVal c, Reify r);
1378  GECODE_FLOAT_EXPORT void
1379  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1380  FloatRelType frt, FloatVar y, Reify r);
1381 
1382 
1388  GECODE_FLOAT_EXPORT void
1390  channel(Home home, FloatVar x0, IntVar x1);
1392  void
1393  channel(Home home, IntVar x0, FloatVar x1);
1395  GECODE_FLOAT_EXPORT void
1396  channel(Home home, FloatVar x0, BoolVar x1);
1398  void
1399  channel(Home home, BoolVar x0, FloatVar x1);
1401 
1402 }
1403 
1404 #include <gecode/float/channel.hpp>
1405 
1406 namespace Gecode {
1407 
1416  GECODE_FLOAT_EXPORT void
1418  wait(Home home, FloatVar x, std::function<void(Space& home)> c);
1420  GECODE_FLOAT_EXPORT void
1421  wait(Home home, const FloatVarArgs& x, std::function<void(Space& home)> c);
1423 
1424 }
1425 
1426 namespace Gecode {
1427 
1441  typedef std::function<bool(const Space& home, FloatVar x, int i)>
1443 
1454  typedef std::function<double(const Space& home, FloatVar x, int i)>
1456 
1463  public:
1467  bool l;
1468  };
1469 
1480  typedef std::function<FloatNumBranch(const Space& home, FloatVar x, int i)>
1482 
1494  typedef std::function<void(Space& home, unsigned int a,
1495  FloatVar x, int i, FloatNumBranch nl)>
1497 
1498 }
1499 
1501 
1502 namespace Gecode {
1503 
1509  class FloatAFC : public AFC {
1510  public:
1518  FloatAFC(void);
1520  FloatAFC(const FloatAFC& a);
1522  FloatAFC& operator =(const FloatAFC& a);
1530  FloatAFC(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1541  void init(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1542  };
1543 
1544 }
1545 
1546 #include <gecode/float/branch/afc.hpp>
1547 
1548 namespace Gecode {
1549 
1555  class FloatAction : public Action {
1556  public:
1564  FloatAction(void);
1566  FloatAction(const FloatAction& a);
1578  FloatAction(Home home, const FloatVarArgs& x, double d=1.0,
1579  FloatBranchMerit bm=nullptr);
1591  GECODE_FLOAT_EXPORT void
1592  init(Home home, const FloatVarArgs& x, double d=1.0,
1593  FloatBranchMerit bm=nullptr);
1594  };
1595 
1596 }
1597 
1599 
1600 namespace Gecode {
1601 
1607  class FloatCHB : public CHB {
1608  public:
1616  FloatCHB(void);
1618  FloatCHB(const FloatCHB& chb);
1620  FloatCHB& operator =(const FloatCHB& chb);
1630  FloatCHB(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1642  GECODE_FLOAT_EXPORT void
1643  init(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1644  };
1645 
1646 }
1647 
1648 #include <gecode/float/branch/chb.hpp>
1649 
1650 namespace Gecode {
1651 
1653  typedef std::function<void(const Space &home, const Brancher& b,
1654  unsigned int a,
1655  FloatVar x, int i, const FloatNumBranch& n,
1656  std::ostream& o)>
1658 
1659 }
1660 
1661 namespace Gecode {
1662 
1668  class FloatVarBranch : public VarBranch<FloatVar> {
1669  public:
1671  enum Select {
1672  SEL_NONE = 0,
1698  };
1699  protected:
1702  public:
1704  FloatVarBranch(void);
1706  FloatVarBranch(Rnd r);
1710  FloatVarBranch(Select s, double, BranchTbl t);
1720  Select select(void) const;
1722  void expand(Home home, const FloatVarArgs& x);
1723  };
1724 
1725 
1744  FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
1748  FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
1752  FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
1756  FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
1784  FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1788  FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1808 
1809 }
1810 
1811 #include <gecode/float/branch/var.hpp>
1812 
1813 namespace Gecode {
1814 
1820  class FloatValBranch : public ValBranch<FloatVar> {
1821  public:
1823  enum Select {
1828  };
1829  protected:
1832  public:
1836  FloatValBranch(Rnd r);
1840  Select select(void) const;
1841  };
1842 
1862 
1863 }
1864 
1865 #include <gecode/float/branch/val.hpp>
1866 
1867 namespace Gecode {
1868 
1874  class FloatAssign : public ValBranch<FloatVar> {
1875  public:
1877  enum Select {
1882  };
1883  protected:
1886  public:
1890  FloatAssign(Rnd r);
1894  Select select(void) const;
1895  };
1896 
1915 
1916 }
1917 
1919 
1920 namespace Gecode {
1921 
1927  GECODE_FLOAT_EXPORT void
1928  branch(Home home, const FloatVarArgs& x,
1929  FloatVarBranch vars, FloatValBranch vals,
1930  FloatBranchFilter bf=nullptr,
1931  FloatVarValPrint vvp=nullptr);
1937  GECODE_FLOAT_EXPORT void
1938  branch(Home home, const FloatVarArgs& x,
1939  TieBreak<FloatVarBranch> vars, FloatValBranch vals,
1940  FloatBranchFilter bf=nullptr,
1941  FloatVarValPrint vvp=nullptr);
1947  GECODE_FLOAT_EXPORT void
1948  branch(Home home, FloatVar x, FloatValBranch vals,
1949  FloatVarValPrint vvp=nullptr);
1950 
1956  GECODE_FLOAT_EXPORT void
1957  assign(Home home, const FloatVarArgs& x,
1958  FloatVarBranch vars, FloatAssign vals,
1959  FloatBranchFilter bf=nullptr,
1960  FloatVarValPrint vvp=nullptr);
1966  GECODE_FLOAT_EXPORT void
1967  assign(Home home, const FloatVarArgs& x,
1968  TieBreak<FloatVarBranch> vars, FloatAssign vals,
1969  FloatBranchFilter bf=nullptr,
1970  FloatVarValPrint vvp=nullptr);
1976  GECODE_FLOAT_EXPORT void
1977  assign(Home home, FloatVar x, FloatAssign vals,
1978  FloatVarValPrint vvp=nullptr);
1979 
1980 }
1981 
1982 namespace Gecode {
1983 
1989  void
1990  branch(Home home, const FloatVarArgs& x, FloatValBranch vals,
1991  FloatBranchFilter bf=nullptr,
1992  FloatVarValPrint vvp=nullptr);
1998  void
1999  assign(Home home, const FloatVarArgs& x, FloatAssign vals,
2000  FloatBranchFilter bf=nullptr,
2001  FloatVarValPrint vvp=nullptr);
2002 
2003 }
2004 
2005 #include <gecode/float/branch.hpp>
2006 
2007 namespace Gecode {
2008 
2009  /*
2010  * \brief Relaxed assignment of variables in \a x from values in \a sx
2011  *
2012  * The variables in \a x are assigned values from the assigned variables
2013  * in the solution \a sx with a relaxation probability \a p. That is,
2014  * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
2015  * assigned a value from \a sx.
2016  *
2017  * The random numbers are generated from the generator \a r. At least
2018  * one variable will not be assigned: in case the relaxation attempt
2019  * would suggest that all variables should be assigned, a single
2020  * variable will be selected randomly to remain unassigned.
2021  *
2022  * Throws an exception of type Float::ArgumentSizeMismatch, if \a x and
2023  * \a sx are of different size.
2024  *
2025  * Throws an exception of type Float::OutOfLimits, if \a p is not between
2026  * \a 0.0 and \a 1.0.
2027  *
2028  * \ingroup TaskModeFloat
2029  */
2030  GECODE_FLOAT_EXPORT void
2031  relax(Home home, const FloatVarArgs& x, const FloatVarArgs& sx,
2032  Rnd r, double p);
2033 
2034 }
2035 
2037 
2038 namespace Gecode {
2039 
2050  protected:
2054  const Delta& d;
2055  public:
2057 
2060  const Delta& d);
2062 
2064  FloatNum min(void) const;
2067  FloatNum max(void) const;
2069  };
2070 
2071 }
2072 
2074 
2076 
2077 namespace Gecode {
2078 
2089 
2095  protected:
2097  std::ostream& os;
2098  public:
2100  StdFloatTracer(std::ostream& os0 = std::cerr);
2102  virtual void init(const Space& home, const FloatTraceRecorder& t);
2104  virtual void prune(const Space& home, const FloatTraceRecorder& t,
2105  const ViewTraceInfo& vti, int i, FloatTraceDelta& d);
2107  virtual void fix(const Space& home, const FloatTraceRecorder& t);
2109  virtual void fail(const Space& home, const FloatTraceRecorder& t);
2111  virtual void done(const Space& home, const FloatTraceRecorder& t);
2113  static StdFloatTracer def;
2114  };
2115 
2116 
2121  GECODE_FLOAT_EXPORT void
2122  trace(Home home, const FloatVarArgs& x,
2123  TraceFilter tf,
2124  int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2125  FloatTracer& t = StdFloatTracer::def);
2130  void
2131  trace(Home home, const FloatVarArgs& x,
2132  int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2133  FloatTracer& t = StdFloatTracer::def);
2134 
2135 }
2136 
2137 #include <gecode/float/trace.hpp>
2138 
2139 #endif
2140 
2141 // IFDEF: GECODE_HAS_FLOAT_VARS
2142 // STATISTICS: float-post
2143 
@ FRT_LE
Less ( )
Definition: float.hh:1072
Select s
Which value to select.
Definition: float.hh:1831
FloatNum tanh_down(FloatNum x)
Return lower bound of hyperbolic tangent of x (domain: )
Passing float variables.
Definition: float.hh:979
FloatNum mul_up(FloatNum x, FloatNum y)
Return upper bound of x times y (domain: )
FloatNum pi_twice_lower(void)
Return lower bound of .
Definition: num.hpp:53
Class for action management.
Definition: action.hpp:42
@ TE_PRUNE
Trace prune events.
Definition: recorder.hpp:44
bool l
Whether to try the lower or upper half first.
Definition: float.hh:1467
FloatNum int_down(FloatNum x)
Return next downward-rounded integer of x (domain: )
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Definition: arithmetic.cpp:109
Post propagator for SetVar x
Definition: set.hh:767
FloatAFC(void)
Construct as not yet initialized.
Definition: afc.hpp:37
@ SEL_RND
Select median value of a randomly chosen part.
Definition: float.hh:1880
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition: float.hh:1694
FloatNum sin_down(FloatNum x)
Return lower bound of sine of x (domain: )
FloatVal & operator-=(const FloatNum &n)
Subtract by n.
Definition: val.hpp:129
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
friend FloatVal atan(const FloatVal &x)
Definition: val.hpp:455
@ FRT_NQ
Disequality ( )
Definition: float.hh:1070
FloatAssign FLOAT_ASSIGN_MAX(void)
Select median value of the upper part.
Definition: assign.hpp:60
void expand(Home home, const FloatVarArgs &x)
Expand AFC, action, and CHB.
Definition: var.hpp:74
FloatNum atanh_up(FloatNum x)
Return upper bound of hyperbolic arctangent of x (domain: )
bool zero_in(void) const
Test whether zero is included.
Definition: val.hpp:100
friend FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:422
@ SEL_DEGREE_MAX
With largest degree.
Definition: float.hh:1677
gecode_boost::numeric::interval< FloatNum, gecode_boost::numeric::interval_lib::policies< R, P > > FloatValImpType
Implementation type for float value.
Definition: float.hh:423
name Constructor Initialize with old trace view a o
Definition: float.hh:2058
friend FloatVal operator-(const FloatVal &x)
Definition: val.hpp:168
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.
Definition: float.hh:1657
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.
Definition: var.hpp:227
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:49
bool operator<(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:226
FloatNum atan_up(FloatNum x)
Return upper bound of arctangent of x (domain: )
static FloatVal pi_twice(void)
Return .
Definition: val.hpp:119
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition: float.hh:1827
Select
Which variable selection.
Definition: float.hh:1671
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition: float.hh:1679
FloatNum int_up(FloatNum x)
Return next upward-rounded integer of x (domain: )
FloatCHB & operator=(const FloatCHB &chb)
Assignment operator.
Definition: chb.hpp:44
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Definition: var.hpp:217
FloatVal val(void) const
Return assigned value.
Definition: float.hpp:53
FloatNum mul_down(FloatNum x, FloatNum y)
Return lower bound of x times y (domain: )
FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl)
Select variable with largest CHB Q-score divided by domain size.
Definition: var.hpp:277
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum add_up(FloatNum x, FloatNum y)
Return upper bound of x plus y (domain: )
FloatNum sqrt_up(FloatNum x)
Return upper bound of square root of x (domain: )
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition: float.hh:1881
@ SEL_ACTION_MIN
With lowest action.
Definition: float.hh:1680
FloatVarBranch FLOAT_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Definition: var.hpp:137
FloatNum cosh_down(FloatNum x)
Return lower bound of hyperbolic cosine of x (domain: )
Recording actions for float variables.
Definition: float.hh:1555
FloatVal tanh(const FloatVal &x)
Definition: val.hpp:468
ViewTraceRecorder< Float::FloatView > FloatTraceRecorder
Trace recorder for float variables.
Definition: float.hh:2088
FloatVal acosh(const FloatVal &x)
Definition: val.hpp:476
Which values to select for branching first.
Definition: float.hh:1820
Class for CHB management.
Definition: chb.hpp:46
FloatNum tanh_up(FloatNum x)
Return upper bound of hyperbolic tangent of x (domain: )
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:95
@ SEL_NONE
First unassigned.
Definition: float.hh:1672
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:767
FloatNum exp_up(FloatNum x)
Return upper bound of exponential of x (domain: )
FloatAFC & operator=(const FloatAFC &a)
Assignment operator.
Definition: afc.hpp:44
Select
Which value selection.
Definition: float.hh:1823
~Rounding(void)
Destructor (restores previous rounding mode)
Definition: rounding.hpp:41
FloatNum div_down(FloatNum x, FloatNum y)
Return lower bound of x divided by y (domain: )
Select s
Which value to select.
Definition: float.hh:1885
NodeType t
Type of node.
Definition: bool-expr.cpp:230
FloatNum atan_down(FloatNum x)
Return lower bound of arctangent of x (domain: )
Rounding(void)
Default constructor (configures full rounding mode)
Definition: rounding.hpp:37
Which variable to select for branching.
Definition: float.hh:1668
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
Definition: relax.cpp:57
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:97
FloatNum cos_down(FloatNum x)
Return lower bound of cosine of x (domain: )
const FloatNum min
Smallest allowed float value.
Definition: float.hh:846
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
bool valid(const FloatVal &n)
Return whether float n is a valid number.
Definition: limits.hpp:39
Select select(void) const
Return selection strategy.
Definition: assign.hpp:49
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition: float.hh:1682
FloatValBranch FLOAT_VAL_SPLIT_MAX(void)
Select values greater than mean of smallest and largest value.
Definition: val.hpp:60
Passing float arguments.
Definition: float.hh:950
@ TE_FIX
Trace fixpoint events.
Definition: recorder.hpp:45
Computation spaces.
Definition: core.hpp:1742
FloatVal & operator*=(const FloatNum &n)
Multiply by n.
Definition: val.hpp:133
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.
Definition: branch.cpp:39
FloatNum sin_up(FloatNum x)
Return upper bound of sine of x (domain: )
friend FloatVal cos(const FloatVal &x)
Definition: val.hpp:439
FloatNum sinh_down(FloatNum x)
Return lower bound of hyperbolic sine of x (domain: )
FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest min.
Definition: var.hpp:192
FloatVal operator+(const FloatVal &x)
Definition: val.hpp:164
@ FRT_GR
Greater ( )
Definition: float.hh:1074
Standard float variable tracer.
Definition: float.hh:2094
FloatRelType
Relation types for floats.
Definition: float.hh:1068
FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Definition: var.hpp:207
FloatNum asin_down(FloatNum x)
Return lower bound of arcsine of x (domain: )
@ SEL_DEGREE_MIN
With smallest degree.
Definition: float.hh:1676
FloatNum max(void) const
Return maximum of domain.
Definition: float.hpp:67
FloatNum tan_up(FloatNum x)
Return upper bound of tangent of x (domain: )
FloatVal & operator/=(const FloatNum &n)
Divide by n.
Definition: val.hpp:137
FloatVal asinh(const FloatVal &x)
Definition: val.hpp:472
bool proper_subset(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:494
void acos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Output stream to use std::ostream & os
Definition: float.hh:2097
FloatNum atanh_down(FloatNum x)
Return lower bound of hyperbolic arctangent of x (domain: )
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:127
FloatNum acosh_down(FloatNum x)
Return lower bound of hyperbolic arccosine of x (domain: )
Variable branching information.
Definition: var.hpp:55
FloatAssign FLOAT_ASSIGN_RND(Rnd r)
Select median value of a randomly chosen part.
Definition: assign.hpp:65
Gecode toplevel namespace
@ SEL_SPLIT_RND
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition: float.hh:1826
@ SEL_SIZE_MIN
With smallest domain size.
Definition: float.hh:1688
bool operator>(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:260
union Gecode::@602::NNF::@65 u
Union depending on nodetype t.
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Definition: branch.cpp:61
friend FloatVal sqr(const FloatVal &x)
Definition: val.hpp:373
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest max.
Definition: var.hpp:202
@ SEL_SIZE_MAX
With largest domain size.
Definition: float.hh:1689
@ TE_DONE
Trace done events.
Definition: recorder.hpp:47
FloatNum asinh_up(FloatNum x)
Return upper bound of hyperbolic arcsine of x (domain: )
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition: float.hh:1683
Float view for float variables.
Definition: view.hpp:52
friend FloatVal sinh(const FloatVal &x)
Definition: val.hpp:460
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition: float.hh:1697
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:200
FloatVal & operator=(const FloatNum &n)
Assignment operator.
Definition: val.hpp:56
int n
Number of variables (size)
Definition: array.hpp:115
Argument array for non-primitive types.
Definition: array.hpp:656
Generic domain change information to be supplied to advisors.
Definition: core.hpp:204
friend FloatVal acos(const FloatVal &x)
Definition: val.hpp:451
Return maximum FloatNum max(void) const
Definition: delta.hpp:49
friend FloatVal asin(const FloatVal &x)
Definition: val.hpp:447
friend std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const FloatVal &x)
Definition: val.hpp:360
FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
Definition: var.hpp:117
FloatAssign FLOAT_ASSIGN_MIN(void)
Select median value of the lower part.
Definition: assign.hpp:55
FloatNum acos_up(FloatNum x)
Return upper bound of arccossine of x (domain: )
void init(Home home, const FloatVarArgs &x, double d=1.0, bool share=true)
Initialize for float variables x with decay factor d.
Definition: afc.hpp:54
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Definition: arithmetic.cpp:118
bool in(FloatNum n) const
Test whether n is included.
Definition: val.hpp:96
bool operator>=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:277
Home class for posting propagators
Definition: core.hpp:856
gecode_boost::numeric::interval_lib::checking_strict< FloatNum > P
Used checking policy.
Definition: float.hh:418
FloatValBranch FLOAT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Definition: val.hpp:55
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
FloatVal(void)
Default constructor.
Definition: val.hpp:45
Trace filters.
Definition: filter.hpp:133
friend bool operator<=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:243
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition: float.hh:1696
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition: float.hh:1824
FloatVal & operator+=(const FloatNum &n)
Increment by n.
Definition: val.hpp:125
FloatNum log_down(FloatNum x)
Return lower bound of logarithm of x (domain: )
static FloatValArgs create(int n, FloatVal start, int inc=1)
Allocate array with n elements such that for all .
Definition: array.cpp:41
static FloatVal hull(FloatNum x, FloatNum y)
Return hull of x and y.
Definition: val.hpp:105
Recording CHB for float variables.
Definition: float.hh:1607
std::function< void(Space &home, unsigned int a, FloatVar x, int i, FloatNumBranch nl)> FloatBranchCommit
Branch commit function type for float variables.
Definition: float.hh:1496
Tracer that process view trace information.
Definition: tracer.hpp:51
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:102
FloatVarBranch FLOAT_VAR_CHB_MAX(BranchTbl tbl)
Select variable with highest CHB Q-score.
Definition: var.hpp:177
static FloatVal pi_half(void)
Return .
Definition: val.hpp:109
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Definition: dom.cpp:40
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
double FloatNum
Floating point number base type.
Definition: float.hh:106
friend FloatVal abs(const FloatVal &x)
Definition: val.hpp:365
FloatNum cos_up(FloatNum x)
Return upper bound of cosine of x (domain: )
friend FloatVal operator+(const FloatVal &x)
Definition: val.hpp:164
FloatNum log_up(FloatNum x)
Return upper bound of logarithm of x (domain: )
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum add_down(FloatNum x, FloatNum y)
Return lower bound of x plus y (domain: )
FloatNum pi_upper(void)
Return upper bound of .
Definition: num.hpp:49
FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest max.
Definition: var.hpp:197
Value description class for branching.
Definition: float.hh:1462
friend FloatVal acosh(const FloatVal &x)
Definition: val.hpp:476
Value branching information.
Definition: val.hpp:41
FloatNum n
The middle value for branching.
Definition: float.hh:1465
@ TE_INIT
Trace init events.
Definition: recorder.hpp:43
FloatValImpType x
Implementation of float value.
Definition: float.hh:425
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
Floating point rounding policy.
Definition: float.hh:154
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with variable selection vars and value selection vals.
Definition: branch.cpp:111
Select s
Which variable to select.
Definition: float.hh:1701
FloatVarBranch FLOAT_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
Definition: var.hpp:127
FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Definition: var.hpp:107
bool subset(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:490
name Constructor Initialize with old trace view a new view a and delta a d FloatTraceDelta(Float::FloatTraceView o, Float::FloatView n, const Delta &d)
Definition: delta.hpp:37
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:88
FloatVarArray(void)
Default constructor (array of size 0)
Definition: array.hpp:102
Random number generator.
Definition: rnd.hpp:42
const double base
Base for geometric restart sequence.
Definition: search.hh:126
FloatNum min(void) const
Return minimum of domain.
Definition: float.hpp:59
FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:213
friend FloatVal pow(const FloatVal &x, int n)
Definition: val.hpp:377
FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c)
Definition: assign.hpp:70
FloatVal sinh(const FloatVal &x)
Definition: val.hpp:460
#define GECODE_FLOAT_EXPORT
Definition: float.hh:68
FloatNum sub_down(FloatNum x, FloatNum y)
Return lower bound of x minus y (domain: )
FloatVal atanh(const FloatVal &x)
Definition: val.hpp:480
@ SEL_MERIT_MIN
With least merit.
Definition: float.hh:1674
Propagator for recording view trace information.
Definition: recorder.hpp:60
@ SEL_MIN_MIN
With smallest min.
Definition: float.hh:1684
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: float.hpp:77
FloatVarBranch FLOAT_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Select variable with smallest CHB Q-score divided by domain size.
Definition: var.hpp:267
ViewTracer< Float::FloatView > FloatTracer
Tracer for float variables.
Definition: float.hh:2083
@ FRT_LQ
Less or equal ( )
Definition: float.hh:1071
Select select(void) const
Return selection strategy.
Definition: val.hpp:49
@ SEL_MIN
Select median value of the lower part.
Definition: float.hh:1878
FloatVarArgs(void)
Allocate empty array.
Definition: array.hpp:73
friend FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:213
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition: float.hh:1691
FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest min.
Definition: var.hpp:187
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
FloatNum pi_lower(void)
Return lower bound of .
Definition: num.hpp:45
bool operator!=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:317
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:41
ExecStatus prune(Space &home, ViewArray< VX > &x, ConstIntView)
Definition: rel.hpp:264
friend bool operator==(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:294
FloatAction(void)
Construct as not yet initialized.
Definition: action.hpp:37
FloatVal operator-(const FloatVal &x)
Definition: val.hpp:168
FloatAssign(Select s=SEL_MIN)
Initialize with selection strategy s.
Definition: assign.hpp:37
friend FloatVal log(const FloatVal &x)
Definition: val.hpp:417
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
Definition: val.hpp:78
FloatCHB(void)
Construct as not yet initialized.
Definition: chb.hpp:37
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
Definition: exec.cpp:39
bool operator<=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:243
friend FloatVal sin(const FloatVal &x)
Definition: val.hpp:435
FloatNum tan_down(FloatNum x)
Return lower bound of tangent of x (domain: )
bool tight(void) const
Test whether float is tight.
Definition: val.hpp:87
FloatVal domain(void) const
Return domain.
Definition: float.hpp:72
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Definition: linear.cpp:41
std::function< bool(const Space &home, FloatVar x, int i)> FloatBranchFilter
Branch filter function type for float variables.
Definition: float.hh:1442
FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest domain size.
Definition: var.hpp:212
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition: float.hh:1693
@ FRT_EQ
Equality ( )
Definition: float.hh:1069
FloatNum med(void) const
Return median of float value.
Definition: val.hpp:82
Float value type.
Definition: float.hh:334
FloatValArgs(std::initializer_list< FloatVal > x)
Allocate array and copy elements from x.
const int v[7]
Definition: distinct.cpp:259
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition: float.hh:1825
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:43
Float variables.
Definition: float.hh:870
@ SEL_MAX_MAX
With largest max.
Definition: float.hh:1687
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:40
NNF * l
Left subtree.
Definition: bool-expr.cpp:240
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition: float.hh:1690
FloatNum pi_half_lower(void)
Return lower bound of .
Definition: num.hpp:37
void init(Home home, const FloatVarArgs &x, FloatBranchMerit bm=nullptr)
Initialize for float variables x.
Definition: chb.cpp:44
friend FloatVal nroot(const FloatVal &x, int n)
Definition: val.hpp:381
FloatNum sub_up(FloatNum x, FloatNum y)
Return upper bound of x minus y (domain: )
bool overlap(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:498
void init(Home home, const FloatVarArgs &x, double d=1.0, FloatBranchMerit bm=nullptr)
Initialize for float variables x with decay factor d.
Definition: action.cpp:45
FloatNum med(void) const
Return median of domain.
Definition: float.hpp:63
friend FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:200
@ FRT_GQ
Greater or equal ( )
Definition: float.hh:1073
Which values to select for assignment.
Definition: float.hh:1874
Variables as interfaces to variable implementations.
Definition: var.hpp:47
FloatNum exp_down(FloatNum x)
Return lower bound of exponential of x (domain: )
FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Definition: var.hpp:102
Gecode::IntSet d(v, 7)
FloatNum pi_half_upper(void)
Return upper bound of .
Definition: num.hpp:41
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition: channel.cpp:41
name Access Return minimum FloatNum min(void) const
Definition: delta.hpp:44
FloatNum acosh_up(FloatNum x)
Return upper bound of hyperbolic arccosine of x (domain: )
FloatNum sqrt_down(FloatNum x)
Return lower bound of square root of x (domain: )
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Definition: var.hpp:222
FloatNum sinh_up(FloatNum x)
Return upper bound of hyperbolic sine of x (domain: )
static FloatVal pi(void)
Return lower bound of .
Definition: val.hpp:114
New view Float::FloatView n
Definition: float.hh:2052
friend FloatVal atanh(const FloatVal &x)
Definition: val.hpp:480
friend FloatVal tanh(const FloatVal &x)
Definition: val.hpp:468
View trace information.
Definition: core.hpp:908
bool in(const FloatVal &n) const
Test whether n is contained in domain.
Definition: float.hpp:82
FloatVarBranch FLOAT_VAR_CHB_MIN(BranchTbl tbl)
Select variable with lowest CHB Q-score.
Definition: var.hpp:167
std::function< FloatNumBranch(const Space &home, FloatVar x, int i)> FloatBranchVal
Branch value function type for float variables.
Definition: float.hh:1481
Float variable array.
Definition: float.hh:1030
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.
Definition: limits.hpp:44
FloatVarBranch FLOAT_VAR_ACTION_MIN(double d, BranchTbl tbl)
Select variable with lowest action with decay factor d.
Definition: var.hpp:147
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
Definition: var.hpp:122
FloatValBranch FLOAT_VAL_SPLIT_RND(Rnd r)
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition: val.hpp:65
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
Definition: trace.cpp:39
friend FloatVal asinh(const FloatVal &x)
Definition: val.hpp:472
void asin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition: float.hh:1678
friend bool operator>=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:277
Select
Which value selection.
Definition: float.hh:1877
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
Definition: bool.cpp:39
Rnd r
Random number generator.
Definition: val.hpp:49
FloatNum median(FloatNum x, FloatNum y)
Return median of x and y (domain: )
Definition: rounding.hpp:44
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition: var.hpp:48
Delta information const Delta & d
Definition: float.hh:2054
@ SEL_MIN_MAX
With largest min.
Definition: float.hh:1685
FloatVal cosh(const FloatVal &x)
Definition: val.hpp:464
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:67
FloatVal hull(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:507
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch(void)
Initialize with strategy SEL_NONE.
Definition: var.hpp:37
friend FloatVal tan(const FloatVal &x)
Definition: val.hpp:443
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest action divided by domain size with decay factor d.
Definition: var.hpp:247
Gecode::FloatVal c(-8, 8)
gecode_boost::numeric::interval_lib::rounded_arith_opp< FloatNum > RoundingBase
Rounding Base class (optimized version)
Definition: float.hh:145
Float trace view.
Definition: trace-view.hpp:37
@ SEL_MERIT_MAX
With highest merit.
Definition: float.hh:1675
FloatNum min(void) const
Return lower bound.
Definition: val.hpp:70
Shared array with arbitrary number of elements.
FloatNum max(void) const
Return upper bound.
Definition: val.hpp:74
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
@ SEL_MAX
Select median value of the upper part.
Definition: float.hh:1879
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
friend bool operator>(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:260
Argument array for variables.
Definition: array.hpp:79
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition: float.hh:1455
@ SEL_RND
Random (uniform, for tie breaking)
Definition: float.hh:1673
FloatValBranch FLOAT_VAL(FloatBranchVal v, FloatBranchCommit c)
Definition: val.hpp:70
Gecode::IntArgs i({1, 2, 3, 4})
FloatVarBranch FLOAT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
Definition: var.hpp:112
FloatNum cosh_up(FloatNum x)
Return upper bound of hyperbolic cosine of x (domain: )
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum div_up(FloatNum x, FloatNum y)
Return upper bound of x divided y (domain: )
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
FloatNum asinh_down(FloatNum x)
Return lower bound of hyperbolic arcsine of x (domain: )
friend FloatVal cosh(const FloatVal &x)
Definition: val.hpp:464
friend FloatVal exp(const FloatVal &x)
Definition: val.hpp:413
@ TE_FAIL
Trace fail events.
Definition: recorder.hpp:46
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition: val-sel.hpp:39
@ SEL_MAX_MIN
With smallest max.
Definition: float.hh:1686
FloatNum acos_down(FloatNum x)
Return lower bound of arccosine of x (domain: )
friend FloatVal sqrt(const FloatVal &x)
Definition: val.hpp:369
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition: float.hh:1695
const FloatNum max
Largest allowed float value.
Definition: float.hh:844
void assign(FloatNum const &l, FloatNum const &u)
Assign lower bound l and upper bound u.
Definition: val.hpp:65
FloatNum pi_twice_upper(void)
Return upper bound of .
Definition: num.hpp:57
@ SEL_ACTION_MAX
With highest action.
Definition: float.hh:1681
FloatValBranch(Select s=SEL_SPLIT_MIN)
Initialize with selection strategy s.
Definition: val.hpp:37
Trace delta information for float variables.
Definition: float.hh:2049
gecode_boost::numeric::interval_lib::save_state< Float::Rounding > R
Used rounding policies.
Definition: float.hh:416
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest action divided by domain size with decay factor d.
Definition: var.hpp:257
friend bool operator<(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:226
FloatAction & operator=(const FloatAction &a)
Assignment operator.
Definition: action.hpp:44
FloatVal intersect(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:503
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition: float.hh:1692
friend bool operator!=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:317
FloatVar(void)
Default constructor.
Definition: float.hpp:44
FloatValArgs(void)
Allocate empty array.
Definition: array.hpp:44
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.
Definition: var.hpp:237
FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:422
FloatNum asin_up(FloatNum x)
Return upper bound of arcsine of x (domain: )
bool singleton(void) const
Test whether float is a singleton.
Definition: val.hpp:92
FloatVarBranch FLOAT_VAR_ACTION_MAX(double d, BranchTbl tbl)
Select variable with highest action with decay factor d.
Definition: var.hpp:157
Recording AFC information for float variables.
Definition: float.hh:1509
bool operator==(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:294