Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.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.org>
5 * Guido Tack <tack@gecode.org>
6 * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
7 *
8 * Copyright:
9 * Christian Schulte, 2002
10 * Guido Tack, 2004
11 * Vincent Barichard, 2012
12 *
13 * This file is part of Gecode, the generic constraint
14 * development environment:
15 * http://www.gecode.org
16 *
17 * Permission is hereby granted, free of charge, to any person obtaining
18 * a copy of this software and associated documentation files (the
19 * "Software"), to deal in the Software without restriction, including
20 * without limitation the rights to use, copy, modify, merge, publish,
21 * distribute, sublicense, and/or sell copies of the Software, and to
22 * permit persons to whom the Software is furnished to do so, subject to
23 * the following conditions:
24 *
25 * The above copyright notice and this permission notice shall be
26 * included in all copies or substantial portions of the Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 *
36 */
37
38#ifndef __GECODE_FLOAT_HH__
39#define __GECODE_FLOAT_HH__
40
41#include <climits>
42#include <cfloat>
43#include <iostream>
44
45#include <functional>
46
47#include <gecode/kernel.hh>
48#include <gecode/int.hh>
49
50/*
51 * Configure linking
52 *
53 */
54#if !defined(GECODE_STATIC_LIBS) && \
55 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
56
57#ifdef GECODE_BUILD_FLOAT
58#define GECODE_FLOAT_EXPORT __declspec( dllexport )
59#else
60#define GECODE_FLOAT_EXPORT __declspec( dllimport )
61#endif
62
63#else
64
65#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
66#define GECODE_FLOAT_EXPORT __attribute__ ((visibility("default")))
67#else
68#define GECODE_FLOAT_EXPORT
69#endif
70
71#endif
72
73// Configure auto-linking
74#ifndef GECODE_BUILD_FLOAT
75#define GECODE_LIBRARY_NAME "Float"
77#endif
78
79// Include interval implementation
80#include <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 boost::numeric::interval_lib::save_state< boost::numeric::interval_lib::rounded_arith_std<FloatNum> >
139 RoundingBase;
140
141#else
142
144 typedef 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);
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 boost::numeric::interval_lib::save_state<Float::Rounding> R;
418 typedef boost::numeric::interval_lib::checking_strict<FloatNum> P;
420 typedef boost::numeric::interval
421 <FloatNum,
422 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
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);
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);
1013 FloatVarArgs(Space& home, int n, FloatNum min, FloatNum max);
1015 };
1016
1017
1028
1033 class FloatVarArray : public VarArray<FloatVar> {
1034 public:
1036
1037
1038 FloatVarArray(void);
1040 FloatVarArray(Space& home, int n);
1042 FloatVarArray(const FloatVarArray& a);
1044 FloatVarArray(Space& home, const FloatVarArgs& a);
1059
1062 };
1063
1064}
1065
1066#include <gecode/float/array.hpp>
1067
1068namespace Gecode {
1069
1082
1088
1090
1092 dom(Home home, FloatVar x, FloatVal n);
1095 dom(Home home, const FloatVarArgs& x, FloatVal n);
1098 dom(Home home, FloatVar x, FloatNum l, FloatNum m);
1101 dom(Home home, const FloatVarArgs& x, FloatNum l, FloatNum u);
1104 dom(Home home, FloatVar x, FloatVal n, Reify r);
1107 dom(Home home, FloatVar x, FloatNum l, FloatNum u, Reify r);
1110 dom(Home home, FloatVar x, FloatVar d);
1113 dom(Home home, const FloatVarArgs& x, const FloatVarArgs& d);
1115
1125 rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1);
1130 rel(Home home, FloatVar x, FloatRelType frt, FloatVal c);
1135 rel(Home home, FloatVar x, FloatRelType frt, FloatVal c, Reify r);
1140 rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1, Reify r);
1145 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVal c);
1150 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVar y);
1158 ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z);
1159
1160}
1161
1162
1163namespace Gecode {
1164
1169
1171
1174 min(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1179 min(Home home, const FloatVarArgs& x, FloatVar y);
1183 max(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1188 max(Home home, const FloatVarArgs& x, FloatVar y);
1189
1193 abs(Home home, FloatVar x0, FloatVar x1);
1194
1198 mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1199
1203 sqr(Home home, FloatVar x0, FloatVar x1);
1204
1208 sqrt(Home home, FloatVar x0, FloatVar x1);
1209
1213 pow(Home home, FloatVar x0, int n, FloatVar x1);
1214
1218 nroot(Home home, FloatVar x0, int n, FloatVar x1);
1219
1223 div(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1224#ifdef GECODE_HAS_MPFR
1228 exp(Home home, FloatVar x0, FloatVar x1);
1232 log(Home home, FloatVar x0, FloatVar x1);
1236 pow(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1240 log(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1244 asin(Home home, FloatVar x0, FloatVar x1);
1248 sin(Home home, FloatVar x0, FloatVar x1);
1252 acos(Home home, FloatVar x0, FloatVar x1);
1256 cos(Home home, FloatVar x0, FloatVar x1);
1260 atan(Home home, FloatVar x0, FloatVar x1);
1264 tan(Home home, FloatVar x0, FloatVar x1);
1266#endif
1267
1283 linear(Home home, const FloatVarArgs& x,
1284 FloatRelType frt, FloatVal c);
1296 linear(Home home, const FloatVarArgs& x,
1297 FloatRelType frt, FloatVar y);
1309 linear(Home home, const FloatVarArgs& x,
1310 FloatRelType frt, FloatVal c, Reify r);
1322 linear(Home home, const FloatVarArgs& x,
1323 FloatRelType frt, FloatVar y, Reify r);
1337 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1338 FloatRelType frt, FloatVal c);
1353 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1354 FloatRelType frt, FloatVar y);
1369 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1370 FloatRelType frt, FloatVal c, Reify r);
1385 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1386 FloatRelType frt, FloatVar y, Reify r);
1387
1388
1394
1396 channel(Home home, FloatVar x0, IntVar x1);
1398 void
1399 channel(Home home, IntVar x0, FloatVar x1);
1402 channel(Home home, FloatVar x0, BoolVar x1);
1404 void
1405 channel(Home home, BoolVar x0, FloatVar x1);
1407
1408}
1409
1410#include <gecode/float/channel.hpp>
1411
1412namespace Gecode {
1413
1422
1424 wait(Home home, FloatVar x, std::function<void(Space& home)> c);
1427 wait(Home home, const FloatVarArgs& x, std::function<void(Space& home)> c);
1429
1430}
1431
1432namespace Gecode {
1433
1438
1447 typedef std::function<bool(const Space& home, FloatVar x, int i)>
1449
1460 typedef std::function<double(const Space& home, FloatVar x, int i)>
1462
1469 public:
1473 bool l;
1474 };
1475
1486 typedef std::function<FloatNumBranch(const Space& home, FloatVar x, int i)>
1488
1500 typedef std::function<void(Space& home, unsigned int a,
1501 FloatVar x, int i, FloatNumBranch nl)>
1503
1504}
1505
1507
1508namespace Gecode {
1509
1515 class FloatAFC : public AFC {
1516 public:
1524 FloatAFC(void);
1526 FloatAFC(const FloatAFC& a);
1528 FloatAFC& operator =(const FloatAFC& a);
1536 FloatAFC(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1547 void init(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1548 };
1549
1550}
1551
1553
1554namespace Gecode {
1555
1561 class FloatAction : public Action {
1562 public:
1570 FloatAction(void);
1572 FloatAction(const FloatAction& a);
1584 FloatAction(Home home, const FloatVarArgs& x, double d=1.0,
1585 FloatBranchMerit bm=nullptr);
1598 init(Home home, const FloatVarArgs& x, double d=1.0,
1599 FloatBranchMerit bm=nullptr);
1600 };
1601
1602}
1603
1605
1606namespace Gecode {
1607
1613 class FloatCHB : public CHB {
1614 public:
1622 FloatCHB(void);
1624 FloatCHB(const FloatCHB& chb);
1626 FloatCHB& operator =(const FloatCHB& chb);
1636 FloatCHB(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1649 init(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1650 };
1651
1652}
1653
1655
1656namespace Gecode {
1657
1659 typedef std::function<void(const Space &home, const Brancher& b,
1660 unsigned int a,
1661 FloatVar x, int i, const FloatNumBranch& n,
1662 std::ostream& o)>
1664
1665}
1666
1667namespace Gecode {
1668
1730
1731
1737
1750 FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
1754 FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
1758 FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
1762 FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
1790 FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1794 FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1798 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1802 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1814
1815}
1816
1818
1819namespace Gecode {
1820
1826 class FloatValBranch : public ValBranch<FloatVar> {
1827 public:
1835 protected:
1838 public:
1846 Select select(void) const;
1847 };
1848
1854
1868
1869}
1870
1872
1873namespace Gecode {
1874
1880 class FloatAssign : public ValBranch<FloatVar> {
1881 public:
1889 protected:
1892 public:
1896 FloatAssign(Rnd r);
1900 Select select(void) const;
1901 };
1902
1908
1921
1922}
1923
1925
1926namespace Gecode {
1927
1934 branch(Home home, const FloatVarArgs& x,
1935 FloatVarBranch vars, FloatValBranch vals,
1936 FloatBranchFilter bf=nullptr,
1937 FloatVarValPrint vvp=nullptr);
1944 branch(Home home, const FloatVarArgs& x,
1945 TieBreak<FloatVarBranch> vars, FloatValBranch vals,
1946 FloatBranchFilter bf=nullptr,
1947 FloatVarValPrint vvp=nullptr);
1954 branch(Home home, FloatVar x, FloatValBranch vals,
1955 FloatVarValPrint vvp=nullptr);
1956
1963 assign(Home home, const FloatVarArgs& x,
1964 FloatVarBranch vars, FloatAssign vals,
1965 FloatBranchFilter bf=nullptr,
1966 FloatVarValPrint vvp=nullptr);
1973 assign(Home home, const FloatVarArgs& x,
1974 TieBreak<FloatVarBranch> vars, FloatAssign vals,
1975 FloatBranchFilter bf=nullptr,
1976 FloatVarValPrint vvp=nullptr);
1983 assign(Home home, FloatVar x, FloatAssign vals,
1984 FloatVarValPrint vvp=nullptr);
1985
1986}
1987
1988namespace Gecode {
1989
1995 void
1996 branch(Home home, const FloatVarArgs& x, FloatValBranch vals,
1997 FloatBranchFilter bf=nullptr,
1998 FloatVarValPrint vvp=nullptr);
2004 void
2005 assign(Home home, const FloatVarArgs& x, FloatAssign vals,
2006 FloatBranchFilter bf=nullptr,
2007 FloatVarValPrint vvp=nullptr);
2008
2009}
2010
2011#include <gecode/float/branch.hpp>
2012
2013namespace Gecode {
2014
2015 /*
2016 * \brief Relaxed assignment of variables in \a x from values in \a sx
2017 *
2018 * The variables in \a x are assigned values from the assigned variables
2019 * in the solution \a sx with a relaxation probability \a p. That is,
2020 * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
2021 * assigned a value from \a sx.
2022 *
2023 * The random numbers are generated from the generator \a r. At least
2024 * one variable will not be assigned: in case the relaxation attempt
2025 * would suggest that all variables should be assigned, a single
2026 * variable will be selected randomly to remain unassigned.
2027 *
2028 * Throws an exception of type Float::ArgumentSizeMismatch, if \a x and
2029 * \a sx are of different size.
2030 *
2031 * Throws an exception of type Float::OutOfLimits, if \a p is not between
2032 * \a 0.0 and \a 1.0.
2033 *
2034 * \ingroup TaskModeFloat
2035 */
2037 relax(Home home, const FloatVarArgs& x, const FloatVarArgs& sx,
2038 Rnd r, double p);
2039
2040}
2041
2043
2044namespace Gecode {
2045
2050
2056 protected:
2060 const Delta& d;
2061 public:
2063
2064
2066 const Delta& d);
2068
2070
2071 FloatNum min(void) const;
2073 FloatNum max(void) const;
2075 };
2076
2077}
2078
2080
2082
2083namespace Gecode {
2084
2095
2101 protected:
2103 std::ostream& os;
2104 public:
2106 StdFloatTracer(std::ostream& os0 = std::cerr);
2108 virtual void init(const Space& home, const FloatTraceRecorder& t);
2110 virtual void prune(const Space& home, const FloatTraceRecorder& t,
2111 const ViewTraceInfo& vti, int i, FloatTraceDelta& d);
2113 virtual void fix(const Space& home, const FloatTraceRecorder& t);
2115 virtual void fail(const Space& home, const FloatTraceRecorder& t);
2117 virtual void done(const Space& home, const FloatTraceRecorder& t);
2120 };
2121
2122
2128 trace(Home home, const FloatVarArgs& x,
2129 TraceFilter tf,
2130 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2136 void
2137 trace(Home home, const FloatVarArgs& x,
2138 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2140
2141}
2142
2143#include <gecode/float/trace.hpp>
2144
2145#endif
2146
2147// IFDEF: GECODE_HAS_FLOAT_VARS
2148// STATISTICS: float-post
2149
AFC(void)
Construct as not yet intialized.
Definition afc.hpp:119
Action(void)
Construct as not yet intialized.
Definition action.hpp:323
Boolean integer variables.
Definition int.hh:515
CHB(void)
Construct as not yet intialized.
Definition chb.hpp:346
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Recording AFC information for float variables.
Definition float.hh:1515
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:1561
FloatAction & operator=(const FloatAction &a)
Assignment operator.
Definition action.hpp:44
void init(Home home, const FloatVarArgs &x, double d=1.0, FloatBranchMerit bm=nullptr)
Initialize for float variables x with decay factor d.
Definition action.cpp:45
FloatAction(void)
Construct as not yet initialized.
Definition action.hpp:37
Which values to select for assignment.
Definition float.hh:1880
Select
Which value selection.
Definition float.hh:1883
@ SEL_MAX
Select median value of the upper part.
Definition float.hh:1885
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1887
@ SEL_RND
Select median value of a randomly chosen part.
Definition float.hh:1886
@ SEL_MIN
Select median value of the lower part.
Definition float.hh:1884
Select s
Which value to select.
Definition float.hh:1891
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:1613
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.
Definition chb.cpp:44
FloatCHB(void)
Construct as not yet initialized.
Definition chb.hpp:37
Value description class for branching.
Definition float.hh:1468
bool l
Whether to try the lower or upper half first.
Definition float.hh:1473
FloatNum n
The middle value for branching.
Definition float.hh:1471
Trace delta information for float variables.
Definition float.hh:2055
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:2060
FloatNum min(void) const
Return minimum.
Definition delta.hpp:44
Float::FloatView n
New view.
Definition float.hh:2058
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 .
Definition array.cpp:41
FloatValArgs(void)
Allocate empty array.
Definition array.hpp:44
Which values to select for branching first.
Definition float.hh:1826
Select select(void) const
Return selection strategy.
Definition val.hpp:49
Select
Which value selection.
Definition float.hh:1829
@ SEL_SPLIT_RND
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition float.hh:1832
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition float.hh:1830
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1833
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition float.hh:1831
Select s
Which value to select.
Definition float.hh:1837
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:360
friend FloatVal cos(const FloatVal &x)
Definition val.hpp:439
bool singleton(void) const
Test whether float is a singleton.
Definition val.hpp:92
friend FloatVal exp(const FloatVal &x)
Definition val.hpp:413
friend FloatVal Float::hull(const FloatVal &x, const FloatVal &y)
friend FloatVal acos(const FloatVal &x)
Definition val.hpp:451
FloatVal & operator/=(const FloatNum &n)
Divide by n.
Definition val.hpp:137
friend bool operator==(const FloatVal &x, const FloatVal &y)
Definition val.hpp:294
boost::numeric::interval_lib::checking_strict< FloatNum > P
Used checking policy.
Definition float.hh:418
friend FloatVal atanh(const FloatVal &x)
Definition val.hpp:480
static FloatVal pi(void)
Return lower bound of .
Definition val.hpp:114
friend bool operator<(const FloatVal &x, const FloatVal &y)
Definition val.hpp:226
friend bool operator<=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:243
friend FloatVal cosh(const FloatVal &x)
Definition val.hpp:464
friend FloatVal operator-(const FloatVal &x)
Definition val.hpp:168
boost::numeric::interval< FloatNum, boost::numeric::interval_lib::policies< R, P > > FloatValImpType
Implementation type for float value.
Definition float.hh:423
static FloatVal pi_twice(void)
Return .
Definition val.hpp:119
friend FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition val.hpp:200
friend FloatVal acosh(const FloatVal &x)
Definition val.hpp:476
FloatValImpType x
Implementation of float value.
Definition float.hh:425
bool zero_in(void) const
Test whether zero is included.
Definition val.hpp:100
friend FloatVal sqrt(const FloatVal &x)
Definition val.hpp:369
FloatVal & operator-=(const FloatNum &n)
Subtract by n.
Definition val.hpp:129
bool in(FloatNum n) const
Test whether n is included.
Definition val.hpp:96
friend FloatVal pow(const FloatVal &x, int n)
Definition val.hpp:377
friend FloatVal abs(const FloatVal &x)
Definition val.hpp:365
friend FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition val.hpp:213
friend FloatVal tanh(const FloatVal &x)
Definition val.hpp:468
FloatVal & operator*=(const FloatNum &n)
Multiply by n.
Definition val.hpp:133
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:417
friend FloatVal sin(const FloatVal &x)
Definition val.hpp:435
friend FloatVal sqr(const FloatVal &x)
Definition val.hpp:373
friend FloatVal sinh(const FloatVal &x)
Definition val.hpp:460
friend bool operator>=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:277
friend FloatVal asin(const FloatVal &x)
Definition val.hpp:447
FloatVal & operator+=(const FloatNum &n)
Increment by n.
Definition val.hpp:125
friend bool operator!=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:317
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:260
boost::numeric::interval_lib::save_state< Float::Rounding > R
Used rounding policies.
Definition float.hh:416
friend FloatVal atan(const FloatVal &x)
Definition val.hpp:455
friend FloatVal asinh(const FloatVal &x)
Definition val.hpp:472
bool tight(void) const
Test whether float is tight.
Definition val.hpp:87
friend FloatVal nroot(const FloatVal &x, int n)
Definition val.hpp:381
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:164
friend FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition val.hpp:422
static FloatVal pi_half(void)
Return .
Definition val.hpp:109
FloatVal(const FloatValImpType &i)
Initialize from implementation i.
Definition val.hpp:51
friend FloatVal tan(const FloatVal &x)
Definition val.hpp:443
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(void)
Allocate empty array.
Definition array.hpp:73
FloatVarArray & operator=(const FloatVarArray &)=default
Assignment operator.
FloatVarArray(void)
Default constructor (array of size 0)
Definition array.hpp:102
Which variable to select for branching.
Definition float.hh:1674
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:1677
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition float.hh:1700
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition float.hh:1701
@ SEL_MIN_MIN
With smallest min.
Definition float.hh:1690
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition float.hh:1698
@ SEL_MAX_MAX
With largest max.
Definition float.hh:1693
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition float.hh:1699
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition float.hh:1689
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition float.hh:1696
@ SEL_MIN_MAX
With largest min.
Definition float.hh:1691
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition float.hh:1702
@ SEL_NONE
First unassigned.
Definition float.hh:1678
@ SEL_MERIT_MIN
With least merit.
Definition float.hh:1680
@ SEL_ACTION_MAX
With highest action.
Definition float.hh:1687
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition float.hh:1688
@ SEL_DEGREE_MAX
With largest degree.
Definition float.hh:1683
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition float.hh:1697
@ SEL_DEGREE_MIN
With smallest degree.
Definition float.hh:1682
@ SEL_MERIT_MAX
With highest merit.
Definition float.hh:1681
@ SEL_MAX_MIN
With smallest max.
Definition float.hh:1692
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition float.hh:1703
@ SEL_RND
Random (uniform, for tie breaking)
Definition float.hh:1679
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition float.hh:1685
@ SEL_SIZE_MAX
With largest domain size.
Definition float.hh:1695
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition float.hh:1684
@ SEL_ACTION_MIN
With lowest action.
Definition float.hh:1686
@ SEL_SIZE_MIN
With smallest domain size.
Definition float.hh:1694
Select s
Which variable to select.
Definition float.hh:1707
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
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:856
Integer variables.
Definition int.hh:371
Reification specification.
Definition int.hh:891
Random number generator.
Definition rnd.hpp:42
Shared array with arbitrary number of elements.
Computation spaces.
Definition core.hpp:1744
static StdFloatTracer def
Default tracer (printing to std::cerr)
Definition float.hh:2119
StdFloatTracer(std::ostream &os0=std::cerr)
Initialize with output stream os0.
Definition tracer.cpp:39
virtual void fail(const Space &home, const FloatTraceRecorder &t)
Print failure information.
Definition tracer.cpp:81
virtual void fix(const Space &home, const FloatTraceRecorder &t)
Print fixpoint information.
Definition tracer.cpp:63
std::ostream & os
Output stream to use.
Definition float.hh:2103
virtual void done(const Space &home, const FloatTraceRecorder &t)
Print that trace recorder is done.
Definition tracer.cpp:99
virtual void prune(const Space &home, const FloatTraceRecorder &t, const ViewTraceInfo &vti, int i, FloatTraceDelta &d)
Print prune information.
Definition tracer.cpp:52
virtual void init(const Space &home, const FloatTraceRecorder &t)
Print init information.
Definition tracer.cpp:43
Trace filters.
Definition filter.hpp:133
Variable arrays
Definition array.hpp:112
View trace information.
Definition core.hpp:910
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:2089
ViewTraceRecorder< Float::FloatView > FloatTraceRecorder
Trace recorder for float variables.
Definition float.hh:2094
GECODE_FLOAT_EXPORT 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.
Definition trace.cpp:39
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:1487
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition float.hh:1461
std::function< bool(const Space &home, FloatVar x, int i)> FloatBranchFilter
Branch filter function type for float variables.
Definition float.hh:1448
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.
Definition branch.cpp:111
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:1502
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.
Definition branch.cpp:39
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Definition linear.cpp:41
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
Definition bool.cpp:39
double FloatNum
Floating point number base type.
Definition float.hh:106
FloatRelType
Relation types for floats.
Definition float.hh:1074
@ FRT_EQ
Equality ( )
Definition float.hh:1075
@ FRT_GR
Greater ( )
Definition float.hh:1080
@ FRT_NQ
Disequality ( )
Definition float.hh:1076
@ FRT_LE
Less ( )
Definition float.hh:1078
@ FRT_LQ
Less or equal ( )
Definition float.hh:1077
@ FRT_GQ
Greater or equal ( )
Definition float.hh:1079
@ 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:490
bool proper_subset(const FloatVal &x, const FloatVal &y)
Definition val.hpp:494
FloatVal hull(const FloatVal &x, const FloatVal &y)
Definition val.hpp:507
bool overlap(const FloatVal &x, const FloatVal &y)
Definition val.hpp:498
FloatVal intersect(const FloatVal &x, const FloatVal &y)
Definition val.hpp:503
boost::numeric::interval_lib::rounded_arith_opp< FloatNum > RoundingBase
Rounding Base class (optimized version)
Definition float.hh:145
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:213
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:1663
FloatVal operator-(const FloatVal &x)
Definition val.hpp:168
FloatVal asinh(const FloatVal &x)
Definition val.hpp:472
bool operator<=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:243
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:164
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition set.hh:773
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 .
Definition channel.cpp:41
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 .
Definition dom.cpp:40
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:226
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition set.hh:773
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 .
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:773
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:260
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:277
GECODE_FLOAT_EXPORT void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
Definition relax.cpp:57
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.
Definition exec.cpp:39
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:422
FloatVal sinh(const FloatVal &x)
Definition val.hpp:460
FloatVal acosh(const FloatVal &x)
Definition val.hpp:476
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:468
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 $n\geq 0$.
FloatVal atanh(const FloatVal &x)
Definition val.hpp:480
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition val.hpp:200
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
Post propagator for SetVar x
Definition set.hh:773
FloatVal cosh(const FloatVal &x)
Definition val.hpp:464
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 $n\geq 0$.
bool operator==(const FloatVal &x, const FloatVal &y)
Definition val.hpp:294
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:317
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