Generated on for Gecode by doxygen 1.17.0
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.dev>
5 * Guido Tack <tack@gecode.dev>
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.dev
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
92
94
96
97namespace Gecode {
98
106 typedef double FloatNum;
107
113 FloatNum pi_lower(void);
115 FloatNum pi_upper(void);
120
121 // Forward declaration
122 class FloatVal;
123
124}
125
126#include <gecode/float/num.hpp>
127
128namespace 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
159 Rounding(void);
161 ~Rounding(void);
163
165
166
187
189
190
197
198#ifdef GECODE_HAS_MPFR
200
201
210
212
213
226
228
229
242
244
245
258
260
261
274#endif
275 };
276
277}}
278
280
281namespace 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
327namespace 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
432 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
452 FloatNum min(void) const;
454 FloatNum max(void) const;
456 FloatNum size(void) const;
458 FloatNum med(void) const;
460
462
463
464 bool tight(void) const;
466 bool singleton(void) const;
468 bool in(FloatNum n) const;
470 bool zero_in(void) const;
472
474
475
476 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
488 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
835namespace Gecode { namespace Float {
836
842 namespace Limits {
844 const FloatNum max = std::numeric_limits<FloatNum>::max();
846 const FloatNum min = -max;
848 bool valid(const FloatVal& n);
850 void check(const FloatVal& n, const char* l);
851 }
852
853}}
854
856
858
859namespace 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
886 FloatVar(void);
888 FloatVar(const FloatVar& y);
890 FloatVar(const Float::FloatView& y);
904
906
907
908 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
931 bool in(const FloatVal& n) const;
933
935 FloatVar& operator =(const FloatVar&) = default;
936 };
937
942 template<class Char, class Traits>
943 std::basic_ostream<Char,Traits>&
944 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVar& x);
945}
946
947#include <gecode/float/view.hpp>
949
950namespace Gecode {
951
953 class FloatValArgs : public ArgArray<FloatVal> {
954 public:
956
957
958 FloatValArgs(void);
960 explicit FloatValArgs(int n);
964 FloatValArgs(const std::vector<FloatVal>& x);
966 FloatValArgs(std::initializer_list<FloatVal> x);
968 template<class InputIterator>
969 FloatValArgs(InputIterator first, InputIterator last);
971 FloatValArgs(int n, const FloatVal* e);
974
977 static FloatValArgs create(int n, FloatVal start, int inc=1);
979 };
980
982 class FloatVarArgs : public VarArgArray<FloatVar> {
983 public:
985
986
987 FloatVarArgs(void);
989 explicit FloatVarArgs(int n);
995 FloatVarArgs(const std::vector<FloatVar>& a);
997 FloatVarArgs(std::initializer_list<FloatVar> a);
999 template<class InputIterator>
1000 FloatVarArgs(InputIterator first, InputIterator last);
1017 };
1018
1019
1030
1035 class FloatVarArray : public VarArray<FloatVar> {
1036 public:
1038
1039
1040 FloatVarArray(void);
1042 FloatVarArray(Space& home, int n);
1044 FloatVarArray(const FloatVarArray& a);
1046 FloatVarArray(Space& home, const FloatVarArgs& a);
1063 };
1064
1065}
1066
1067#include <gecode/float/array.hpp>
1068
1069namespace Gecode {
1070
1083
1089
1091
1096 dom(Home home, const FloatVarArgs& x, FloatVal n);
1102 dom(Home home, const FloatVarArgs& x, FloatNum l, FloatNum u);
1114 dom(Home home, const FloatVarArgs& x, const FloatVarArgs& d);
1116
1146 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVal c);
1151 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVar y);
1160
1161}
1162
1163
1164namespace Gecode {
1165
1170
1172
1175 min(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1180 min(Home home, const FloatVarArgs& x, FloatVar y);
1184 max(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1189 max(Home home, const FloatVarArgs& x, FloatVar y);
1190
1194 abs(Home home, FloatVar x0, FloatVar x1);
1195
1200
1204 sqr(Home home, FloatVar x0, FloatVar x1);
1205
1210
1214 pow(Home home, FloatVar x0, int n, FloatVar x1);
1215
1219 nroot(Home home, FloatVar x0, int n, FloatVar x1);
1220
1224 div(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1225#ifdef GECODE_HAS_MPFR
1229 exp(Home home, FloatVar x0, FloatVar x1);
1233 log(Home home, FloatVar x0, FloatVar x1);
1237 pow(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1241 log(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1249 sin(Home home, FloatVar x0, FloatVar x1);
1257 cos(Home home, FloatVar x0, FloatVar x1);
1265 tan(Home home, FloatVar x0, FloatVar x1);
1267#endif
1268
1284 linear(Home home, const FloatVarArgs& x,
1285 FloatRelType frt, FloatVal c);
1297 linear(Home home, const FloatVarArgs& x,
1298 FloatRelType frt, FloatVar y);
1310 linear(Home home, const FloatVarArgs& x,
1311 FloatRelType frt, FloatVal c, Reify r);
1323 linear(Home home, const FloatVarArgs& x,
1324 FloatRelType frt, FloatVar y, Reify r);
1338 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1339 FloatRelType frt, FloatVal c);
1354 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1355 FloatRelType frt, FloatVar y);
1370 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1371 FloatRelType frt, FloatVal c, Reify r);
1386 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1387 FloatRelType frt, FloatVar y, Reify r);
1388
1389
1395
1399 void
1400 channel(Home home, IntVar x0, FloatVar x1);
1405 void
1406 channel(Home home, BoolVar x0, FloatVar x1);
1408
1409}
1410
1411#include <gecode/float/channel.hpp>
1412
1413namespace Gecode {
1414
1423
1425 wait(Home home, FloatVar x, std::function<void(Space& home)> c);
1428 wait(Home home, const FloatVarArgs& x, std::function<void(Space& home)> c);
1430
1431}
1432
1433namespace Gecode {
1434
1439
1448 typedef std::function<bool(const Space& home, FloatVar x, int i)>
1450
1461 typedef std::function<double(const Space& home, FloatVar x, int i)>
1463
1470 public:
1474 bool l;
1475 };
1476
1487 typedef std::function<FloatNumBranch(const Space& home, FloatVar x, int i)>
1489
1501 typedef std::function<void(Space& home, unsigned int a,
1502 FloatVar x, int i, FloatNumBranch nl)>
1504
1505}
1506
1508
1509namespace Gecode {
1510
1516 class FloatAFC : public AFC {
1517 public:
1525 FloatAFC(void);
1527 FloatAFC(const FloatAFC& a);
1529 FloatAFC& operator =(const FloatAFC& a);
1537 FloatAFC(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1548 void init(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1549 };
1550
1551}
1552
1554
1555namespace Gecode {
1556
1562 class FloatAction : public Action {
1563 public:
1571 FloatAction(void);
1573 FloatAction(const FloatAction& a);
1587 FloatAction(Home home, const FloatVarArgs& x, double d=1.0,
1588 bool p=true, bool f=true,
1589 FloatBranchMerit bm=nullptr);
1604 init(Home home, const FloatVarArgs& x, double d=1.0,
1605 bool p=true, bool f=true,
1606 FloatBranchMerit bm=nullptr);
1607 };
1608
1609}
1610
1612
1613namespace Gecode {
1614
1620 class FloatCHB : public CHB {
1621 public:
1629 FloatCHB(void);
1631 FloatCHB(const FloatCHB& chb);
1633 FloatCHB& operator =(const FloatCHB& chb);
1643 FloatCHB(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1656 init(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1657 };
1658
1659}
1660
1662
1663namespace Gecode {
1664
1666 typedef std::function<void(const Space &home, const Brancher& b,
1667 unsigned int a,
1668 FloatVar x, int i, const FloatNumBranch& n,
1669 std::ostream& o)>
1671
1672}
1673
1674namespace Gecode {
1675
1737
1738
1744
1757 FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
1761 FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
1765 FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
1769 FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
1797 FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1801 FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1805 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1809 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1821
1822}
1823
1825
1826namespace Gecode {
1827
1833 class FloatValBranch : public ValBranch<FloatVar> {
1834 public:
1842 protected:
1845 public:
1853 Select select(void) const;
1854 };
1855
1861
1875
1876}
1877
1879
1880namespace Gecode {
1881
1887 class FloatAssign : public ValBranch<FloatVar> {
1888 public:
1896 protected:
1899 public:
1903 FloatAssign(Rnd r);
1907 Select select(void) const;
1908 };
1909
1915
1928
1929}
1930
1932
1933namespace Gecode {
1934
1941 branch(Home home, const FloatVarArgs& x,
1942 FloatVarBranch vars, FloatValBranch vals,
1943 FloatBranchFilter bf=nullptr,
1944 FloatVarValPrint vvp=nullptr);
1951 branch(Home home, const FloatVarArgs& x,
1953 FloatBranchFilter bf=nullptr,
1954 FloatVarValPrint vvp=nullptr);
1962 FloatVarValPrint vvp=nullptr);
1963
1970 assign(Home home, const FloatVarArgs& x,
1971 FloatVarBranch vars, FloatAssign vals,
1972 FloatBranchFilter bf=nullptr,
1973 FloatVarValPrint vvp=nullptr);
1980 assign(Home home, const FloatVarArgs& x,
1982 FloatBranchFilter bf=nullptr,
1983 FloatVarValPrint vvp=nullptr);
1991 FloatVarValPrint vvp=nullptr);
1992
1993}
1994
1995namespace Gecode {
1996
2002 void
2003 branch(Home home, const FloatVarArgs& x, FloatValBranch vals,
2004 FloatBranchFilter bf=nullptr,
2005 FloatVarValPrint vvp=nullptr);
2011 void
2012 assign(Home home, const FloatVarArgs& x, FloatAssign vals,
2013 FloatBranchFilter bf=nullptr,
2014 FloatVarValPrint vvp=nullptr);
2015
2016}
2017
2018#include <gecode/float/branch.hpp>
2019
2020namespace Gecode {
2021
2022 /*
2023 * \brief Relaxed assignment of variables in \a x from values in \a sx
2024 *
2025 * The variables in \a x are assigned values from the assigned variables
2026 * in the solution \a sx with a relaxation probability \a p. That is,
2027 * if \f$p=0.1\f$ approximately 10% of the variables in \a x will be
2028 * assigned a value from \a sx.
2029 *
2030 * The random numbers are generated from the generator \a r. At least
2031 * one variable will not be assigned: in case the relaxation attempt
2032 * would suggest that all variables should be assigned, a single
2033 * variable will be selected randomly to remain unassigned.
2034 *
2035 * Throws an exception of type Float::ArgumentSizeMismatch, if \a x and
2036 * \a sx are of different size.
2037 *
2038 * Throws an exception of type Float::OutOfLimits, if \a p is not between
2039 * \a 0.0 and \a 1.0.
2040 *
2041 * \ingroup TaskModeFloat
2042 */
2044 relax(Home home, const FloatVarArgs& x, const FloatVarArgs& sx,
2045 Rnd r, double p);
2046
2047}
2048
2050
2051namespace Gecode {
2052
2057
2063 protected:
2067 const Delta& d;
2068 public:
2070
2071
2073 const Delta& d);
2075
2077
2078 FloatNum min(void) const;
2080 FloatNum max(void) const;
2082 };
2083
2084}
2085
2087
2089
2090namespace Gecode {
2091
2102
2108 protected:
2110 std::ostream& os;
2111 public:
2113 StdFloatTracer(std::ostream& os0 = std::cerr);
2115 virtual void init(const Space& home, const FloatTraceRecorder& t);
2117 virtual void prune(const Space& home, const FloatTraceRecorder& t,
2118 const ViewTraceInfo& vti, int i, FloatTraceDelta& d);
2120 virtual void fix(const Space& home, const FloatTraceRecorder& t);
2122 virtual void fail(const Space& home, const FloatTraceRecorder& t);
2124 virtual void done(const Space& home, const FloatTraceRecorder& t);
2127 };
2128
2129
2135 trace(Home home, const FloatVarArgs& x,
2136 TraceFilter tf,
2137 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2143 void
2144 trace(Home home, const FloatVarArgs& x,
2145 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2147
2148}
2149
2150#include <gecode/float/trace.hpp>
2151
2152#endif
2153
2154// IFDEF: GECODE_HAS_FLOAT_VARS
2155// STATISTICS: float-post
AFC(void)
Construct as not yet initialized.
Definition afc.hpp:119
Action(void)
Construct as not yet initialized.
Definition action.hpp:344
Boolean integer variables.
Definition int.hh:533
CHB(void)
Construct as not yet initialized.
Definition chb.hpp:346
Generic domain change information to be supplied to advisors.
Definition core.hpp:209
Recording AFC information for float variables.
Definition float.hh:1516
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
FloatAFC(void)
Construct as not yet initialized.
Definition afc.hpp:37
FloatAFC & operator=(const FloatAFC &a)
Assignment operator.
Definition afc.hpp:44
Recording actions for float variables.
Definition float.hh:1562
FloatAction & operator=(const FloatAction &a)
Assignment operator.
Definition action.hpp:44
void init(Home home, const FloatVarArgs &x, double d=1.0, bool p=true, bool f=true, FloatBranchMerit bm=nullptr)
Initialize for float variables x with decay factor d.
FloatAction(void)
Construct as not yet initialized.
Definition action.hpp:37
FloatAction(Home home, const FloatVarArgs &x, double d=1.0, bool p=true, bool f=true, FloatBranchMerit bm=nullptr)
Initialize for float variables x with decay factor d.
Which values to select for assignment.
Definition float.hh:1887
Select
Which value selection.
Definition float.hh:1890
@ SEL_MAX
Select median value of the upper part.
Definition float.hh:1892
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1894
@ SEL_RND
Select median value of a randomly chosen part.
Definition float.hh:1893
@ SEL_MIN
Select median value of the lower part.
Definition float.hh:1891
Select s
Which value to select.
Definition float.hh:1898
FloatAssign(Select s=SEL_MIN)
Initialize with selection strategy s.
Definition assign.hpp:37
Select select(void) const
Return selection strategy.
Definition assign.hpp:49
Recording CHB for float variables.
Definition float.hh:1620
FloatCHB & operator=(const FloatCHB &chb)
Assignment operator.
Definition chb.hpp:44
void init(Home home, const FloatVarArgs &x, FloatBranchMerit bm=nullptr)
Initialize for float variables x.
FloatCHB(Home home, const FloatVarArgs &x, FloatBranchMerit bm=nullptr)
Initialize for float variables x.
FloatCHB(void)
Construct as not yet initialized.
Definition chb.hpp:37
Value description class for branching.
Definition float.hh:1469
bool l
Whether to try the lower or upper half first.
Definition float.hh:1474
FloatNum n
The middle value for branching.
Definition float.hh:1472
Trace delta information for float variables.
Definition float.hh:2062
FloatTraceDelta(Float::FloatTraceView o, Float::FloatView n, const Delta &d)
Initialize with old trace view o, new view n, and delta d.
Definition delta.hpp:37
const Delta & d
Delta information.
Definition float.hh:2067
FloatNum min(void) const
Return minimum.
Definition delta.hpp:44
Float::FloatView n
New view.
Definition float.hh:2065
FloatNum max(void) const
Return maximum.
Definition delta.hpp:49
Passing float arguments.
Definition float.hh:953
FloatValArgs(std::initializer_list< FloatVal > x)
Allocate array and copy elements from x.
static FloatValArgs create(int n, FloatVal start, int inc=1)
Allocate array with n elements such that for all .
FloatValArgs(void)
Allocate empty array.
Definition array.hpp:44
Which values to select for branching first.
Definition float.hh:1833
Select select(void) const
Return selection strategy.
Definition val.hpp:49
Select
Which value selection.
Definition float.hh:1836
@ SEL_SPLIT_RND
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition float.hh:1839
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition float.hh:1837
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1840
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition float.hh:1838
Select s
Which value to select.
Definition float.hh:1844
FloatValBranch(Select s=SEL_SPLIT_MIN)
Initialize with selection strategy s.
Definition val.hpp:37
Float value type.
Definition float.hh:334
friend std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const FloatVal &x)
Definition val.hpp:377
friend FloatVal cos(const FloatVal &x)
Definition val.hpp:456
bool singleton(void) const
Test whether float is a singleton.
Definition val.hpp:109
friend FloatVal exp(const FloatVal &x)
Definition val.hpp:430
friend FloatVal Float::hull(const FloatVal &x, const FloatVal &y)
friend FloatVal acos(const FloatVal &x)
Definition val.hpp:468
FloatVal & operator/=(const FloatNum &n)
Divide by n.
Definition val.hpp:154
friend bool operator==(const FloatVal &x, const FloatVal &y)
Definition val.hpp:311
friend FloatVal atanh(const FloatVal &x)
Definition val.hpp:497
static FloatVal pi(void)
Return lower bound of .
Definition val.hpp:131
friend bool operator<(const FloatVal &x, const FloatVal &y)
Definition val.hpp:243
friend bool operator<=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:260
friend FloatVal cosh(const FloatVal &x)
Definition val.hpp:481
friend FloatVal operator-(const FloatVal &x)
Definition val.hpp:185
static FloatVal pi_twice(void)
Return .
Definition val.hpp:136
friend FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition val.hpp:217
friend FloatVal acosh(const FloatVal &x)
Definition val.hpp:493
FloatValImpType x
Implementation of float value.
Definition float.hh:425
bool zero_in(void) const
Test whether zero is included.
Definition val.hpp:117
friend FloatVal sqrt(const FloatVal &x)
Definition val.hpp:386
FloatVal & operator-=(const FloatNum &n)
Subtract by n.
Definition val.hpp:146
bool in(FloatNum n) const
Test whether n is included.
Definition val.hpp:113
friend FloatVal pow(const FloatVal &x, int n)
Definition val.hpp:394
gecode_boost::numeric::interval_lib::save_state< Float::Rounding > R
Used rounding policies.
Definition float.hh:416
friend FloatVal abs(const FloatVal &x)
Definition val.hpp:382
friend FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition val.hpp:230
friend FloatVal tanh(const FloatVal &x)
Definition val.hpp:485
FloatVal & operator*=(const FloatNum &n)
Multiply by n.
Definition val.hpp:150
FloatNum max(void) const
Return upper bound.
Definition val.hpp:74
void assign(FloatNum const &l, FloatNum const &u)
Assign lower bound l and upper bound u.
Definition val.hpp:65
friend FloatVal log(const FloatVal &x)
Definition val.hpp:434
friend FloatVal sin(const FloatVal &x)
Definition val.hpp:452
gecode_boost::numeric::interval_lib::checking_strict< FloatNum > P
Used checking policy.
Definition float.hh:418
friend FloatVal sqr(const FloatVal &x)
Definition val.hpp:390
friend FloatVal sinh(const FloatVal &x)
Definition val.hpp:477
friend bool operator>=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:294
friend FloatVal asin(const FloatVal &x)
Definition val.hpp:464
FloatVal & operator+=(const FloatNum &n)
Increment by n.
Definition val.hpp:142
friend bool operator!=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:334
FloatNum med(void) const
Return median of float value.
Definition val.hpp:82
FloatVal & operator=(const FloatNum &n)
Assignment operator.
Definition val.hpp:56
friend bool operator>(const FloatVal &x, const FloatVal &y)
Definition val.hpp:277
friend FloatVal atan(const FloatVal &x)
Definition val.hpp:472
friend FloatVal asinh(const FloatVal &x)
Definition val.hpp:489
bool tight(void) const
Test whether float is tight.
Definition val.hpp:104
friend FloatVal nroot(const FloatVal &x, int n)
Definition val.hpp:398
FloatNum size(void) const
Return size of float value (distance between maximum and minimum).
Definition val.hpp:78
friend FloatVal operator+(const FloatVal &x)
Definition val.hpp:181
friend FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition val.hpp:439
static FloatVal pi_half(void)
Return .
Definition val.hpp:126
FloatVal(const FloatValImpType &i)
Initialize from implementation i.
Definition val.hpp:51
friend FloatVal tan(const FloatVal &x)
Definition val.hpp:460
gecode_boost::numeric::interval< FloatNum, gecode_boost::numeric::interval_lib::policies< R, P > > FloatValImpType
Implementation type for float value.
Definition float.hh:423
FloatVal(void)
Default constructor.
Definition val.hpp:45
FloatNum min(void) const
Return lower bound.
Definition val.hpp:70
Passing float variables.
Definition float.hh:982
FloatVarArgs(Space &home, int n, FloatNum min, FloatNum max)
Initialize array with n new variables.
FloatVarArgs(void)
Allocate empty array.
Definition array.hpp:73
FloatVarArgs & operator=(const FloatVarArgs &)=default
Assignment operator.
FloatVarArray & operator=(const FloatVarArray &)=default
Assignment operator.
FloatVarArray(Space &home, int n, FloatNum min, FloatNum max)
Initialize array with n new variables.
FloatVarArray(void)
Default constructor (array of size 0).
Definition array.hpp:102
Which variable to select for branching.
Definition float.hh:1681
Select select(void) const
Return selection strategy.
Definition var.hpp:69
FloatVarBranch(void)
Initialize with strategy SEL_NONE.
Definition var.hpp:37
void expand(Home home, const FloatVarArgs &x)
Expand AFC, action, and CHB.
Definition var.hpp:74
Select
Which variable selection.
Definition float.hh:1684
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition float.hh:1707
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition float.hh:1708
@ SEL_MIN_MIN
With smallest min.
Definition float.hh:1697
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition float.hh:1705
@ SEL_MAX_MAX
With largest max.
Definition float.hh:1700
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition float.hh:1706
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition float.hh:1696
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition float.hh:1703
@ SEL_MIN_MAX
With largest min.
Definition float.hh:1698
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition float.hh:1709
@ SEL_NONE
First unassigned.
Definition float.hh:1685
@ SEL_MERIT_MIN
With least merit.
Definition float.hh:1687
@ SEL_ACTION_MAX
With highest action.
Definition float.hh:1694
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition float.hh:1695
@ SEL_DEGREE_MAX
With largest degree.
Definition float.hh:1690
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition float.hh:1704
@ SEL_DEGREE_MIN
With smallest degree.
Definition float.hh:1689
@ SEL_MERIT_MAX
With highest merit.
Definition float.hh:1688
@ SEL_MAX_MIN
With smallest max.
Definition float.hh:1699
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition float.hh:1710
@ SEL_RND
Random (uniform, for tie breaking).
Definition float.hh:1686
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition float.hh:1692
@ SEL_SIZE_MAX
With largest domain size.
Definition float.hh:1702
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition float.hh:1691
@ SEL_ACTION_MIN
With lowest action.
Definition float.hh:1693
@ SEL_SIZE_MIN
With smallest domain size.
Definition float.hh:1701
Select s
Which variable to select.
Definition float.hh:1714
Float variables.
Definition float.hh:870
friend class FloatVarArgs
Definition float.hh:872
bool in(const FloatVal &n) const
Test whether n is contained in domain.
Definition float.hpp:82
FloatVal domain(void) const
Return domain.
Definition float.hpp:72
FloatNum med(void) const
Return median of domain.
Definition float.hpp:63
FloatVar & operator=(const FloatVar &)=default
Assignment operator.
FloatNum size(void) const
Return size of domain (distance between maximum and minimum).
Definition float.hpp:77
FloatNum min(void) const
Return minimum of domain.
Definition float.hpp:59
FloatVar(void)
Default constructor.
Definition float.hpp:44
FloatVar(Space &home, FloatNum min, FloatNum max)
Initialize variable with range domain.
FloatVal val(void) const
Return assigned value.
Definition float.hpp:53
FloatNum max(void) const
Return maximum of domain.
Definition float.hpp:67
friend class FloatVarArray
Definition float.hh:871
Float variable implementation.
Definition var-imp.hpp:76
Float view for float variables.
Definition view.hpp:52
FloatNum sin_down(FloatNum x)
Return lower bound of sine of x (domain: ).
FloatNum tanh_up(FloatNum x)
Return upper bound of hyperbolic tangent of x (domain: ).
FloatNum acosh_up(FloatNum x)
Return upper bound of hyperbolic arccosine of x (domain: ).
~Rounding(void)
Destructor (restores previous rounding mode).
Definition rounding.hpp:41
FloatNum tanh_down(FloatNum x)
Return lower bound of hyperbolic tangent of x (domain: ).
FloatNum sinh_up(FloatNum x)
Return upper bound of hyperbolic sine of x (domain: ).
FloatNum int_up(FloatNum x)
Return next upward-rounded integer of x (domain: ).
FloatNum sqrt_up(FloatNum x)
Return upper bound of square root of x (domain: ).
FloatNum atanh_down(FloatNum x)
Return lower bound of hyperbolic arctangent of x (domain: ).
FloatNum cos_up(FloatNum x)
Return upper bound of cosine of x (domain: ).
FloatNum sub_up(FloatNum x, FloatNum y)
Return upper bound of x minus y (domain: ).
FloatNum int_down(FloatNum x)
Return next downward-rounded integer of x (domain: ).
FloatNum median(FloatNum x, FloatNum y)
Return median of x and y (domain: ).
Definition rounding.hpp:44
FloatNum add_up(FloatNum x, FloatNum y)
Return upper bound of x plus y (domain: ).
Rounding(void)
Default constructor (configures full rounding mode).
Definition rounding.hpp:37
FloatNum sinh_down(FloatNum x)
Return lower bound of hyperbolic sine of x (domain: ).
FloatNum tan_down(FloatNum x)
Return lower bound of tangent of x (domain: ).
FloatNum sqrt_down(FloatNum x)
Return lower bound of square root of x (domain: ).
FloatNum sub_down(FloatNum x, FloatNum y)
Return lower bound of x minus y (domain: ).
FloatNum asin_down(FloatNum x)
Return lower bound of arcsine of x (domain: ).
FloatNum mul_up(FloatNum x, FloatNum y)
Return upper bound of x times y (domain: ).
FloatNum div_up(FloatNum x, FloatNum y)
Return upper bound of x divided y (domain: ).
FloatNum exp_down(FloatNum x)
Return lower bound of exponential of x (domain: ).
FloatNum div_down(FloatNum x, FloatNum y)
Return lower bound of x divided by y (domain: ).
FloatNum mul_down(FloatNum x, FloatNum y)
Return lower bound of x times y (domain: ).
FloatNum asin_up(FloatNum x)
Return upper bound of arcsine of x (domain: ).
FloatNum acosh_down(FloatNum x)
Return lower bound of hyperbolic arccosine of x (domain: ).
FloatNum atan_down(FloatNum x)
Return lower bound of arctangent of x (domain: ).
FloatNum cosh_down(FloatNum x)
Return lower bound of hyperbolic cosine of x (domain: ).
FloatNum log_up(FloatNum x)
Return upper bound of logarithm of x (domain: ).
FloatNum asinh_down(FloatNum x)
Return lower bound of hyperbolic arcsine of x (domain: ).
FloatNum sin_up(FloatNum x)
Return upper bound of sine of x (domain: ).
FloatNum acos_up(FloatNum x)
Return upper bound of arccossine of x (domain: ).
FloatNum cosh_up(FloatNum x)
Return upper bound of hyperbolic cosine of x (domain: ).
FloatNum exp_up(FloatNum x)
Return upper bound of exponential of x (domain: ).
FloatNum tan_up(FloatNum x)
Return upper bound of tangent of x (domain: ).
FloatNum acos_down(FloatNum x)
Return lower bound of arccosine of x (domain: ).
FloatNum atanh_up(FloatNum x)
Return upper bound of hyperbolic arctangent of x (domain: ).
FloatNum log_down(FloatNum x)
Return lower bound of logarithm of x (domain: ).
FloatNum atan_up(FloatNum x)
Return upper bound of arctangent of x (domain: ).
FloatNum cos_down(FloatNum x)
Return lower bound of cosine of x (domain: ).
FloatNum asinh_up(FloatNum x)
Return upper bound of hyperbolic arcsine of x (domain: ).
FloatNum add_down(FloatNum x, FloatNum y)
Return lower bound of x plus y (domain: ).
Home class for posting propagators
Definition core.hpp:863
Integer variables.
Definition int.hh:389
Reification specification.
Definition int.hh:910
Random number generator.
Definition rnd.hpp:42
Shared array with arbitrary number of elements.
Computation spaces.
Definition core.hpp:1775
virtual void done(const Space &home, const FloatTraceRecorder &t)
Print that trace recorder is done.
virtual void prune(const Space &home, const FloatTraceRecorder &t, const ViewTraceInfo &vti, int i, FloatTraceDelta &d)
Print prune information.
static StdFloatTracer def
Default tracer (printing to std::cerr).
Definition float.hh:2126
virtual void fail(const Space &home, const FloatTraceRecorder &t)
Print failure information.
StdFloatTracer(std::ostream &os0=std::cerr)
Initialize with output stream os0.
std::ostream & os
Output stream to use.
Definition float.hh:2110
virtual void fix(const Space &home, const FloatTraceRecorder &t)
Print fixpoint information.
virtual void init(const Space &home, const FloatTraceRecorder &t)
Print init information.
Combine variable selection criteria for tie-breaking.
Definition tiebreak.hpp:38
Trace filters.
Definition filter.hpp:133
Variable arrays
Definition array.hpp:112
View trace information.
Definition core.hpp:917
Propagator for recording view trace information.
Definition recorder.hpp:60
Tracer that process view trace information.
Definition tracer.hpp:51
#define GECODE_FLOAT_EXPORT
Definition float.hh:68
ViewTracer< Float::FloatView > FloatTracer
Tracer for float variables.
Definition float.hh:2096
ViewTraceRecorder< Float::FloatView > FloatTraceRecorder
Trace recorder for float variables.
Definition float.hh:2101
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te=(TE_INIT|TE_PRUNE|TE_FIX|TE_FAIL|TE_DONE), FloatTracer &t=StdFloatTracer::def)
Create a tracer for float variables.
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition var.hpp:48
std::function< FloatNumBranch(const Space &home, FloatVar x, int i)> FloatBranchVal
Branch value function type for float variables.
Definition float.hh:1488
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition float.hh:1462
std::function< bool(const Space &home, FloatVar x, int i)> FloatBranchFilter
Branch filter function type for float variables.
Definition float.hh:1449
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Assign all x with variable selection vars and value selection vals.
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:1503
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
double FloatNum
Floating point number base type.
Definition float.hh:106
FloatRelType
Relation types for floats.
Definition float.hh:1075
@ FRT_EQ
Equality ( ).
Definition float.hh:1076
@ FRT_GR
Greater ( ).
Definition float.hh:1081
@ FRT_NQ
Disequality ( ).
Definition float.hh:1077
@ FRT_LE
Less ( ).
Definition float.hh:1079
@ FRT_LQ
Less or equal ( ).
Definition float.hh:1078
@ FRT_GQ
Greater or equal ( ).
Definition float.hh:1080
@ TE_INIT
Trace init events.
Definition recorder.hpp:43
@ TE_PRUNE
Trace prune events.
Definition recorder.hpp:44
@ TE_FIX
Trace fixpoint events.
Definition recorder.hpp:45
@ TE_FAIL
Trace fail events.
Definition recorder.hpp:46
@ TE_DONE
Trace done events.
Definition recorder.hpp:47
Numerical limits for floating point variables.
Definition float.hh:842
const FloatNum max
Largest allowed float value.
Definition float.hh:844
bool valid(const FloatVal &n)
Return whether float n is a valid number.
Definition limits.hpp:39
const FloatNum min
Smallest allowed float value.
Definition float.hh:846
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
bool subset(const FloatVal &x, const FloatVal &y)
Definition val.hpp:507
gecode_boost::numeric::interval_lib::rounded_arith_opp< FloatNum > RoundingBase
Rounding Base class (optimized version).
Definition float.hh:145
bool proper_subset(const FloatVal &x, const FloatVal &y)
Definition val.hpp:511
FloatVal hull(const FloatVal &x, const FloatVal &y)
Definition val.hpp:524
bool overlap(const FloatVal &x, const FloatVal &y)
Definition val.hpp:515
FloatVal intersect(const FloatVal &x, const FloatVal &y)
Definition val.hpp:520
Gecode toplevel namespace
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree divided by domain size.
Definition var.hpp:222
FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree divided by domain size.
Definition var.hpp:217
FloatVarBranch FLOAT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking).
Definition var.hpp:112
FloatValBranch FLOAT_VAL_SPLIT_MAX(void)
Select values greater than mean of smallest and largest value.
Definition val.hpp:60
FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition val.hpp:230
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:1670
FloatVal operator-(const FloatVal &x)
Definition val.hpp:185
FloatVal asinh(const FloatVal &x)
Definition val.hpp:489
bool operator<=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:260
FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest accumulated failure count with decay factor d.
Definition var.hpp:127
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatNum pi_upper(void)
Return upper bound of .
Definition num.hpp:49
FloatVal operator+(const FloatVal &x)
Definition val.hpp:181
FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest domain size.
Definition var.hpp:212
FloatNum pi_lower(void)
Return lower bound of .
Definition num.hpp:45
FloatNum pi_half_lower(void)
Return lower bound of .
Definition num.hpp:37
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl=nullptr)
Select variable with largest max.
Definition var.hpp:202
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
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
FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smalllest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:227
FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest CHB Q-score divided by domain size.
Definition var.hpp:277
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition val-sel.hpp:39
FloatNum pi_twice_lower(void)
Return lower bound of .
Definition num.hpp:53
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatNum pi_half_upper(void)
Return upper bound of .
Definition num.hpp:41
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
bool operator<(const FloatVal &x, const FloatVal &y)
Definition val.hpp:243
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatVarBranch FLOAT_VAR_CHB_MIN(BranchTbl tbl=nullptr)
Select variable with lowest CHB Q-score.
Definition var.hpp:167
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest CHB Q-score divided by domain size.
Definition var.hpp:267
FloatNum pi_twice_upper(void)
Return upper bound of .
Definition num.hpp:57
FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with highest action with decay factor d.
Definition var.hpp:157
void acos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_CHB_MAX(BranchTbl tbl=nullptr)
Select variable with highest CHB Q-score.
Definition var.hpp:177
FloatAssign FLOAT_ASSIGN_MAX(void)
Select median value of the upper part.
Definition assign.hpp:60
bool operator>(const FloatVal &x, const FloatVal &y)
Definition val.hpp:277
FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl=nullptr)
Select variable with smallest min.
Definition var.hpp:187
FloatValBranch FLOAT_VAL(FloatBranchVal v, FloatBranchCommit c=nullptr)
Definition val.hpp:70
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl=nullptr)
Select variable with smallest max.
Definition var.hpp:197
FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with lowest action with decay factor d.
Definition var.hpp:147
bool operator>=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:294
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
Definition var.hpp:97
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree.
Definition var.hpp:122
FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition val.hpp:439
FloatVal sinh(const FloatVal &x)
Definition val.hpp:477
FloatVal acosh(const FloatVal &x)
Definition val.hpp:493
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest action divided by domain size with decay factor d.
Definition var.hpp:257
FloatVal tanh(const FloatVal &x)
Definition val.hpp:485
FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl=nullptr)
Select variable with largest min.
Definition var.hpp:192
void asin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatAssign FLOAT_ASSIGN_RND(Rnd r)
Select median value of a randomly chosen part.
Definition assign.hpp:65
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for .
FloatVal atanh(const FloatVal &x)
Definition val.hpp:497
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition val.hpp:217
FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:237
FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with least merit according to branch merit function bm.
Definition var.hpp:102
FloatVal cosh(const FloatVal &x)
Definition val.hpp:481
FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree.
Definition var.hpp:117
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for .
bool operator==(const FloatVal &x, const FloatVal &y)
Definition val.hpp:311
FloatValBranch FLOAT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Definition val.hpp:55
bool operator!=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:334
FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest domain size.
Definition var.hpp:207
FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count with decay factor d.
Definition var.hpp:137
FloatAssign FLOAT_ASSIGN_MIN(void)
Select median value of the lower part.
Definition assign.hpp:55
FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c=nullptr)
Definition assign.hpp:70
FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest action divided by domain size with decay factor d.
Definition var.hpp:247
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with highest merit according to branch merit function bm.
Definition var.hpp:107