Generated on Sat Feb 7 2015 02:01:38 for Gecode by doxygen 1.8.9.1
Grocery Class Reference

Example: Grocery puzzle More...

Public Member Functions

 Grocery (const Options &opt)
 The actual model. More...
 
 Grocery (bool share, Grocery &s)
 Constructor for cloning s. More...
 
virtual Spacecopy (bool share)
 Copy during cloning. More...
 
virtual void print (std::ostream &os) const
 Print solution. More...
 
- Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace >
 ScriptBase (void)
 Default constructor. More...
 
 ScriptBase (bool share, ScriptBase &e)
 Constructor used for cloning. More...
 
virtual void compare (const Space &, std::ostream &os) const
 Compare with s. More...
 

Protected Attributes

IntVarArray abcd
 The price of each item. More...
 

Static Protected Attributes

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

Related Functions

(Note that these are not member functions.)

int main (int argc, char *argv[])
 Main-function. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace >
static std::ostream & select_ostream (const char *name, std::ofstream &ofs)
 Choose output stream according to name. More...
 
template<class Script , template< class > class Engine, class Options >
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 60 of file grocery.cpp.

Constructor & Destructor Documentation

Grocery::Grocery ( const Options opt)
inline

The actual model.

Definition at line 70 of file grocery.cpp.

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

Constructor for cloning s.

Definition at line 86 of file grocery.cpp.

Member Function Documentation

virtual Space* Grocery::copy ( bool  share)
inlinevirtual

Copy during cloning.

Definition at line 92 of file grocery.cpp.

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

Print solution.

Reimplemented from Gecode::Driver::ScriptBase< BaseSpace >.

Definition at line 98 of file grocery.cpp.

Friends And Related Function Documentation

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

Main-function.

Definition at line 107 of file grocery.cpp.

Member Data Documentation

IntVarArray Grocery::abcd
protected

The price of each item.

Definition at line 63 of file grocery.cpp.

const int Grocery::s = 711
staticprotected

Sum and product of prices.

Definition at line 65 of file grocery.cpp.

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

Decimal product of prices.

Definition at line 67 of file grocery.cpp.


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