Generated on Mon Aug 25 11:35:48 2008 for Gecode by doxygen 1.5.6

Grocery Class Reference
[Scripts for problems]

Inherits Example.

List of all members.


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 57 of file grocery.cc.


Public Member Functions

 Grocery (const Options &)
 The actual model.
 Grocery (bool share, Grocery &s)
 Constructor for cloning s.
virtual Spacecopy (bool share)
 Copy during cloning.
virtual void print (std::ostream &os)
 Print solution.

Protected Attributes

IntVarArray x
 The price of each item.

Static Protected Attributes

static const int s = 711
 Sum and product of prices.

Constructor & Destructor Documentation

Grocery::Grocery ( const Options  )  [inline]

The actual model.

Definition at line 65 of file grocery.cc.

Grocery::Grocery ( bool  share,
Grocery s 
) [inline]

Constructor for cloning s.

Definition at line 83 of file grocery.cc.


Member Function Documentation

virtual Space* Grocery::copy ( bool  share  )  [inline, virtual]

Copy during cloning.

Implements Gecode::Space.

Definition at line 89 of file grocery.cc.

virtual void Grocery::print ( std::ostream &  os  )  [inline, virtual]

Print solution.

Reimplemented from Example.

Definition at line 95 of file grocery.cc.


Member Data Documentation

IntVarArray Grocery::x [protected]

The price of each item.

Definition at line 60 of file grocery.cc.

const int Grocery::s = 711 [static, protected]

Sum and product of prices.

Definition at line 62 of file grocery.cc.


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