Generated on Sat Feb 7 2015 02:01:29 for Gecode by doxygen 1.8.9.1
set.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  * Christian Schulte <schulte@gecode.org>
6  *
7  * Contributing authors:
8  * Gabor Szokoli <szokoli@gecode.org>
9  *
10  * Copyright:
11  * Guido Tack, 2004
12  * Christian Schulte, 2004
13  * Gabor Szokoli, 2004
14  *
15  * Last modified:
16  * $Date: 2014-04-28 20:54:50 +0200 (Mon, 28 Apr 2014) $ by $Author: schulte $
17  * $Revision: 14116 $
18  *
19  * This file is part of Gecode, the generic constraint
20  * development environment:
21  * http://www.gecode.org
22  *
23  * Permission is hereby granted, free of charge, to any person obtaining
24  * a copy of this software and associated documentation files (the
25  * "Software"), to deal in the Software without restriction, including
26  * without limitation the rights to use, copy, modify, merge, publish,
27  * distribute, sublicense, and/or sell copies of the Software, and to
28  * permit persons to whom the Software is furnished to do so, subject to
29  * the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be
32  * included in all copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41  *
42  */
43 
44 #ifndef __GECODE_SET_HH__
45 #define __GECODE_SET_HH__
46 
47 #include <gecode/kernel.hh>
48 #include <gecode/int.hh>
49 #include <gecode/iter.hh>
50 
51 /*
52  * Configure linking
53  *
54  */
55 #if !defined(GECODE_STATIC_LIBS) && \
56  (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
57 
58 #ifdef GECODE_BUILD_SET
59 #define GECODE_SET_EXPORT __declspec( dllexport )
60 #else
61 #define GECODE_SET_EXPORT __declspec( dllimport )
62 #endif
63 
64 #else
65 
66 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
67 #define GECODE_SET_EXPORT __attribute__ ((visibility("default")))
68 #else
69 #define GECODE_SET_EXPORT
70 #endif
71 
72 #endif
73 
74 // Configure auto-linking
75 #ifndef GECODE_BUILD_SET
76 #define GECODE_LIBRARY_NAME "Set"
78 #endif
79 
80 
92 #include <gecode/set/exception.hpp>
93 
94 namespace Gecode { namespace Set {
95 
97  namespace Limits {
99  const int max = (Gecode::Int::Limits::max / 2) - 1;
101  const int min = -max;
103  const unsigned int card = max-min+1;
105  void check(int n, const char* l);
107  void check(unsigned int n, const char* l);
109  void check(const IntSet& s, const char* l);
110  }
111 
112 }}
113 
114 #include <gecode/set/limits.hpp>
115 
116 #include <gecode/set/var-imp.hpp>
117 
118 namespace Gecode {
119 
120  namespace Set {
121  class SetView;
122  }
123 
129  class SetVar : public VarImpVar<Set::SetVarImp> {
130  friend class SetVarArray;
131  friend class SetVarArgs;
133  public:
135 
136  SetVar(void);
139  SetVar(const SetVar& y);
141  SetVar(const Set::SetView& y);
142 
145 
164  SetVar(Space& home,int glbMin,int glbMax,int lubMin,int lubMax,
165  unsigned int cardMin = 0,
166  unsigned int cardMax = Set::Limits::card);
167 
185  SetVar(Space& home,const IntSet& glbD,int lubMin,int lubMax,
186  unsigned int cardMin = 0,
187  unsigned int cardMax = Set::Limits::card);
188 
207  SetVar(Space& home,int glbMin,int glbMax,const IntSet& lubD,
208  unsigned int cardMin = 0,
209  unsigned int cardMax = Set::Limits::card);
210 
229  SetVar(Space& home,const IntSet& glbD,const IntSet& lubD,
230  unsigned int cardMin = 0,
231  unsigned int cardMax = Set::Limits::card);
233 
235 
236  unsigned int glbSize(void) const;
239  unsigned int lubSize(void) const;
241  unsigned int unknownSize(void) const;
243  unsigned int cardMin(void) const;
245  unsigned int cardMax(void) const;
247  int lubMin(void) const;
249  int lubMax(void) const;
251  int glbMin(void) const;
253  int glbMax(void) const;
255 
257 
258  bool contains(int i) const;
261  bool notContains(int i) const;
263  };
264 
270 
273  private:
275  public:
277 
278  SetVarGlbRanges(void);
281  SetVarGlbRanges(const SetVar& x);
283 
285 
286  bool operator ()(void) const;
289  void operator ++(void);
291 
293 
294  int min(void) const;
297  int max(void) const;
299  unsigned int width(void) const;
301  };
302 
305  private:
307  public:
309 
310  SetVarLubRanges(void);
313  SetVarLubRanges(const SetVar& x);
315 
317 
318  bool operator ()(void) const;
321  void operator ++(void);
323 
325 
326  int min(void) const;
329  int max(void) const;
331  unsigned int width(void) const;
333  };
334 
337  private:
339  public:
341 
342  SetVarUnknownRanges(void);
345  SetVarUnknownRanges(const SetVar& x);
347 
349 
350  bool operator ()(void) const;
353  void operator ++(void);
355 
357 
358  int min(void) const;
361  int max(void) const;
363  unsigned int width(void) const;
365  };
366 
369  private:
371  public:
373 
374  SetVarGlbValues(void);
377  SetVarGlbValues(const SetVar& x);
379 
381 
382  bool operator ()(void) const;
385  void operator ++(void);
387 
389 
390  int val(void) const;
393  };
394 
397  private:
399  public:
401 
402  SetVarLubValues(void);
405  SetVarLubValues(const SetVar& x);
407 
409 
410  bool operator ()(void) const;
413  void operator ++(void);
415 
417 
418  int val(void) const;
421  };
422 
425  private:
427  public:
429 
430  SetVarUnknownValues(void);
433  SetVarUnknownValues(const SetVar& x);
435 
437 
438  bool operator ()(void) const;
441  void operator ++(void);
443 
445 
446  int val(void) const;
449  };
450 
452 
457  template<class Char, class Traits>
458  std::basic_ostream<Char,Traits>&
459  operator <<(std::basic_ostream<Char,Traits>& os, const SetVar& x);
460 
461 }
462 
463 #include <gecode/set/view.hpp>
464 
465 namespace Gecode {
475 
476 }
477 
479 
480 namespace Gecode {
481 
490  class SetVarArgs : public VarArgArray<SetVar> {
491  public:
493 
494  SetVarArgs(void) {}
497  explicit SetVarArgs(int n) : VarArgArray<SetVar>(n) {}
503  SetVarArgs(const std::vector<SetVar>& a) : VarArgArray<SetVar>(a) {}
505  template<class InputIterator>
506  SetVarArgs(InputIterator first, InputIterator last)
507  : VarArgArray<SetVar>(first,last) {}
515  SetVarArgs(Space& home,int n,int glbMin,int glbMax,
516  int lubMin,int lubMax,
517  unsigned int minCard = 0,
518  unsigned int maxCard = Set::Limits::card);
526  SetVarArgs(Space& home,int n,const IntSet& glb,
527  int lubMin, int lubMax,
528  unsigned int minCard = 0,
529  unsigned int maxCard = Set::Limits::card);
537  SetVarArgs(Space& home,int n,int glbMin,int glbMax,
538  const IntSet& lub,
539  unsigned int minCard = 0,
540  unsigned int maxCard = Set::Limits::card);
548  SetVarArgs(Space& home,int n,
549  const IntSet& glb,const IntSet& lub,
550  unsigned int minCard = 0,
551  unsigned int maxCard = Set::Limits::card);
553  };
555 
571  class SetVarArray : public VarArray<SetVar> {
572  public:
574 
575  SetVarArray(void);
578  SetVarArray(const SetVarArray&);
580  SetVarArray(Space& home, const SetVarArgs&);
582  GECODE_SET_EXPORT SetVarArray(Space& home, int n);
590  SetVarArray(Space& home,int n,int glbMin,int glbMax,int lubMin,int lubMax,
591  unsigned int minCard = 0,
592  unsigned int maxCard = Set::Limits::card);
600  SetVarArray(Space& home,int n,const IntSet& glb, int lubMin, int lubMax,
601  unsigned int minCard = 0,
602  unsigned int maxCard = Set::Limits::card);
610  SetVarArray(Space& home,int n,int glbMin,int glbMax,const IntSet& lub,
611  unsigned int minCard = 0,
612  unsigned int maxCard = Set::Limits::card);
620  SetVarArray(Space& home,int n,
621  const IntSet& glb,const IntSet& lub,
622  unsigned int minCard = 0,
623  unsigned int maxCard = Set::Limits::card);
625  };
626 
627 }
628 
629 #include <gecode/set/array.hpp>
630 
631 namespace Gecode {
632 
644  enum SetRelType {
655  };
656 
661  enum SetOpType {
666  };
667 
675 
677  GECODE_SET_EXPORT void
678  dom(Home home, SetVar x, SetRelType r, int i);
680  GECODE_SET_EXPORT void
681  dom(Home home, const SetVarArgs& x, SetRelType r, int i);
683  GECODE_SET_EXPORT void
684  dom(Home home, SetVar x, SetRelType r, int i, int j);
686  GECODE_SET_EXPORT void
687  dom(Home home, const SetVarArgs& x, SetRelType r, int i, int j);
689  GECODE_SET_EXPORT void
690  dom(Home home, SetVar x, SetRelType r, const IntSet& s);
692  GECODE_SET_EXPORT void
693  dom(Home home, const SetVarArgs& x, SetRelType r, const IntSet& s);
695  GECODE_SET_EXPORT void
696  cardinality(Home home, SetVar x, unsigned int i, unsigned int j);
698  GECODE_SET_EXPORT void
699  cardinality(Home home, const SetVarArgs& x, unsigned int i, unsigned int j);
701  GECODE_SET_EXPORT void
702  dom(Home home, SetVar x, SetRelType rt, int i, Reify r);
704  GECODE_SET_EXPORT void
705  dom(Home home, SetVar x, SetRelType rt, int i, int j, Reify r);
707  GECODE_SET_EXPORT void
708  dom(Home home, SetVar x, SetRelType rt, const IntSet& s, Reify r);
710  GECODE_SET_EXPORT void
711  dom(Home home, SetVar x, SetVar d);
713  GECODE_SET_EXPORT void
714  dom(Home home, const SetVarArgs& x, const SetVarArgs& d);
716 
717 
725 
727  GECODE_SET_EXPORT void
728  rel(Home home, SetVar x, SetRelType r, SetVar y);
729 
731  GECODE_SET_EXPORT void
732  rel(Home home, SetVar x, SetRelType rt, SetVar y, Reify r);
733 
735  GECODE_SET_EXPORT void
736  rel(Home home, SetVar s, SetRelType r, IntVar x);
737 
739  GECODE_SET_EXPORT void
740  rel(Home home, IntVar x, SetRelType r, SetVar s);
741 
743  GECODE_SET_EXPORT void
744  rel(Home home, SetVar s, SetRelType rt, IntVar x, Reify r);
745 
747  GECODE_SET_EXPORT void
748  rel(Home home, IntVar x, SetRelType rt, SetVar s, Reify r);
749 
751  GECODE_SET_EXPORT void
752  rel(Home home, SetVar s, IntRelType r, IntVar x);
753 
755  GECODE_SET_EXPORT void
756  rel(Home home, IntVar x, IntRelType r, SetVar s);
757 
759 
767 
769  GECODE_SET_EXPORT void
770  rel(Home home, SetVar x, SetOpType op, SetVar y, SetRelType r, SetVar z);
771 
773  GECODE_SET_EXPORT void
774  rel(Home home, SetOpType op, const SetVarArgs& x, SetVar y);
775 
777  GECODE_SET_EXPORT void
778  rel(Home home, SetOpType op, const SetVarArgs& x, const IntSet& z, SetVar y);
779 
781  GECODE_SET_EXPORT void
782  rel(Home home, SetOpType op, const IntVarArgs& x, const IntSet& z, SetVar y);
783 
785  GECODE_SET_EXPORT void
786  rel(Home home, SetOpType op, const IntVarArgs& x, SetVar y);
787 
789  GECODE_SET_EXPORT void
790  rel(Home home, const IntSet& x, SetOpType op, SetVar y,
791  SetRelType r, SetVar z);
792 
794  GECODE_SET_EXPORT void
795  rel(Home home, SetVar x, SetOpType op, const IntSet& y,
796  SetRelType r, SetVar z);
797 
799  GECODE_SET_EXPORT void
800  rel(Home home, SetVar x, SetOpType op, SetVar y,
801  SetRelType r, const IntSet& z);
802 
804  GECODE_SET_EXPORT void
805  rel(Home home, const IntSet& x, SetOpType op, SetVar y, SetRelType r,
806  const IntSet& z);
807 
809  GECODE_SET_EXPORT void
810  rel(Home home, SetVar x, SetOpType op, const IntSet& y, SetRelType r,
811  const IntSet& z);
812 
814 
815 
822 
824  GECODE_SET_EXPORT void
825  convex(Home home, SetVar x);
826 
828  GECODE_SET_EXPORT void
829  convex(Home home, SetVar x, SetVar y);
830 
832 
839 
841  GECODE_SET_EXPORT void
842  sequence(Home home, const SetVarArgs& x);
843 
845  GECODE_SET_EXPORT void
846  sequence(Home home, const SetVarArgs& y, SetVar x);
847 
849 
856 
857 
859  GECODE_SET_EXPORT void
860  atmostOne(Home home, const SetVarArgs& x, unsigned int c);
861 
863 
871 
874  GECODE_SET_EXPORT void
875  min(Home home, SetVar s, IntVar x);
876 
879  GECODE_SET_EXPORT void
880  notMin(Home home, SetVar s, IntVar x);
881 
884  GECODE_SET_EXPORT void
885  min(Home home, SetVar s, IntVar x, Reify r);
886 
889  GECODE_SET_EXPORT void
890  max(Home home, SetVar s, IntVar x);
891 
894  GECODE_SET_EXPORT void
895  notMax(Home home, SetVar s, IntVar x);
896 
899  GECODE_SET_EXPORT void
900  max(Home home, SetVar s, IntVar x, Reify r);
901 
903  GECODE_SET_EXPORT void
904  cardinality(Home home, SetVar s, IntVar x);
905 
916  GECODE_SET_EXPORT void
917  weights(Home home, IntSharedArray elements, IntSharedArray weights,
918  SetVar x, IntVar y);
919 
921 
929 
931  GECODE_SET_EXPORT void
932  channel(Home home, const IntVarArgs& x,const SetVarArgs& y);
933 
935  GECODE_SET_EXPORT void
936  channelSorted(Home home, const IntVarArgs& x, SetVar y);
937 
939  GECODE_SET_EXPORT void
940  channel(Home home, const BoolVarArgs& x, SetVar y);
941 
943  GECODE_SET_EXPORT void
944  channel(Home home, const SetVarArgs& x, const SetVarArgs& y);
945 
947 
959  GECODE_SET_EXPORT void
960  precede(Home home, const SetVarArgs& x, int s, int t);
964  GECODE_SET_EXPORT void
965  precede(Home home, const SetVarArgs& x, const IntArgs& c);
966 
980 
990  GECODE_SET_EXPORT void
991  element(Home home, SetOpType op, const SetVarArgs& x, SetVar y, SetVar z,
992  const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
993 
1003  GECODE_SET_EXPORT void
1004  element(Home home, SetOpType op, const IntVarArgs& x, SetVar y, SetVar z,
1005  const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
1006 
1016  GECODE_SET_EXPORT void
1017  element(Home home, SetOpType op, const IntSetArgs& x, SetVar y, SetVar z,
1018  const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
1019 
1029  GECODE_SET_EXPORT void
1030  element(Home home, SetOpType op, const IntArgs& x, SetVar y, SetVar z,
1031  const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
1032 
1038  GECODE_SET_EXPORT void
1039  element(Home home, const SetVarArgs& x, IntVar y, SetVar z);
1040 
1046  GECODE_SET_EXPORT void
1047  element(Home home, const IntSetArgs& s, IntVar y, SetVar z);
1048 
1054  GECODE_SET_EXPORT void
1055  element(Home home, const IntSetArgs& a,
1056  IntVar x, int w, IntVar y, int h, SetVar z);
1062  GECODE_SET_EXPORT void
1063  element(Home home, const SetVarArgs& a,
1064  IntVar x, int w, IntVar y, int h, SetVar z);
1066 
1077  GECODE_SET_EXPORT void
1079  wait(Home home, SetVar x, void (*c)(Space& home));
1081  GECODE_SET_EXPORT void
1082  wait(Home home, const SetVarArgs& x, void (*c)(Space& home));
1084 
1085 }
1086 
1087 namespace Gecode {
1088 
1102  typedef bool (*SetBranchFilter)(const Space& home, SetVar x, int i);
1103 
1114  typedef double (*SetBranchMerit)(const Space& home, SetVar x, int i);
1115 
1126  typedef int (*SetBranchVal)(const Space& home, SetVar x, int i);
1127 
1139  typedef void (*SetBranchCommit)(Space& home, unsigned int a,
1140  SetVar x, int i, int n);
1141 
1142 }
1143 
1145 
1146 namespace Gecode {
1147 
1153  class SetAFC : public AFC {
1154  public:
1162  SetAFC(void);
1164  SetAFC(const SetAFC& a);
1166  SetAFC& operator =(const SetAFC& a);
1168  SetAFC(Home home, const SetVarArgs& x, double d=1.0);
1176  void init(Home, const SetVarArgs& x, double d=1.0);
1177  };
1178 
1179 }
1180 
1181 #include <gecode/set/branch/afc.hpp>
1182 
1183 namespace Gecode {
1184 
1185 
1191  class SetActivity : public Activity {
1192  public:
1200  SetActivity(void);
1202  SetActivity(const SetActivity& a);
1204  SetActivity& operator =(const SetActivity& a);
1214  SetActivity(Home home, const SetVarArgs& x, double d=1.0,
1215  SetBranchMerit bm=NULL);
1227  GECODE_SET_EXPORT void
1228  init(Home, const SetVarArgs& x, double d=1.0,
1229  SetBranchMerit bm=NULL);
1230  };
1231 
1232 }
1233 
1235 
1236 namespace Gecode {
1237 
1239  typedef void (*SetVarValPrint)(const Space &home, const BrancherHandle& bh,
1240  unsigned int a,
1241  SetVar x, int i, const int& n,
1242  std::ostream& o);
1243 
1244 }
1245 
1246 namespace Gecode {
1247 
1253  class SetVarBranch : public VarBranch {
1254  public:
1256  enum Select {
1257  SEL_NONE = 0,
1279  };
1280  protected:
1283  public:
1285  SetVarBranch(void);
1287  SetVarBranch(Rnd r);
1291  SetVarBranch(Select s, double d, BranchTbl t);
1299  Select select(void) const;
1301  void expand(Home home, const SetVarArgs& x);
1302  };
1303 
1309  SetVarBranch SET_VAR_NONE(void);
1322  SetVarBranch SET_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=NULL);
1326  SetVarBranch SET_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=NULL);
1330  SetVarBranch SET_VAR_ACTIVITY_MIN(double d=1.0, BranchTbl tbl=NULL);
1334  SetVarBranch SET_VAR_ACTIVITY_MAX(double d=1.0, BranchTbl tbl=NULL);
1354  SetVarBranch SET_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
1358  SetVarBranch SET_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
1370 
1371 }
1372 
1373 #include <gecode/set/branch/var.hpp>
1374 
1375 namespace Gecode {
1376 
1382  class SetValBranch : public ValBranch {
1383  public:
1385  enum Select {
1395  };
1396  protected:
1399  public:
1403  SetValBranch(Select s, Rnd r);
1407  Select select(void) const;
1408  };
1409 
1440 
1441 }
1442 
1443 #include <gecode/set/branch/val.hpp>
1444 
1445 namespace Gecode {
1446 
1452  class SetAssign : public ValBranch {
1453  public:
1455  enum Select {
1465  };
1466  protected:
1469  public:
1473  SetAssign(Select s, Rnd r);
1477  Select select(void) const;
1478  };
1479 
1509 
1510 }
1511 
1513 
1514 namespace Gecode {
1515 
1521  GECODE_SET_EXPORT BrancherHandle
1522  branch(Home home, const SetVarArgs& x,
1523  SetVarBranch vars, SetValBranch vals,
1524  SetBranchFilter bf=NULL,
1525  SetVarValPrint vvp=NULL);
1531  GECODE_SET_EXPORT BrancherHandle
1532  branch(Home home, const SetVarArgs& x,
1533  TieBreak<SetVarBranch> vars, SetValBranch vals,
1534  SetBranchFilter bf=NULL,
1535  SetVarValPrint vvp=NULL);
1541  GECODE_SET_EXPORT BrancherHandle
1542  branch(Home home, SetVar x, SetValBranch vals,
1543  SetVarValPrint vvp=NULL);
1549  GECODE_SET_EXPORT BrancherHandle
1550  assign(Home home, const SetVarArgs& x, SetAssign vals,
1551  SetBranchFilter bf=NULL,
1552  SetVarValPrint vvp=NULL);
1558  GECODE_SET_EXPORT BrancherHandle
1559  assign(Home home, SetVar x, SetAssign vals,
1560  SetVarValPrint vvp=NULL);
1561 
1562 }
1563 
1564 // LDSB-related declarations.
1565 namespace Gecode {
1567  GECODE_SET_EXPORT SymmetryHandle VariableSymmetry(const SetVarArgs& x);
1574  SymmetryHandle VariableSequenceSymmetry(const SetVarArgs& x, int ss);
1581  GECODE_SET_EXPORT BrancherHandle
1582  branch(Home home, const SetVarArgs& x,
1583  SetVarBranch vars, SetValBranch vals,
1584  const Symmetries& syms,
1585  SetBranchFilter bf=NULL,
1586  SetVarValPrint vvp=NULL);
1593  GECODE_SET_EXPORT BrancherHandle
1594  branch(Home home, const SetVarArgs& x,
1595  TieBreak<SetVarBranch> vars, SetValBranch vals,
1596  const Symmetries& syms,
1597  SetBranchFilter bf=NULL,
1598  SetVarValPrint vvp=NULL);
1599 }
1600 
1601 #endif
1602 
1603 // IFDEF: GECODE_HAS_SET_VARS
1604 // STATISTICS: set-post
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest unknown set.
Definition: var.hpp:183
void operator++(void)
Move iterator to next value (if possible)
Definition: set.hpp:200
Which values to select for branching first.
Definition: set.hh:1382
SetVarArgs(InputIterator first, InputIterator last)
Initialize from InputIterator first and last.
Definition: set.hh:506
unsigned int cardMax(void) const
Return cardinality maximum.
Definition: set.hpp:85
SetVarBranch SET_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
Definition: var.hpp:123
bool operator()(void) const
Test whether iterator is still at a range or done.
Definition: set.hpp:115
Select
Which value selection.
Definition: set.hh:1455
Include random element.
Definition: set.hh:1392
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest minimum unknown element.
Definition: var.hpp:168
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
Post propagator for and .
Definition: channel.cpp:49
With highest activity.
Definition: set.hh:1266
SetVarArray(void)
Default constructor (array of size 0)
Definition: array.hpp:52
int val(void) const
Return current value.
Definition: set.hpp:247
Variables as interfaces to variable implementations.
Definition: var.hpp:51
NodeType t
Type of node.
Definition: bool-expr.cpp:234
int min(void) const
Return smallest value of range.
Definition: set.hpp:150
void check(int n, const char *l)
Check whether integer n is in range, otherwise throw overflow exception with information l...
Definition: limits.hpp:41
SetRelType
Common relation types for sets.
Definition: set.hh:644
SetValBranch(Select s=SEL_MIN_INC)
Initialize with selection strategy s.
Definition: val.hpp:41
Include largest element.
Definition: set.hh:1460
Select value according to user-defined functions.
Definition: set.hh:1394
SetAssign SET_ASSIGN_MIN_EXC(void)
Exclude smallest element.
Definition: assign.hpp:64
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
Range iterator for the unknown set.
Definition: var-imp.hpp:406
SetVarBranch SET_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:91
int min(void) const
Return smallest value of range.
Definition: set.hpp:123
Include smallest element.
Definition: set.hh:1456
const int min
Smallest allowed integer in integer set.
Definition: set.hh:101
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition: arithmetic.cpp:218
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
Definition: var.hpp:113
SetValBranch SET_VAL_MED_INC(void)
Include median element (rounding downwards)
Definition: val.hpp:69
With smallest minimum unknown element.
Definition: set.hh:1267
Include median element (rounding downwards)
Definition: set.hh:1458
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:57
SetVarBranch SET_VAR_ACTIVITY_MIN(double d, BranchTbl tbl)
Select variable with lowest activity with decay factor d.
Definition: var.hpp:143
Handle for brancher.
Definition: core.hpp:1157
Select
Which value selection.
Definition: set.hh:1385
int glbMax(void) const
Return maximum of greatest lower bound.
Definition: set.hpp:97
SetValBranch SET_VAL_MIN_INC(void)
Include smallest element.
Definition: val.hpp:59
SetVarBranch SET_VAR_ACTIVITY_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest activity divided by domain size with decay factor d.
Definition: var.hpp:223
With largest degree divided by domain size.
Definition: set.hh:1274
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Definition: dom.cpp:44
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
Definition: assign.hpp:99
void atmostOne(Home home, const SetVarArgs &xa, unsigned int c)
Post propagator for and .
Definition: distinct.cpp:45
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Definition: set.hpp:186
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Definition: set.hpp:158
Select select(void) const
Return selection strategy.
Definition: val.hpp:53
Range iterator for the greatest lower bound.
Definition: var-imp.hpp:363
int max(void) const
Return largest value of range.
Definition: set.hpp:154
unsigned int lubSize(void) const
Return number of elements in the least upper bound.
Definition: set.hpp:70
SetOpType
Common operations for sets.
Definition: set.hh:661
Superset ( )
Definition: set.hh:648
Recording activities for set variables.
Definition: set.hh:1191
SetAssign SET_ASSIGN_MAX_INC(void)
Include largest element.
Definition: assign.hpp:79
SetValBranch SET_VAL_RND_EXC(Rnd r)
Exclude random element.
Definition: val.hpp:94
Complement.
Definition: set.hh:650
const unsigned int card
Maximum cardinality of an integer set.
Definition: set.hh:103
const int max
Largest allowed integer in integer set.
Definition: set.hh:99
Include smallest element.
Definition: set.hh:1386
ArgArray< IntSet > IntSetArgs
Passing set arguments.
Definition: int.hh:598
const int max
Largest allowed integer value.
Definition: int.hh:113
bool contains(int i) const
Test whether i is in greatest lower bound.
Definition: set.hpp:76
Computation spaces.
Definition: core.hpp:1362
Exclude median element (rounding downwards)
Definition: set.hh:1459
Difference.
Definition: set.hh:665
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
Exclude random element.
Definition: assign.hpp:94
unsigned int unknownSize(void) const
Return number of unknown elements (elements in lub but not in glb)
Definition: set.hpp:73
Range iterator for the least upper bound.
Definition: var-imp.hpp:321
With largest maximum unknown element.
Definition: set.hh:1270
bool operator()(void) const
Test whether iterator is still at a value or done.
Definition: set.hpp:195
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest unknown set.
Definition: var.hpp:188
unsigned int cardMin(void) const
Return cardinality minimum.
Definition: set.hpp:82
unsigned int glbSize(void) const
Return number of elements in the greatest lower bound.
Definition: set.hpp:67
Exclude largest element.
Definition: set.hh:1461
Iterator for the unknown ranges of a set variable.
Definition: set.hh:336
Gecode::IntSet d(v, 7)
Iterator for the values in the unknown set of a set variable.
Definition: set.hh:424
Exclude median element (rounding downwards)
Definition: set.hh:1389
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntConLevel)
Post propagator for .
Definition: sequence.cpp:51
int val(void) const
Return current value.
Definition: set.hpp:205
Gecode::FloatVal c(-8, 8)
With smallest accumulated failure count.
Definition: set.hh:1263
Include largest element.
Definition: set.hh:1390
SetAssign SET_ASSIGN_MAX_EXC(void)
Exclude largest element.
Definition: assign.hpp:84
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
Definition: ldsb.cpp:66
With largest degree.
Definition: set.hh:1262
Select select(void) const
Return selection strategy.
Definition: var.hpp:69
void init(Home, const SetVarArgs &x, double d=1.0)
Initialize for set variables x with decay factor d.
Definition: afc.hpp:58
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
Definition: var.hpp:193
SetVarLubRanges(void)
Default constructor.
Definition: set.hpp:134
Gecode::IntArgs i(4, 1, 2, 3, 4)
With smallest maximum unknown element.
Definition: set.hh:1269
Class for AFC (accumulated failure count) management.
Definition: afc.hpp:44
int max(void) const
Return largest value of range.
Definition: set.hpp:127
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
With smallest degree.
Definition: set.hh:1261
First unassigned.
Definition: set.hh:1257
int(* SetBranchVal)(const Space &home, SetVar x, int i)
Branch value function type for set variables.
Definition: set.hh:1126
int val(void) const
Return current value.
Definition: set.hpp:226
IntRelType
Relation types for integers.
Definition: int.hh:903
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Definition: var.hpp:107
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
SetActivity(void)
Construct as not yet initialized.
Definition: activity.hpp:41
int lubMax(void) const
Return maximum element of least upper bound.
Definition: set.hpp:91
With smallest degree divided by domain size.
Definition: set.hh:1273
Less or equal ( )
Definition: set.hh:651
SetVarBranch SET_VAR_ACTIVITY_MAX(double d, BranchTbl tbl)
Select variable with highest activity with decay factor d.
Definition: var.hpp:153
Exclude smallest element.
Definition: set.hh:1457
With largest accumulated failure count divided by domain size.
Definition: set.hh:1276
SetVarBranch(void)
Initialize with strategy SEL_NONE.
Definition: var.hpp:41
Value iterator from range iterator.
With largest accumulated failure count.
Definition: set.hh:1264
void(* SetBranchCommit)(Space &home, unsigned int a, SetVar x, int i, int n)
Branch commit function type for set variables.
Definition: set.hh:1139
SetValBranch SET_VAL_MAX_EXC(void)
Exclude largest element.
Definition: val.hpp:84
Iterator for the greatest lower bound ranges of a set variable.
Definition: set.hh:272
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: set.hpp:79
Subset ( )
Definition: set.hh:647
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
Definition: var.hpp:118
Exclude largest element.
Definition: set.hh:1391
void precede(Home home, const IntVarArgs &x, int s, int t, IntConLevel)
Post propagator that s precedes t in x.
Definition: precede.cpp:47
With smallest activity divided by domain size.
Definition: set.hh:1277
SetValBranch SET_VAL_MAX_INC(void)
Include largest element.
Definition: val.hpp:79
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest maximum unknown element.
Definition: var.hpp:178
double(* SetBranchMerit)(const Space &home, SetVar x, int i)
Branch merit function type for set variables.
Definition: set.hh:1114
Intersection
Definition: set.hh:664
void(* VoidFunction)(void)
Base type for any function pointer.
Definition: cast.hpp:45
Integer sets.
Definition: int.hh:171
Exclude random element.
Definition: set.hh:1393
Less ( )
Definition: set.hh:652
With largest activity divided by domain size.
Definition: set.hh:1278
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntConLevel)
Post domain consistent propagator for .
Definition: element.cpp:43
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count divided by domain size with decay factor d...
Definition: var.hpp:203
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest maximum unknown element.
Definition: var.hpp:173
Recording AFC information for set variables.
Definition: set.hh:1153
int n
Number of variables (size)
Definition: array.hpp:89
SetVarArgs(const VarArray< SetVar > &a)
Initialize from variable array a (copy elements)
Definition: set.hh:501
With largest unknown set.
Definition: set.hh:1272
Iterator for the least upper bound ranges of a set variable.
Definition: set.hh:304
void operator++(void)
Move iterator to next value (if possible)
Definition: set.hpp:242
SharedArray< int > IntSharedArray
Arrays of integers that can be shared among several element constraints.
Definition: int.hh:1345
Select s
Which value to select.
Definition: set.hh:1398
SetAFC & operator=(const SetAFC &a)
Assignment operator.
Definition: afc.hpp:48
void notMax(Home home, SetVar s, IntVar x)
Post propagator that propagates that x is not the maximal element of s.
Definition: int.cpp:155
SetVarLubValues(void)
Default constructor.
SetValBranch SET_VAL_MIN_EXC(void)
Exclude smallest element.
Definition: val.hpp:64
Include median element (rounding downwards)
Definition: set.hh:1388
SetVarBranch SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count divided by domain size with decay factor d...
Definition: var.hpp:213
SetVarArgs(void)
Allocate empty array.
Definition: set.hh:495
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
Definition: set-expr.cpp:815
SetAssign SET_ASSIGN_MIN_INC(void)
Include smallest element.
Definition: assign.hpp:59
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
const int v[7]
Definition: distinct.cpp:207
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:75
Set view for set variables
Definition: view.hpp:60
BrancherHandle bh
With highest merit.
Definition: set.hh:1260
Exclude smallest element.
Definition: set.hh:1387
Union.
Definition: set.hh:662
With lowest activity.
Definition: set.hh:1265
Passing set variables.
Definition: set.hh:490
Random (uniform, for tie breaking)
Definition: set.hh:1258
Greater or equal ( )
Definition: set.hh:653
void init(Home, const SetVarArgs &x, double d=1.0, SetBranchMerit bm=NULL)
Initialize for set variables x with decay factor d.
Definition: activity.cpp:49
SetAssign SET_ASSIGN_MED_INC(void)
Include median element (rounding downwards)
Definition: assign.hpp:69
bool operator()(void) const
Test whether iterator is still at a value or done.
Definition: set.hpp:216
Value branching information.
Definition: branch-val.hpp:44
SetVarBranch SET_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
Definition: var.hpp:96
void operator++(void)
Move iterator to next range (if possible)
Definition: set.hpp:119
Variable branching information.
Definition: branch-var.hpp:55
BrancherHandle assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
Definition: branch.cpp:113
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Set variables
Definition: set.hh:129
Disjoint union.
Definition: set.hh:663
SetVarUnknownValues(void)
Default constructor.
SetVarArgs(int n)
Allocate array with n elements.
Definition: set.hh:497
void operator++(void)
Move iterator to next range (if possible)
Definition: set.hpp:146
void convex(Home home, SetVar x)
Post propagator that propagates that x is convex.
Definition: convex.cpp:45
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Definition: var.hpp:198
Select value according to user-defined functions.
Definition: set.hh:1464
void expand(Home home, const SetVarArgs &x)
Expand decay factor into AFC or activity.
Definition: var.hpp:74
SetAssign SET_ASSIGN_MED_EXC(void)
Exclude median element (rounding downwards)
Definition: assign.hpp:74
Iterator for the values in the greatest lower bound of a set variable.
Definition: set.hh:368
int lubMin(void) const
Return minimum element of least upper bound.
Definition: set.hpp:88
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:47
bool operator()(void) const
Test whether iterator is still at a range or done.
Definition: set.hpp:170
With smallest unknown set.
Definition: set.hh:1271
SetVarArgs(const SetVarArgs &a)
Initialize from variable argument array a (copy elements)
Definition: set.hh:499
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Post propagator for .
Definition: int.cpp:179
SetValBranch SET_VAL_MED_EXC(void)
Exclude median element (rounding downwards)
Definition: val.hpp:74
void(* SetVarValPrint)(const Space &home, const BrancherHandle &bh, unsigned int a, SetVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for set variables.
Definition: set.hh:1239
bool(* SetBranchFilter)(const Space &home, SetVar x, int i)
Branch filter function type for set variables.
Definition: set.hh:1102
With largest minimum unknown element.
Definition: set.hh:1268
Greater ( )
Definition: set.hh:654
bool operator()(void) const
Test whether iterator is still at a range or done.
Definition: set.hpp:142
Equality ( )
Definition: set.hh:645
Disjoint ( )
Definition: set.hh:649
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Definition: set.hpp:131
int n
Number of elements.
Definition: array.hpp:524
Exclude random element.
Definition: set.hh:1463
SetVarUnknownRanges(void)
Default constructor.
Definition: set.hpp:161
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
Definition: ldsb.cpp:94
int min(void) const
Return smallest value of range.
Definition: set.hpp:178
Set variable array
Definition: set.hh:571
Disequality ( )
Definition: set.hh:646
Which value to select for assignment.
Definition: set.hh:1452
void operator++(void)
Move iterator to next range (if possible)
Definition: set.hpp:174
Gecode toplevel namespace
Argument array for variables.
Definition: array.hpp:53
Select
Which variable selection.
Definition: set.hh:1256
void wait(Home home, FloatVar x, void(*c)(Space &home))
Execute c when x becomes assigned.
Definition: exec.cpp:44
SetVarBranch SET_VAR_ACTIVITY_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest activity divided by domain size with decay factor d. ...
Definition: var.hpp:233
SetAssign SET_ASSIGN_RND_INC(Rnd r)
Include random element.
Definition: assign.hpp:89
BrancherHandle branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
Definition: branch.cpp:43
void operator++(void)
Move iterator to next value (if possible)
Definition: set.hpp:221
Which variable to select for branching.
Definition: set.hh:1253
Random number generator.
Definition: rnd.hpp:46
bool operator()(void) const
Test whether iterator is still at a value or done.
Definition: set.hpp:237
SetVarGlbRanges(void)
Default constructor.
Definition: set.hpp:107
Select s
Which variable to select.
Definition: set.hh:1282
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest minimum unknown element.
Definition: var.hpp:163
Class for activity management.
Definition: activity.hpp:44
Select select(void) const
Return selection strategy.
Definition: assign.hpp:53
SetVar(void)
Default constructor.
Definition: set.hpp:50
Select s
Which value to select.
Definition: set.hh:1468
SetValBranch SET_VAL_RND_INC(Rnd r)
Include random element.
Definition: val.hpp:89
Home class for posting propagators
Definition: core.hpp:717
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Definition: branch.cpp:65
SetVarArgs(const std::vector< SetVar > &a)
Initialize from vector a.
Definition: set.hh:503
void notMin(Home home, SetVar s, IntVar x)
Post propagator that propagates that x is not the minimal element of s.
Definition: int.cpp:126
Include random element.
Definition: set.hh:1462
SetVarBranch SET_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Definition: var.hpp:133
SetVarGlbValues(void)
Default constructor.
int glbMin(void) const
Return minimum element of greatest lower bound.
Definition: set.hpp:94
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
Definition: var.hpp:101
int max(void) const
Return largest value of range.
Definition: set.hpp:182
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
#define GECODE_SET_EXPORT
Definition: set.hh:69
SetAssign(Select s=SEL_MIN_INC)
Initialize with selection strategy s.
Definition: assign.hpp:41
Iterator for the values in the least upper bound of a set variable.
Definition: set.hh:396
SetValBranch SET_VAL(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
Definition: val.hpp:99
SetActivity & operator=(const SetActivity &a)
Assignment operator.
Definition: activity.hpp:48
With smallest accumulated failure count divided by domain size.
Definition: set.hh:1275
SetVar * a
Element array.
Definition: array.hpp:528
SetAFC(void)
Construct as not yet initialized.
Definition: afc.hpp:41
Rnd r
Random number generator.
Definition: branch-val.hpp:47
double(* BranchTbl)(const Space &home, double w, double b)
Tie-break limit function.
Definition: branch-var.hpp:49