Warehouses< Script > Class Template Reference
Example scripts (models)

Example: Locating warehouses More...

## Public Member Functions

| Warehouses (const Options &opt)
| Actual model.
| Warehouses (Warehouses &s)
| Constructor for cloning s.
Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > >
| ScriptBase (const Options &opt)
| Constructor.
| ScriptBase (ScriptBase &e)
| Constructor used for cloning.
virtual void | print (std::ostream &os) const
| Print a solution to os.
virtual void | compare (const Space &home, std::ostream &os) const
| Compare with s.
Public Member Functions inherited from Gecode::Driver::IgnoreStepOption< BaseSpace >
| IgnoreStepOption (const Options &)
| Constructor.
| IgnoreStepOption (BaseSpace &e)
| Constructor used for cloning.

## Protected Attributes

IntVarArray | supplier
| Which warehouse supplies a store.
BoolVarArray | open
| Is a warehouse open (warehouse needed).
IntVarArray | c_store
| Cost of a store.

## Related Symbols

(Note that these are not member symbols.)
int | main (int argc, char *argv[])
| Main-function.

## Additional Inherited Members

Static Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > >
static std::ostream & | select_ostream (const char *sn, std::ofstream &ofs)
| Choose output stream according to sn.
static void | run (const Options &opt, Script *s=NULL)

## Detailed Description

template<class Script>
class Warehouses< Script >

Example: Locating warehouses

A company needs to construct warehouses to supply stores with goods. Each warehouse possibly to be constructed has a certain capacity defining how many stores it can supply. Constructing a warehouse incurs a fixed cost. Costs for transportation from warehouses to stores depend on the locations of warehouses and stores.

Determine which warehouses should be constructed and which warehouse should supply which store such that overall cost (transportation cost plus construction cost) is smallest.

Taken from: Pascal Van Hentenryck, The OPL Optmization Programming Language, The MIT Press, 1999.

See also problem 34 at http://www.csplib.org/.

Note that "Modeling and Programming with Gecode" uses this example as a case study.

Definition at line 100 of file warehouses.cpp.

## Constructor & Destructor Documentation

## Warehouses() [1/2]

template<class Script>

Warehouses< Script >::Warehouses | ( | const Options & | opt | ) |

inline

Actual model.

Definition at line 110 of file warehouses.cpp.

## Warehouses() [2/2]

template<class Script>

Warehouses< Script >::Warehouses | ( | Warehouses< Script > & | s | ) |

inline

Constructor for cloning s.

Definition at line 140 of file warehouses.cpp.

## Friends And Related Symbol Documentation

## main()

template<class Script>

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

related

Main-function.

Definition at line 228 of file warehouses.cpp.

## Member Data Documentation

## supplier

template<class Script>

IntVarArray Warehouses< Script >::supplier

protected

Which warehouse supplies a store.

Definition at line 103 of file warehouses.cpp.

## open

template<class Script>

BoolVarArray Warehouses< Script >::open

protected

Is a warehouse open (warehouse needed).

Definition at line 105 of file warehouses.cpp.

## c_store

template<class Script>

IntVarArray Warehouses< Script >::c_store

protected

Cost of a store.

Definition at line 107 of file warehouses.cpp.

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

- examples/warehouses.cpp