DominatingQueens Class Reference
Example scripts (models)

Example: Dominating Queens More...

## Public Member Functions

| DominatingQueens (const SizeOptions &opt)
| The actual problem.
virtual IntVar | cost (void) const
| Return cost.
| DominatingQueens (DominatingQueens &s)
| Constructor for cloning s.
virtual Space * | copy (void)
| Perform copying during cloning.
virtual void | print (std::ostream &os) const
| Print solution.
Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > >
| ScriptBase (const Options &opt)
| Constructor.
| ScriptBase (ScriptBase &e)
| Constructor used for cloning.
virtual void | compare (const Space &home, std::ostream &os) const
| Compare with s.
Public Member Functions inherited from Gecode::Driver::IgnoreStepOption< BaseSpace >
| IgnoreStepOption (const Options &)
| Constructor.
| IgnoreStepOption (BaseSpace &e)
| Constructor used for cloning.

## Protected Member Functions

int | xy (int x, int y) const
| Compute coordinate pair from x and y.
int | x (int xy) const
| Compute x coordinate from pair xy.
int | y (int xy) const
| Compute y coordinate from pair xy.
IntSet | attacked (int xy)
| Compute set of fields that can be attacked by xy.

## Protected Attributes

const int | n
| Size of the board.
IntVarArray | b
| Fields on the board.
IntVar | q
| Number of queens.

## Related Symbols

(Note that these are not member symbols.)
int | main (int argc, char *argv[])
| Main-function.

## Additional Inherited Members

Static Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > >
static std::ostream & | select_ostream (const char *sn, std::ofstream &ofs)
| Choose output stream according to sn.
static void | run (const Options &opt, Script *s=NULL)

## Detailed Description

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 53 of file dominating-queens.cpp.

## Constructor & Destructor Documentation

## DominatingQueens() [1/2]

DominatingQueens::DominatingQueens | ( | const SizeOptions & | opt | ) |

inline

The actual problem.

Definition at line 86 of file dominating-queens.cpp.

## DominatingQueens() [2/2]

DominatingQueens::DominatingQueens | ( | DominatingQueens & | s | ) |

inline

Constructor for cloning s.

Definition at line 117 of file dominating-queens.cpp.

## Member Function Documentation

## xy()

int DominatingQueens::xy | ( | int | x,
|  | int | y ) const

inline protected

Compute coordinate pair from x and y.

Definition at line 62 of file dominating-queens.cpp.

## x()

int DominatingQueens::x | ( | int | xy | ) | const

inline protected

Compute x coordinate from pair xy.

Definition at line 66 of file dominating-queens.cpp.

## y()

int DominatingQueens::y | ( | int | xy | ) | const

inline protected

Compute y coordinate from pair xy.

Definition at line 70 of file dominating-queens.cpp.

## attacked()

IntSet DominatingQueens::attacked | ( | int | xy | ) |

inline protected

Compute set of fields that can be attacked by xy.

Definition at line 74 of file dominating-queens.cpp.

## cost()

virtual IntVar DominatingQueens::cost | ( | void |  | ) | const

inline virtual

Return cost.

Definition at line 112 of file dominating-queens.cpp.

## copy()

virtual Space * DominatingQueens::copy | ( | void |  | ) |

inline virtual

Perform copying during cloning.

Definition at line 125 of file dominating-queens.cpp.

## print()

virtual void DominatingQueens::print | ( | std::ostream & | os | ) | const

inline virtual

Print solution.

Reimplemented from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > >.

Definition at line 131 of file dominating-queens.cpp.

## Friends And Related Symbol Documentation

## main()

int main | ( | int | argc,
|  | char * | argv[] )

related

Main-function.

Definition at line 157 of file dominating-queens.cpp.

## Member Data Documentation

## n

const int DominatingQueens::n

protected

Size of the board.

Definition at line 56 of file dominating-queens.cpp.

## b

IntVarArray DominatingQueens::b

protected

Fields on the board.

Definition at line 58 of file dominating-queens.cpp.

## q

IntVar DominatingQueens::q

protected

Number of queens.

Definition at line 60 of file dominating-queens.cpp.

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

- examples/dominating-queens.cpp