Grocery Class Reference
Example scripts (models)

Example: Grocery puzzle More...

## Public Member Functions

| Grocery (const Options &opt)
| The actual model.
| Grocery (Grocery &s)
| Constructor for cloning s.
virtual Space * | copy (void)
| Copy during cloning.
virtual void | print (std::ostream &os) const
| Print solution.
Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > >
| 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 | abcd
| The price of each item.

## Static Protected Attributes

static const int | s = 711
| Sum and product of prices.
static const int | p = 711 * 100 * 100 * 100
| Decimal product of prices.

## 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< Space > >
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: Grocery puzzle

A kid goes into a grocery store and buys four items. The cashier charges $7.11, the kid pays and is about to leave when the cashier calls the kid back, and says ''Hold on, I multiplied the four items instead of adding them; I'll try again; Hah, with adding them the price still comes to $7.11''. What were the prices of the four items?

The model is taken from: Christian Schulte, Gert Smolka, Finite Domain Constraint Programming in Oz. A Tutorial. 2001. Available from: http://www.mozart-oz.org/documentation/fdt/

Definition at line 56 of file grocery.cpp.

## Constructor & Destructor Documentation

## Grocery() [1/2]

Grocery::Grocery | ( | const Options & | opt | ) |

inline

The actual model.

Definition at line 66 of file grocery.cpp.

## Grocery() [2/2]

Grocery::Grocery | ( | Grocery & | s | ) |

inline

Constructor for cloning s.

Definition at line 83 of file grocery.cpp.

## Member Function Documentation

## copy()

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

inline virtual

Copy during cloning.

Definition at line 89 of file grocery.cpp.

## print()

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

inline virtual

Print solution.

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

Definition at line 95 of file grocery.cpp.

## Friends And Related Symbol Documentation

## main()

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

related

Main-function.

Definition at line 104 of file grocery.cpp.

## Member Data Documentation

## abcd

IntVarArray Grocery::abcd

protected

The price of each item.

Definition at line 59 of file grocery.cpp.

## s

const int Grocery::s = 711

static protected

Sum and product of prices.

Definition at line 61 of file grocery.cpp.

## p

const int Grocery::p = 711 * 100 * 100 * 100

static protected

Decimal product of prices.

Definition at line 63 of file grocery.cpp.

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

- examples/grocery.cpp