Grocery Class Reference
[Example scripts (models)]
Inherits Example.
Detailed Description
Example: Grocery puzzleA 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 Space * | copy (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
|
The actual model.
Definition at line 49 of file grocery.cc. |
|
Constructor for cloning s.
Definition at line 74 of file grocery.cc. |
Member Function Documentation
|
Copy during cloning.
Implements Gecode::Space. Definition at line 80 of file grocery.cc. |
|
Print solution.
Reimplemented from Example. Definition at line 86 of file grocery.cc. |
Member Data Documentation
|
The price of each item.
Definition at line 44 of file grocery.cc. |
|
Sum and product of prices.
Definition at line 46 of file grocery.cc. |
The documentation for this class was generated from the following file:
- examples/grocery.cc (Revision: 3517)