QueenArmies Class Reference
[Example scripts (models)]
Inherits Example.
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 Space * | copy (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
|
Definition at line 62 of file queen-armies.cc. |
|
Definition at line 99 of file queen-armies.cc. |
Member Function Documentation
|
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. |
|
Definition at line 115 of file queen-armies.cc. |
|
Reimplemented from Example. Definition at line 121 of file queen-armies.cc. |
Friends And Related Function Documentation
|
Position of a piece in a square board.
Definition at line 187 of file queen-armies.cc. |
Member Data Documentation
|
Definition at line 55 of file queen-armies.cc. |
|
Set of un-attacked squares.
Definition at line 56 of file queen-armies.cc. |
|
Set of squares occupied by white queens.
Definition at line 56 of file queen-armies.cc. |
|
The placement of the white queens.
Definition at line 58 of file queen-armies.cc. |
|
The placement of the black queens.
Definition at line 58 of file queen-armies.cc. |
|
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:
- examples/queen-armies.cc (Revision: 3783)