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 <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 /*
132 * All compilers, MSVC included, keep upward mode between calls. The
133 * downward operations negate an operand, which negate_opaque in
134 * rounded_arith.hpp keeps from being folded into the rounded operation.
135 *
136 */
138 typedef boost::numeric::interval_lib::rounded_arith_opp<FloatNum>
140
147 public:
149
150
171
173
174
181
182#ifdef GECODE_HAS_MPFR
184
185
194
196
197
210
212
213
226
228
229
242
244
245
258#endif
259 };
260
268 class Rounding : public
269 boost::numeric::interval_lib::save_state<RoundingBase> {};
270
271
272}}
273
275
276namespace Gecode { namespace Float {
277
282 bool subset(const FloatVal& x, const FloatVal& y);
287 bool proper_subset(const FloatVal& x, const FloatVal& y);
292 bool overlap(const FloatVal& x, const FloatVal& y);
293
298 FloatVal intersect(const FloatVal& x, const FloatVal& y);
303 FloatVal hull(const FloatVal& x, const FloatVal& y);
308 FloatVal hull(const FloatVal& x, const FloatNum& y);
313 FloatVal hull(const FloatNum& x, const FloatVal& y);
318 FloatVal hull(const FloatNum& x, const FloatNum& y);
319
320}}
321
322namespace Gecode {
323
329 class FloatVal {
330 friend FloatVal operator +(const FloatVal& x);
331 friend FloatVal operator -(const FloatVal& x);
332 friend FloatVal operator +(const FloatVal& x, const FloatVal& y);
333 friend FloatVal operator +(const FloatVal& x, const FloatNum& y);
334 friend FloatVal operator +(const FloatNum& x, const FloatVal& y);
335 friend FloatVal operator -(const FloatVal& x, const FloatVal& y);
336 friend FloatVal operator -(const FloatVal& x, const FloatNum& y);
337 friend FloatVal operator -(const FloatNum& x, const FloatVal& y);
338 friend FloatVal operator *(const FloatVal& x, const FloatVal& y);
339 friend FloatVal operator *(const FloatVal& x, const FloatNum& y);
340 friend FloatVal operator *(const FloatNum& x, const FloatVal& y);
341 friend FloatVal operator /(const FloatVal& x, const FloatVal& y);
342 friend FloatVal operator /(const FloatVal& x, const FloatNum& y);
343 friend FloatVal operator /(const FloatNum& x, const FloatVal& y);
344
345 friend bool operator <(const FloatVal& x, const FloatVal& y);
346 friend bool operator <(const FloatVal& x, const FloatNum& y);
347 friend bool operator <(const FloatNum& x, const FloatVal& y);
348 friend bool operator <=(const FloatVal& x, const FloatVal& y);
349 friend bool operator <=(const FloatVal& x, const FloatNum& y);
350 friend bool operator <=(const FloatNum& x, const FloatVal& y);
351 friend bool operator >(const FloatVal& x, const FloatVal& y);
352 friend bool operator >(const FloatVal& x, const FloatNum& y);
353 friend bool operator >(const FloatNum& x, const FloatVal& y);
354 friend bool operator >=(const FloatVal& x, const FloatVal& y);
355 friend bool operator >=(const FloatVal& x, const FloatNum& y);
356 friend bool operator >=(const FloatNum& x, const FloatVal& y);
357 friend bool operator ==(const FloatVal& x, const FloatVal& y);
358 friend bool operator ==(const FloatVal& x, const FloatNum& y);
359 friend bool operator ==(const FloatNum& x, const FloatVal& y);
360 friend bool operator !=(const FloatVal& x, const FloatVal& y);
361 friend bool operator !=(const FloatVal& x, const FloatNum& y);
362 friend bool operator !=(const FloatNum& x, const FloatVal& y);
363
364 template<class Char, class Traits>
365 friend std::basic_ostream<Char,Traits>&
366 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
367
368 friend FloatVal abs(const FloatVal& x);
369 friend FloatVal sqrt(const FloatVal& x);
370 friend FloatVal sqr(const FloatVal& x);
371 friend FloatVal pow(const FloatVal& x, int n);
372 friend FloatVal nroot(const FloatVal& x, int n);
373
374 friend FloatVal max(const FloatVal& x, const FloatVal& y);
375 friend FloatVal max(const FloatVal& x, const FloatNum& y);
376 friend FloatVal max(const FloatNum& x, const FloatVal& y);
377 friend FloatVal min(const FloatVal& x, const FloatVal& y);
378 friend FloatVal min(const FloatVal& x, const FloatNum& y);
379 friend FloatVal min(const FloatNum& x, const FloatVal& y);
380
381#ifdef GECODE_HAS_MPFR
382 friend FloatVal exp(const FloatVal& x);
383 friend FloatVal log(const FloatVal& x);
384 friend FloatVal fmod(const FloatVal& x, const FloatVal& y);
385 friend FloatVal fmod(const FloatVal& x, const FloatNum& y);
386 friend FloatVal fmod(const FloatNum& x, const FloatVal& y);
387 friend FloatVal sin(const FloatVal& x);
388 friend FloatVal cos(const FloatVal& x);
389 friend FloatVal tan(const FloatVal& x);
390 friend FloatVal asin(const FloatVal& x);
391 friend FloatVal acos(const FloatVal& x);
392 friend FloatVal atan(const FloatVal& x);
393 friend FloatVal sinh(const FloatVal& x);
394 friend FloatVal cosh(const FloatVal& x);
395 friend FloatVal tanh(const FloatVal& x);
396 friend FloatVal asinh(const FloatVal& x);
397 friend FloatVal acosh(const FloatVal& x);
398 friend FloatVal atanh(const FloatVal& x);
399#endif
400
401 friend bool Float::subset(const FloatVal& x, const FloatVal& y);
402 friend bool Float::proper_subset(const FloatVal& x, const FloatVal& y);
403 friend bool Float::overlap(const FloatVal& x, const FloatVal& y);
404 friend FloatVal Float::intersect(const FloatVal& x, const FloatVal& y);
405 friend FloatVal Float::hull(const FloatVal& x, const FloatVal& y);
406 friend FloatVal Float::hull(const FloatVal& x, const FloatNum& y);
407 friend FloatVal Float::hull(const FloatNum& x, const FloatVal& y);
408 friend FloatVal Float::hull(const FloatNum& x, const FloatNum& y);
409 protected:
413 typedef boost::numeric::interval_lib::checking_strict<FloatNum> P;
415 typedef boost::numeric::interval
416 <FloatNum,
417 boost::numeric::interval_lib::policies<R, P> >
422 explicit FloatVal(const FloatValImpType& i);
423 public:
425
426
427 FloatVal(void);
429 FloatVal(const FloatNum& n);
431 FloatVal(const FloatNum& l, const FloatNum& u);
433 FloatVal(const FloatVal& v);
434
436 FloatVal& operator =(const FloatNum& n);
438 FloatVal& operator =(const FloatVal& v);
439
441 void assign(FloatNum const &l, FloatNum const &u);
443
445
446
447 FloatNum min(void) const;
449 FloatNum max(void) const;
451 FloatNum size(void) const;
453 FloatNum med(void) const;
455
457
458
459 bool tight(void) const;
461 bool singleton(void) const;
463 bool in(FloatNum n) const;
465 bool zero_in(void) const;
467
469
470
471 static FloatVal hull(FloatNum x, FloatNum y);
473 static FloatVal pi_half(void);
475 static FloatVal pi(void);
477 static FloatVal pi_twice(void);
479
481
482
483 FloatVal& operator +=(const FloatNum& n);
485 FloatVal& operator -=(const FloatNum& n);
487 FloatVal& operator *=(const FloatNum& n);
489 FloatVal& operator /=(const FloatNum& n);
491 FloatVal& operator +=(const FloatVal& v);
493 FloatVal& operator -=(const FloatVal& v);
495 FloatVal& operator *=(const FloatVal& v);
497 FloatVal& operator /=(const FloatVal& v);
499 };
500
505 FloatVal operator +(const FloatVal& x);
510 FloatVal operator -(const FloatVal& x);
511
516 FloatVal operator +(const FloatVal& x, const FloatVal& y);
521 FloatVal operator +(const FloatVal& x, const FloatNum& y);
526 FloatVal operator +(const FloatNum& x, const FloatVal& y);
531 FloatVal operator -(const FloatVal& x, const FloatVal& y);
536 FloatVal operator -(const FloatVal& x, const FloatNum& y);
541 FloatVal operator -(const FloatNum& x, const FloatVal& y);
546 FloatVal operator *(const FloatVal& x, const FloatVal& y);
551 FloatVal operator *(const FloatVal& x, const FloatNum& y);
556 FloatVal operator *(const FloatNum& x, const FloatVal& y);
561 FloatVal operator /(const FloatVal& x, const FloatVal& y);
566 FloatVal operator /(const FloatVal& x, const FloatNum& y);
571 FloatVal operator /(const FloatNum& r, const FloatVal& x);
572
577 bool operator <(const FloatVal& x, const FloatVal& y);
582 bool operator <(const FloatVal& x, const FloatNum& y);
587 bool operator <(const FloatNum& x, const FloatVal& y);
588
593 bool operator <=(const FloatVal& x, const FloatVal& y);
598 bool operator <=(const FloatVal& x, const FloatNum& y);
603 bool operator <=(const FloatNum& x, const FloatVal& y);
604
609 bool operator >(const FloatVal& x, const FloatVal& y);
614 bool operator >(const FloatVal& x, const FloatNum& y);
619 bool operator >(const FloatNum& x, const FloatVal& y);
620
625 bool operator >=(const FloatVal& x, const FloatVal& y);
630 bool operator >=(const FloatVal& x, const FloatNum& y);
635 bool operator >=(const FloatNum& x, const FloatVal& y);
640 bool operator ==(const FloatVal& x, const FloatVal& y);
645 bool operator ==(const FloatVal& x, const FloatNum& y);
650 bool operator ==(const FloatNum& x, const FloatVal& y);
651
656 bool operator !=(const FloatVal& x, const FloatVal& y);
661 bool operator !=(const FloatVal& x, const FloatNum& y);
666 bool operator !=(const FloatNum& x, const FloatVal& y);
667
672 template<class Char, class Traits>
673 std::basic_ostream<Char,Traits>&
674 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
675
680 FloatVal abs(const FloatVal& x);
685 FloatVal sqrt(const FloatVal& x);
690 FloatVal sqr(const FloatVal& x);
695 FloatVal pow(const FloatVal& x, int n);
700 FloatVal nroot(const FloatVal& x, int n);
701
706 FloatVal max(const FloatVal& x, const FloatVal& y);
711 FloatVal max(const FloatVal& x, const FloatNum& y);
716 FloatVal max(const FloatNum& x, const FloatVal& y);
721 FloatVal min(const FloatVal& x, const FloatVal& y);
726 FloatVal min(const FloatVal& x, const FloatNum& y);
731 FloatVal min(const FloatNum& x, const FloatVal& y);
732
733#ifdef GECODE_HAS_MPFR
734 /* transcendental functions: exp, log */
739 FloatVal exp(const FloatVal& x);
744 FloatVal log(const FloatVal& x);
745
750 FloatVal fmod(const FloatVal& x, const FloatVal& y);
755 FloatVal fmod(const FloatVal& x, const FloatNum& y);
760 FloatVal fmod(const FloatNum& x, const FloatVal& y);
761
766 FloatVal sin(const FloatVal& x);
771 FloatVal cos(const FloatVal& x);
776 FloatVal tan(const FloatVal& x);
781 FloatVal asin(const FloatVal& x);
786 FloatVal acos(const FloatVal& x);
791 FloatVal atan(const FloatVal& x);
792
797 FloatVal sinh(const FloatVal& x);
802 FloatVal cosh(const FloatVal& x);
807 FloatVal tanh(const FloatVal& x);
812 FloatVal asinh(const FloatVal& x);
817 FloatVal acosh(const FloatVal& x);
822 FloatVal atanh(const FloatVal& x);
823
824#endif
825
826}
827
828#include <gecode/float/val.hpp>
829
830namespace Gecode { namespace Float {
831
837 namespace Limits {
839 const FloatNum max = std::numeric_limits<FloatNum>::max();
841 const FloatNum min = -max;
843 bool valid(const FloatVal& n);
845 void check(const FloatVal& n, const char* l);
846 }
847
848}}
849
851
853
854namespace Gecode {
855
856 namespace Float {
857 class FloatView;
858 }
859
865 class FloatVar : public VarImpVar<Float::FloatVarImp> {
866 friend class FloatVarArray;
867 friend class FloatVarArgs;
868 private:
876 void _init(Space& home, FloatNum min, FloatNum max);
877 public:
879
880
881 FloatVar(void);
883 FloatVar(const FloatVar& y);
885 FloatVar(const Float::FloatView& y);
899
901
902
903 FloatVal domain(void) const;
905 FloatNum min(void) const;
907 FloatNum max(void) const;
909 FloatNum med(void) const;
911 FloatNum size(void) const;
919 FloatVal val(void) const;
920
922
924
925
926 bool in(const FloatVal& n) const;
928
930 FloatVar& operator =(const FloatVar&) = default;
931 };
932
937 template<class Char, class Traits>
938 std::basic_ostream<Char,Traits>&
939 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVar& x);
940}
941
942#include <gecode/float/view.hpp>
944
945namespace Gecode {
946
948 class FloatValArgs : public ArgArray<FloatVal> {
949 public:
951
952
953 FloatValArgs(void);
955 explicit FloatValArgs(int n);
959 FloatValArgs(const std::vector<FloatVal>& x);
961 FloatValArgs(std::initializer_list<FloatVal> x);
963 template<class InputIterator>
964 FloatValArgs(InputIterator first, InputIterator last);
966 FloatValArgs(int n, const FloatVal* e);
969
972 static FloatValArgs create(int n, FloatVal start, int inc=1);
974 };
975
977 class FloatVarArgs : public VarArgArray<FloatVar> {
978 public:
980
981
982 FloatVarArgs(void);
984 explicit FloatVarArgs(int n);
990 FloatVarArgs(const std::vector<FloatVar>& a);
992 FloatVarArgs(std::initializer_list<FloatVar> a);
994 template<class InputIterator>
995 FloatVarArgs(InputIterator first, InputIterator last);
1008 FloatVarArgs(Space& home, int n, FloatNum min, FloatNum max);
1012 };
1013
1014
1025
1030 class FloatVarArray : public VarArray<FloatVar> {
1031 public:
1033
1034
1035 FloatVarArray(void);
1037 FloatVarArray(Space& home, int n);
1039 FloatVarArray(const FloatVarArray& a);
1041 FloatVarArray(Space& home, const FloatVarArgs& a);
1058 };
1059
1060}
1061
1062#include <gecode/float/array.hpp>
1063
1064namespace Gecode {
1065
1078
1084
1086
1088 dom(Home home, FloatVar x, FloatVal n);
1091 dom(Home home, const FloatVarArgs& x, FloatVal n);
1094 dom(Home home, FloatVar x, FloatNum l, FloatNum m);
1097 dom(Home home, const FloatVarArgs& x, FloatNum l, FloatNum u);
1100 dom(Home home, FloatVar x, FloatVal n, Reify r);
1103 dom(Home home, FloatVar x, FloatNum l, FloatNum u, Reify r);
1106 dom(Home home, FloatVar x, FloatVar d);
1109 dom(Home home, const FloatVarArgs& x, const FloatVarArgs& d);
1111
1121 rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1);
1126 rel(Home home, FloatVar x, FloatRelType frt, FloatVal c);
1131 rel(Home home, FloatVar x, FloatRelType frt, FloatVal c, Reify r);
1136 rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1, Reify r);
1141 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVal c);
1146 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVar y);
1154 ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z);
1155
1156}
1157
1158
1159namespace Gecode {
1160
1165
1167
1170 min(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1175 min(Home home, const FloatVarArgs& x, FloatVar y);
1179 max(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1184 max(Home home, const FloatVarArgs& x, FloatVar y);
1185
1189 abs(Home home, FloatVar x0, FloatVar x1);
1190
1194 mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1195
1199 sqr(Home home, FloatVar x0, FloatVar x1);
1200
1204 sqrt(Home home, FloatVar x0, FloatVar x1);
1205
1209 pow(Home home, FloatVar x0, int n, FloatVar x1);
1210
1214 nroot(Home home, FloatVar x0, int n, FloatVar x1);
1215
1219 div(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1220#ifdef GECODE_HAS_MPFR
1224 exp(Home home, FloatVar x0, FloatVar x1);
1228 log(Home home, FloatVar x0, FloatVar x1);
1232 pow(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1236 log(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1240 asin(Home home, FloatVar x0, FloatVar x1);
1244 sin(Home home, FloatVar x0, FloatVar x1);
1248 acos(Home home, FloatVar x0, FloatVar x1);
1252 cos(Home home, FloatVar x0, FloatVar x1);
1256 atan(Home home, FloatVar x0, FloatVar x1);
1260 tan(Home home, FloatVar x0, FloatVar x1);
1262#endif
1263
1279 linear(Home home, const FloatVarArgs& x,
1280 FloatRelType frt, FloatVal c);
1292 linear(Home home, const FloatVarArgs& x,
1293 FloatRelType frt, FloatVar y);
1305 linear(Home home, const FloatVarArgs& x,
1306 FloatRelType frt, FloatVal c, Reify r);
1318 linear(Home home, const FloatVarArgs& x,
1319 FloatRelType frt, FloatVar y, Reify r);
1333 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1334 FloatRelType frt, FloatVal c);
1349 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1350 FloatRelType frt, FloatVar y);
1365 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1366 FloatRelType frt, FloatVal c, Reify r);
1381 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1382 FloatRelType frt, FloatVar y, Reify r);
1383
1384
1390
1392 channel(Home home, FloatVar x0, IntVar x1);
1394 void
1395 channel(Home home, IntVar x0, FloatVar x1);
1398 channel(Home home, FloatVar x0, BoolVar x1);
1400 void
1401 channel(Home home, BoolVar x0, FloatVar x1);
1403
1404}
1405
1406#include <gecode/float/channel.hpp>
1407
1408namespace Gecode {
1409
1418
1420 wait(Home home, FloatVar x, std::function<void(Space& home)> c);
1423 wait(Home home, const FloatVarArgs& x, std::function<void(Space& home)> c);
1425
1426}
1427
1428namespace Gecode {
1429
1434
1443 typedef std::function<bool(const Space& home, FloatVar x, int i)>
1445
1456 typedef std::function<double(const Space& home, FloatVar x, int i)>
1458
1465 public:
1469 bool l;
1470 };
1471
1482 typedef std::function<FloatNumBranch(const Space& home, FloatVar x, int i)>
1484
1496 typedef std::function<void(Space& home, unsigned int a,
1497 FloatVar x, int i, FloatNumBranch nl)>
1499
1500}
1501
1503
1504namespace Gecode {
1505
1511 class FloatAFC : public AFC {
1512 public:
1520 FloatAFC(void);
1522 FloatAFC(const FloatAFC& a);
1524 FloatAFC& operator =(const FloatAFC& a);
1532 FloatAFC(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1543 void init(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1544 };
1545
1546}
1547
1549
1550namespace Gecode {
1551
1557 class FloatAction : public Action {
1558 public:
1566 FloatAction(void);
1568 FloatAction(const FloatAction& a);
1582 FloatAction(Home home, const FloatVarArgs& x, double d=1.0,
1583 bool p=true, bool f=true,
1584 FloatBranchMerit bm=nullptr);
1599 init(Home home, const FloatVarArgs& x, double d=1.0,
1600 bool p=true, bool f=true,
1601 FloatBranchMerit bm=nullptr);
1602 };
1603
1604}
1605
1607
1608namespace Gecode {
1609
1615 class FloatCHB : public CHB {
1616 public:
1624 FloatCHB(void);
1626 FloatCHB(const FloatCHB& chb);
1628 FloatCHB& operator =(const FloatCHB& chb);
1638 FloatCHB(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1651 init(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1652 };
1653
1654}
1655
1657
1658namespace Gecode {
1659
1661 typedef std::function<void(const Space &home, const Brancher& b,
1662 unsigned int a,
1663 FloatVar x, int i, const FloatNumBranch& n,
1664 std::ostream& o)>
1666
1667}
1668
1669namespace Gecode {
1670
1732
1733
1739
1752 FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
1756 FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
1760 FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
1764 FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
1792 FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1796 FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1800 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1804 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1816
1817}
1818
1820
1821namespace Gecode {
1822
1828 class FloatValBranch : public ValBranch<FloatVar> {
1829 public:
1837 protected:
1840 public:
1848 Select select(void) const;
1849 };
1850
1856
1870
1871}
1872
1874
1875namespace Gecode {
1876
1882 class FloatAssign : public ValBranch<FloatVar> {
1883 public:
1891 protected:
1894 public:
1898 FloatAssign(Rnd r);
1902 Select select(void) const;
1903 };
1904
1910
1923
1924}
1925
1927
1928namespace Gecode {
1929
1936 branch(Home home, const FloatVarArgs& x,
1937 FloatVarBranch vars, FloatValBranch vals,
1938 FloatBranchFilter bf=nullptr,
1939 FloatVarValPrint vvp=nullptr);
1946 branch(Home home, const FloatVarArgs& x,
1947 TieBreak<FloatVarBranch> vars, FloatValBranch vals,
1948 FloatBranchFilter bf=nullptr,
1949 FloatVarValPrint vvp=nullptr);
1956 branch(Home home, FloatVar x, FloatValBranch vals,
1957 FloatVarValPrint vvp=nullptr);
1958
1965 assign(Home home, const FloatVarArgs& x,
1966 FloatVarBranch vars, FloatAssign vals,
1967 FloatBranchFilter bf=nullptr,
1968 FloatVarValPrint vvp=nullptr);
1975 assign(Home home, const FloatVarArgs& x,
1976 TieBreak<FloatVarBranch> vars, FloatAssign vals,
1977 FloatBranchFilter bf=nullptr,
1978 FloatVarValPrint vvp=nullptr);
1985 assign(Home home, FloatVar x, FloatAssign vals,
1986 FloatVarValPrint vvp=nullptr);
1987
1988}
1989
1990namespace Gecode {
1991
1997 void
1998 branch(Home home, const FloatVarArgs& x, FloatValBranch vals,
1999 FloatBranchFilter bf=nullptr,
2000 FloatVarValPrint vvp=nullptr);
2006 void
2007 assign(Home home, const FloatVarArgs& x, FloatAssign vals,
2008 FloatBranchFilter bf=nullptr,
2009 FloatVarValPrint vvp=nullptr);
2010
2011}
2012
2013#include <gecode/float/branch.hpp>
2014
2015namespace Gecode {
2016
2017 /*
2018 * \brief Relaxed assignment of variables in \a x from values in \a sx
2019 *
2020 * The variables in \a x are assigned values from the assigned variables
2021 * in the solution \a sx with a relaxation probability \a p. That is,
2022 * if \f$p=0.1\f$ approximately 10% of the variables in \a x will be
2023 * assigned a value from \a sx.
2024 *
2025 * The random numbers are generated from the generator \a r. At least
2026 * one variable will not be assigned: in case the relaxation attempt
2027 * would suggest that all variables should be assigned, a single
2028 * variable will be selected randomly to remain unassigned.
2029 *
2030 * Throws an exception of type Float::ArgumentSizeMismatch, if \a x and
2031 * \a sx are of different size.
2032 *
2033 * Throws an exception of type Float::OutOfLimits, if \a p is not between
2034 * \a 0.0 and \a 1.0.
2035 *
2036 * \ingroup TaskModeFloat
2037 */
2039 relax(Home home, const FloatVarArgs& x, const FloatVarArgs& sx,
2040 Rnd r, double p);
2041
2042}
2043
2045
2046namespace Gecode {
2047
2052
2058 protected:
2062 const Delta& d;
2063 public:
2065
2066
2068 const Delta& d);
2070
2072
2073 FloatNum min(void) const;
2075 FloatNum max(void) const;
2077 };
2078
2079}
2080
2082
2084
2085namespace Gecode {
2086
2097
2103 protected:
2105 std::ostream& os;
2106 public:
2108 StdFloatTracer(std::ostream& os0 = std::cerr);
2110 virtual void init(const Space& home, const FloatTraceRecorder& t);
2112 virtual void prune(const Space& home, const FloatTraceRecorder& t,
2113 const ViewTraceInfo& vti, int i, FloatTraceDelta& d);
2115 virtual void fix(const Space& home, const FloatTraceRecorder& t);
2117 virtual void fail(const Space& home, const FloatTraceRecorder& t);
2119 virtual void done(const Space& home, const FloatTraceRecorder& t);
2122 };
2123
2124
2130 trace(Home home, const FloatVarArgs& x,
2131 TraceFilter tf,
2132 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2138 void
2139 trace(Home home, const FloatVarArgs& x,
2140 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2142
2143}
2144
2145#include <gecode/float/trace.hpp>
2146
2147#endif
2148
2149// IFDEF: GECODE_HAS_FLOAT_VARS
2150// 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:534
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:1511
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:1557
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.
Definition action.cpp:45
FloatAction(void)
Construct as not yet initialized.
Definition action.hpp:37
Which values to select for assignment.
Definition float.hh:1882
Select
Which value selection.
Definition float.hh:1885
@ SEL_MAX
Select median value of the upper part.
Definition float.hh:1887
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1889
@ SEL_RND
Select median value of a randomly chosen part.
Definition float.hh:1888
@ SEL_MIN
Select median value of the lower part.
Definition float.hh:1886
Select s
Which value to select.
Definition float.hh:1893
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:1615
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:1464
bool l
Whether to try the lower or upper half first.
Definition float.hh:1469
FloatNum n
The middle value for branching.
Definition float.hh:1467
Trace delta information for float variables.
Definition float.hh:2057
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:2062
FloatNum min(void) const
Return minimum.
Definition delta.hpp:44
Float::FloatView n
New view.
Definition float.hh:2060
FloatNum max(void) const
Return maximum.
Definition delta.hpp:49
Passing float arguments.
Definition float.hh:948
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:1828
Select select(void) const
Return selection strategy.
Definition val.hpp:49
Select
Which value selection.
Definition float.hh:1831
@ SEL_SPLIT_RND
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition float.hh:1834
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition float.hh:1832
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1835
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition float.hh:1833
Select s
Which value to select.
Definition float.hh:1839
FloatValBranch(Select s=SEL_SPLIT_MIN)
Initialize with selection strategy s.
Definition val.hpp:37
Float value type.
Definition float.hh:329
friend std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const FloatVal &x)
Definition val.hpp:361
friend FloatVal cos(const FloatVal &x)
Definition val.hpp:440
bool singleton(void) const
Test whether float is a singleton.
Definition val.hpp:93
friend FloatVal exp(const FloatVal &x)
Definition val.hpp:414
friend FloatVal Float::hull(const FloatVal &x, const FloatVal &y)
friend FloatVal acos(const FloatVal &x)
Definition val.hpp:452
FloatVal & operator/=(const FloatNum &n)
Divide by n.
Definition val.hpp:138
friend bool operator==(const FloatVal &x, const FloatVal &y)
Definition val.hpp:295
boost::numeric::interval_lib::checking_strict< FloatNum > P
Used checking policy.
Definition float.hh:413
friend FloatVal atanh(const FloatVal &x)
Definition val.hpp:481
static FloatVal pi(void)
Return lower bound of .
Definition val.hpp:115
friend bool operator<(const FloatVal &x, const FloatVal &y)
Definition val.hpp:227
friend bool operator<=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:244
friend FloatVal cosh(const FloatVal &x)
Definition val.hpp:465
friend FloatVal operator-(const FloatVal &x)
Definition val.hpp:169
boost::numeric::interval< FloatNum, boost::numeric::interval_lib::policies< R, P > > FloatValImpType
Implementation type for float value.
Definition float.hh:418
static FloatVal pi_twice(void)
Return .
Definition val.hpp:120
friend FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition val.hpp:201
friend FloatVal acosh(const FloatVal &x)
Definition val.hpp:477
FloatValImpType x
Implementation of float value.
Definition float.hh:420
bool zero_in(void) const
Test whether zero is included.
Definition val.hpp:101
friend FloatVal sqrt(const FloatVal &x)
Definition val.hpp:370
FloatVal & operator-=(const FloatNum &n)
Subtract by n.
Definition val.hpp:130
bool in(FloatNum n) const
Test whether n is included.
Definition val.hpp:97
friend FloatVal pow(const FloatVal &x, int n)
Definition val.hpp:378
friend FloatVal abs(const FloatVal &x)
Definition val.hpp:366
friend FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition val.hpp:214
friend FloatVal tanh(const FloatVal &x)
Definition val.hpp:469
FloatVal & operator*=(const FloatNum &n)
Multiply by n.
Definition val.hpp:134
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:418
friend FloatVal sin(const FloatVal &x)
Definition val.hpp:436
friend FloatVal sqr(const FloatVal &x)
Definition val.hpp:374
friend FloatVal sinh(const FloatVal &x)
Definition val.hpp:461
friend bool operator>=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:278
friend FloatVal asin(const FloatVal &x)
Definition val.hpp:448
FloatVal & operator+=(const FloatNum &n)
Increment by n.
Definition val.hpp:126
friend bool operator!=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:318
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:261
Float::Rounding R
Used rounding policies.
Definition float.hh:411
friend FloatVal atan(const FloatVal &x)
Definition val.hpp:456
friend FloatVal asinh(const FloatVal &x)
Definition val.hpp:473
bool tight(void) const
Test whether float is tight.
Definition val.hpp:88
friend FloatVal nroot(const FloatVal &x, int n)
Definition val.hpp:382
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:165
friend FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition val.hpp:423
static FloatVal pi_half(void)
Return .
Definition val.hpp:110
FloatVal(const FloatValImpType &i)
Initialize from implementation i.
Definition val.hpp:51
friend FloatVal tan(const FloatVal &x)
Definition val.hpp:444
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:977
FloatVarArgs(void)
Allocate empty array.
Definition array.hpp:73
FloatVarArgs & operator=(const FloatVarArgs &)=default
Assignment operator.
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:1676
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:1679
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition float.hh:1702
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition float.hh:1703
@ SEL_MIN_MIN
With smallest min.
Definition float.hh:1692
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition float.hh:1700
@ SEL_MAX_MAX
With largest max.
Definition float.hh:1695
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition float.hh:1701
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition float.hh:1691
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition float.hh:1698
@ SEL_MIN_MAX
With largest min.
Definition float.hh:1693
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition float.hh:1704
@ SEL_NONE
First unassigned.
Definition float.hh:1680
@ SEL_MERIT_MIN
With least merit.
Definition float.hh:1682
@ SEL_ACTION_MAX
With highest action.
Definition float.hh:1689
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition float.hh:1690
@ SEL_DEGREE_MAX
With largest degree.
Definition float.hh:1685
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition float.hh:1699
@ SEL_DEGREE_MIN
With smallest degree.
Definition float.hh:1684
@ SEL_MERIT_MAX
With highest merit.
Definition float.hh:1683
@ SEL_MAX_MIN
With smallest max.
Definition float.hh:1694
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition float.hh:1705
@ SEL_RND
Random (uniform, for tie breaking).
Definition float.hh:1681
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition float.hh:1687
@ SEL_SIZE_MAX
With largest domain size.
Definition float.hh:1697
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition float.hh:1686
@ SEL_ACTION_MIN
With lowest action.
Definition float.hh:1688
@ SEL_SIZE_MIN
With smallest domain size.
Definition float.hh:1696
Select s
Which variable to select.
Definition float.hh:1709
Float variables.
Definition float.hh:865
friend class FloatVarArgs
Definition float.hh:867
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:866
Float variable implementation.
Definition var-imp.hpp:76
Float view for float variables.
Definition view.hpp:52
Floating point rounding operations without state saving.
Definition float.hh:146
FloatNum int_up(FloatNum x)
Return next upward-rounded integer of x (domain: ).
FloatNum log_down(FloatNum x)
Return lower bound of logarithm of x (domain: ).
FloatNum int_down(FloatNum x)
Return next downward-rounded integer of x (domain: ).
FloatNum exp_down(FloatNum x)
Return lower bound of exponential of x (domain: ).
FloatNum asin_up(FloatNum x)
Return upper bound of arcsine of x (domain: ).
FloatNum log_up(FloatNum x)
Return upper bound of logarithm 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 atanh_up(FloatNum x)
Return upper bound of hyperbolic arctangent of x (domain: ).
FloatNum asinh_down(FloatNum x)
Return lower bound of hyperbolic arcsine of x (domain: ).
FloatNum asinh_up(FloatNum x)
Return upper bound of hyperbolic arcsine of x (domain: ).
FloatNum div_up(FloatNum x, FloatNum y)
Return upper bound of x divided y (domain: ).
FloatNum sub_up(FloatNum x, FloatNum y)
Return upper bound of x minus y (domain: ).
FloatNum cosh_down(FloatNum x)
Return lower bound of hyperbolic cosine of x (domain: ).
FloatNum sqrt_up(FloatNum x)
Return upper bound of square root of x (domain: ).
FloatNum mul_down(FloatNum x, FloatNum y)
Return lower bound of x times y (domain: ).
FloatNum tanh_up(FloatNum x)
Return upper bound of hyperbolic tangent of x (domain: ).
FloatNum acosh_down(FloatNum x)
Return lower bound of hyperbolic arccosine of x (domain: ).
FloatNum acosh_up(FloatNum x)
Return upper bound of hyperbolic arccosine of x (domain: ).
FloatNum atan_down(FloatNum x)
Return lower bound of arctangent of x (domain: ).
FloatNum acos_up(FloatNum x)
Return upper bound of arccossine of x (domain: ).
FloatNum sin_up(FloatNum x)
Return upper bound of sine of x (domain: ).
FloatNum tan_up(FloatNum x)
Return upper bound of tangent of x (domain: ).
FloatNum cos_down(FloatNum x)
Return lower bound of cosine of x (domain: ).
FloatNum cos_up(FloatNum x)
Return upper bound of cosine of x (domain: ).
FloatNum tan_down(FloatNum x)
Return lower bound of tangent of x (domain: ).
FloatNum tanh_down(FloatNum x)
Return lower bound of hyperbolic tangent of x (domain: ).
FloatNum atan_up(FloatNum x)
Return upper bound of arctangent of x (domain: ).
FloatNum median(FloatNum x, FloatNum y)
Return an overflow-safe median of x and y, where x <= y.
Definition rounding.hpp:37
FloatNum add_up(FloatNum x, FloatNum y)
Return upper bound of x plus y (domain: ).
FloatNum asin_down(FloatNum x)
Return lower bound of arcsine of x (domain: ).
FloatNum add_down(FloatNum x, FloatNum y)
Return lower bound of x plus y (domain: ).
FloatNum div_down(FloatNum x, FloatNum y)
Return lower bound of x divided by y (domain: ).
FloatNum mul_up(FloatNum x, FloatNum y)
Return upper bound of x times y (domain: ).
FloatNum exp_up(FloatNum x)
Return upper bound of exponential of x (domain: ).
FloatNum sinh_down(FloatNum x)
Return lower bound of hyperbolic sine of x (domain: ).
FloatNum sin_down(FloatNum x)
Return lower bound of sine of x (domain: ).
FloatNum atanh_down(FloatNum x)
Return lower bound of hyperbolic arctangent of x (domain: ).
FloatNum cosh_up(FloatNum x)
Return upper bound of hyperbolic cosine of x (domain: ).
FloatNum sinh_up(FloatNum x)
Return upper bound of hyperbolic sine of x (domain: ).
FloatNum acos_down(FloatNum x)
Return lower bound of arccosine of x (domain: ).
Floating point rounding policy that restores the caller's mode.
Definition float.hh:269
Home class for posting propagators
Definition core.hpp:863
Integer variables.
Definition int.hh:390
Reification specification.
Definition int.hh:1176
Random number generator.
Definition rnd.hpp:42
Shared array with arbitrary number of elements.
Computation spaces.
Definition core.hpp:1787
static StdFloatTracer def
Default tracer (printing to std::cerr).
Definition float.hh:2121
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:2105
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: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:2091
ViewTraceRecorder< Float::FloatView > FloatTraceRecorder
Trace recorder for float variables.
Definition float.hh:2096
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:1483
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition float.hh:1457
std::function< bool(const Space &home, FloatVar x, int i)> FloatBranchFilter
Branch filter function type for float variables.
Definition float.hh:1444
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:1498
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:1070
@ FRT_EQ
Equality ( ).
Definition float.hh:1071
@ FRT_GR
Greater ( ).
Definition float.hh:1076
@ FRT_NQ
Disequality ( ).
Definition float.hh:1072
@ FRT_LE
Less ( ).
Definition float.hh:1074
@ FRT_LQ
Less or equal ( ).
Definition float.hh:1073
@ FRT_GQ
Greater or equal ( ).
Definition float.hh:1075
@ 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:837
const FloatNum max
Largest allowed float value.
Definition float.hh:839
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:841
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:491
bool proper_subset(const FloatVal &x, const FloatVal &y)
Definition val.hpp:495
FloatVal hull(const FloatVal &x, const FloatVal &y)
Definition val.hpp:508
bool overlap(const FloatVal &x, const FloatVal &y)
Definition val.hpp:499
boost::numeric::interval_lib::rounded_arith_opp< FloatNum > RoundingControl
Rounding operations that keep upward mode between calls.
Definition float.hh:139
FloatVal intersect(const FloatVal &x, const FloatVal &y)
Definition val.hpp:504
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:214
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:1665
FloatVal operator-(const FloatVal &x)
Definition val.hpp:169
FloatVal asinh(const FloatVal &x)
Definition val.hpp:473
bool operator<=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:244
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:165
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:227
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:261
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:278
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:423
FloatVal sinh(const FloatVal &x)
Definition val.hpp:461
FloatVal acosh(const FloatVal &x)
Definition val.hpp:477
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:469
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:481
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition val.hpp:201
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:465
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:295
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:318
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