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

QueenArmies Class Reference
[Example scripts (models)]

Inherits Example.

List of all members.


Detailed Description

Example: Peacable co-existing armies of queens.

The goal of this problem is to place as many white and black queens on a chess-board without any two queens of different color attacking each other. The number of black queens should be greater than or equal to the number of white queens.

This model is based on the one presented in "Models and Symmetry Breaking for 'Peaceable Armies of Queens'", by Barbara M. Smith, Karen E. Petrie, and Ian P. Gent.

The smart version uses a custom branching implementing a heuristic from the above paper, that helps speeding up the proof of optimality.

Definition at line 53 of file queen-armies.cc.

Constant sets for attacking queens.

int pos (int i, int j, int n)
 Position of a piece in a square board.

Public Member Functions

 QueenArmies (const Options &o)
 QueenArmies (bool share, QueenArmies &s)
virtual Spacecopy (bool share)
 Copying member function.
void constrain (Space *s)
virtual void print (void)

Public Attributes

const int n
SetVar U
 Set of un-attacked squares.
SetVar W
 Set of squares occupied by white queens.
BoolVarArray w
 The placement of the white queens.
BoolVarArray b
 The placement of the black queens.
IntVar q
 The number of white queens placed.

Classes

class  QueenBranch
 Custom branching for Peacable queens. More...


Constructor & Destructor Documentation

QueenArmies::QueenArmies const Options o  )  [inline]
 

Definition at line 62 of file queen-armies.cc.

QueenArmies::QueenArmies bool  share,
QueenArmies s
[inline]
 

Definition at line 99 of file queen-armies.cc.


Member Function Documentation

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

Copying member function.

Must create a new object using the constructor for cloning.

Implements Gecode::Space.

Definition at line 110 of file queen-armies.cc.

void QueenArmies::constrain Space s  )  [inline]
 

Definition at line 115 of file queen-armies.cc.

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

Reimplemented from Example.

Definition at line 121 of file queen-armies.cc.


Friends And Related Function Documentation

int pos int  i,
int  j,
int  n
[related]
 

Position of a piece in a square board.

Definition at line 187 of file queen-armies.cc.


Member Data Documentation

const int QueenArmies::n
 

Definition at line 55 of file queen-armies.cc.

SetVar QueenArmies::U
 

Set of un-attacked squares.

Definition at line 56 of file queen-armies.cc.

SetVar QueenArmies::W
 

Set of squares occupied by white queens.

Definition at line 56 of file queen-armies.cc.

BoolVarArray QueenArmies::w
 

The placement of the white queens.

Definition at line 58 of file queen-armies.cc.

BoolVarArray QueenArmies::b
 

The placement of the black queens.

Definition at line 58 of file queen-armies.cc.

IntVar QueenArmies::q
 

The number of white queens placed.

Definition at line 60 of file queen-armies.cc.


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