
Example: Magic sequence More...
Public Types | |
| enum | { PROP_COUNT , PROP_GCC } |
| Propagation to use for model. More... | |
Public Member Functions | |
| MagicSequence (const SizeOptions &opt) | |
| The actual model. More... | |
| MagicSequence (MagicSequence &e) | |
| Constructor for cloning e. More... | |
| virtual Space * | copy (void) |
| Copy during cloning. More... | |
| virtual void | print (std::ostream &os) const |
| Print sequence. More... | |
Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace > | |
| ScriptBase (const Options &opt) | |
| Constructor. More... | |
| ScriptBase (ScriptBase &e) | |
| Constructor used for cloning. More... | |
| virtual void | compare (const Space &home, std::ostream &os) const |
| Compare with s. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| int | main (int argc, char *argv[]) |
| Main-function. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace > | |
| static std::ostream & | select_ostream (const char *sn, std::ofstream &ofs) |
| Choose output stream according to sn. More... | |
| template<class Script , template< class > class Engine, class Options > | |
| static void | run (const Options &opt, Script *s=NULL) |
Example: Magic sequence
Find a magic sequence of length
. A magic sequence of length
is a sequence
of integers such that for every
:
is an integer between
and
.
occurs exactly
times in the sequence.See problem 19 at http://www.csplib.org/.
Note that "Modeling and Programming with Gecode" uses this example as a case study.
Definition at line 59 of file magic-sequence.cpp.
| anonymous enum |
Propagation to use for model.
| Enumerator | |
|---|---|
| PROP_COUNT | Use count constraints. |
| PROP_GCC | Use single global cardinality constraint. |
Definition at line 67 of file magic-sequence.cpp.
|
inline |
The actual model.
Definition at line 72 of file magic-sequence.cpp.
|
inline |
Constructor for cloning e.
Definition at line 89 of file magic-sequence.cpp.
|
inlinevirtual |
Copy during cloning.
Definition at line 94 of file magic-sequence.cpp.
|
inlinevirtual |
Print sequence.
Reimplemented from Gecode::Driver::ScriptBase< BaseSpace >.
Definition at line 99 of file magic-sequence.cpp.
|
related |
Main-function.
Definition at line 115 of file magic-sequence.cpp.