MagicSequence Class Reference
[Scripts for problems]
Inherits Example.
Detailed Description
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
.- the number
occurs exactly
times in the sequence.
See problem 19 at http://www.csplib.org/.
Definition at line 57 of file magic-sequence.cc.
Public Types | |
| enum | { PROP_REIFIED, PROP_COUNT, PROP_GCC } |
| Propagation to use for model. More... | |
Public Member Functions | |
| void | exactly (IntVarArray &v, IntVar &x, int i) |
| Naive version for counting number of ocurrences of i. | |
| MagicSequence (const SizeOptions &opt) | |
| The actual model. | |
| MagicSequence (bool share, MagicSequence &e) | |
| Constructor for cloning e. | |
| virtual Space * | copy (bool share) |
| Copy during cloning. | |
| virtual void | print (std::ostream &os) |
| Print sequence. | |
Member Enumeration Documentation
| anonymous enum |
Propagation to use for model.
- Enumerator:
-
PROP_REIFIED Use reified constraints. PROP_COUNT Use count constraints. PROP_GCC Use single global cardinality constraint.
Definition at line 65 of file magic-sequence.cc.
Constructor & Destructor Documentation
| MagicSequence::MagicSequence | ( | const SizeOptions & | opt | ) | [inline] |
| MagicSequence::MagicSequence | ( | bool | share, | |
| MagicSequence & | e | |||
| ) | [inline] |
Member Function Documentation
| void MagicSequence::exactly | ( | IntVarArray & | v, | |
| IntVar & | x, | |||
| int | i | |||
| ) | [inline] |
Naive version for counting number of ocurrences of i.
Definition at line 72 of file magic-sequence.cc.
| virtual Space* MagicSequence::copy | ( | bool | share | ) | [inline, virtual] |
| virtual void MagicSequence::print | ( | std::ostream & | os | ) | [inline, virtual] |
The documentation for this class was generated from the following file:
- examples/magic-sequence.cc (Revision: 5524)
