
Example: Dominating Queens More...
Public Member Functions | |
| DominatingQueens (const SizeOptions &opt) | |
| The actual problem. More... | |
| virtual IntVar | cost (void) const |
| Return cost. More... | |
| DominatingQueens (bool share, DominatingQueens &s) | |
| Constructor for cloning s. More... | |
| virtual Space * | copy (bool share) |
| Perform copying during cloning. More... | |
| virtual void | print (std::ostream &os) const |
| Print solution. More... | |
Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace > | |
| ScriptBase (const Options &opt) | |
| Constructor. More... | |
| ScriptBase (bool share, ScriptBase &e) | |
| Constructor used for cloning. More... | |
| virtual void | compare (const Space &home, std::ostream &os) const |
| Compare with s. More... | |
Protected Member Functions | |
| int | xy (int x, int y) const |
| Compute coordinate pair from x and y. More... | |
| int | x (int xy) const |
| Compute x coordinate from pair xy. More... | |
| int | y (int xy) const |
| Compute y coordinate from pair xy. More... | |
| IntSet | attacked (int xy) |
| Compute set of fields that can be attacked by xy. More... | |
Protected Attributes | |
| const int | n |
| Size of the board. More... | |
| IntVarArray | b |
| Fields on the board. More... | |
| IntVar | q |
| Number of queens. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| int | main (int argc, char *argv[]) |
| Main-function. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace > | |
| static std::ostream & | select_ostream (const char *name, std::ofstream &ofs) |
| Choose output stream according to name. More... | |
| template<class Script , template< class > class Engine, class Options > | |
| static void | run (const Options &opt, Script *s=NULL) |
Example: Dominating Queens
Place a number of queens on a n times n chessboard such that each squares is either attacked or occupied by a queen.
The model is taken from: C. Bessiere, E. Hebrard, B. Hnich, Z. Kiziltan, and T. Walsh, Filtering Algorithms for the NValue Constraint, Constraints, 11(4), 271-293, 2006.
Definition at line 57 of file dominating-queens.cpp.
|
inline |
The actual problem.
Definition at line 90 of file dominating-queens.cpp.
|
inline |
Constructor for cloning s.
Definition at line 121 of file dominating-queens.cpp.
|
inlineprotected |
Compute coordinate pair from x and y.
Definition at line 66 of file dominating-queens.cpp.
|
inlineprotected |
Compute x coordinate from pair xy.
Definition at line 70 of file dominating-queens.cpp.
|
inlineprotected |
Compute y coordinate from pair xy.
Definition at line 74 of file dominating-queens.cpp.
|
inlineprotected |
Compute set of fields that can be attacked by xy.
Definition at line 78 of file dominating-queens.cpp.
|
inlinevirtual |
Return cost.
Definition at line 116 of file dominating-queens.cpp.
|
inlinevirtual |
Perform copying during cloning.
Definition at line 129 of file dominating-queens.cpp.
|
inlinevirtual |
Print solution.
Reimplemented from Gecode::Driver::ScriptBase< BaseSpace >.
Definition at line 135 of file dominating-queens.cpp.
|
related |
Main-function.
Definition at line 161 of file dominating-queens.cpp.
|
protected |
Size of the board.
Definition at line 60 of file dominating-queens.cpp.
|
protected |
Fields on the board.
Definition at line 62 of file dominating-queens.cpp.
|
protected |
Number of queens.
Definition at line 64 of file dominating-queens.cpp.