QueenArmies Class Reference
[Scripts for problems]
Example: Peaceable co-existing armies of queens
More...
Classes | |
| class | QueenBranch |
| Custom branching for Peacaeble queens. More... | |
Public Types | |
| enum | { BRANCH_NAIVE, BRANCH_SPECIFIC } |
| Branching to use for model. More... | |
| enum | { SEARCH_BAB, SEARCH_RESTART } |
| Search variants. More... | |
Public Member Functions | |
| QueenArmies (const SizeOptions &opt) | |
| Constructor. | |
| QueenArmies (bool share, QueenArmies &s) | |
| Constructor for cloning. | |
| virtual Space * | copy (bool share) |
| Return copy during cloning. | |
| virtual IntVar | cost (void) const |
| Return solution cost. | |
| virtual void | print (std::ostream &os) const |
| Print solution. | |
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. | |
Constant sets for attacking queens. | |
| IntSet * | A |
| Position of a piece in a square board. | |
| int | pos (int i, int j, int n) |
| Position of a piece in a square board. | |
Detailed Description
Example: Peaceable co-existing armies of queensThe 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 71 of file queen-armies.cpp.
Member Enumeration Documentation
| anonymous enum |
Branching to use for model.
- Enumerator:
-
BRANCH_NAIVE Choose variables left to right. BRANCH_SPECIFIC Choose variable with problem specific strategy.
Definition at line 81 of file queen-armies.cpp.
| anonymous enum |
Constructor & Destructor Documentation
| QueenArmies::QueenArmies | ( | const SizeOptions & | opt | ) | [inline] |
| QueenArmies::QueenArmies | ( | bool | share, | |
| QueenArmies & | s | |||
| ) | [inline] |
Member Function Documentation
| virtual Space* QueenArmies::copy | ( | bool | share | ) | [inline, virtual] |
Return copy during cloning.
Implements Gecode::Space.
Definition at line 140 of file queen-armies.cpp.
| virtual IntVar QueenArmies::cost | ( | void | ) | const [inline, virtual] |
Return solution cost.
Implements Gecode::MiniModel::OptimizeSpace< IRT_GR >.
Definition at line 144 of file queen-armies.cpp.
| virtual void QueenArmies::print | ( | std::ostream & | os | ) | const [inline, virtual] |
Print solution.
Reimplemented from Gecode::Driver::ScriptBase< MaximizeSpace >.
Definition at line 149 of file queen-armies.cpp.
Friends And Related Function Documentation
| int pos | ( | int | i, | |
| int | j, | |||
| int | n | |||
| ) | [related] |
Member Data Documentation
| const int QueenArmies::n |
Definition at line 73 of file queen-armies.cpp.
The documentation for this class was generated from the following file:
- examples/queen-armies.cpp (Revision: 9061)
