Generated on Thu Jul 25 2019 00:00:00 for Gecode by doxygen 1.8.15
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  * Last modified:
14  * $Date: 2017-04-10 13:21:37 +0200 (Mon, 10 Apr 2017) $ by $Author: schulte $
15  * $Revision: 15631 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #ifndef __GECODE_FLOAT_HH__
43 #define __GECODE_FLOAT_HH__
44 
45 #include <climits>
46 #include <cfloat>
47 #include <iostream>
48 
49 #include <functional>
50 
51 #include <gecode/kernel.hh>
52 #include <gecode/int.hh>
53 
54 /*
55  * Configure linking
56  *
57  */
58 #if !defined(GECODE_STATIC_LIBS) && \
59  (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
60 
61 #ifdef GECODE_BUILD_FLOAT
62 #define GECODE_FLOAT_EXPORT __declspec( dllexport )
63 #else
64 #define GECODE_FLOAT_EXPORT __declspec( dllimport )
65 #endif
66 
67 #else
68 
69 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
70 #define GECODE_FLOAT_EXPORT __attribute__ ((visibility("default")))
71 #else
72 #define GECODE_FLOAT_EXPORT
73 #endif
74 
75 #endif
76 
77 // Configure auto-linking
78 #ifndef GECODE_BUILD_FLOAT
79 #define GECODE_LIBRARY_NAME "Float"
81 #endif
82 
83 // Include interval implementation
84 #include <gecode/third-party/boost/numeric/interval.hpp>
85 
98 
100 
101 namespace Gecode {
102 
110  typedef double FloatNum;
111 
113  FloatNum pi_half_lower(void);
115  FloatNum pi_half_upper(void);
117  FloatNum pi_lower(void);
119  FloatNum pi_upper(void);
121  FloatNum pi_twice_lower(void);
123  FloatNum pi_twice_upper(void);
124 
125  // Forward declaration
126  class FloatVal;
127 
128 }
129 
130 #include <gecode/float/num.hpp>
131 
132 namespace Gecode { namespace Float {
133 
134 
135 #if defined(_MSC_VER) && (defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP > 0)))
136 
137  /*
138  * This is used for the MSVC compiler for x64 or x86 with SSE enabled.
139  *
140  */
142  typedef gecode_boost::numeric::interval_lib::rounded_arith_std<FloatNum>
143  RoundingBase;
144 
145 #else
146 
148  typedef gecode_boost::numeric::interval_lib::rounded_arith_opp<FloatNum>
150 
151 #endif
152 
158  class Rounding : public RoundingBase {
159  public:
161 
162  Rounding(void);
165  ~Rounding(void);
167 
169 
191 
193 
201 
202 #ifdef GECODE_HAS_MPFR
203 
214 
216 
230 
232 
246 
248 
262 
264 
278 #endif
279  };
280 
281 }}
282 
283 #include <gecode/float/rounding.hpp>
284 
285 namespace Gecode { namespace Float {
286 
291  bool subset(const FloatVal& x, const FloatVal& y);
296  bool proper_subset(const FloatVal& x, const FloatVal& y);
301  bool overlap(const FloatVal& x, const FloatVal& y);
302 
307  FloatVal intersect(const FloatVal& x, const FloatVal& y);
312  FloatVal hull(const FloatVal& x, const FloatVal& y);
317  FloatVal hull(const FloatVal& x, const FloatNum& y);
322  FloatVal hull(const FloatNum& x, const FloatVal& y);
327  FloatVal hull(const FloatNum& x, const FloatNum& y);
328 
329 }}
330 
331 namespace Gecode {
332 
338  class FloatVal {
339  friend FloatVal operator +(const FloatVal& x);
340  friend FloatVal operator -(const FloatVal& x);
341  friend FloatVal operator +(const FloatVal& x, const FloatVal& y);
342  friend FloatVal operator +(const FloatVal& x, const FloatNum& y);
343  friend FloatVal operator +(const FloatNum& x, const FloatVal& y);
344  friend FloatVal operator -(const FloatVal& x, const FloatVal& y);
345  friend FloatVal operator -(const FloatVal& x, const FloatNum& y);
346  friend FloatVal operator -(const FloatNum& x, const FloatVal& y);
347  friend FloatVal operator *(const FloatVal& x, const FloatVal& y);
348  friend FloatVal operator *(const FloatVal& x, const FloatNum& y);
349  friend FloatVal operator *(const FloatNum& x, const FloatVal& y);
350  friend FloatVal operator /(const FloatVal& x, const FloatVal& y);
351  friend FloatVal operator /(const FloatVal& x, const FloatNum& y);
352  friend FloatVal operator /(const FloatNum& x, const FloatVal& y);
353 
354  friend bool operator <(const FloatVal& x, const FloatVal& y);
355  friend bool operator <(const FloatVal& x, const FloatNum& y);
356  friend bool operator <(const FloatNum& x, const FloatVal& y);
357  friend bool operator <=(const FloatVal& x, const FloatVal& y);
358  friend bool operator <=(const FloatVal& x, const FloatNum& y);
359  friend bool operator <=(const FloatNum& x, const FloatVal& y);
360  friend bool operator >(const FloatVal& x, const FloatVal& y);
361  friend bool operator >(const FloatVal& x, const FloatNum& y);
362  friend bool operator >(const FloatNum& x, const FloatVal& y);
363  friend bool operator >=(const FloatVal& x, const FloatVal& y);
364  friend bool operator >=(const FloatVal& x, const FloatNum& y);
365  friend bool operator >=(const FloatNum& x, const FloatVal& y);
366  friend bool operator ==(const FloatVal& x, const FloatVal& y);
367  friend bool operator ==(const FloatVal& x, const FloatNum& y);
368  friend bool operator ==(const FloatNum& x, const FloatVal& y);
369  friend bool operator !=(const FloatVal& x, const FloatVal& y);
370  friend bool operator !=(const FloatVal& x, const FloatNum& y);
371  friend bool operator !=(const FloatNum& x, const FloatVal& y);
372 
373  template<class Char, class Traits>
374  friend std::basic_ostream<Char,Traits>&
375  operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
376 
377  friend FloatVal abs(const FloatVal& x);
378  friend FloatVal sqrt(const FloatVal& x);
379  friend FloatVal sqr(const FloatVal& x);
380  friend FloatVal pow(const FloatVal& x, int n);
381  friend FloatVal nroot(const FloatVal& x, int n);
382 
383  friend FloatVal max(const FloatVal& x, const FloatVal& y);
384  friend FloatVal max(const FloatVal& x, const FloatNum& y);
385  friend FloatVal max(const FloatNum& x, const FloatVal& y);
386  friend FloatVal min(const FloatVal& x, const FloatVal& y);
387  friend FloatVal min(const FloatVal& x, const FloatNum& y);
388  friend FloatVal min(const FloatNum& x, const FloatVal& y);
389 
390 #ifdef GECODE_HAS_MPFR
391  friend FloatVal exp(const FloatVal& x);
392  friend FloatVal log(const FloatVal& x);
393  friend FloatVal fmod(const FloatVal& x, const FloatVal& y);
394  friend FloatVal fmod(const FloatVal& x, const FloatNum& y);
395  friend FloatVal fmod(const FloatNum& x, const FloatVal& y);
396  friend FloatVal sin(const FloatVal& x);
397  friend FloatVal cos(const FloatVal& x);
398  friend FloatVal tan(const FloatVal& x);
399  friend FloatVal asin(const FloatVal& x);
400  friend FloatVal acos(const FloatVal& x);
401  friend FloatVal atan(const FloatVal& x);
402  friend FloatVal sinh(const FloatVal& x);
403  friend FloatVal cosh(const FloatVal& x);
404  friend FloatVal tanh(const FloatVal& x);
405  friend FloatVal asinh(const FloatVal& x);
406  friend FloatVal acosh(const FloatVal& x);
407  friend FloatVal atanh(const FloatVal& x);
408 #endif
409 
410  friend bool Float::subset(const FloatVal& x, const FloatVal& y);
411  friend bool Float::proper_subset(const FloatVal& x, const FloatVal& y);
412  friend bool Float::overlap(const FloatVal& x, const FloatVal& y);
413  friend FloatVal Float::intersect(const FloatVal& x, const FloatVal& y);
414  friend FloatVal Float::hull(const FloatVal& x, const FloatVal& y);
415  friend FloatVal Float::hull(const FloatVal& x, const FloatNum& y);
416  friend FloatVal Float::hull(const FloatNum& x, const FloatVal& y);
417  friend FloatVal Float::hull(const FloatNum& x, const FloatNum& y);
418  protected:
420  typedef gecode_boost::numeric::interval_lib::save_state<Float::Rounding> R;
422  typedef gecode_boost::numeric::interval_lib::checking_strict<FloatNum> P;
424  typedef gecode_boost::numeric::interval
425  <FloatNum,
426  gecode_boost::numeric::interval_lib::policies<R, P> >
431  explicit FloatVal(const FloatValImpType& i);
432  public:
434 
435  FloatVal(void);
438  FloatVal(const FloatNum& n);
440  FloatVal(const FloatNum& l, const FloatNum& u);
442  FloatVal(const FloatVal& v);
443 
445  FloatVal& operator =(const FloatNum& n);
447  FloatVal& operator =(const FloatVal& v);
448 
450  void assign(FloatNum const &l, FloatNum const &u);
452 
454 
455  FloatNum min(void) const;
458  FloatNum max(void) const;
460  FloatNum size(void) const;
462  FloatNum med(void) const;
464 
466 
467  bool tight(void) const;
470  bool singleton(void) const;
472  bool in(FloatNum n) const;
474  bool zero_in(void) const;
476 
478 
479  static FloatVal hull(FloatNum x, FloatNum y);
482  static FloatVal pi_half(void);
484  static FloatVal pi(void);
486  static FloatVal pi_twice(void);
488 
490 
491  FloatVal& operator +=(const FloatNum& n);
494  FloatVal& operator -=(const FloatNum& n);
496  FloatVal& operator *=(const FloatNum& n);
498  FloatVal& operator /=(const FloatNum& n);
500  FloatVal& operator +=(const FloatVal& v);
502  FloatVal& operator -=(const FloatVal& v);
504  FloatVal& operator *=(const FloatVal& v);
506  FloatVal& operator /=(const FloatVal& v);
508  };
509 
514  FloatVal operator +(const FloatVal& x);
519  FloatVal operator -(const FloatVal& x);
520 
525  FloatVal operator +(const FloatVal& x, const FloatVal& y);
530  FloatVal operator +(const FloatVal& x, const FloatNum& y);
535  FloatVal operator +(const FloatNum& x, const FloatVal& y);
540  FloatVal operator -(const FloatVal& x, const FloatVal& y);
545  FloatVal operator -(const FloatVal& x, const FloatNum& y);
550  FloatVal operator -(const FloatNum& x, const FloatVal& y);
555  FloatVal operator *(const FloatVal& x, const FloatVal& y);
560  FloatVal operator *(const FloatVal& x, const FloatNum& y);
565  FloatVal operator *(const FloatNum& x, const FloatVal& y);
570  FloatVal operator /(const FloatVal& x, const FloatVal& y);
575  FloatVal operator /(const FloatVal& x, const FloatNum& y);
580  FloatVal operator /(const FloatNum& r, const FloatVal& x);
581 
586  bool operator <(const FloatVal& x, const FloatVal& y);
591  bool operator <(const FloatVal& x, const FloatNum& y);
596  bool operator <(const FloatNum& x, const FloatVal& y);
597 
602  bool operator <=(const FloatVal& x, const FloatVal& y);
607  bool operator <=(const FloatVal& x, const FloatNum& y);
612  bool operator <=(const FloatNum& x, const FloatVal& y);
613 
618  bool operator >(const FloatVal& x, const FloatVal& y);
623  bool operator >(const FloatVal& x, const FloatNum& y);
628  bool operator >(const FloatNum& x, const FloatVal& y);
629 
634  bool operator >=(const FloatVal& x, const FloatVal& y);
639  bool operator >=(const FloatVal& x, const FloatNum& y);
644  bool operator >=(const FloatNum& x, const FloatVal& y);
649  bool operator ==(const FloatVal& x, const FloatVal& y);
654  bool operator ==(const FloatVal& x, const FloatNum& y);
659  bool operator ==(const FloatNum& x, const FloatVal& y);
660 
665  bool operator !=(const FloatVal& x, const FloatVal& y);
670  bool operator !=(const FloatVal& x, const FloatNum& y);
675  bool operator !=(const FloatNum& x, const FloatVal& y);
676 
681  template<class Char, class Traits>
682  std::basic_ostream<Char,Traits>&
683  operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
684 
689  FloatVal abs(const FloatVal& x);
694  FloatVal sqrt(const FloatVal& x);
699  FloatVal sqr(const FloatVal& x);
704  FloatVal pow(const FloatVal& x, int n);
709  FloatVal nroot(const FloatVal& x, int n);
710 
715  FloatVal max(const FloatVal& x, const FloatVal& y);
720  FloatVal max(const FloatVal& x, const FloatNum& y);
725  FloatVal max(const FloatNum& x, const FloatVal& y);
730  FloatVal min(const FloatVal& x, const FloatVal& y);
735  FloatVal min(const FloatVal& x, const FloatNum& y);
740  FloatVal min(const FloatNum& x, const FloatVal& y);
741 
742 #ifdef GECODE_HAS_MPFR
743  /* transcendental functions: exp, log */
748  FloatVal exp(const FloatVal& x);
753  FloatVal log(const FloatVal& x);
754 
759  FloatVal fmod(const FloatVal& x, const FloatVal& y);
764  FloatVal fmod(const FloatVal& x, const FloatNum& y);
769  FloatVal fmod(const FloatNum& x, const FloatVal& y);
770 
775  FloatVal sin(const FloatVal& x);
780  FloatVal cos(const FloatVal& x);
785  FloatVal tan(const FloatVal& x);
790  FloatVal asin(const FloatVal& x);
795  FloatVal acos(const FloatVal& x);
800  FloatVal atan(const FloatVal& x);
801 
806  FloatVal sinh(const FloatVal& x);
811  FloatVal cosh(const FloatVal& x);
816  FloatVal tanh(const FloatVal& x);
821  FloatVal asinh(const FloatVal& x);
826  FloatVal acosh(const FloatVal& x);
831  FloatVal atanh(const FloatVal& x);
832 
833 #endif
834 
835 }
836 
837 #include <gecode/float/val.hpp>
838 
839 namespace Gecode { namespace Float {
840 
846  namespace Limits {
850  const FloatNum min = -max;
852  bool valid(const FloatVal& n);
854  void check(const FloatVal& n, const char* l);
855  }
856 
857 }}
858 
859 #include <gecode/float/limits.hpp>
860 
861 #include <gecode/float/var-imp.hpp>
862 
863 namespace Gecode {
864 
865  namespace Float {
866  class FloatView;
867  }
868 
874  class FloatVar : public VarImpVar<Float::FloatVarImp> {
875  friend class FloatVarArray;
876  friend class FloatVarArgs;
877  private:
885  void _init(Space& home, FloatNum min, FloatNum max);
886  public:
888 
889  FloatVar(void);
892  FloatVar(const FloatVar& y);
894  FloatVar(const Float::FloatView& y);
908 
910 
911  FloatVal domain(void) const;
914  FloatNum min(void) const;
916  FloatNum max(void) const;
918  FloatNum med(void) const;
920  FloatNum size(void) const;
928  FloatVal val(void) const;
929 
931 
933 
934  bool in(const FloatVal& n) const;
937  };
938 
943  template<class Char, class Traits>
944  std::basic_ostream<Char,Traits>&
945  operator <<(std::basic_ostream<Char,Traits>& os, const FloatVar& x);
946 }
947 
948 #include <gecode/float/view.hpp>
950 
951 namespace Gecode {
952 
954  class FloatValArgs : public ArgArray<FloatVal> {
955  public:
957 
958  FloatValArgs(void);
961  explicit FloatValArgs(int n);
965  FloatValArgs(const std::vector<FloatVal>& x);
967  template<class InputIterator>
968  FloatValArgs(InputIterator first, InputIterator last);
970  FloatValArgs(int n, const FloatVal* e);
973 
976  static FloatValArgs create(int n, FloatVal start, int inc=1);
978  };
979 
981  class FloatVarArgs : public VarArgArray<FloatVar> {
982  public:
984 
985  FloatVarArgs(void) {}
988  explicit FloatVarArgs(int n) : VarArgArray<FloatVar>(n) {}
994  FloatVarArgs(const std::vector<FloatVar>& a) : VarArgArray<FloatVar>(a) {}
996  template<class InputIterator>
997  FloatVarArgs(InputIterator first, InputIterator last)
998  : VarArgArray<FloatVar>(first,last) {}
1011  FloatVarArgs(Space& home, int n, FloatNum min, FloatNum max);
1013  };
1015 
1031  class FloatVarArray : public VarArray<FloatVar> {
1032  public:
1034 
1035  FloatVarArray(void);
1038  FloatVarArray(Space& home, int n);
1040  FloatVarArray(const FloatVarArray& a);
1042  FloatVarArray(Space& home, const FloatVarArgs& a);
1055  FloatVarArray(Space& home, int n, FloatNum min, FloatNum max);
1057  };
1058 
1059 }
1060 
1061 #include <gecode/float/array.hpp>
1062 
1063 namespace Gecode {
1064 
1076  };
1077 
1085  GECODE_FLOAT_EXPORT void
1087  dom(Home home, FloatVar x, FloatVal n);
1089  GECODE_FLOAT_EXPORT void
1090  dom(Home home, const FloatVarArgs& x, FloatVal n);
1092  GECODE_FLOAT_EXPORT void
1093  dom(Home home, FloatVar x, FloatNum l, FloatNum m);
1095  GECODE_FLOAT_EXPORT void
1096  dom(Home home, const FloatVarArgs& x, FloatNum l, FloatNum u);
1098  GECODE_FLOAT_EXPORT void
1099  dom(Home home, FloatVar x, FloatVal n, Reify r);
1101  GECODE_FLOAT_EXPORT void
1102  dom(Home home, FloatVar x, FloatNum l, FloatNum u, Reify r);
1104  GECODE_FLOAT_EXPORT void
1105  dom(Home home, FloatVar x, FloatVar d);
1107  GECODE_FLOAT_EXPORT void
1108  dom(Home home, const FloatVarArgs& x, const FloatVarArgs& d);
1110 
1119  GECODE_FLOAT_EXPORT void
1120  rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1);
1124  GECODE_FLOAT_EXPORT void
1125  rel(Home home, FloatVar x, FloatRelType frt, FloatVal c);
1129  GECODE_FLOAT_EXPORT void
1130  rel(Home home, FloatVar x, FloatRelType frt, FloatVal c, Reify r);
1134  GECODE_FLOAT_EXPORT void
1135  rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1, Reify r);
1139  GECODE_FLOAT_EXPORT void
1140  rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVal c);
1144  GECODE_FLOAT_EXPORT void
1145  rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVar y);
1152  GECODE_FLOAT_EXPORT void
1153  ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z);
1154 
1155 }
1156 
1157 
1158 namespace Gecode {
1159 
1168  GECODE_FLOAT_EXPORT void
1169  min(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1173  GECODE_FLOAT_EXPORT void
1174  min(Home home, const FloatVarArgs& x, FloatVar y);
1177  GECODE_FLOAT_EXPORT void
1178  max(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1182  GECODE_FLOAT_EXPORT void
1183  max(Home home, const FloatVarArgs& x, FloatVar y);
1184 
1187  GECODE_FLOAT_EXPORT void
1188  abs(Home home, FloatVar x0, FloatVar x1);
1189 
1192  GECODE_FLOAT_EXPORT void
1193  mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1194 
1197  GECODE_FLOAT_EXPORT void
1198  sqr(Home home, FloatVar x0, FloatVar x1);
1199 
1202  GECODE_FLOAT_EXPORT void
1203  sqrt(Home home, FloatVar x0, FloatVar x1);
1204 
1207  GECODE_FLOAT_EXPORT void
1208  pow(Home home, FloatVar x0, int n, FloatVar x1);
1209 
1212  GECODE_FLOAT_EXPORT void
1213  nroot(Home home, FloatVar x0, int n, FloatVar x1);
1214 
1217  GECODE_FLOAT_EXPORT void
1218  div(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1219 #ifdef GECODE_HAS_MPFR
1220 
1222  GECODE_FLOAT_EXPORT void
1223  exp(Home home, FloatVar x0, FloatVar x1);
1226  GECODE_FLOAT_EXPORT void
1227  log(Home home, FloatVar x0, FloatVar x1);
1230  GECODE_FLOAT_EXPORT void
1231  pow(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1234  GECODE_FLOAT_EXPORT void
1235  log(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1238  GECODE_FLOAT_EXPORT void
1239  asin(Home home, FloatVar x0, FloatVar x1);
1242  GECODE_FLOAT_EXPORT void
1243  sin(Home home, FloatVar x0, FloatVar x1);
1246  GECODE_FLOAT_EXPORT void
1247  acos(Home home, FloatVar x0, FloatVar x1);
1250  GECODE_FLOAT_EXPORT void
1251  cos(Home home, FloatVar x0, FloatVar x1);
1254  GECODE_FLOAT_EXPORT void
1255  atan(Home home, FloatVar x0, FloatVar x1);
1258  GECODE_FLOAT_EXPORT void
1259  tan(Home home, FloatVar x0, FloatVar x1);
1261 #endif
1262 
1270  GECODE_FLOAT_EXPORT void
1271  linear(Home home, const FloatVarArgs& x,
1272  FloatRelType frt, FloatVal c);
1276  GECODE_FLOAT_EXPORT void
1277  linear(Home home, const FloatVarArgs& x,
1278  FloatRelType frt, FloatVar y);
1282  GECODE_FLOAT_EXPORT void
1283  linear(Home home, const FloatVarArgs& x,
1284  FloatRelType frt, FloatVal c, Reify r);
1288  GECODE_FLOAT_EXPORT void
1289  linear(Home home, const FloatVarArgs& x,
1290  FloatRelType frt, FloatVar y, Reify r);
1297  GECODE_FLOAT_EXPORT void
1298  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1299  FloatRelType frt, FloatVal c);
1306  GECODE_FLOAT_EXPORT void
1307  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1308  FloatRelType frt, FloatVar y);
1315  GECODE_FLOAT_EXPORT void
1316  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1317  FloatRelType frt, FloatVal c, Reify r);
1324  GECODE_FLOAT_EXPORT void
1325  linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1326  FloatRelType frt, FloatVar y, Reify r);
1327 
1328 
1334  GECODE_FLOAT_EXPORT void
1336  channel(Home home, FloatVar x0, IntVar x1);
1338  void
1339  channel(Home home, IntVar x0, FloatVar x1);
1341  GECODE_FLOAT_EXPORT void
1342  channel(Home home, FloatVar x0, BoolVar x1);
1344  void
1345  channel(Home home, BoolVar x0, FloatVar x1);
1347 
1348 }
1349 
1350 #include <gecode/float/channel.hpp>
1351 
1352 namespace Gecode {
1353 
1362  GECODE_FLOAT_EXPORT void
1364  wait(Home home, FloatVar x, std::function<void(Space& home)> c);
1366  GECODE_FLOAT_EXPORT void
1367  wait(Home home, const FloatVarArgs& x, std::function<void(Space& home)> c);
1369 
1370 }
1371 
1372 namespace Gecode {
1373 
1387  typedef std::function<bool(const Space& home, FloatVar x, int i)>
1389 
1400  typedef std::function<double(const Space& home, FloatVar x, int i)>
1402 
1409  public:
1413  bool l;
1414  };
1415 
1426  typedef std::function<FloatNumBranch(const Space& home, FloatVar x, int i)>
1428 
1440  typedef std::function<void(Space& home, unsigned int a,
1441  FloatVar x, int i, FloatNumBranch nl)>
1443 
1444 }
1445 
1447 
1448 namespace Gecode {
1449 
1455  class FloatAFC : public AFC {
1456  public:
1464  FloatAFC(void);
1466  FloatAFC(const FloatAFC& a);
1468  FloatAFC& operator =(const FloatAFC& a);
1470  FloatAFC(Home home, const FloatVarArgs& x, double d=1.0);
1478  void init(Home home, const FloatVarArgs& x, double d=1.0);
1479  };
1480 
1481 }
1482 
1483 #include <gecode/float/branch/afc.hpp>
1484 
1485 namespace Gecode {
1486 
1492  class FloatAction : public Action {
1493  public:
1501  FloatAction(void);
1503  FloatAction(const FloatAction& a);
1515  FloatAction(Home home, const FloatVarArgs& x, double d=1.0,
1516  FloatBranchMerit bm=nullptr);
1528  GECODE_FLOAT_EXPORT void
1529  init(Home home, const FloatVarArgs& x, double d=1.0,
1530  FloatBranchMerit bm=nullptr);
1531  };
1532 
1533 }
1534 
1536 
1537 namespace Gecode {
1538 
1544  class FloatCHB : public CHB {
1545  public:
1553  FloatCHB(void);
1555  FloatCHB(const FloatCHB& chb);
1557  FloatCHB& operator =(const FloatCHB& chb);
1567  FloatCHB(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1579  GECODE_FLOAT_EXPORT void
1580  init(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1581  };
1582 
1583 }
1584 
1585 #include <gecode/float/branch/chb.hpp>
1586 
1587 namespace Gecode {
1588 
1590  typedef std::function<void(const Space &home, const Brancher& b,
1591  unsigned int a,
1592  FloatVar x, int i, const FloatNumBranch& n,
1593  std::ostream& o)>
1595 
1596 }
1597 
1598 namespace Gecode {
1599 
1605  class FloatVarBranch : public VarBranch<FloatVar> {
1606  public:
1608  enum Select {
1609  SEL_NONE = 0,
1635  };
1636  protected:
1639  public:
1641  FloatVarBranch(void);
1643  FloatVarBranch(Rnd r);
1647  FloatVarBranch(Select s, double, BranchTbl t);
1657  Select select(void) const;
1659  void expand(Home home, const FloatVarArgs& x);
1660  };
1661 
1662 
1681  FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
1685  FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
1689  FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
1693  FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
1721  FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1725  FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1745 
1746 }
1747 
1748 #include <gecode/float/branch/var.hpp>
1749 
1750 namespace Gecode {
1751 
1757  class FloatValBranch : public ValBranch<FloatVar> {
1758  public:
1760  enum Select {
1765  };
1766  protected:
1769  public:
1773  FloatValBranch(Rnd r);
1777  Select select(void) const;
1778  };
1779 
1799 
1800 }
1801 
1802 #include <gecode/float/branch/val.hpp>
1803 
1804 namespace Gecode {
1805 
1811  class FloatAssign : public ValBranch<FloatVar> {
1812  public:
1814  enum Select {
1819  };
1820  protected:
1823  public:
1827  FloatAssign(Rnd r);
1831  Select select(void) const;
1832  };
1833 
1852 
1853 }
1854 
1856 
1857 namespace Gecode {
1858 
1864  GECODE_FLOAT_EXPORT void
1865  branch(Home home, const FloatVarArgs& x,
1866  FloatVarBranch vars, FloatValBranch vals,
1867  FloatBranchFilter bf=nullptr,
1868  FloatVarValPrint vvp=nullptr);
1874  GECODE_FLOAT_EXPORT void
1875  branch(Home home, const FloatVarArgs& x,
1876  TieBreak<FloatVarBranch> vars, FloatValBranch vals,
1877  FloatBranchFilter bf=nullptr,
1878  FloatVarValPrint vvp=nullptr);
1884  GECODE_FLOAT_EXPORT void
1885  branch(Home home, FloatVar x, FloatValBranch vals,
1886  FloatVarValPrint vvp=nullptr);
1887 
1893  GECODE_FLOAT_EXPORT void
1894  assign(Home home, const FloatVarArgs& x, FloatAssign vals,
1895  FloatBranchFilter bf=nullptr,
1896  FloatVarValPrint vvp=nullptr);
1902  GECODE_FLOAT_EXPORT void
1903  assign(Home home, FloatVar x, FloatAssign vals,
1904  FloatVarValPrint vvp=nullptr);
1906 
1907 }
1908 
1909 namespace Gecode {
1910 
1911  /*
1912  * \brief Relaxed assignment of variables in \a x from values in \a sx
1913  *
1914  * The variables in \a x are assigned values from the assigned variables
1915  * in the solution \a sx with a relaxation probability \a p. That is,
1916  * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
1917  * assigned a value from \a sx.
1918  *
1919  * The random numbers are generated from the generator \a r. At least
1920  * one variable will not be assigned: in case the relaxation attempt
1921  * would suggest that all variables should be assigned, a single
1922  * variable will be selected randomly to remain unassigned.
1923  *
1924  * Throws an exception of type Float::ArgumentSizeMismatch, if \a x and
1925  * \a sx are of different size.
1926  *
1927  * Throws an exception of type Float::OutOfLimits, if \a p is not between
1928  * \a 0.0 and \a 1.0.
1929  *
1930  * \ingroup TaskModeFloat
1931  */
1932  GECODE_FLOAT_EXPORT void
1933  relax(Home home, const FloatVarArgs& x, const FloatVarArgs& sx,
1934  Rnd r, double p);
1935 
1936 }
1937 
1939 
1940 namespace Gecode {
1941 
1952  protected:
1956  const Delta& d;
1957  public:
1959 
1962  const Delta& d);
1964 
1966  FloatNum min(void) const;
1969  FloatNum max(void) const;
1971  };
1972 
1973 }
1974 
1976 
1978 
1979 namespace Gecode {
1980 
1991 
1997  protected:
1999  std::ostream& os;
2000  public:
2002  StdFloatTracer(std::ostream& os0 = std::cerr);
2004  virtual void init(const Space& home, const FloatTraceRecorder& t);
2006  virtual void prune(const Space& home, const FloatTraceRecorder& t,
2007  const ViewTraceInfo& vti, int i, FloatTraceDelta& d);
2009  virtual void fix(const Space& home, const FloatTraceRecorder& t);
2011  virtual void fail(const Space& home, const FloatTraceRecorder& t);
2013  virtual void done(const Space& home, const FloatTraceRecorder& t);
2015  static StdFloatTracer def;
2016  };
2017 
2018 
2023  GECODE_FLOAT_EXPORT void
2024  trace(Home home, const FloatVarArgs& x,
2025  TraceFilter tf,
2026  int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2027  FloatTracer& t = StdFloatTracer::def);
2032  void
2033  trace(Home home, const FloatVarArgs& x,
2034  int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2035  FloatTracer& t = StdFloatTracer::def);
2036 
2037 }
2038 
2039 #include <gecode/float/trace.hpp>
2040 
2041 #endif
2042 
2043 // IFDEF: GECODE_HAS_FLOAT_VARS
2044 // STATISTICS: float-post
2045 
#define GECODE_FLOAT_EXPORT
Definition: float.hh:72
FloatNum pi_half_upper(void)
Return upper bound of .
Definition: num.hpp:45
FloatAction & operator=(const FloatAction &a)
Assignment operator.
Definition: action.hpp:48
Select values greater than mean of smallest and largest value.
Definition: float.hh:1762
FloatVal operator-(const FloatVal &x)
Definition: val.hpp:172
With smallest degree divided by domain size.
Definition: float.hh:1627
Passing float arguments.
Definition: float.hh:954
FloatVarBranch FLOAT_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Select variable with smallest CHB Q-score divided by domain size.
Definition: var.hpp:271
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.
Definition: var.hpp:51
NodeType t
Type of node.
Definition: bool-expr.cpp:234
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.
Definition: float.hh:1760
Tracer that process view trace information.
Definition: tracer.hpp:55
FloatVarArgs(int n)
Allocate array with n elements.
Definition: float.hh:988
Which values to select for branching first.
Definition: float.hh:1757
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:92
FloatVarArgs(const std::vector< FloatVar > &a)
Initialize from vector a.
Definition: float.hh:994
With smallest domain size.
Definition: float.hh:1625
FloatNum div_up(FloatNum x, FloatNum y)
Return upper bound of x divided y (domain: )
FloatVarBranch(void)
Initialize with strategy SEL_NONE.
Definition: var.hpp:41
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.
Definition: val.hpp:64
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
FloatVarArgs(const FloatVarArgs &a)
Initialize from variable argument array a (copy elements)
Definition: float.hh:990
bool valid(const FloatVal &n)
Return whether float n is a valid number.
Definition: limits.hpp:43
With largest domain size.
Definition: float.hh:1626
union Gecode::@579::NNF::@61 u
Union depending on nodetype t.
FloatNum cosh_down(FloatNum x)
Return lower bound of hyperbolic cosine of x (domain: )
View trace information.
Definition: core.hpp:974
bool subset(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:494
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:43
With largest CHB Q-score divided by domain size.
Definition: float.hh:1634
With smallest accumulated failure count divided by domain size.
Definition: float.hh:1629
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 .
friend bool operator>(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:264
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition: channel.cpp:45
const FloatNum max
Largest allowed float value.
Definition: float.hh:848
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.
Definition: var.hpp:281
FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:217
Select select(void) const
Return selection strategy.
Definition: assign.hpp:53
Disequality ( )
Definition: float.hh:1071
ViewTraceRecorder< Float::FloatView > FloatTraceRecorder
Trace recorder for float variables.
Definition: float.hh:1990
FloatAssign FLOAT_ASSIGN_MAX(void)
Select median value of the upper part.
Definition: assign.hpp:64
Recording actions for float variables.
Definition: float.hh:1492
FloatNum tanh_down(FloatNum x)
Return lower bound of hyperbolic tangent of x (domain: )
FloatNum max(void) const
Return maximum of domain.
Definition: float.hpp:71
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:49
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
Definition: var.hpp:126
friend FloatVal cosh(const FloatVal &x)
Definition: val.hpp:468
Less or equal ( )
Definition: float.hh:1072
FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:426
friend FloatVal exp(const FloatVal &x)
Definition: val.hpp:417
FloatVal & operator/=(const FloatNum &n)
Divide by n.
Definition: val.hpp:141
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:53
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:45
Passing float variables.
Definition: float.hh:981
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:231
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Definition: arithmetic.cpp:122
bool overlap(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:502
friend FloatVal sqr(const FloatVal &x)
Definition: val.hpp:377
Select median value of a randomly chosen part.
Definition: float.hh:1817
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Definition: arithmetic.cpp:113
FloatVar(void)
Default constructor.
Definition: float.hpp:48
bool singleton(void) const
Test whether float is a singleton.
Definition: val.hpp:96
FloatAssign FLOAT_ASSIGN_MIN(void)
Select median value of the lower part.
Definition: assign.hpp:59
friend FloatVal sinh(const FloatVal &x)
Definition: val.hpp:464
Select s
Which value to select.
Definition: float.hh:1768
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Definition: dom.cpp:44
void expand(Home home, const FloatVarArgs &x)
Expand AFC, action, and CHB.
Definition: var.hpp:78
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Definition: linear.cpp:45
FloatVal hull(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:511
bool zero_in(void) const
Test whether zero is included.
Definition: val.hpp:104
FloatNum sqrt_down(FloatNum x)
Return lower bound of square root of x (domain: )
friend FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:426
With largest accumulated failure count.
Definition: float.hh:1616
FloatNum asin_up(FloatNum x)
Return upper bound of arcsine of x (domain: )
Which variable to select for branching.
Definition: float.hh:1605
FloatVal & operator-=(const FloatNum &n)
Subtract by n.
Definition: val.hpp:133
gecode_boost::numeric::interval_lib::checking_strict< FloatNum > P
Used checking policy.
Definition: float.hh:422
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition: float.hh:1763
Less ( )
Definition: float.hh:1073
Select select(void) const
Return selection strategy.
Definition: var.hpp:73
static FloatVal pi_twice(void)
Return .
Definition: val.hpp:123
Select
Which variable selection.
Definition: float.hh:1608
FloatNum sinh_up(FloatNum x)
Return upper bound of hyperbolic sine of x (domain: )
friend FloatVal acos(const FloatVal &x)
Definition: val.hpp:455
FloatNum sqrt_up(FloatNum x)
Return upper bound of square root of x (domain: )
friend FloatVal asin(const FloatVal &x)
Definition: val.hpp:451
gecode_boost::numeric::interval< FloatNum, gecode_boost::numeric::interval_lib::policies< R, P > > FloatValImpType
Implementation type for float value.
Definition: float.hh:427
Return maximum FloatNum max(void) const
Definition: delta.hpp:53
With highest CHB Q-score.
Definition: float.hh:1620
FloatVal val(void) const
Return assigned value.
Definition: float.hpp:57
FloatValBranch FLOAT_VAL(FloatBranchVal v, FloatBranchCommit c)
Definition: val.hpp:74
Trace init events.
bool in(FloatNum n) const
Test whether n is included.
Definition: val.hpp:100
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:251
Float variable array.
Definition: float.hh:1031
Computation spaces.
Definition: core.hpp:1748
ExecStatus prune(Space &home, ViewArray< VX > &x, ConstIntView)
Definition: rel.hpp:257
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:101
FloatVal(void)
Default constructor.
Definition: val.hpp:49
friend bool operator<=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:247
FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
Definition: var.hpp:121
FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Definition: var.hpp:106
static FloatVal hull(FloatNum x, FloatNum y)
Return hull of x and y.
Definition: val.hpp:109
Select s
Which value to select.
Definition: float.hh:1822
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:69
With smallest action divided by domain size.
Definition: float.hh:1631
Gecode::IntSet d(v, 7)
FloatValImpType x
Implementation of float value.
Definition: float.hh:429
With lowest CHB Q-score.
Definition: float.hh:1619
FloatNum min(void) const
Return minimum of domain.
Definition: float.hpp:63
FloatNum pi_twice_lower(void)
Return lower bound of .
Definition: num.hpp:57
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
Trace prune events.
Greater or equal ( )
Definition: float.hh:1074
FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest domain size.
Definition: var.hpp:216
FloatNum log_down(FloatNum x)
Return lower bound of logarithm of x (domain: )
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Standard float variable tracer.
Definition: float.hh:1996
bool proper_subset(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:498
const FloatNum min
Smallest allowed float value.
Definition: float.hh:850
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: float.hpp:81
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Definition: var.hpp:221
Gecode::IntArgs i(4, 1, 2, 3, 4)
FloatNum n
The middle value for branching.
Definition: float.hh:1411
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:44
FloatNum asin_down(FloatNum x)
Return lower bound of arcsine of x (domain: )
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
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.
Definition: array.hpp:727
FloatVarArgs(const VarArray< FloatVar > &a)
Initialize from variable array a (copy elements)
Definition: float.hh:992
FloatVal & operator*=(const FloatNum &n)
Multiply by n.
Definition: val.hpp:137
FloatAssign FLOAT_ASSIGN_RND(Rnd r)
Select median value of a randomly chosen part.
Definition: assign.hpp:69
FloatVal sinh(const FloatVal &x)
Definition: val.hpp:464
FloatNum pi_twice_upper(void)
Return upper bound of .
Definition: num.hpp:61
FloatVal intersect(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:507
Value description class for branching.
Definition: float.hh:1408
friend bool operator==(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:298
FloatValArgs(void)
Allocate empty array.
Definition: array.hpp:48
FloatVal operator+(const FloatVal &x)
Definition: val.hpp:168
name Access Return minimum FloatNum min(void) const
Definition: delta.hpp:48
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:99
FloatRelType
Relation types for floats.
Definition: float.hh:1069
FloatNum log_up(FloatNum x)
Return upper bound of logarithm of x (domain: )
void init(Home home, const FloatVarArgs &x, double d=1.0)
Initialize for float variables x with decay factor d.
Definition: afc.hpp:58
bool operator!=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:321
static FloatValArgs create(int n, FloatVal start, int inc=1)
Allocate array with n elements such that for all .
Definition: array.cpp:45
New view Float::FloatView n
Definition: float.hh:1954
friend FloatVal cos(const FloatVal &x)
Definition: val.hpp:443
bool tight(void) const
Test whether float is tight.
Definition: val.hpp:91
FloatVal domain(void) const
Return domain.
Definition: float.hpp:76
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:41
FloatNum cos_down(FloatNum x)
Return lower bound of cosine of x (domain: )
Output stream to use std::ostream & os
Definition: float.hh:1999
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:106
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition: branch-var.hpp:52
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
Definition: exec.cpp:44
Class for CHB management.
Definition: chb.hpp:50
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
bool l
Whether to try the lower or upper half first.
Definition: float.hh:1413
friend FloatVal nroot(const FloatVal &x, int n)
Definition: val.hpp:385
FloatVal cosh(const FloatVal &x)
Definition: val.hpp:468
FloatVarArray(void)
Default constructor (array of size 0)
Definition: array.hpp:76
Trace filters.
friend FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:204
FloatNum pi_half_lower(void)
Return lower bound of .
Definition: num.hpp:41
FloatNum med(void) const
Return median of float value.
Definition: val.hpp:86
FloatValBranch FLOAT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Definition: val.hpp:59
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:1442
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:784
FloatVarBranch FLOAT_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
Definition: var.hpp:131
FloatNum atanh_up(FloatNum x)
Return upper bound of hyperbolic arctangent of x (domain: )
static FloatVal pi(void)
Return lower bound of .
Definition: val.hpp:118
FloatNum med(void) const
Return median of domain.
Definition: float.hpp:67
FloatVal & operator=(const FloatNum &n)
Assignment operator.
Definition: val.hpp:60
friend FloatVal atanh(const FloatVal &x)
Definition: val.hpp:484
With largest accumulated failure count divided by domain size.
Definition: float.hh:1630
int n
Number of variables (size)
Definition: array.hpp:89
friend FloatVal tanh(const FloatVal &x)
Definition: val.hpp:472
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)
Definition: var.hpp:116
ViewTracer< Float::FloatView > FloatTracer
Tracer for float variables.
Definition: float.hh:1985
friend std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const FloatVal &x)
Definition: val.hpp:364
With smallest CHB Q-score divided by domain size.
Definition: float.hh:1633
FloatAFC(void)
Construct as not yet initialized.
Definition: afc.hpp:41
Select values not greater than mean of smallest and largest value.
Definition: float.hh:1761
FloatVarArgs(InputIterator first, InputIterator last)
Initialize from InputIterator first and last.
Definition: float.hh:997
Floating point rounding policy.
Definition: float.hh:158
Random (uniform, for tie breaking)
Definition: float.hh:1610
FloatNum tan_up(FloatNum x)
Return upper bound of tangent of x (domain: )
Equality ( )
Definition: float.hh:1070
Recording CHB for float variables.
Definition: float.hh:1544
FloatNum atan_up(FloatNum x)
Return upper bound of arctangent of x (domain: )
Float view for float variables.
Definition: view.hpp:56
FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Definition: var.hpp:211
Greater ( )
Definition: float.hh:1075
bool in(const FloatVal &n) const
Test whether n is contained in domain.
Definition: float.hpp:86
FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest min.
Definition: var.hpp:196
FloatVal & operator+=(const FloatNum &n)
Increment by n.
Definition: val.hpp:129
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:784
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:48
const int v[7]
Definition: distinct.cpp:263
Propagator for recording view trace information.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:71
FloatNum cos_up(FloatNum x)
Return upper bound of cosine of x (domain: )
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
friend FloatVal asinh(const FloatVal &x)
Definition: val.hpp:476
Trace delta information for float variables.
Definition: float.hh:1951
FloatNum acosh_up(FloatNum x)
Return upper bound of hyperbolic arccosine of x (domain: )
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
friend FloatVal abs(const FloatVal &x)
Definition: val.hpp:369
Value branching information.
Definition: branch-val.hpp:45
Trace done events.
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:131
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
Definition: relax.cpp:61
const double base
Base for geometric restart sequence.
Definition: search.hh:122
Float value type.
Definition: float.hh:338
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:204
Variable branching information.
Definition: branch-var.hpp:59
name Constructor Initialize with old trace view a o
Definition: float.hh:1960
FloatNum atan_down(FloatNum x)
Return lower bound of arctangent of x (domain: )
FloatNum max(void) const
Return upper bound.
Definition: val.hpp:78
Rounding(void)
Default constructor (configures full rounding mode)
Definition: rounding.hpp:41
Generic domain change information to be supplied to advisors.
Definition: core.hpp:281
FloatNum sub_down(FloatNum x, FloatNum y)
Return lower bound of x minus y (domain: )
Select median value of the upper part.
Definition: float.hh:1816
FloatNum acosh_down(FloatNum x)
Return lower bound of hyperbolic arccosine of x (domain: )
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
With smallest accumulated failure count.
Definition: float.hh:1615
Select
Which value selection.
Definition: float.hh:1814
Select s
Which variable to select.
Definition: float.hh:1638
static FloatVal pi_half(void)
Return .
Definition: val.hpp:113
friend FloatVal tan(const FloatVal &x)
Definition: val.hpp:447
Rnd r
Random number generator.
Definition: branch-val.hpp:53
bool operator>=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:281
FloatVal acosh(const FloatVal &x)
Definition: val.hpp:480
FloatVarBranch FLOAT_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Definition: var.hpp:141
friend FloatVal operator+(const FloatVal &x)
Definition: val.hpp:168
FloatNum div_down(FloatNum x, FloatNum y)
Return lower bound of x divided by y (domain: )
FloatNum min(void) const
Return lower bound.
Definition: val.hpp:74
FloatNum exp_up(FloatNum x)
Return upper bound of exponential of x (domain: )
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:47
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.
Definition: float.hh:1388
With largest degree divided by domain size.
Definition: float.hh:1628
FloatVarBranch FLOAT_VAR_ACTION_MIN(double d, BranchTbl tbl)
Select variable with lowest action with decay factor d.
Definition: var.hpp:151
friend FloatVal acosh(const FloatVal &x)
Definition: val.hpp:480
FloatVal atanh(const FloatVal &x)
Definition: val.hpp:484
Select select(void) const
Return selection strategy.
Definition: val.hpp:53
friend bool operator<(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:230
FloatVal asinh(const FloatVal &x)
Definition: val.hpp:476
FloatVarBranch FLOAT_VAR_CHB_MIN(BranchTbl tbl)
Select variable with lowest CHB Q-score.
Definition: var.hpp:171
friend FloatVal pow(const FloatVal &x, int n)
Definition: val.hpp:381
gecode_boost::numeric::interval_lib::rounded_arith_opp< FloatNum > RoundingBase
Rounding Base class (optimized version)
Definition: float.hh:149
Which values to select for assignment.
Definition: float.hh:1811
Delta information const Delta & d
Definition: float.hh:1956
Trace fail events.
Post propagator for SetVar x
Definition: set.hh:784
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition: val-sel.hpp:43
FloatNum cosh_up(FloatNum x)
Return upper bound of hyperbolic cosine of x (domain: )
Trace fixpoint events.
friend FloatVal sqrt(const FloatVal &x)
Definition: val.hpp:373
FloatNum exp_down(FloatNum x)
Return lower bound of exponential of x (domain: )
void assign(FloatNum const &l, FloatNum const &u)
Assign lower bound l and upper bound u.
Definition: val.hpp:69
FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c)
Definition: assign.hpp:74
int n
Number of elements.
Definition: array.hpp:527
FloatValBranch(Select s=SEL_SPLIT_MIN)
Initialize with selection strategy s.
Definition: val.hpp:41
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
Definition: trace.cpp:43
gecode_boost::numeric::interval_lib::save_state< Float::Rounding > R
Used rounding policies.
Definition: float.hh:420
Select median value of the lower part.
Definition: float.hh:1815
Float variables.
Definition: float.hh:874
bool operator>(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:264
FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest min.
Definition: var.hpp:191
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.
Definition: float.hh:1594
friend FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:217
friend bool operator!=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:321
bool operator<(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:230
bool operator==(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:298
bool operator<=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:247
With largest action divided by domain size.
Definition: float.hh:1632
FloatNum add_up(FloatNum x, FloatNum y)
Return upper bound of x plus y (domain: )
Gecode toplevel namespace
Argument array for variables.
Definition: array.hpp:53
friend FloatVal log(const FloatVal &x)
Definition: val.hpp:421
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
Definition: val.hpp:82
FloatCHB(void)
Construct as not yet initialized.
Definition: chb.hpp:41
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.
Definition: action.hpp:46
FloatVarArgs(void)
Allocate empty array.
Definition: float.hh:986
friend FloatVal sin(const FloatVal &x)
Definition: val.hpp:439
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:261
Random number generator.
Definition: rnd.hpp:46
friend FloatVal atan(const FloatVal &x)
Definition: val.hpp:459
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:241
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 .
Definition: num.hpp:49
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.
Definition: branch.cpp:115
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest max.
Definition: var.hpp:206
FloatAFC & operator=(const FloatAFC &a)
Assignment operator.
Definition: afc.hpp:48
FloatVal tanh(const FloatVal &x)
Definition: val.hpp:472
Home class for posting propagators
Definition: core.hpp:922
FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Definition: var.hpp:111
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Definition: branch.cpp:65
FloatVarBranch FLOAT_VAR_ACTION_MAX(double d, BranchTbl tbl)
Select variable with highest action with decay factor d.
Definition: var.hpp:161
void init(Home home, const FloatVarArgs &x, FloatBranchMerit bm=nullptr)
Initialize for float variables x.
Definition: chb.cpp:48
double FloatNum
Floating point number base type.
Definition: float.hh:110
FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest max.
Definition: var.hpp:201
friend FloatVal operator-(const FloatVal &x)
Definition: val.hpp:172
Shared array with arbitrary number of elements.
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Definition: var.hpp:226
~Rounding(void)
Destructor (restores previous rounding mode)
Definition: rounding.hpp:45
std::function< FloatNumBranch(const Space &home, FloatVar x, int i)> FloatBranchVal
Branch value function type for float variables.
Definition: float.hh:1427
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
Definition: bool.cpp:43
FloatAssign(Select s=SEL_MIN)
Initialize with selection strategy s.
Definition: assign.hpp:41
FloatNum median(FloatNum x, FloatNum y)
Return median of x and y (domain: )
Definition: rounding.hpp:48
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition: float.hh:1401
FloatCHB & operator=(const FloatCHB &chb)
Assignment operator.
Definition: chb.hpp:48
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum sin_down(FloatNum x)
Return lower bound of sine of x (domain: )
friend bool operator>=(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:281
Recording AFC information for float variables.
Definition: float.hh:1455
FloatNum tan_down(FloatNum x)
Return lower bound of tangent of x (domain: )
FloatVal * a
Element array.
Definition: array.hpp:531
Select value according to user-defined functions.
Definition: float.hh:1764
FloatNum pi_upper(void)
Return upper bound of .
Definition: num.hpp:53
FloatAction(void)
Construct as not yet initialized.
Definition: action.hpp:41
FloatVarBranch FLOAT_VAR_CHB_MAX(BranchTbl tbl)
Select variable with highest CHB Q-score.
Definition: var.hpp:181
Select value according to user-defined functions.
Definition: float.hh:1818