Generated on for Gecode by doxygen 1.18.0
float.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.dev>
5 * Guido Tack <tack@gecode.dev>
6 * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
7 *
8 * Copyright:
9 * Christian Schulte, 2002
10 * Guido Tack, 2004
11 * Vincent Barichard, 2012
12 *
13 * This file is part of Gecode, the generic constraint
14 * development environment:
15 * http://www.gecode.dev
16 *
17 * Permission is hereby granted, free of charge, to any person obtaining
18 * a copy of this software and associated documentation files (the
19 * "Software"), to deal in the Software without restriction, including
20 * without limitation the rights to use, copy, modify, merge, publish,
21 * distribute, sublicense, and/or sell copies of the Software, and to
22 * permit persons to whom the Software is furnished to do so, subject to
23 * the following conditions:
24 *
25 * The above copyright notice and this permission notice shall be
26 * included in all copies or substantial portions of the Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 *
36 */
37
38#ifndef GECODE_FLOAT_HH
39#define GECODE_FLOAT_HH
40
41#include <climits>
42#include <cfloat>
43#include <iostream>
44
45#include <functional>
46
47#include <gecode/kernel.hh>
48#include <gecode/int.hh>
49
50/*
51 * Configure linking
52 *
53 */
54#if !defined(GECODE_STATIC_LIBS) && \
55 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
56
57#ifdef GECODE_BUILD_FLOAT
58#define GECODE_FLOAT_EXPORT __declspec( dllexport )
59#else
60#define GECODE_FLOAT_EXPORT __declspec( dllimport )
61#endif
62
63#else
64
65#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
66#define GECODE_FLOAT_EXPORT __attribute__ ((visibility("default")))
67#else
68#define GECODE_FLOAT_EXPORT
69#endif
70
71#endif
72
73// Configure auto-linking
74#ifndef GECODE_BUILD_FLOAT
75#define GECODE_LIBRARY_NAME "Float"
77#endif
78
79// Include interval implementation
80#include <gecode/third-party/boost/numeric/interval.hpp>
81
92
94
96
97namespace Gecode {
98
106 typedef double FloatNum;
107
113 FloatNum pi_lower(void);
115 FloatNum pi_upper(void);
120
121 // Forward declaration
122 class FloatVal;
123
124}
125
126#include <gecode/float/num.hpp>
127
128namespace Gecode { namespace Float {
129
130
131#if defined(_MSC_VER) && (defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP > 0)))
132
133 /*
134 * This is used for the MSVC compiler for x64 or x86 with SSE enabled.
135 *
136 */
138 typedef gecode_boost::numeric::interval_lib::rounded_arith_std<FloatNum>
139 RoundingControl;
140
141#else
142
144 typedef gecode_boost::numeric::interval_lib::rounded_arith_opp<FloatNum>
146
147#endif
148
155 public:
157
158
179
181
182
189
190#ifdef GECODE_HAS_MPFR
192
193
202
204
205
218
220
221
234
236
237
250
252
253
266#endif
267 };
268
276 class Rounding : public
277 gecode_boost::numeric::interval_lib::save_state<RoundingBase> {};
278
279
280}}
281
283
284namespace Gecode { namespace Float {
285
290 bool subset(const FloatVal& x, const FloatVal& y);
295 bool proper_subset(const FloatVal& x, const FloatVal& y);
300 bool overlap(const FloatVal& x, const FloatVal& y);
301
306 FloatVal intersect(const FloatVal& x, const FloatVal& y);
311 FloatVal hull(const FloatVal& x, const FloatVal& y);
316 FloatVal hull(const FloatVal& x, const FloatNum& y);
321 FloatVal hull(const FloatNum& x, const FloatVal& y);
326 FloatVal hull(const FloatNum& x, const FloatNum& y);
327
328}}
329
330namespace Gecode {
331
337 class FloatVal {
338 friend FloatVal operator +(const FloatVal& x);
339 friend FloatVal operator -(const FloatVal& x);
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 friend FloatVal operator /(const FloatVal& x, const FloatVal& y);
350 friend FloatVal operator /(const FloatVal& x, const FloatNum& y);
351 friend FloatVal operator /(const FloatNum& x, const FloatVal& y);
352
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 friend bool operator !=(const FloatVal& x, const FloatVal& y);
369 friend bool operator !=(const FloatVal& x, const FloatNum& y);
370 friend bool operator !=(const FloatNum& x, const FloatVal& y);
371
372 template<class Char, class Traits>
373 friend std::basic_ostream<Char,Traits>&
374 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
375
376 friend FloatVal abs(const FloatVal& x);
377 friend FloatVal sqrt(const FloatVal& x);
378 friend FloatVal sqr(const FloatVal& x);
379 friend FloatVal pow(const FloatVal& x, int n);
380 friend FloatVal nroot(const FloatVal& x, int n);
381
382 friend FloatVal max(const FloatVal& x, const FloatVal& y);
383 friend FloatVal max(const FloatVal& x, const FloatNum& y);
384 friend FloatVal max(const FloatNum& x, const FloatVal& y);
385 friend FloatVal min(const FloatVal& x, const FloatVal& y);
386 friend FloatVal min(const FloatVal& x, const FloatNum& y);
387 friend FloatVal min(const FloatNum& x, const FloatVal& y);
388
389#ifdef GECODE_HAS_MPFR
390 friend FloatVal exp(const FloatVal& x);
391 friend FloatVal log(const FloatVal& x);
392 friend FloatVal fmod(const FloatVal& x, const FloatVal& y);
393 friend FloatVal fmod(const FloatVal& x, const FloatNum& y);
394 friend FloatVal fmod(const FloatNum& x, const FloatVal& y);
395 friend FloatVal sin(const FloatVal& x);
396 friend FloatVal cos(const FloatVal& x);
397 friend FloatVal tan(const FloatVal& x);
398 friend FloatVal asin(const FloatVal& x);
399 friend FloatVal acos(const FloatVal& x);
400 friend FloatVal atan(const FloatVal& x);
401 friend FloatVal sinh(const FloatVal& x);
402 friend FloatVal cosh(const FloatVal& x);
403 friend FloatVal tanh(const FloatVal& x);
404 friend FloatVal asinh(const FloatVal& x);
405 friend FloatVal acosh(const FloatVal& x);
406 friend FloatVal atanh(const FloatVal& x);
407#endif
408
409 friend bool Float::subset(const FloatVal& x, const FloatVal& y);
410 friend bool Float::proper_subset(const FloatVal& x, const FloatVal& y);
411 friend bool Float::overlap(const FloatVal& x, const FloatVal& y);
412 friend FloatVal Float::intersect(const FloatVal& x, const FloatVal& y);
413 friend FloatVal Float::hull(const FloatVal& x, const FloatVal& y);
414 friend FloatVal Float::hull(const FloatVal& x, const FloatNum& y);
415 friend FloatVal Float::hull(const FloatNum& x, const FloatVal& y);
416 friend FloatVal Float::hull(const FloatNum& x, const FloatNum& y);
417 protected:
421 typedef gecode_boost::numeric::interval_lib::checking_strict<FloatNum> P;
423 typedef gecode_boost::numeric::interval
424 <FloatNum,
425 gecode_boost::numeric::interval_lib::policies<R, P> >
430 explicit FloatVal(const FloatValImpType& i);
431 public:
433
434
435 FloatVal(void);
437 FloatVal(const FloatNum& n);
439 FloatVal(const FloatNum& l, const FloatNum& u);
441 FloatVal(const FloatVal& v);
442
444 FloatVal& operator =(const FloatNum& n);
446 FloatVal& operator =(const FloatVal& v);
447
449 void assign(FloatNum const &l, FloatNum const &u);
451
453
454
455 FloatNum min(void) const;
457 FloatNum max(void) const;
459 FloatNum size(void) const;
461 FloatNum med(void) const;
463
465
466
467 bool tight(void) const;
469 bool singleton(void) const;
471 bool in(FloatNum n) const;
473 bool zero_in(void) const;
475
477
478
479 static FloatVal hull(FloatNum x, FloatNum y);
481 static FloatVal pi_half(void);
483 static FloatVal pi(void);
485 static FloatVal pi_twice(void);
487
489
490
491 FloatVal& operator +=(const FloatNum& n);
493 FloatVal& operator -=(const FloatNum& n);
495 FloatVal& operator *=(const FloatNum& n);
497 FloatVal& operator /=(const FloatNum& n);
499 FloatVal& operator +=(const FloatVal& v);
501 FloatVal& operator -=(const FloatVal& v);
503 FloatVal& operator *=(const FloatVal& v);
505 FloatVal& operator /=(const FloatVal& v);
507 };
508
513 FloatVal operator +(const FloatVal& x);
518 FloatVal operator -(const FloatVal& x);
519
524 FloatVal operator +(const FloatVal& x, const FloatVal& y);
529 FloatVal operator +(const FloatVal& x, const FloatNum& y);
534 FloatVal operator +(const FloatNum& x, const FloatVal& y);
539 FloatVal operator -(const FloatVal& x, const FloatVal& y);
544 FloatVal operator -(const FloatVal& x, const FloatNum& y);
549 FloatVal operator -(const FloatNum& x, const FloatVal& y);
554 FloatVal operator *(const FloatVal& x, const FloatVal& y);
559 FloatVal operator *(const FloatVal& x, const FloatNum& y);
564 FloatVal operator *(const FloatNum& x, const FloatVal& y);
569 FloatVal operator /(const FloatVal& x, const FloatVal& y);
574 FloatVal operator /(const FloatVal& x, const FloatNum& y);
579 FloatVal operator /(const FloatNum& r, const FloatVal& x);
580
585 bool operator <(const FloatVal& x, const FloatVal& y);
590 bool operator <(const FloatVal& x, const FloatNum& y);
595 bool operator <(const FloatNum& x, const FloatVal& y);
596
601 bool operator <=(const FloatVal& x, const FloatVal& y);
606 bool operator <=(const FloatVal& x, const FloatNum& y);
611 bool operator <=(const FloatNum& x, const FloatVal& y);
612
617 bool operator >(const FloatVal& x, const FloatVal& y);
622 bool operator >(const FloatVal& x, const FloatNum& y);
627 bool operator >(const FloatNum& x, const FloatVal& y);
628
633 bool operator >=(const FloatVal& x, const FloatVal& y);
638 bool operator >=(const FloatVal& x, const FloatNum& y);
643 bool operator >=(const FloatNum& x, const FloatVal& y);
648 bool operator ==(const FloatVal& x, const FloatVal& y);
653 bool operator ==(const FloatVal& x, const FloatNum& y);
658 bool operator ==(const FloatNum& x, const FloatVal& y);
659
664 bool operator !=(const FloatVal& x, const FloatVal& y);
669 bool operator !=(const FloatVal& x, const FloatNum& y);
674 bool operator !=(const FloatNum& x, const FloatVal& y);
675
680 template<class Char, class Traits>
681 std::basic_ostream<Char,Traits>&
682 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
683
688 FloatVal abs(const FloatVal& x);
693 FloatVal sqrt(const FloatVal& x);
698 FloatVal sqr(const FloatVal& x);
703 FloatVal pow(const FloatVal& x, int n);
708 FloatVal nroot(const FloatVal& x, int n);
709
714 FloatVal max(const FloatVal& x, const FloatVal& y);
719 FloatVal max(const FloatVal& x, const FloatNum& y);
724 FloatVal max(const FloatNum& x, const FloatVal& y);
729 FloatVal min(const FloatVal& x, const FloatVal& y);
734 FloatVal min(const FloatVal& x, const FloatNum& y);
739 FloatVal min(const FloatNum& x, const FloatVal& y);
740
741#ifdef GECODE_HAS_MPFR
742 /* transcendental functions: exp, log */
747 FloatVal exp(const FloatVal& x);
752 FloatVal log(const FloatVal& x);
753
758 FloatVal fmod(const FloatVal& x, const FloatVal& y);
763 FloatVal fmod(const FloatVal& x, const FloatNum& y);
768 FloatVal fmod(const FloatNum& x, const FloatVal& y);
769
774 FloatVal sin(const FloatVal& x);
779 FloatVal cos(const FloatVal& x);
784 FloatVal tan(const FloatVal& x);
789 FloatVal asin(const FloatVal& x);
794 FloatVal acos(const FloatVal& x);
799 FloatVal atan(const FloatVal& x);
800
805 FloatVal sinh(const FloatVal& x);
810 FloatVal cosh(const FloatVal& x);
815 FloatVal tanh(const FloatVal& x);
820 FloatVal asinh(const FloatVal& x);
825 FloatVal acosh(const FloatVal& x);
830 FloatVal atanh(const FloatVal& x);
831
832#endif
833
834}
835
836#include <gecode/float/val.hpp>
837
838namespace Gecode { namespace Float {
839
845 namespace Limits {
847 const FloatNum max = std::numeric_limits<FloatNum>::max();
849 const FloatNum min = -max;
851 bool valid(const FloatVal& n);
853 void check(const FloatVal& n, const char* l);
854 }
855
856}}
857
859
861
862namespace Gecode {
863
864 namespace Float {
865 class FloatView;
866 }
867
873 class FloatVar : public VarImpVar<Float::FloatVarImp> {
874 friend class FloatVarArray;
875 friend class FloatVarArgs;
876 private:
884 void _init(Space& home, FloatNum min, FloatNum max);
885 public:
887
888
889 FloatVar(void);
891 FloatVar(const FloatVar& y);
893 FloatVar(const Float::FloatView& y);
907
909
910
911 FloatVal domain(void) const;
913 FloatNum min(void) const;
915 FloatNum max(void) const;
917 FloatNum med(void) const;
919 FloatNum size(void) const;
927 FloatVal val(void) const;
928
930
932
933
934 bool in(const FloatVal& n) const;
936
938 FloatVar& operator =(const FloatVar&) = default;
939 };
940
945 template<class Char, class Traits>
946 std::basic_ostream<Char,Traits>&
947 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVar& x);
948}
949
950#include <gecode/float/view.hpp>
952
953namespace Gecode {
954
956 class FloatValArgs : public ArgArray<FloatVal> {
957 public:
959
960
961 FloatValArgs(void);
963 explicit FloatValArgs(int n);
967 FloatValArgs(const std::vector<FloatVal>& x);
969 FloatValArgs(std::initializer_list<FloatVal> x);
971 template<class InputIterator>
972 FloatValArgs(InputIterator first, InputIterator last);
974 FloatValArgs(int n, const FloatVal* e);
977
980 static FloatValArgs create(int n, FloatVal start, int inc=1);
982 };
983
985 class FloatVarArgs : public VarArgArray<FloatVar> {
986 public:
988
989
990 FloatVarArgs(void);
992 explicit FloatVarArgs(int n);
998 FloatVarArgs(const std::vector<FloatVar>& a);
1000 FloatVarArgs(std::initializer_list<FloatVar> a);
1002 template<class InputIterator>
1003 FloatVarArgs(InputIterator first, InputIterator last);
1020 };
1021
1022
1033
1038 class FloatVarArray : public VarArray<FloatVar> {
1039 public:
1041
1042
1043 FloatVarArray(void);
1045 FloatVarArray(Space& home, int n);
1047 FloatVarArray(const FloatVarArray& a);
1049 FloatVarArray(Space& home, const FloatVarArgs& a);
1066 };
1067
1068}
1069
1070#include <gecode/float/array.hpp>
1071
1072namespace Gecode {
1073
1086
1092
1094
1099 dom(Home home, const FloatVarArgs& x, FloatVal n);
1105 dom(Home home, const FloatVarArgs& x, FloatNum l, FloatNum u);
1117 dom(Home home, const FloatVarArgs& x, const FloatVarArgs& d);
1119
1149 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVal c);
1154 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVar y);
1163
1164}
1165
1166
1167namespace Gecode {
1168
1173
1175
1178 min(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1183 min(Home home, const FloatVarArgs& x, FloatVar y);
1187 max(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1192 max(Home home, const FloatVarArgs& x, FloatVar y);
1193
1197 abs(Home home, FloatVar x0, FloatVar x1);
1198
1203
1207 sqr(Home home, FloatVar x0, FloatVar x1);
1208
1213
1217 pow(Home home, FloatVar x0, int n, FloatVar x1);
1218
1222 nroot(Home home, FloatVar x0, int n, FloatVar x1);
1223
1227 div(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
1228#ifdef GECODE_HAS_MPFR
1232 exp(Home home, FloatVar x0, FloatVar x1);
1236 log(Home home, FloatVar x0, FloatVar x1);
1240 pow(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1244 log(Home home, FloatNum base, FloatVar x0, FloatVar x1);
1252 sin(Home home, FloatVar x0, FloatVar x1);
1260 cos(Home home, FloatVar x0, FloatVar x1);
1268 tan(Home home, FloatVar x0, FloatVar x1);
1270#endif
1271
1287 linear(Home home, const FloatVarArgs& x,
1288 FloatRelType frt, FloatVal c);
1300 linear(Home home, const FloatVarArgs& x,
1301 FloatRelType frt, FloatVar y);
1313 linear(Home home, const FloatVarArgs& x,
1314 FloatRelType frt, FloatVal c, Reify r);
1326 linear(Home home, const FloatVarArgs& x,
1327 FloatRelType frt, FloatVar y, Reify r);
1341 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1342 FloatRelType frt, FloatVal c);
1357 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1358 FloatRelType frt, FloatVar y);
1373 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1374 FloatRelType frt, FloatVal c, Reify r);
1389 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
1390 FloatRelType frt, FloatVar y, Reify r);
1391
1392
1398
1402 void
1403 channel(Home home, IntVar x0, FloatVar x1);
1408 void
1409 channel(Home home, BoolVar x0, FloatVar x1);
1411
1412}
1413
1414#include <gecode/float/channel.hpp>
1415
1416namespace Gecode {
1417
1426
1428 wait(Home home, FloatVar x, std::function<void(Space& home)> c);
1431 wait(Home home, const FloatVarArgs& x, std::function<void(Space& home)> c);
1433
1434}
1435
1436namespace Gecode {
1437
1442
1451 typedef std::function<bool(const Space& home, FloatVar x, int i)>
1453
1464 typedef std::function<double(const Space& home, FloatVar x, int i)>
1466
1473 public:
1477 bool l;
1478 };
1479
1490 typedef std::function<FloatNumBranch(const Space& home, FloatVar x, int i)>
1492
1504 typedef std::function<void(Space& home, unsigned int a,
1505 FloatVar x, int i, FloatNumBranch nl)>
1507
1508}
1509
1511
1512namespace Gecode {
1513
1519 class FloatAFC : public AFC {
1520 public:
1528 FloatAFC(void);
1530 FloatAFC(const FloatAFC& a);
1532 FloatAFC& operator =(const FloatAFC& a);
1540 FloatAFC(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1551 void init(Home home, const FloatVarArgs& x, double d=1.0, bool share=true);
1552 };
1553
1554}
1555
1557
1558namespace Gecode {
1559
1565 class FloatAction : public Action {
1566 public:
1574 FloatAction(void);
1576 FloatAction(const FloatAction& a);
1590 FloatAction(Home home, const FloatVarArgs& x, double d=1.0,
1591 bool p=true, bool f=true,
1592 FloatBranchMerit bm=nullptr);
1607 init(Home home, const FloatVarArgs& x, double d=1.0,
1608 bool p=true, bool f=true,
1609 FloatBranchMerit bm=nullptr);
1610 };
1611
1612}
1613
1615
1616namespace Gecode {
1617
1623 class FloatCHB : public CHB {
1624 public:
1632 FloatCHB(void);
1634 FloatCHB(const FloatCHB& chb);
1636 FloatCHB& operator =(const FloatCHB& chb);
1646 FloatCHB(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1659 init(Home home, const FloatVarArgs& x, FloatBranchMerit bm=nullptr);
1660 };
1661
1662}
1663
1665
1666namespace Gecode {
1667
1669 typedef std::function<void(const Space &home, const Brancher& b,
1670 unsigned int a,
1671 FloatVar x, int i, const FloatNumBranch& n,
1672 std::ostream& o)>
1674
1675}
1676
1677namespace Gecode {
1678
1740
1741
1747
1760 FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
1764 FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
1768 FloatVarBranch FLOAT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
1772 FloatVarBranch FLOAT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
1800 FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1804 FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1808 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
1812 FloatVarBranch FLOAT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
1824
1825}
1826
1828
1829namespace Gecode {
1830
1836 class FloatValBranch : public ValBranch<FloatVar> {
1837 public:
1845 protected:
1848 public:
1856 Select select(void) const;
1857 };
1858
1864
1878
1879}
1880
1882
1883namespace Gecode {
1884
1890 class FloatAssign : public ValBranch<FloatVar> {
1891 public:
1899 protected:
1902 public:
1906 FloatAssign(Rnd r);
1910 Select select(void) const;
1911 };
1912
1918
1931
1932}
1933
1935
1936namespace Gecode {
1937
1944 branch(Home home, const FloatVarArgs& x,
1945 FloatVarBranch vars, FloatValBranch vals,
1946 FloatBranchFilter bf=nullptr,
1947 FloatVarValPrint vvp=nullptr);
1954 branch(Home home, const FloatVarArgs& x,
1956 FloatBranchFilter bf=nullptr,
1957 FloatVarValPrint vvp=nullptr);
1965 FloatVarValPrint vvp=nullptr);
1966
1973 assign(Home home, const FloatVarArgs& x,
1974 FloatVarBranch vars, FloatAssign vals,
1975 FloatBranchFilter bf=nullptr,
1976 FloatVarValPrint vvp=nullptr);
1983 assign(Home home, const FloatVarArgs& x,
1985 FloatBranchFilter bf=nullptr,
1986 FloatVarValPrint vvp=nullptr);
1994 FloatVarValPrint vvp=nullptr);
1995
1996}
1997
1998namespace Gecode {
1999
2005 void
2006 branch(Home home, const FloatVarArgs& x, FloatValBranch vals,
2007 FloatBranchFilter bf=nullptr,
2008 FloatVarValPrint vvp=nullptr);
2014 void
2015 assign(Home home, const FloatVarArgs& x, FloatAssign vals,
2016 FloatBranchFilter bf=nullptr,
2017 FloatVarValPrint vvp=nullptr);
2018
2019}
2020
2021#include <gecode/float/branch.hpp>
2022
2023namespace Gecode {
2024
2025 /*
2026 * \brief Relaxed assignment of variables in \a x from values in \a sx
2027 *
2028 * The variables in \a x are assigned values from the assigned variables
2029 * in the solution \a sx with a relaxation probability \a p. That is,
2030 * if \f$p=0.1\f$ approximately 10% of the variables in \a x will be
2031 * assigned a value from \a sx.
2032 *
2033 * The random numbers are generated from the generator \a r. At least
2034 * one variable will not be assigned: in case the relaxation attempt
2035 * would suggest that all variables should be assigned, a single
2036 * variable will be selected randomly to remain unassigned.
2037 *
2038 * Throws an exception of type Float::ArgumentSizeMismatch, if \a x and
2039 * \a sx are of different size.
2040 *
2041 * Throws an exception of type Float::OutOfLimits, if \a p is not between
2042 * \a 0.0 and \a 1.0.
2043 *
2044 * \ingroup TaskModeFloat
2045 */
2047 relax(Home home, const FloatVarArgs& x, const FloatVarArgs& sx,
2048 Rnd r, double p);
2049
2050}
2051
2053
2054namespace Gecode {
2055
2060
2066 protected:
2070 const Delta& d;
2071 public:
2073
2074
2076 const Delta& d);
2078
2080
2081 FloatNum min(void) const;
2083 FloatNum max(void) const;
2085 };
2086
2087}
2088
2090
2092
2093namespace Gecode {
2094
2105
2111 protected:
2113 std::ostream& os;
2114 public:
2116 StdFloatTracer(std::ostream& os0 = std::cerr);
2118 virtual void init(const Space& home, const FloatTraceRecorder& t);
2120 virtual void prune(const Space& home, const FloatTraceRecorder& t,
2121 const ViewTraceInfo& vti, int i, FloatTraceDelta& d);
2123 virtual void fix(const Space& home, const FloatTraceRecorder& t);
2125 virtual void fail(const Space& home, const FloatTraceRecorder& t);
2127 virtual void done(const Space& home, const FloatTraceRecorder& t);
2130 };
2131
2132
2138 trace(Home home, const FloatVarArgs& x,
2139 TraceFilter tf,
2140 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2146 void
2147 trace(Home home, const FloatVarArgs& x,
2148 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
2150
2151}
2152
2153#include <gecode/float/trace.hpp>
2154
2155#endif
2156
2157// IFDEF: GECODE_HAS_FLOAT_VARS
2158// 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:1519
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:1565
FloatAction & operator=(const FloatAction &a)
Assignment operator.
Definition action.hpp:44
void init(Home home, const FloatVarArgs &x, double d=1.0, bool p=true, bool f=true, FloatBranchMerit bm=nullptr)
Initialize for float variables x with decay factor d.
FloatAction(void)
Construct as not yet initialized.
Definition action.hpp:37
FloatAction(Home home, const FloatVarArgs &x, double d=1.0, bool p=true, bool f=true, FloatBranchMerit bm=nullptr)
Initialize for float variables x with decay factor d.
Which values to select for assignment.
Definition float.hh:1890
Select
Which value selection.
Definition float.hh:1893
@ SEL_MAX
Select median value of the upper part.
Definition float.hh:1895
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1897
@ SEL_RND
Select median value of a randomly chosen part.
Definition float.hh:1896
@ SEL_MIN
Select median value of the lower part.
Definition float.hh:1894
Select s
Which value to select.
Definition float.hh:1901
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:1623
FloatCHB & operator=(const FloatCHB &chb)
Assignment operator.
Definition chb.hpp:44
void init(Home home, const FloatVarArgs &x, FloatBranchMerit bm=nullptr)
Initialize for float variables x.
FloatCHB(Home home, const FloatVarArgs &x, FloatBranchMerit bm=nullptr)
Initialize for float variables x.
FloatCHB(void)
Construct as not yet initialized.
Definition chb.hpp:37
Value description class for branching.
Definition float.hh:1472
bool l
Whether to try the lower or upper half first.
Definition float.hh:1477
FloatNum n
The middle value for branching.
Definition float.hh:1475
Trace delta information for float variables.
Definition float.hh:2065
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:2070
FloatNum min(void) const
Return minimum.
Definition delta.hpp:44
Float::FloatView n
New view.
Definition float.hh:2068
FloatNum max(void) const
Return maximum.
Definition delta.hpp:49
Passing float arguments.
Definition float.hh:956
FloatValArgs(std::initializer_list< FloatVal > x)
Allocate array and copy elements from x.
static FloatValArgs create(int n, FloatVal start, int inc=1)
Allocate array with n elements such that for all .
FloatValArgs(void)
Allocate empty array.
Definition array.hpp:44
Which values to select for branching first.
Definition float.hh:1836
Select select(void) const
Return selection strategy.
Definition val.hpp:49
Select
Which value selection.
Definition float.hh:1839
@ SEL_SPLIT_RND
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition float.hh:1842
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition float.hh:1840
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition float.hh:1843
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition float.hh:1841
Select s
Which value to select.
Definition float.hh:1847
FloatValBranch(Select s=SEL_SPLIT_MIN)
Initialize with selection strategy s.
Definition val.hpp:37
Float value type.
Definition float.hh:337
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
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
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:428
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
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
gecode_boost::numeric::interval_lib::checking_strict< FloatNum > P
Used checking policy.
Definition float.hh:421
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
friend FloatVal max(const FloatVal &x, const FloatVal &y)
Definition val.hpp:387
friend FloatVal min(const FloatVal &x, const FloatVal &y)
Definition val.hpp:399
Float::Rounding R
Used rounding policies.
Definition float.hh:419
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
gecode_boost::numeric::interval< FloatNum, gecode_boost::numeric::interval_lib::policies< R, P > > FloatValImpType
Implementation type for float value.
Definition float.hh:426
FloatVal(void)
Default constructor.
Definition val.hpp:45
Passing float variables.
Definition float.hh:985
FloatVarArgs(Space &home, int n, FloatNum min, FloatNum max)
Initialize array with n new variables.
FloatVarArgs(void)
Allocate empty array.
Definition array.hpp:73
FloatVarArgs & operator=(const FloatVarArgs &)=default
Assignment operator.
FloatVarArray & operator=(const FloatVarArray &)=default
Assignment operator.
FloatVarArray(Space &home, int n, FloatNum min, FloatNum max)
Initialize array with n new variables.
FloatVarArray(void)
Default constructor (array of size 0).
Definition array.hpp:102
Which variable to select for branching.
Definition float.hh:1684
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:1687
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition float.hh:1710
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition float.hh:1711
@ SEL_MIN_MIN
With smallest min.
Definition float.hh:1700
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition float.hh:1708
@ SEL_MAX_MAX
With largest max.
Definition float.hh:1703
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition float.hh:1709
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition float.hh:1699
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition float.hh:1706
@ SEL_MIN_MAX
With largest min.
Definition float.hh:1701
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition float.hh:1712
@ SEL_NONE
First unassigned.
Definition float.hh:1688
@ SEL_MERIT_MIN
With least merit.
Definition float.hh:1690
@ SEL_ACTION_MAX
With highest action.
Definition float.hh:1697
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition float.hh:1698
@ SEL_DEGREE_MAX
With largest degree.
Definition float.hh:1693
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition float.hh:1707
@ SEL_DEGREE_MIN
With smallest degree.
Definition float.hh:1692
@ SEL_MERIT_MAX
With highest merit.
Definition float.hh:1691
@ SEL_MAX_MIN
With smallest max.
Definition float.hh:1702
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition float.hh:1713
@ SEL_RND
Random (uniform, for tie breaking).
Definition float.hh:1689
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition float.hh:1695
@ SEL_SIZE_MAX
With largest domain size.
Definition float.hh:1705
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition float.hh:1694
@ SEL_ACTION_MIN
With lowest action.
Definition float.hh:1696
@ SEL_SIZE_MIN
With smallest domain size.
Definition float.hh:1704
Select s
Which variable to select.
Definition float.hh:1717
Float variables.
Definition float.hh:873
friend class FloatVarArgs
Definition float.hh:875
bool in(const FloatVal &n) const
Test whether n is contained in domain.
Definition float.hpp:82
FloatVal domain(void) const
Return domain.
Definition float.hpp:72
FloatNum med(void) const
Return median of domain.
Definition float.hpp:63
FloatVar & operator=(const FloatVar &)=default
Assignment operator.
FloatNum size(void) const
Return size of domain (distance between maximum and minimum).
Definition float.hpp:77
FloatNum min(void) const
Return minimum of domain.
Definition float.hpp:59
FloatVar(void)
Default constructor.
Definition float.hpp:44
FloatVar(Space &home, FloatNum min, FloatNum max)
Initialize variable with range domain.
FloatVal val(void) const
Return assigned value.
Definition float.hpp:53
FloatNum max(void) const
Return maximum of domain.
Definition float.hpp:67
friend class FloatVarArray
Definition float.hh:874
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:154
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:277
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:1782
virtual void done(const Space &home, const FloatTraceRecorder &t)
Print that trace recorder is done.
virtual void prune(const Space &home, const FloatTraceRecorder &t, const ViewTraceInfo &vti, int i, FloatTraceDelta &d)
Print prune information.
static StdFloatTracer def
Default tracer (printing to std::cerr).
Definition float.hh:2129
virtual void fail(const Space &home, const FloatTraceRecorder &t)
Print failure information.
StdFloatTracer(std::ostream &os0=std::cerr)
Initialize with output stream os0.
std::ostream & os
Output stream to use.
Definition float.hh:2113
virtual void fix(const Space &home, const FloatTraceRecorder &t)
Print fixpoint information.
virtual void init(const Space &home, const FloatTraceRecorder &t)
Print init information.
Combine variable selection criteria for tie-breaking.
Definition tiebreak.hpp:38
Trace filters.
Definition filter.hpp:133
Variable arrays
Definition array.hpp:112
View trace information.
Definition core.hpp:917
Propagator for recording view trace information.
Definition recorder.hpp:60
Tracer that process view trace information.
Definition tracer.hpp:51
#define GECODE_FLOAT_EXPORT
Definition float.hh:68
ViewTracer< Float::FloatView > FloatTracer
Tracer for float variables.
Definition float.hh:2099
ViewTraceRecorder< Float::FloatView > FloatTraceRecorder
Trace recorder for float variables.
Definition float.hh:2104
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te=(TE_INIT|TE_PRUNE|TE_FIX|TE_FAIL|TE_DONE), FloatTracer &t=StdFloatTracer::def)
Create a tracer for float variables.
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition var.hpp:48
std::function< FloatNumBranch(const Space &home, FloatVar x, int i)> FloatBranchVal
Branch value function type for float variables.
Definition float.hh:1491
std::function< double(const Space &home, FloatVar x, int i)> FloatBranchMerit
Branch merit function type for float variables.
Definition float.hh:1465
std::function< bool(const Space &home, FloatVar x, int i)> FloatBranchFilter
Branch filter function type for float variables.
Definition float.hh:1452
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Assign all x with variable selection vars and value selection vals.
std::function< void(Space &home, unsigned int a, FloatVar x, int i, FloatNumBranch nl)> FloatBranchCommit
Branch commit function type for float variables.
Definition float.hh:1506
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
double FloatNum
Floating point number base type.
Definition float.hh:106
FloatRelType
Relation types for floats.
Definition float.hh:1078
@ FRT_EQ
Equality ( ).
Definition float.hh:1079
@ FRT_GR
Greater ( ).
Definition float.hh:1084
@ FRT_NQ
Disequality ( ).
Definition float.hh:1080
@ FRT_LE
Less ( ).
Definition float.hh:1082
@ FRT_LQ
Less or equal ( ).
Definition float.hh:1081
@ FRT_GQ
Greater or equal ( ).
Definition float.hh:1083
@ 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:845
const FloatNum max
Largest allowed float value.
Definition float.hh:847
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:849
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
gecode_boost::numeric::interval_lib::rounded_arith_opp< FloatNum > RoundingControl
Rounding operations that keep upward mode between calls.
Definition float.hh:145
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
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:1673
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 .
FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl=nullptr)
Select variable with largest max.
Definition var.hpp:202
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatValBranch FLOAT_VAL_SPLIT_RND(Rnd r)
Select values randomly which are not greater or not smaller than mean of largest and smallest value.
Definition val.hpp:65
FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smalllest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:227
FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest CHB Q-score divided by domain size.
Definition var.hpp:277
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition val-sel.hpp:39
FloatNum pi_twice_lower(void)
Return lower bound of .
Definition num.hpp:53
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatNum pi_half_upper(void)
Return upper bound of .
Definition num.hpp:41
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
bool operator<(const FloatVal &x, const FloatVal &y)
Definition val.hpp: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)
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVarBranch FLOAT_VAR_NONE(void)
Select first unassigned variable.
Definition var.hpp:97
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree.
Definition var.hpp:122
FloatVal fmod(const FloatVal &x, const FloatVal &y)
Definition val.hpp: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