Generated on for Gecode by doxygen 1.17.0
minimodel.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 * Matthias Balzer <matthias.balzer@itwm.fraunhofer.de>
7 * Mikael Zayenz Lagerkvist <lagerkvist@gecode.dev>
8 * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
9 *
10 * Contributing authors:
11 * Alexander Shepil <alexander.shepil@sap.com>
12 *
13 * Copyright:
14 * Christian Schulte, 2004
15 * Fraunhofer ITWM, 2017
16 * Guido Tack, 2004
17 * Mikael Zayenz Lagerkvist, 2005, 2026
18 * Alexander Shepil, 2024
19 * Vincent Barichard, 2012
20 *
21 * This file is part of Gecode, the generic constraint
22 * development environment:
23 * http://www.gecode.dev
24 *
25 * Permission is hereby granted, free of charge, to any person obtaining
26 * a copy of this software and associated documentation files (the
27 * "Software"), to deal in the Software without restriction, including
28 * without limitation the rights to use, copy, modify, merge, publish,
29 * distribute, sublicense, and/or sell copies of the Software, and to
30 * permit persons to whom the Software is furnished to do so, subject to
31 * the following conditions:
32 *
33 * The above copyright notice and this permission notice shall be
34 * included in all copies or substantial portions of the Software.
35 *
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
40 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
41 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
42 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 *
44 */
45
46#ifndef GECODE_MINIMODEL_HH
47#define GECODE_MINIMODEL_HH
48
49#include <gecode/kernel.hh>
50#include <gecode/int.hh>
51#ifdef GECODE_HAS_SET_VARS
52#include <gecode/set.hh>
53#endif
54#ifdef GECODE_HAS_FLOAT_VARS
55#include <gecode/float.hh>
56#endif
57
58#ifdef GECODE_HAS_FAULT_INJECTION
59#include <atomic>
60#endif
61
62#include <iostream>
63#include <type_traits>
64
65/*
66 * Support for DLLs under Windows
67 *
68 */
69
70#if !defined(GECODE_STATIC_LIBS) && \
71 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
72
73#ifdef GECODE_BUILD_MINIMODEL
74#define GECODE_MINIMODEL_EXPORT __declspec( dllexport )
75#else
76#define GECODE_MINIMODEL_EXPORT __declspec( dllimport )
77#endif
78
79#else
80
81#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
82
83#define GECODE_MINIMODEL_EXPORT __attribute__ ((visibility("default")))
84
85#else
86
87#define GECODE_MINIMODEL_EXPORT
88
89#endif
90#endif
91
92// Configure auto-linking
93#ifndef GECODE_BUILD_MINIMODEL
94#define GECODE_LIBRARY_NAME "MiniModel"
96#endif
97
98namespace Gecode {
99
101 namespace MiniModel {}
102
103}
104
106
107namespace Gecode {
108
111 protected:
128 public:
131
133 IntPropLevel linear2(void) const;
137 IntPropLevel linear(void) const;
140
142 IntPropLevel abs(void) const;
145
147 IntPropLevel max2(void) const;
151 IntPropLevel max(void) const;
155 IntPropLevel min2(void) const;
159 IntPropLevel min(void) const;
162
164 IntPropLevel mult(void) const;
168 IntPropLevel div(void) const;
172 IntPropLevel mod(void) const;
175
177 IntPropLevel sqr(void) const;
181 IntPropLevel sqrt(void) const;
184
186 IntPropLevel pow(void) const;
190 IntPropLevel nroot(void) const;
193
195 IntPropLevel element(void) const;
198
200 IntPropLevel ite(void) const;
203
206 static const IntPropLevels def;
207 };
208
209}
210
212
213namespace Gecode {
214
215 class LinIntRel;
216#ifdef GECODE_HAS_SET_VARS
217 class SetExpr;
218#endif
219#ifdef GECODE_HAS_FLOAT_VARS
220 class LinFloatExpr;
221#endif
222
225 public:
227 virtual IntVar post(Home home, IntVar* ret,
228 const IntPropLevels& ipls) const = 0;
230 virtual void post(Home home, IntRelType irt, int c,
231 const IntPropLevels& ipls) const = 0;
233 virtual void post(Home home, IntRelType irt, int c,
234 BoolVar b, const IntPropLevels& ipls) const = 0;
236 virtual ~NonLinIntExpr(void);
238 static IntVar result(Home home, IntVar* x);
240 static IntVar result(Home home, IntVar* x, IntVar y);
242 void* operator new(size_t s);
244 void operator delete(void* p, size_t s);
245 };
246
247}
248
250
251namespace Gecode {
252
253 namespace MiniModel {
254 class ArithNonLinIntExpr;
255 }
256
258 class LinIntExpr {
259 friend class LinIntRel;
261#ifdef GECODE_HAS_SET_VARS
262 friend class SetExpr;
263#endif
264#ifdef GECODE_HAS_FLOAT_VARS
265 friend class LinFloatExpr;
266#endif
267 public:
280 private:
282 struct NoNode {};
284 class Node;
286 Node* n;
288 LinIntExpr(NoNode);
289 public:
292 LinIntExpr(void);
293#ifdef GECODE_HAS_FAULT_INJECTION
295 GECODE_MINIMODEL_EXPORT static void fault_reset_allocations(void);
297 GECODE_MINIMODEL_EXPORT static int fault_live_allocations(void);
298#endif
301 LinIntExpr(int c);
304 LinIntExpr(const IntVar& x, int a=1);
307 LinIntExpr(const BoolVar& x, int a=1);
310 explicit LinIntExpr(const IntVarArgs& x);
313 LinIntExpr(const IntArgs& a, const IntVarArgs& x);
316 explicit LinIntExpr(const BoolVarArgs& x);
319 LinIntExpr(const IntArgs& a, const BoolVarArgs& x);
322 LinIntExpr(const LinIntExpr& e);
325 LinIntExpr(const LinIntExpr& e0, NodeType t, const LinIntExpr& e1);
328 LinIntExpr(const LinIntExpr& e0, NodeType t, int c);
331 LinIntExpr(int a, const LinIntExpr& e);
334 explicit LinIntExpr(NonLinIntExpr* e);
337 const LinIntExpr& operator =(const LinIntExpr& e);
340 void post(Home home, IntRelType irt, const IntPropLevels& ipls) const;
343 void post(Home home, IntRelType irt, const BoolVar& b,
344 const IntPropLevels& ipls) const;
347 IntVar post(Home home, const IntPropLevels& ipls) const;
350 NonLinIntExpr* nle(void) const;
353 ~LinIntExpr(void);
354 };
355
356 class BoolExpr;
357
359 class LinIntRel {
360 friend class BoolExpr;
361 private:
363 LinIntExpr e;
365 IntRelType irt;
367 static IntRelType neg(IntRelType irt);
369 LinIntRel(void);
370 public:
372 LinIntRel(const LinIntExpr& l, IntRelType irt, const LinIntExpr& r);
374 LinIntRel(const LinIntExpr& l, IntRelType irt, int r);
376 LinIntRel(int l, IntRelType irt, const LinIntExpr& r);
378 void post(Home home, bool t, const IntPropLevels& ipls) const;
380 void post(Home home, const BoolVar& b, bool t, const IntPropLevels& ipls) const;
381 };
382
399
401
403 operator +(int, const IntVar&);
406 operator +(int, const BoolVar&);
409 operator +(int, const LinIntExpr&);
412 operator +(const IntVar&, int);
415 operator +(const BoolVar&, int);
418 operator +(const LinIntExpr&, int);
421 operator +(const IntVar&, const IntVar&);
424 operator +(const IntVar&, const BoolVar&);
427 operator +(const BoolVar&, const IntVar&);
430 operator +(const BoolVar&, const BoolVar&);
433 operator +(const IntVar&, const LinIntExpr&);
436 operator +(const BoolVar&, const LinIntExpr&);
439 operator +(const LinIntExpr&, const IntVar&);
442 operator +(const LinIntExpr&, const BoolVar&);
445 operator +(const LinIntExpr&, const LinIntExpr&);
446
449 operator -(int, const IntVar&);
452 operator -(int, const BoolVar&);
455 operator -(int, const LinIntExpr&);
458 operator -(const IntVar&, int);
461 operator -(const BoolVar&, int);
464 operator -(const LinIntExpr&, int);
467 operator -(const IntVar&, const IntVar&);
470 operator -(const IntVar&, const BoolVar&);
473 operator -(const BoolVar&, const IntVar&);
476 operator -(const BoolVar&, const BoolVar&);
479 operator -(const IntVar&, const LinIntExpr&);
482 operator -(const BoolVar&, const LinIntExpr&);
485 operator -(const LinIntExpr&, const IntVar&);
488 operator -(const LinIntExpr&, const BoolVar&);
491 operator -(const LinIntExpr&, const LinIntExpr&);
492
495 operator -(const IntVar&);
498 operator -(const BoolVar&);
501 operator -(const LinIntExpr&);
502
505 operator *(int, const IntVar&);
508 operator *(int, const BoolVar&);
511 operator *(const IntVar&, int);
514 operator *(const BoolVar&, int);
517 operator *(const LinIntExpr&, int);
520 operator *(int, const LinIntExpr&);
521
524 sum(const IntVarArgs& x);
527 sum(const IntArgs& a, const IntVarArgs& x);
530 sum(const BoolVarArgs& x);
533 sum(const IntArgs& a, const BoolVarArgs& x);
536 sum(const IntArgs& args);
537
540 operator ==(int l, const IntVar& r);
543 operator ==(int l, const BoolVar& r);
546 operator ==(int l, const LinIntExpr& r);
549 operator ==(const IntVar& l, int r);
552 operator ==(const BoolVar& l, int r);
555 operator ==(const LinIntExpr& l, int r);
558 operator ==(const IntVar& l, const IntVar& r);
561 operator ==(const IntVar& l, const BoolVar& r);
564 operator ==(const BoolVar& l, const IntVar& r);
567 operator ==(const BoolVar& l, const BoolVar& r);
570 operator ==(const IntVar& l, const LinIntExpr& r);
573 operator ==(const BoolVar& l, const LinIntExpr& r);
576 operator ==(const LinIntExpr& l, const IntVar& r);
579 operator ==(const LinIntExpr& l, const BoolVar& r);
582 operator ==(const LinIntExpr& l, const LinIntExpr& r);
583
586 operator !=(int l, const IntVar& r);
589 operator !=(int l, const BoolVar& r);
592 operator !=(int l, const LinIntExpr& r);
595 operator !=(const IntVar& l, int r);
598 operator !=(const BoolVar& l, int r);
601 operator !=(const LinIntExpr& l, int r);
604 operator !=(const IntVar& l, const IntVar& r);
607 operator !=(const IntVar& l, const BoolVar& r);
610 operator !=(const BoolVar& l, const IntVar& r);
613 operator !=(const BoolVar& l, const BoolVar& r);
616 operator !=(const IntVar& l, const LinIntExpr& r);
619 operator !=(const BoolVar& l, const LinIntExpr& r);
622 operator !=(const LinIntExpr& l, const IntVar& r);
625 operator !=(const LinIntExpr& l, const BoolVar& r);
628 operator !=(const LinIntExpr& l, const LinIntExpr& r);
629
632 operator <(int l, const IntVar& r);
635 operator <(int l, const BoolVar& r);
638 operator <(int l, const LinIntExpr& r);
641 operator <(const IntVar& l, int r);
644 operator <(const BoolVar& l, int r);
647 operator <(const LinIntExpr& l, int r);
650 operator <(const IntVar& l, const IntVar& r);
653 operator <(const IntVar& l, const BoolVar& r);
656 operator <(const BoolVar& l, const IntVar& r);
659 operator <(const BoolVar& l, const BoolVar& r);
662 operator <(const IntVar& l, const LinIntExpr& r);
665 operator <(const BoolVar& l, const LinIntExpr& r);
668 operator <(const LinIntExpr& l, const IntVar& r);
671 operator <(const LinIntExpr& l, const BoolVar& r);
674 operator <(const LinIntExpr& l, const LinIntExpr& r);
675
678 operator <=(int l, const IntVar& r);
681 operator <=(int l, const BoolVar& r);
684 operator <=(int l, const LinIntExpr& r);
687 operator <=(const IntVar& l, int r);
690 operator <=(const BoolVar& l, int r);
693 operator <=(const LinIntExpr& l, int r);
696 operator <=(const IntVar& l, const IntVar& r);
699 operator <=(const IntVar& l, const BoolVar& r);
702 operator <=(const BoolVar& l, const IntVar& r);
705 operator <=(const BoolVar& l, const BoolVar& r);
708 operator <=(const IntVar& l, const LinIntExpr& r);
711 operator <=(const BoolVar& l, const LinIntExpr& r);
714 operator <=(const LinIntExpr& l, const IntVar& r);
717 operator <=(const LinIntExpr& l, const BoolVar& r);
720 operator <=(const LinIntExpr& l, const LinIntExpr& r);
721
724 operator >(int l, const IntVar& r);
727 operator >(int l, const BoolVar& r);
730 operator >(int l, const LinIntExpr& r);
733 operator >(const IntVar& l, int r);
736 operator >(const BoolVar& l, int r);
739 operator >(const LinIntExpr& l, int r);
742 operator >(const IntVar& l, const IntVar& r);
745 operator >(const IntVar& l, const BoolVar& r);
748 operator >(const BoolVar& l, const IntVar& r);
751 operator >(const BoolVar& l, const BoolVar& r);
754 operator >(const IntVar& l, const LinIntExpr& r);
757 operator >(const BoolVar& l, const LinIntExpr& r);
760 operator >(const LinIntExpr& l, const IntVar& r);
763 operator >(const LinIntExpr& l, const BoolVar& r);
766 operator >(const LinIntExpr& l, const LinIntExpr& r);
767
770 operator >=(int l, const IntVar& r);
773 operator >=(int l, const BoolVar& r);
776 operator >=(int l, const LinIntExpr& r);
779 operator >=(const IntVar& l, int r);
782 operator >=(const BoolVar& l, int r);
785 operator >=(const LinIntExpr& l, int r);
788 operator >=(const IntVar& l, const IntVar& r);
791 operator >=(const IntVar& l, const BoolVar& r);
794 operator >=(const BoolVar& l, const IntVar& r);
797 operator >=(const BoolVar& l, const BoolVar& r);
800 operator >=(const IntVar& l, const LinIntExpr& r);
803 operator >=(const BoolVar& l, const LinIntExpr& r);
806 operator >=(const LinIntExpr& l, const IntVar& r);
809 operator >=(const LinIntExpr& l, const BoolVar& r);
812 operator >=(const LinIntExpr& l, const LinIntExpr& r);
814
815#ifdef GECODE_HAS_FLOAT_VARS
816
819 public:
821 virtual FloatVar post(Home home, FloatVar* ret) const = 0;
823 virtual void post(Home home, FloatRelType frt, FloatVal c) const = 0;
825 virtual void post(Home home, FloatRelType frt, FloatVal c,
826 BoolVar b) const = 0;
828 virtual ~NonLinFloatExpr(void);
830 static FloatVar result(Home home, FloatVar* x);
832 static FloatVar result(Home home, FloatVar* x, FloatVar y);
834 void* operator new(size_t s);
836 void operator delete(void* p, size_t s);
837 };
838
839}
840
842
843namespace Gecode {
844
847 friend class LinFloatRel;
848 public:
859 private:
861 class Node;
862 Node* n;
863 public:
866 LinFloatExpr(void);
869 LinFloatExpr(const FloatVal& c);
872 LinFloatExpr(const FloatVar& x);
875 LinFloatExpr(const FloatVar& x, FloatVal a);
878 explicit LinFloatExpr(const FloatVarArgs& x);
881 LinFloatExpr(const FloatValArgs& a, const FloatVarArgs& x);
884 LinFloatExpr(const LinFloatExpr& e);
887 LinFloatExpr(const LinFloatExpr& e0, NodeType t, const LinFloatExpr& e1);
890 LinFloatExpr(const LinFloatExpr& e0, NodeType t, const FloatVal& c);
896 explicit LinFloatExpr(NonLinFloatExpr* e);
899 const LinFloatExpr& operator =(const LinFloatExpr& e);
902 void post(Home home, FloatRelType frt) const;
905 void post(Home home, FloatRelType frt, const BoolVar& b) const;
908 FloatVar post(Home home) const;
911 NonLinFloatExpr* nlfe(void) const;
914 ~LinFloatExpr(void);
915 };
916
917 class BoolExpr;
918
920 class LinFloatRel {
921 friend class BoolExpr;
922 private:
924 LinFloatExpr e;
926 FloatRelType frt;
928 static FloatRelType neg(FloatRelType frt);
930 LinFloatRel(void);
931 public:
933 LinFloatRel(const LinFloatExpr& l, FloatRelType frt, const LinFloatExpr& r);
935 LinFloatRel(const LinFloatExpr& l, FloatRelType frt, FloatVal r);
937 LinFloatRel(FloatVal l, FloatRelType frt, const LinFloatExpr& r);
939 void post(Home home, bool t) const;
941 void post(Home home, const BoolVar& b, bool t) const;
942 };
943
957
959 operator +(const FloatVal&, const FloatVar&);
962 operator +(const FloatVal&, const LinFloatExpr&);
965 operator +(const FloatVar&, const FloatVal&);
968 operator +(const LinFloatExpr&, const FloatVal&);
971 operator +(const FloatVar&, const FloatVar&);
974 operator +(const FloatVar&, const LinFloatExpr&);
977 operator +(const LinFloatExpr&, const FloatVar&);
980 operator +(const LinFloatExpr&, const LinFloatExpr&);
981
984 operator -(const FloatVal&, const FloatVar&);
987 operator -(const FloatVal&, const LinFloatExpr&);
990 operator -(const FloatVar&, const FloatVal&);
993 operator -(const LinFloatExpr&, const FloatVal&);
996 operator -(const FloatVar&, const FloatVar&);
999 operator -(const FloatVar&, const LinFloatExpr&);
1002 operator -(const LinFloatExpr&, const FloatVar&);
1005 operator -(const LinFloatExpr&, const LinFloatExpr&);
1006
1009 operator -(const FloatVar&);
1012 operator -(const LinFloatExpr&);
1013
1016 operator *(const FloatVal&, const FloatVar&);
1019 operator *(const FloatVar&, const FloatVal&);
1022 operator *(const LinFloatExpr&, const FloatVal&);
1025 operator *(const FloatVal&, const LinFloatExpr&);
1026
1029 sum(const FloatVarArgs& x);
1032 sum(const FloatValArgs& a, const FloatVarArgs& x);
1033
1036 operator ==(const FloatVal& l, const FloatVar& r);
1039 operator ==(const FloatVal& l, const LinFloatExpr& r);
1042 operator ==(const FloatVar& l, const FloatVal& r);
1045 operator ==(const LinFloatExpr& l, const FloatVal& r);
1048 operator ==(const FloatVar& l, const FloatVar& r);
1051 operator ==(const FloatVar& l, const LinFloatExpr& r);
1054 operator ==(const LinFloatExpr& l, const FloatVar& r);
1057 operator ==(const LinFloatExpr& l, const LinFloatExpr& r);
1058
1061 operator !=(const FloatVal& l, const FloatVar& r);
1064 operator !=(const FloatVal& l, const LinFloatExpr& r);
1067 operator !=(const FloatVar& l, const FloatVal& r);
1070 operator !=(const LinFloatExpr& l, const FloatVal& r);
1073 operator !=(const FloatVar& l, const FloatVar& r);
1076 operator !=(const FloatVar& l, const LinFloatExpr& r);
1079 operator !=(const LinFloatExpr& l, const FloatVar& r);
1082 operator !=(const LinFloatExpr& l, const LinFloatExpr& r);
1083
1086 operator <(const FloatVal& l, const FloatVar& r);
1089 operator <(const FloatVal& l, const LinFloatExpr& r);
1092 operator <(const FloatVar& l, const FloatVal& r);
1095 operator <(const LinFloatExpr& l, const FloatVal& r);
1098 operator <(const FloatVar& l, const FloatVar& r);
1101 operator <(const FloatVar& l, const LinFloatExpr& r);
1104 operator <(const LinFloatExpr& l, const FloatVar& r);
1107 operator <(const LinFloatExpr& l, const LinFloatExpr& r);
1108
1111 operator <=(const FloatVal& l, const FloatVar& r);
1114 operator <=(const FloatVal& l, const LinFloatExpr& r);
1117 operator <=(const FloatVar& l, const FloatVal& r);
1120 operator <=(const LinFloatExpr& l, const FloatVal& r);
1123 operator <=(const FloatVar& l, const FloatVar& r);
1126 operator <=(const FloatVar& l, const LinFloatExpr& r);
1129 operator <=(const LinFloatExpr& l, const FloatVar& r);
1132 operator <=(const LinFloatExpr& l, const LinFloatExpr& r);
1133
1136 operator >(const FloatVal& l, const FloatVar& r);
1139 operator >(const FloatVal& l, const LinFloatExpr& r);
1142 operator >(const FloatVar& l, const FloatVal& r);
1145 operator >(const LinFloatExpr& l, const FloatVal& r);
1148 operator >(const FloatVar& l, const FloatVar& r);
1151 operator >(const FloatVar& l, const LinFloatExpr& r);
1154 operator >(const LinFloatExpr& l, const FloatVar& r);
1157 operator >(const LinFloatExpr& l, const LinFloatExpr& r);
1158
1161 operator >=(const FloatVal& l, const FloatVar& r);
1164 operator >=(const FloatVal& l, const LinFloatExpr& r);
1167 operator >=(const FloatVar& l, const FloatVal& r);
1170 operator >=(const LinFloatExpr& l, const FloatVal& r);
1173 operator >=(const FloatVar& l, const FloatVar& r);
1176 operator >=(const FloatVar& l, const LinFloatExpr& r);
1179 operator >=(const LinFloatExpr& l, const FloatVar& r);
1182 operator >=(const LinFloatExpr& l, const LinFloatExpr& r);
1184#endif
1185
1186#ifdef GECODE_HAS_SET_VARS
1188 class SetExpr {
1189 public:
1200
1201 class Node;
1202 private:
1204 Node* n;
1205 public:
1207 SetExpr(void);
1210 SetExpr(const SetExpr& e);
1213 SetExpr(const SetExpr& l, NodeType t, const SetExpr& r);
1216 SetExpr(const SetVar& x);
1219 explicit SetExpr(const LinIntExpr& x);
1222 SetExpr(const IntSet& s);
1225 SetExpr(const SetExpr& e, NodeType t);
1228 SetVar post(Home home) const;
1231 void post(Home home, SetRelType srt, const SetExpr& e) const;
1234 void post(Home home, BoolVar b, bool t,
1235 SetRelType srt, const SetExpr& e) const;
1238 const SetExpr& operator =(const SetExpr& e);
1241 ~SetExpr(void);
1242 };
1243
1246 public:
1254 SetCmpRel(const SetExpr& l, SetRelType srt, const SetExpr& r);
1255 };
1256
1258 class SetRel {
1259 private:
1261 SetExpr _e0;
1263 SetRelType _srt;
1265 SetExpr _e1;
1266 public:
1268 SetRel(void);
1270 SetRel(const SetExpr& e0, SetRelType srt, const SetExpr& e1);
1272 SetRel(const SetCmpRel& r);
1274 void post(Home home, bool t) const;
1276 void post(Home home, BoolVar b, bool t) const;
1277 };
1278
1287
1289
1291 singleton(const LinIntExpr&);
1294 operator -(const SetExpr&);
1297 operator &(const SetExpr&, const SetExpr&);
1300 operator |(const SetExpr&, const SetExpr&);
1303 operator +(const SetExpr&, const SetExpr&);
1306 operator -(const SetExpr&, const SetExpr&);
1307
1310 inter(const SetVarArgs&);
1313 setunion(const SetVarArgs&);
1316 setdunion(const SetVarArgs&);
1317
1320 cardinality(const SetExpr&);
1323 min(const SetExpr&);
1326 max(const SetExpr&);
1327
1330 operator ==(const SetExpr&, const SetExpr&);
1333 operator !=(const SetExpr&, const SetExpr&);
1336 operator <=(const SetExpr&, const SetExpr&);
1339 operator <=(const SetCmpRel&, const SetExpr&);
1342 operator >=(const SetExpr&, const SetExpr&);
1345 operator >=(const SetCmpRel&, const SetExpr&);
1348 operator ||(const SetExpr&, const SetExpr&);
1350#endif
1351
1353 class BoolExpr {
1354 public:
1368
1370 public:
1372 Misc(void);
1377 virtual void post(Home home, BoolVar b, bool neg,
1378 const IntPropLevels& ipls) = 0;
1380 virtual GECODE_MINIMODEL_EXPORT ~Misc(void);
1381 };
1382
1383 class Node;
1384 private:
1386 Node* n;
1389 static Node* constant(bool value);
1391 BoolExpr(const BoolExpr& l, NodeType t, const BoolExpr& r,
1392 bool accumulator);
1394 BoolExpr operator &&(const BoolExpr&, const BoolExpr&);
1396 BoolExpr operator ||(const BoolExpr&, const BoolExpr&);
1397 public:
1405 BoolExpr(void);
1408 BoolExpr(const BoolExpr& e);
1411 BoolExpr(const BoolExpr& l, NodeType t, const BoolExpr& r);
1417 template<class Bool,
1418 std::enable_if_t<std::is_same<Bool,bool>::value,int> = 0>
1419 BoolExpr(Bool value);
1422 BoolExpr(const BoolVar& x);
1425 BoolExpr(const BoolExpr& e, NodeType t);
1428 BoolExpr(const LinIntRel& rl);
1429#ifdef GECODE_HAS_FLOAT_VARS
1432 BoolExpr(const LinFloatRel& rfl);
1433#endif
1434#ifdef GECODE_HAS_SET_VARS
1437 BoolExpr(const SetRel& rs);
1440 BoolExpr(const SetCmpRel& rs);
1441#endif
1444 explicit BoolExpr(Misc* m);
1447 BoolVar expr(Home home, const IntPropLevels& ipls) const;
1450 void rel(Home home, const IntPropLevels& ipls) const;
1453 const BoolExpr& operator =(const BoolExpr& e);
1456 ~BoolExpr(void);
1457 };
1458
1467
1469
1471 operator !(const BoolExpr&);
1480 operator &&(const BoolExpr&, const BoolExpr&);
1489 operator ||(const BoolExpr&, const BoolExpr&);
1492 operator ^(const BoolExpr&, const BoolExpr&);
1493
1496 operator !=(const BoolExpr&, const BoolExpr&);
1499 operator ==(const BoolExpr&, const BoolExpr&);
1502 operator >>(const BoolExpr&, const BoolExpr&);
1505 operator <<(const BoolExpr&, const BoolExpr&);
1506
1508
1514
1516
1518 dom(const IntVar& x, int n);
1521 dom(const IntVar& x, int l, int m);
1524 dom(const IntVar& x, const IntSet& s);
1525
1526#ifdef GECODE_HAS_SET_VARS
1529 dom(const SetVar& x, SetRelType rt, int i);
1532 dom(const SetVar& x, SetRelType rt, int i, int j);
1535 dom(const SetVar& x, SetRelType rt, const IntSet& s);
1536#endif
1537
1538#ifdef GECODE_HAS_FLOAT_VARS
1541 dom(const FloatVar& x, const FloatVal& n);
1544 dom(const FloatVar& x, FloatNum l, FloatNum u);
1545#endif
1547
1553
1555#ifdef GECODE_HAS_SET_VARS
1558 operator ==(const SetExpr& s, const LinIntExpr& x);
1561 operator ==(const LinIntExpr& x, const SetExpr& s);
1563 BoolExpr
1564 operator ==(const LinIntExpr&, IntSet) = delete;
1566 BoolExpr
1567 operator ==(IntSet, const LinIntExpr&) = delete;
1568
1571 operator !=(const SetExpr& s, const LinIntExpr& x);
1574 operator !=(const LinIntExpr& x, const SetExpr& s);
1576 BoolExpr
1577 operator !=(const LinIntExpr&, IntSet) = delete;
1579 BoolExpr
1580 operator !=(IntSet, const LinIntExpr&) = delete;
1581
1584 operator <=(const SetExpr& s, const LinIntExpr& x);
1587 operator <=(const LinIntExpr& x, const SetExpr& s);
1590 operator <=(const LinIntExpr&, IntSet) = delete;
1593 operator <=(IntSet, const LinIntExpr&) = delete;
1594
1597 operator <(const SetExpr& s, const LinIntExpr& x);
1600 operator <(const LinIntExpr& x, const SetExpr& s);
1603 operator <(const LinIntExpr&, IntSet) = delete;
1606 operator <(IntSet, const LinIntExpr&) = delete;
1607
1610 operator >=(const SetExpr& s, const LinIntExpr& x);
1613 operator >=(const LinIntExpr& x, const SetExpr& s);
1615 BoolExpr
1616 operator >=(const LinIntExpr&, IntSet) = delete;
1618 BoolExpr
1619 operator >=(IntSet, const LinIntExpr&) = delete;
1620
1623 operator >(const SetExpr& s, const LinIntExpr& x);
1626 operator >(const LinIntExpr& x, const SetExpr& s);
1628 BoolExpr
1629 operator >(const LinIntExpr&, IntSet) = delete;
1631 BoolExpr
1632 operator >(IntSet, const LinIntExpr&) = delete;
1633#endif
1635
1642
1644 expr(Home home, const LinIntExpr& e,
1645 const IntPropLevels& ipls=IntPropLevels::def);
1646#ifdef GECODE_HAS_FLOAT_VARS
1649 expr(Home home, const LinFloatExpr& e);
1650#endif
1651#ifdef GECODE_HAS_SET_VARS
1654 expr(Home home, const SetExpr& e);
1655#endif
1658 expr(Home home, const BoolExpr& e,
1659 const IntPropLevels& ipls=IntPropLevels::def);
1661 template<class Bool,
1662 std::enable_if_t<std::is_same<Bool,bool>::value,int> = 0>
1663 IntVar expr(Home home, Bool value,
1664 const IntPropLevels& ipls=IntPropLevels::def);
1667 rel(Home home, const BoolExpr& e,
1668 const IntPropLevels& ipls=IntPropLevels::def);
1670
1671}
1672
1678
1679namespace Gecode {
1680
1681 namespace MiniModel {
1682 class ExpInfo;
1683 }
1684
1692 private:
1694 class Exp;
1696 Exp* e;
1698 REG(Exp* e);
1700 std::string toString(void) const;
1701 public:
1703 REG(void);
1705 REG(int s);
1712 REG(const IntArgs& x);
1713
1715 REG(const REG& r);
1717 const REG& operator =(const REG& r);
1718
1720 REG operator +(const REG& r);
1722 REG& operator +=(const REG& r);
1724 REG operator |(const REG& r);
1726 REG& operator |=(const REG& r);
1728 REG operator *(void);
1730 REG operator +(void);
1732 REG operator ()(unsigned int n, unsigned int m);
1734 REG operator ()(unsigned int n);
1736 template<class Char, class Traits>
1737 std::basic_ostream<Char,Traits>&
1738 print(std::basic_ostream<Char,Traits>& os) const;
1740 operator DFA(void);
1742 ~REG(void);
1743 };
1744
1748 template<class Char, class Traits>
1749 std::basic_ostream<Char,Traits>&
1750 operator <<(std::basic_ostream<Char,Traits>& os, const REG& r);
1751
1752}
1753
1754#include <gecode/minimodel/reg.hpp>
1755
1756namespace Gecode {
1757
1764
1765 GECODE_MINIMODEL_EXPORT LinIntExpr
1766 operator *(const LinIntExpr& x, const LinIntExpr& y);
1768 GECODE_MINIMODEL_EXPORT LinIntExpr
1769 operator /(const LinIntExpr& x, const LinIntExpr& y);
1771 GECODE_MINIMODEL_EXPORT LinIntExpr
1772 operator %(const LinIntExpr& x, const LinIntExpr& y);
1774 GECODE_MINIMODEL_EXPORT LinIntExpr
1775 abs(const LinIntExpr& e);
1777 GECODE_MINIMODEL_EXPORT LinIntExpr
1778 min(const LinIntExpr& x, const LinIntExpr& y);
1780 GECODE_MINIMODEL_EXPORT LinIntExpr
1781 min(const IntVarArgs& x);
1783 GECODE_MINIMODEL_EXPORT LinIntExpr
1784 max(const LinIntExpr& x, const LinIntExpr& y);
1786 GECODE_MINIMODEL_EXPORT LinIntExpr
1787 max(const IntVarArgs& x);
1789 GECODE_MINIMODEL_EXPORT LinIntExpr
1790 sqr(const LinIntExpr& x);
1792 GECODE_MINIMODEL_EXPORT LinIntExpr
1793 sqrt(const LinIntExpr& x);
1795 GECODE_MINIMODEL_EXPORT LinIntExpr
1796 pow(const LinIntExpr& x, int n);
1798 GECODE_MINIMODEL_EXPORT LinIntExpr
1799 nroot(const LinIntExpr& x, int n);
1801 GECODE_MINIMODEL_EXPORT LinIntExpr
1802 element(const IntVarArgs& x, const LinIntExpr& y);
1805 element(const BoolVarArgs& x, const LinIntExpr& y);
1807 GECODE_MINIMODEL_EXPORT LinIntExpr
1808 element(const IntArgs& x, const LinIntExpr& y);
1810 GECODE_MINIMODEL_EXPORT LinIntExpr
1811 ite(const BoolExpr& b, const LinIntExpr& x, const LinIntExpr& y);
1813
1814#ifdef GECODE_HAS_FLOAT_VARS
1816 GECODE_MINIMODEL_EXPORT LinFloatExpr
1817 operator *(const FloatVar&, const FloatVar&);
1819 GECODE_MINIMODEL_EXPORT LinFloatExpr
1820 operator *(const FloatVar&, const LinFloatExpr&);
1822 GECODE_MINIMODEL_EXPORT LinFloatExpr
1823 operator *(const LinFloatExpr&, const FloatVar&);
1825 GECODE_MINIMODEL_EXPORT LinFloatExpr
1826 abs(const LinFloatExpr& e);
1828 GECODE_MINIMODEL_EXPORT LinFloatExpr
1829 min(const LinFloatExpr& x, const LinFloatExpr& y);
1831 GECODE_MINIMODEL_EXPORT LinFloatExpr
1832 min(const FloatVarArgs& x);
1834 GECODE_MINIMODEL_EXPORT LinFloatExpr
1835 max(const LinFloatExpr& x, const LinFloatExpr& y);
1837 GECODE_MINIMODEL_EXPORT LinFloatExpr
1838 max(const FloatVarArgs& x);
1840 GECODE_MINIMODEL_EXPORT LinFloatExpr
1841 operator *(const LinFloatExpr& x, const LinFloatExpr& y);
1843 GECODE_MINIMODEL_EXPORT LinFloatExpr
1844 operator /(const LinFloatExpr& x, const LinFloatExpr& y);
1846 GECODE_MINIMODEL_EXPORT LinFloatExpr
1847 sqr(const LinFloatExpr& x);
1849 GECODE_MINIMODEL_EXPORT LinFloatExpr
1850 sqrt(const LinFloatExpr& x);
1852 GECODE_MINIMODEL_EXPORT LinFloatExpr
1853 pow(const LinFloatExpr& x, int n);
1855 GECODE_MINIMODEL_EXPORT LinFloatExpr
1856 nroot(const LinFloatExpr& x, int n);
1858
1859#ifdef GECODE_HAS_MPFR
1866
1867 GECODE_MINIMODEL_EXPORT LinFloatExpr
1868 exp(const LinFloatExpr& x);
1870 GECODE_MINIMODEL_EXPORT LinFloatExpr
1871 log(const LinFloatExpr& x);
1873
1880
1881 GECODE_MINIMODEL_EXPORT LinFloatExpr
1882 asin(const LinFloatExpr& x);
1884 GECODE_MINIMODEL_EXPORT LinFloatExpr
1885 sin(const LinFloatExpr& x);
1887 GECODE_MINIMODEL_EXPORT LinFloatExpr
1888 acos(const LinFloatExpr& x);
1890 GECODE_MINIMODEL_EXPORT LinFloatExpr
1891 cos(const LinFloatExpr& x);
1893 GECODE_MINIMODEL_EXPORT LinFloatExpr
1894 atan(const LinFloatExpr& x);
1896 GECODE_MINIMODEL_EXPORT LinFloatExpr
1897 tan(const LinFloatExpr& x);
1899#endif
1900#endif
1901
1902}
1903
1904namespace Gecode {
1905
1912
1913 BoolVar
1914 channel(Home home, IntVar x, IntPropLevel ipl=IPL_DEF);
1916 IntVar
1917 channel(Home home, BoolVar b, IntPropLevel ipl=IPL_DEF);
1918#ifdef GECODE_HAS_FLOAT_VARS
1920 IntVar
1921 channel(Home home, FloatVar f);
1922#endif
1923#ifdef GECODE_HAS_SET_VARS
1925 SetVar
1926 channel(Home home, const IntVarArgs& x, IntPropLevel ipl=IPL_DEF);
1927#endif
1929
1930}
1931
1933
1934namespace Gecode {
1935
1944
1946
1950 void
1951 atmost(Home home, const IntVarArgs& x, int n, int m,
1952 IntPropLevel ipl=IPL_DEF);
1957 void
1958 atmost(Home home, const IntVarArgs& x, IntVar y, int m,
1959 IntPropLevel ipl=IPL_DEF);
1967 void
1968 atmost(Home home, const IntVarArgs& x, const IntArgs& y, int m,
1969 IntPropLevel ipl=IPL_DEF);
1974 void
1975 atmost(Home home, const IntVarArgs& x, int n, IntVar z,
1976 IntPropLevel ipl=IPL_DEF);
1981 void
1982 atmost(Home home, const IntVarArgs& x, IntVar y, IntVar z,
1983 IntPropLevel ipl=IPL_DEF);
1991 void
1992 atmost(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
1993 IntPropLevel ipl=IPL_DEF);
1994
1999 void
2000 atleast(Home home, const IntVarArgs& x, int n, int m,
2001 IntPropLevel ipl=IPL_DEF);
2006 void
2007 atleast(Home home, const IntVarArgs& x, IntVar y, int m,
2008 IntPropLevel ipl=IPL_DEF);
2016 void
2017 atleast(Home home, const IntVarArgs& x, const IntArgs& y, int m,
2018 IntPropLevel ipl=IPL_DEF);
2023 void
2024 atleast(Home home, const IntVarArgs& x, int n, IntVar z,
2025 IntPropLevel ipl=IPL_DEF);
2030 void
2031 atleast(Home home, const IntVarArgs& x, IntVar y, IntVar z,
2032 IntPropLevel ipl=IPL_DEF);
2040 void
2041 atleast(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
2042 IntPropLevel ipl=IPL_DEF);
2043
2048 void
2049 exactly(Home home, const IntVarArgs& x, int n, int m,
2050 IntPropLevel ipl=IPL_DEF);
2055 void
2056 exactly(Home home, const IntVarArgs& x, IntVar y, int m,
2057 IntPropLevel ipl=IPL_DEF);
2065 void
2066 exactly(Home home, const IntVarArgs& x, const IntArgs& y, int m,
2067 IntPropLevel ipl=IPL_DEF);
2072 void
2073 exactly(Home home, const IntVarArgs& x, int n, IntVar z,
2074 IntPropLevel ipl=IPL_DEF);
2079 void
2080 exactly(Home home, const IntVarArgs& x, IntVar y, IntVar z,
2081 IntPropLevel ipl=IPL_DEF);
2089 void
2090 exactly(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
2091 IntPropLevel ipl=IPL_DEF);
2092
2095 void
2096 lex(Home home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
2097 IntPropLevel ipl=IPL_DEF);
2100 void
2101 lex(Home home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
2102 IntPropLevel ipl=IPL_DEF);
2103
2106 void
2107 values(Home home, const IntVarArgs& x, IntSet y,
2108 IntPropLevel ipl=IPL_DEF);
2110
2111#ifdef GECODE_HAS_SET_VARS
2120
2122
2127 void
2128 channel(Home home, const IntVarArgs& x, SetVar y);
2129
2132 void
2133 range(Home home, const IntVarArgs& x, SetVar y, SetVar z);
2134
2140 void
2141 roots(Home home, const IntVarArgs& x, SetVar y, SetVar z);
2143
2144#endif
2145
2146}
2147
2149
2150namespace Gecode {
2151
2152 template<class> class Matrix;
2153
2161 template<class A>
2162 class Slice {
2163 public:
2166 private:
2167 ArgsType _r;
2168 int _fc,
2169 _tc,
2170 _fr,
2171 _tr;
2172 public:
2174 Slice(const Matrix<A>& a, int fc, int tc, int fr, int tr);
2178 Slice& reverse(void);
2180 operator ArgsType(void);
2182 operator Matrix<ArgsType>(void);
2183
2185 operator const ArgsType(void) const;
2187 operator const Matrix<ArgsType>(void) const;
2188 };
2189
2191 template<class A>
2192 typename Slice<A>::ArgsType
2193 operator+(const Slice<A>& x, const Slice<A>& y);
2194
2196 template<class A>
2197 typename Slice<A>::ArgsType
2198 operator+(const Slice<A>& x, const typename ArrayTraits<A>::ArgsType& y);
2199
2201 template<class A>
2202 typename Slice<A>::ArgsType
2203 operator+(const typename ArrayTraits<A>::ArgsType& x, const Slice<A>& y);
2204
2206 template<class A>
2207 typename Slice<A>::ArgsType
2208 operator+(const Slice<A>& x, const typename ArrayTraits<A>::ValueType& y);
2209
2211 template<class A>
2212 typename Slice<A>::ArgsType
2213 operator+(const typename ArrayTraits<A>::ValueType& x, const Slice<A>& y);
2214
2225 template<class A>
2226 class Matrix {
2227 public:
2232
2233 private:
2235 typedef typename ArrayTraits<A>::StorageType StorageType;
2236 StorageType _a;
2237 int _w;
2238 int _h;
2239
2240 public:
2253 Matrix(A a, int w, int h);
2254
2267 Matrix(A a, int n);
2268
2270 int width(void) const;
2272 int height(void) const;
2274 ArgsType const get_array(void) const;
2275
2281 ValueType& operator ()(int c, int r);
2282
2288 const ValueType& operator ()(int c, int r) const;
2289
2299 Slice<A> slice(int fc, int tc, int fr, int tr) const;
2300
2302 Slice<A> row(int r) const;
2303
2305 Slice<A> col(int c) const;
2306 };
2307
2311 template<class Char, class Traits, class A>
2312 std::basic_ostream<Char,Traits>&
2313 operator <<(std::basic_ostream<Char,Traits>& os, const Matrix<A>& m);
2314
2318 template<class Char, class Traits, class A>
2319 std::basic_ostream<Char,Traits>&
2320 operator <<(std::basic_ostream<Char,Traits>& os, const Slice<A>& s);
2321
2328 void element(Home home, const Matrix<IntArgs>& m, IntVar x, IntVar y,
2329 IntVar z, IntPropLevel ipl=IPL_DEF);
2336 void element(Home home, const Matrix<IntArgs>& m, IntVar x, IntVar y,
2344 void element(Home home, const Matrix<IntVarArgs>& m, IntVar x, IntVar y,
2345 IntVar z, IntPropLevel ipl=IPL_DEF);
2352 void element(Home home, const Matrix<BoolVarArgs>& m, IntVar x, IntVar y,
2353 BoolVar z, IntPropLevel ipln=IPL_DEF);
2354#ifdef GECODE_HAS_SET_VARS
2361 void element(Home home, const Matrix<IntSetArgs>& m, IntVar x, IntVar y,
2362 SetVar z);
2369 void element(Home home, const Matrix<SetVarArgs>& m, IntVar x, IntVar y,
2370 SetVar z);
2371#endif
2372
2376 template<class A>
2381 template<class A>
2386 template<class A>
2391 template<class A>
2398 template<class A>
2400}
2401
2404
2409namespace Gecode {
2410
2412 GECODE_MINIMODEL_EXPORT LinIntExpr
2413 sum(const Slice<IntArgs>& slice);
2415 GECODE_MINIMODEL_EXPORT LinIntExpr
2416 sum(const Matrix<IntArgs>& matrix);
2417
2418}
2420
2421namespace Gecode {
2422
2431
2437 public:
2439 IntMinimizeSpace(void);
2444 virtual void constrain(const Space& best);
2446 virtual IntVar cost(void) const = 0;
2447 };
2448
2454 public:
2456 IntMaximizeSpace(void);
2461 virtual void constrain(const Space& best);
2463 virtual IntVar cost(void) const = 0;
2464 };
2465
2471 public:
2473 IntLexMinimizeSpace(void);
2478 virtual void constrain(const Space& best);
2480 virtual IntVarArgs cost(void) const = 0;
2481 };
2482
2488 public:
2490 IntLexMaximizeSpace(void);
2495 virtual void constrain(const Space& best);
2497 virtual IntVarArgs cost(void) const = 0;
2498 };
2499
2500#ifdef GECODE_HAS_FLOAT_VARS
2501
2512 protected:
2515 public:
2522 virtual void constrain(const Space& best);
2524 virtual FloatVar cost(void) const = 0;
2525 };
2526
2537 protected:
2540 public:
2547 virtual void constrain(const Space& best);
2549 virtual FloatVar cost(void) const = 0;
2550 };
2551
2552#endif
2553
2554}
2555
2557
2558#endif
2559
2560// IFDEF: GECODE_HAS_INT_VARS
2561// STATISTICS: minimodel-any
Traits of arrays in Gecode.
Definition array.hpp:94
Miscealloneous Boolean expressions.
Misc(void)
Default constructor.
Definition bool-expr.hpp:55
virtual void post(Home home, BoolVar b, bool neg, const IntPropLevels &ipls)=0
Node for Boolean expression
Definition bool-expr.cpp:49
Boolean expressions.
friend BoolExpr operator||(const BoolExpr &, const BoolExpr &)
friend BoolExpr operator&&(const BoolExpr &, const BoolExpr &)
NodeType
Type of Boolean expression.
@ NT_RLINFLOAT
Reified linear relation.
@ NT_AND
Conjunction.
@ NT_EQV
Equivalence.
@ NT_RLIN
Reified linear relation.
@ NT_VAR
Variable.
@ NT_CONST
Boolean constant.
@ NT_OR
Disjunction.
@ NT_MISC
Other Boolean expression.
@ NT_NOT
Negation.
@ NT_RSET
Reified set relation.
const BoolExpr & operator=(const BoolExpr &e)
Assignment operator.
BoolVar expr(Home home, const IntPropLevels &ipls) const
Post propagators for expression.
~BoolExpr(void)
Destructor.
void rel(Home home, const IntPropLevels &ipls) const
Post propagators for relation.
Passing Boolean variables.
Definition int.hh:739
Boolean integer variables.
Definition int.hh:534
Finite automaton with deterministic construction by default.
Definition int.hh:2620
virtual void constrain(const Space &best)
Member function constraining according to cost.
Definition optimize.cpp:107
FloatNum step
Step by which a next solution has to have lower cost.
virtual FloatVar cost(void) const =0
Return variable with current cost.
FloatMaximizeSpace(FloatNum s=0.0)
Constructor with step s.
Definition optimize.hpp:80
virtual FloatVar cost(void) const =0
Return variable with current cost.
virtual void constrain(const Space &best)
Member function constraining according to cost.
Definition optimize.cpp:89
FloatMinimizeSpace(FloatNum s=0.0)
Constructor with step s.
Definition optimize.hpp:71
FloatNum step
Step by which a next solution has to have lower cost.
Passing float arguments.
Definition float.hh:948
Float value type.
Definition float.hh:329
Passing float variables.
Definition float.hh:977
Float variables.
Definition float.hh:865
Base class for heap allocated objects.
Definition heap.hpp:344
Home class for posting propagators
Definition core.hpp:863
Passing integer arguments.
Definition int.hh:653
virtual IntVarArgs cost(void) const =0
Return variables with current costs.
IntLexMaximizeSpace(void)
Default constructor.
Definition optimize.hpp:61
virtual void constrain(const Space &best)
Member function constraining according to increasing costs.
Definition optimize.cpp:74
virtual IntVarArgs cost(void) const =0
Return variables with current costs.
virtual void constrain(const Space &best)
Member function constraining according to decreasing costs.
Definition optimize.cpp:61
IntLexMinimizeSpace(void)
Default constructor.
Definition optimize.hpp:53
virtual IntVar cost(void) const =0
Return variable with current cost.
IntMaximizeSpace(void)
Default constructor.
Definition optimize.hpp:45
virtual void constrain(const Space &best)
Member function constraining according to increasing cost.
Definition optimize.cpp:51
virtual IntVar cost(void) const =0
Return variable with current cost.
IntMinimizeSpace(void)
Default constructor.
Definition optimize.hpp:37
virtual void constrain(const Space &best)
Member function constraining according to decreasing cost.
Definition optimize.cpp:41
Class for specifying integer propagation levels used by minimodel.
Definition minimodel.hh:110
IntPropLevel _linear
For n-ary linear.
Definition minimodel.hh:113
IntPropLevel div(void) const
Return integer propagation level for division constraints.
Definition ipl.hpp:114
IntPropLevel element(void) const
Return integer propagation level for element constraints.
Definition ipl.hpp:164
IntPropLevel _sqr
For square.
Definition minimodel.hh:122
IntPropLevel mod(void) const
Return integer propagation level for modulo constraints.
Definition ipl.hpp:122
IntPropLevel linear(void) const
Return integer propagation level for non-binary linear constraints.
Definition ipl.hpp:55
IntPropLevel max2(void) const
Return integer propagation level for binary maximum constraints.
Definition ipl.hpp:73
IntPropLevel _mult
For multiplication.
Definition minimodel.hh:119
IntPropLevel _mod
For modulo.
Definition minimodel.hh:121
IntPropLevel ite(void) const
Return integer propagation level for if-then-else constraints.
Definition ipl.hpp:173
IntPropLevel mult(void) const
Return integer propagation level for multiplication constraints.
Definition ipl.hpp:106
IntPropLevel min(void) const
Return integer propagation level for non-binary minimum constraints.
Definition ipl.hpp:97
IntPropLevel _sqrt
For square root.
Definition minimodel.hh:123
IntPropLevel _ite
For if-then-else.
Definition minimodel.hh:127
IntPropLevel nroot(void) const
Return integer propagation level for root constraints.
Definition ipl.hpp:155
IntPropLevel abs(void) const
Return integer propagation level for absolute value constraints.
Definition ipl.hpp:64
IntPropLevel _max
For n-ary maximum.
Definition minimodel.hh:116
IntPropLevel _nroot
For root.
Definition minimodel.hh:125
IntPropLevel _pow
For power.
Definition minimodel.hh:124
IntPropLevel _element
For element.
Definition minimodel.hh:126
IntPropLevel _div
For division.
Definition minimodel.hh:120
IntPropLevel _abs
For absolute value.
Definition minimodel.hh:114
IntPropLevel sqrt(void) const
Return integer propagation level for square root constraints.
Definition ipl.hpp:139
IntPropLevels(IntPropLevel ipl=IPL_DEF)
Initialize with default propagation level.
Definition ipl.hpp:37
static const IntPropLevels def
Default propagation levels for all constraints.
Definition minimodel.hh:206
IntPropLevel linear2(void) const
Return integer propagation level for binary linear constraints.
Definition ipl.hpp:47
IntPropLevel min2(void) const
Return integer propagation level for binary minimum constraints.
Definition ipl.hpp:89
IntPropLevel _min2
For binary minimum.
Definition minimodel.hh:117
IntPropLevel pow(void) const
Return integer propagation level for power constraints.
Definition ipl.hpp:147
IntPropLevel _min
For minimum.
Definition minimodel.hh:118
IntPropLevel _linear2
For binary linear.
Definition minimodel.hh:112
IntPropLevel _max2
For binary maximum.
Definition minimodel.hh:115
IntPropLevel max(void) const
Return integer propagation level for non-binary maximum constraints.
Definition ipl.hpp:81
IntPropLevel sqr(void) const
Return integer propagation level for square constraints.
Definition ipl.hpp:131
Integer sets.
Definition int.hh:179
Passing integer variables.
Definition int.hh:681
Integer variables.
Definition int.hh:390
Float expressions
Definition minimodel.hh:846
friend class LinFloatRel
Definition minimodel.hh:847
NonLinFloatExpr * nlfe(void) const
Return non-linear expression inside, or null if not non-linear.
LinFloatExpr(void)
Default constructor.
const LinFloatExpr & operator=(const LinFloatExpr &e)
Assignment operator.
~LinFloatExpr(void)
Destructor.
void post(Home home, FloatRelType frt) const
Post propagator.
NodeType
Type of linear expression.
Definition minimodel.hh:850
@ NT_VAR
Linear term with variable.
Definition minimodel.hh:852
@ NT_CONST
Float value constant.
Definition minimodel.hh:851
@ NT_SUM
Sum of float variables.
Definition minimodel.hh:854
@ NT_NONLIN
Non-linear expression.
Definition minimodel.hh:853
@ NT_ADD
Addition of linear terms.
Definition minimodel.hh:855
@ NT_MUL
Multiplication by coefficient.
Definition minimodel.hh:857
@ NT_SUB
Subtraction of linear terms.
Definition minimodel.hh:856
Linear relations.
Definition minimodel.hh:920
void post(Home home, bool t) const
Post propagator for relation (if t is false for negated relation).
Definition float-rel.hpp:72
friend class BoolExpr
Definition minimodel.hh:921
Linear expressions over integer variables.
Definition minimodel.hh:258
NodeType
Type of linear expression.
Definition minimodel.hh:269
@ NT_CONST
Integer constant.
Definition minimodel.hh:270
@ NT_SUB
Subtraction of linear terms.
Definition minimodel.hh:277
@ NT_SUM_BOOL
Sum of Boolean variables.
Definition minimodel.hh:275
@ NT_ADD
Addition of linear terms.
Definition minimodel.hh:276
@ NT_SUM_INT
Sum of integer variables.
Definition minimodel.hh:274
@ NT_VAR_BOOL
Linear term with Boolean variable.
Definition minimodel.hh:272
@ NT_MUL
Multiplication by coefficient.
Definition minimodel.hh:278
@ NT_NONLIN
Non-linear expression.
Definition minimodel.hh:273
@ NT_VAR_INT
Linear term with integer variable.
Definition minimodel.hh:271
LinIntExpr(void)
Default constructor.
Definition int-expr.cpp:401
friend class LinFloatExpr
Definition minimodel.hh:265
~LinIntExpr(void)
Destructor.
Definition int-expr.cpp:587
void post(Home home, IntRelType irt, const IntPropLevels &ipls) const
Post propagator.
Definition int-expr.cpp:191
const LinIntExpr & operator=(const LinIntExpr &e)
Assignment operator.
Definition int-expr.cpp:576
NonLinIntExpr * nle(void) const
Return non-linear expression inside, or null if not non-linear.
Definition int-expr.cpp:394
friend class LinIntRel
Definition minimodel.hh:259
friend class SetExpr
Definition minimodel.hh:262
Linear relations over integer variables.
Definition minimodel.hh:359
void post(Home home, bool t, const IntPropLevels &ipls) const
Post propagator for relation (if t is false for negated relation).
Definition int-rel.hpp:70
friend class BoolExpr
Definition minimodel.hh:360
Matrix-interface for arrays.
int width(void) const
Return the width of the matrix.
Definition matrix.hpp:143
ValueType & operator()(int c, int r)
Access element (c, r) of the matrix.
Definition matrix.hpp:155
Slice< A > slice(int fc, int tc, int fr, int tr) const
Access slice of the matrix.
Definition matrix.hpp:171
Slice< A > col(int c) const
Access column c.
Definition matrix.hpp:183
ArrayTraits< A >::ValueType ValueType
The type of elements of this array.
Slice< A > row(int r) const
Access row r.
Definition matrix.hpp:177
ArgsType const get_array(void) const
Return an Args-array of the contents of the matrix.
Definition matrix.hpp:149
Matrix(A a, int w, int h)
Basic constructor.
Definition matrix.hpp:127
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
int height(void) const
Return the height of the matrix.
Definition matrix.hpp:146
Non-linear arithmetic expressions over integer variables.
Definition int-arith.cpp:45
Expression information.
Definition reg.cpp:535
Base class for non-linear float expressions.
Definition minimodel.hh:818
virtual void post(Home home, FloatRelType frt, FloatVal c) const =0
Post expression to be in relation frt with c.
static FloatVar result(Home home, FloatVar *x)
Return fresh variable if x is null, x otherwise.
virtual ~NonLinFloatExpr(void)
Destructor.
virtual void post(Home home, FloatRelType frt, FloatVal c, BoolVar b) const =0
Post reified expression to be in relation frt with c.
virtual FloatVar post(Home home, FloatVar *ret) const =0
Return variable constrained to be equal to the expression.
Base class for non-linear expressions over integer variables.
Definition minimodel.hh:224
virtual void post(Home home, IntRelType irt, int c, BoolVar b, const IntPropLevels &ipls) const =0
Post reified expression to be in relation irt with c.
static IntVar result(Home home, IntVar *x)
Return fresh variable if x is null, x otherwise.
Definition int-expr.hpp:40
virtual void post(Home home, IntRelType irt, int c, const IntPropLevels &ipls) const =0
Post expression to be in relation irt with c.
virtual IntVar post(Home home, IntVar *ret, const IntPropLevels &ipls) const =0
Return variable constrained to be equal to the expression.
virtual ~NonLinIntExpr(void)
Destructor.
Definition int-expr.hpp:37
Implementation of the actual expression tree.
Definition reg.cpp:52
Regular expressions over integer values.
Comparison relation (for two-sided comparisons).
SetRelType srt
Which relation.
SetExpr l
Left side of relation.
SetExpr r
Right side of relation.
SetCmpRel(const SetExpr &l, SetRelType srt, const SetExpr &r)
Constructor.
Definition set-rel.hpp:43
Set expressions
SetExpr(void)
Default constructor.
Definition set-expr.hpp:44
SetVar post(Home home) const
Post propagators for expression.
Definition set-expr.cpp:649
~SetExpr(void)
Destructor.
Definition set-expr.cpp:639
NodeType
Type of set expression.
@ NT_CMPL
Complement.
@ NT_INTER
Intersection.
@ NT_DUNION
Disjoint union.
@ NT_VAR
Variable.
@ NT_LEXP
Linear expression.
@ NT_CONST
Constant.
const SetExpr & operator=(const SetExpr &e)
Assignment operator.
Definition set-expr.cpp:629
Set relations
void post(Home home, bool t) const
Post propagators for relation (or negated relation if t is false).
Definition set-rel.hpp:58
SetRel(void)
Default constructor.
Definition set-rel.hpp:47
Passing set variables.
Definition set.hh:491
Set variables
Definition set.hh:127
A slice of a matrix.
Slice(const Matrix< A > &a, int fc, int tc, int fr, int tr)
Construct slice.
Definition matrix.hpp:43
Slice & reverse(void)
Reverses the contents of the slice, and returns a reference to it.
Definition matrix.hpp:62
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
A reference-counted pointer to a SymmetryObject.
Definition int.hh:6434
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
IntRelType
Relation types for integers.
Definition int.hh:1225
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:1274
@ IPL_BITS_
Number of bits required (internal).
Definition int.hh:1285
@ IPL_DEF
Simple propagation levels.
Definition int.hh:1276
Space(void)
Default constructor.
Definition core.cpp:121
SetRelType
Common relation types for sets.
Definition set.hh:650
void print(const Search::Statistics &stat, bool restart)
Print statistics.
Definition job-shop.cpp:677
#define GECODE_MINIMODEL_EXPORT
Definition minimodel.hh:87
Boolean propagators.
Minimalistic modeling support.
Definition minimodel.hh:101
Gecode toplevel namespace
FloatVal operator/(const FloatVal &x, const FloatVal &y)
Definition val.hpp:214
void lex(Home home, const IntVarArgs &x, IntRelType r, const IntVarArgs &y, IntPropLevel ipl=IPL_DEF)
Post lexical order between x and y.
Definition aliases.hpp:132
FloatVal operator-(const FloatVal &x)
Definition val.hpp:169
bool operator<=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:244
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
FloatVal operator+(const FloatVal &x)
Definition val.hpp:165
SymmetryHandle rows_reflect(const Matrix< A > &m)
Reflect rows symmetry specification.
Definition ldsb.hpp:62
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition channel.cpp:41
void atmost(Home home, const IntVarArgs &x, int n, int m, IntPropLevel ipl=IPL_DEF)
Post constraint .
Definition aliases.hpp:39
SetRel operator||(const SetExpr &, const SetExpr &)
Disjointness of set expressions.
Definition set-rel.cpp:71
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
IntVar expr(Home home, const LinIntExpr &e, const IntPropLevels &ipls=IntPropLevels::def)
Post linear expression and return its value.
Definition int-expr.cpp:988
SetExpr operator&(const SetExpr &, const SetExpr &)
Intersection of set expressions.
Definition set-expr.cpp:671
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition val-sel.hpp:39
void atleast(Home home, const IntVarArgs &x, int n, int m, IntPropLevel ipl=IPL_DEF)
Post constraint .
Definition aliases.hpp:70
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
IntRelType neg(IntRelType irt)
Return negated relation type of irt.
Definition irt.hpp:52
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Definition dom.cpp:40
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
bool operator<(const FloatVal &x, const FloatVal &y)
Definition val.hpp:227
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Definition element.cpp:39
SetExpr inter(const SetVarArgs &)
Intersection of set variables.
Definition set-expr.cpp:696
BoolExpr operator!(const BoolExpr &)
Negated Boolean expression.
BoolExpr operator^(const BoolExpr &, const BoolExpr &)
Exclusive-or of Boolean expressions.
void range(Home home, const IntVarArgs &x, SetVar y, SetVar z)
Post constraint .
Definition aliases.hpp:158
void roots(Home home, const IntVarArgs &x, SetVar y, SetVar z)
Post constraint .
Definition aliases.hpp:163
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
Definition aliases.hpp:143
void acos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
SymmetryHandle columns_reflect(const Matrix< A > &m)
Reflect columns symmetry specification.
Definition ldsb.hpp:85
bool operator>(const FloatVal &x, const FloatVal &y)
Definition val.hpp:261
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
bool operator>=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:278
SetExpr setdunion(const SetVarArgs &)
Disjoint union of set variables.
Definition set-expr.cpp:714
SymmetryHandle rows_interchange(const Matrix< A > &m)
Interchangeable rows symmetry specification.
Definition ldsb.hpp:40
LinIntExpr sum(const IntVarArgs &x)
Construct linear expression as sum of integer variables.
Definition int-expr.cpp:953
void exactly(Home home, const IntVarArgs &x, int n, int m, IntPropLevel ipl=IPL_DEF)
Post constraint .
Definition aliases.hpp:101
SetExpr setunion(const SetVarArgs &)
Union of set variables.
Definition set-expr.cpp:705
SetExpr singleton(const LinIntExpr &)
Singleton expression.
Definition set-expr.cpp:691
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Archive & operator>>(Archive &e, FloatNumBranch &nl)
Definition val-sel.hpp:44
BoolExpr operator&&(const BoolExpr &, const BoolExpr &)
void asin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
SetExpr operator|(const SetExpr &, const SetExpr &)
Union of set expressions.
Definition set-expr.cpp:675
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for .
LinIntExpr cardinality(const SetExpr &)
Cardinality of set expression.
Definition set-expr.cpp:817
FloatVal operator*(const FloatVal &x, const FloatVal &y)
Definition val.hpp:201
SymmetryHandle diagonal_reflect(const Matrix< A > &m)
Reflect around main diagonal symmetry specification.
Definition ldsb.hpp:108
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
LinIntExpr operator%(const LinIntExpr &x, const LinIntExpr &y)
Return expression for .
bool operator!=(const FloatVal &x, const FloatVal &y)
Definition val.hpp:318
SymmetryHandle columns_interchange(const Matrix< A > &m)
Interchangeable columns symmetry specification.
Definition ldsb.hpp:51
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
#define GECODE_VTABLE_EXPORT
Definition support.hh:76