Generated on Wed Nov 1 15:04:51 2006 for Gecode by doxygen 1.4.5

Grocery Class Reference
[Example scripts (models)]

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 41 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 (void)
 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 49 of file grocery.cc.

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

Constructor for cloning s.

Definition at line 74 of file grocery.cc.


Member Function Documentation

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

Copy during cloning.

Implements Gecode::Space.

Definition at line 80 of file grocery.cc.

virtual void Grocery::print void   )  [inline, virtual]
 

Print solution.

Reimplemented from Example.

Definition at line 86 of file grocery.cc.


Member Data Documentation

IntVarArray Grocery::x [protected]
 

The price of each item.

Definition at line 44 of file grocery.cc.

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

Sum and product of prices.

Definition at line 46 of file grocery.cc.


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