Generated on Wed Nov 1 15:04:51 2006 for Gecode by doxygen 1.4.5

LangfordNum Class Reference
[Example scripts (models)]

Inherits Example.

List of all members.


Detailed Description

Example: Langford's number problem

Problem 024 in the categoy "combinatorial mathematics" of http://www.csplib.org/.

For a detailed problem analysis see http://www.lclark.edu/~miller/langford.html

Definition at line 50 of file langfordnum.cc.

Public Member Functions

void adiff_skn (Space *home, IntVarArray &x, IntVarArray &pi)
 Constrain x to be a permutation of $ S_{kn} = \{0, \dots, n*k - 1\}$.
IntVarp (int i, int j)
 Returns the position of the j-th occurence of value $ v =(i + 1)$.
IntVarys (int i, int j)
void distance (Space *home)
 The occurences of a value v in the Langford sequence are v numbers apart.
 LangfordNum (const Options &op)
 LangfordNum (bool share, LangfordNum &l)
virtual Spacecopy (bool share)
 Copying member function.
virtual void print (void)


Constructor & Destructor Documentation

LangfordNum::LangfordNum const Options op  )  [inline]
 

Definition at line 116 of file langfordnum.cc.

LangfordNum::LangfordNum bool  share,
LangfordNum l
[inline]
 

Definition at line 157 of file langfordnum.cc.


Member Function Documentation

void LangfordNum::adiff_skn Space home,
IntVarArray x,
IntVarArray pi
[inline]
 

Constrain x to be a permutation of $ S_{kn} = \{0, \dots, n*k - 1\}$.

$ \forall i, j\in S_{kn}, i\neq j: x_i \neq x_j $

Definition at line 70 of file langfordnum.cc.

IntVar& LangfordNum::p int  i,
int  j
[inline]
 

Returns the position of the j-th occurence of value $ v =(i + 1)$.

Definition at line 88 of file langfordnum.cc.

IntVar& LangfordNum::ys int  i,
int  j
[inline]
 

Definition at line 92 of file langfordnum.cc.

void LangfordNum::distance Space home  )  [inline]
 

The occurences of a value v in the Langford sequence are v numbers apart.

Let $ \#(i, v) $ denote the position of the i-th occurence of value v in the Langford Sequence. Then this function posts the constraint that $ \forall i, j \in \{1, \dots, k\}, i \neq j: \forall v \in \{1, \dots, n\}: \#(i, v) + (v + 1) = \#(j, v)$

Definition at line 106 of file langfordnum.cc.

virtual Space* LangfordNum::copy bool  share  )  [inline, virtual]
 

Copying member function.

Must create a new object using the constructor for cloning.

Implements Gecode::Space.

Definition at line 166 of file langfordnum.cc.

virtual void LangfordNum::print void   )  [inline, virtual]
 

Reimplemented from Example.

Definition at line 170 of file langfordnum.cc.


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