Generated on Mon Aug 25 11:35:48 2008 for Gecode by doxygen 1.5.6

MagicSequence Class Reference
[Scripts for problems]

Inherits Example.

List of all members.


Detailed Description

Example: Magic sequence

Find a magic sequence of length $n$. A magic sequence of length $n$ is a sequence

\[x_0,x_1, \ldots, x_{n-1}\]

of integers such that for every $i=0,\ldots,n-1$:

  • $x_i$ is an integer between $0$ and $n-1$.
  • the number $i$ occurs exactly $x_i$ 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 Spacecopy (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]

The actual model.

Definition at line 80 of file magic-sequence.cc.

MagicSequence::MagicSequence ( bool  share,
MagicSequence e 
) [inline]

Constructor for cloning e.

Definition at line 105 of file magic-sequence.cc.


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]

Copy during cloning.

Implements Gecode::Space.

Definition at line 110 of file magic-sequence.cc.

virtual void MagicSequence::print ( std::ostream &  os  )  [inline, virtual]

Print sequence.

Reimplemented from Example.

Definition at line 115 of file magic-sequence.cc.


The documentation for this class was generated from the following file: