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. | |
IntSet * | A |
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
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] |
Friends And Related Function Documentation
Definition at line 32 of file queen-armies.cc.
int pos | ( | int | i, | |
int | j, | |||
int | n | |||
) | [related] |
Member Data Documentation
const int QueenArmies::n |
Definition at line 55 of file queen-armies.cc.
The documentation for this class was generated from the following file:
- examples/queen-armies.cc (Revision: 3783)