GolombRuler Class Reference
Example scripts (models)

Example: Finding optimal Golomb rulers More...

## Public Member Functions

| GolombRuler (const SizeOptions &opt)
| Actual model.
virtual IntVar | cost (void) const
| Return cost.
virtual void | print (std::ostream &os) const
| Print solution.
| GolombRuler (GolombRuler &s)
| Constructor for cloning s.
virtual Space * | copy (void)
| Copy during cloning.
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 Attributes

IntVarArray | m
| Array for ruler marks.

## 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: Finding optimal Golomb rulers

The script makes use of two lower bounds taken from: Barbara Smith, Kostas Stergiou, Toby Walsh, Modelling the Golomb Ruler Problem. In IJCAI 99 Workshop on Non-binary Constraints, 1999.

See also problem 6 at http://www.csplib.org/.

The upper bound used is from the trivial construction where distances between consecutive marks are increasing powers of two.

Note that "Modeling and Programming with Gecode" uses this example as a case study.

Definition at line 62 of file golomb-ruler.cpp.

## Constructor & Destructor Documentation

## GolombRuler() [1/2]

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

inline

Actual model.

Definition at line 68 of file golomb-ruler.cpp.

## GolombRuler() [2/2]

GolombRuler::GolombRuler | ( | GolombRuler & | s | ) |

inline

Constructor for cloning s.

Definition at line 114 of file golomb-ruler.cpp.

## Member Function Documentation

## cost()

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

inline virtual

Return cost.

Definition at line 103 of file golomb-ruler.cpp.

## print()

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

inline virtual

Print solution.

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

Definition at line 109 of file golomb-ruler.cpp.

## copy()

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

inline virtual

Copy during cloning.

Definition at line 120 of file golomb-ruler.cpp.

## Friends And Related Symbol Documentation

## main()

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

related

Main-function.

Definition at line 129 of file golomb-ruler.cpp.

## Member Data Documentation

## m

IntVarArray GolombRuler::m

protected

Array for ruler marks.

Definition at line 65 of file golomb-ruler.cpp.

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

- examples/golomb-ruler.cpp