Example: Locating warehouses More...
Public Member Functions | |
Warehouses (const Options &opt) | |
Actual model. | |
Warehouses (Warehouses &s) | |
Constructor for cloning s. | |
![]() | |
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. | |
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 std::ostream & | select_ostream (const char *sn, std::ofstream &ofs) |
Choose output stream according to sn. | |
template<class Script , template< class > class Engine, class Options > | |
static void | run (const Options &opt, Script *s=NULL) |
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.
|
inline |
Actual model.
Definition at line 110 of file warehouses.cpp.
|
inline |
Constructor for cloning s.
Definition at line 140 of file warehouses.cpp.
|
related |
Main-function.
Definition at line 228 of file warehouses.cpp.
|
protected |
Which warehouse supplies a store.
Definition at line 103 of file warehouses.cpp.
|
protected |
Is a warehouse open (warehouse needed)
Definition at line 105 of file warehouses.cpp.
|
protected |
Cost of a store.
Definition at line 107 of file warehouses.cpp.