Grocery Class Reference
[Scripts for problems]
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 57 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 (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] |
| Grocery::Grocery | ( | bool | share, | |
| Grocery & | s | |||
| ) | [inline] |
Member Function Documentation
| virtual Space* Grocery::copy | ( | bool | share | ) | [inline, virtual] |
| virtual void Grocery::print | ( | std::ostream & | os | ) | [inline, virtual] |
Member Data Documentation
IntVarArray Grocery::x [protected] |
const int Grocery::s = 711 [static, protected] |
The documentation for this class was generated from the following file:
- examples/grocery.cc (Revision: 6024)
