99 template<
class Script>
118 element(*
this, open, supplier[s], 1);
175 os <<
"\tSupplier: " << supplier << std::endl
176 <<
"\tOpen warehouses: " << open << std::endl
177 <<
"\tStore cost: " << c_store << std::endl
178 <<
"\tTotal cost: " << c_total << std::endl
196 c_open =
expr(*
this,
sum(open));
197 c_stores =
expr(*
this,
sum(c_store));
202 c[0] = c_open; c[1] = c_stores;
218 os <<
"\tSupplier: " << supplier << std::endl
219 <<
"\tOpen warehouses: " << open << std::endl
220 <<
"\tOpen cost: " << c_open << std::endl
221 <<
"\tStores cost: " << c_stores << std::endl
237 opt.
parse(argc,argv);
238 switch (opt.
model()) {
240 IntMinimizeScript::run<SumCostWarehouses,BAB,Options>(
opt);
243 IntLexMinimizeScript::run<LexCostWarehouses,BAB,Options>(
opt);
BoolVarArray open
Is a warehouse open (warehouse needed)
const int c_supply[n_stores][n_warehouses]
Cost for supply a store by a warehouse.
virtual void print(std::ostream &os) const
Print solution.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
IntVar c_stores
Cost for stores.
virtual IntVar cost(void) const
Return solution cost.
virtual IntVarArgs cost(void) const
Return solution cost.
virtual void print(std::ostream &os) const
Print solution.
Model with cost defined lexicographically.
IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl)
Select variable with largest min-regret.
virtual Space * copy(void)
Copy during cloning.
LexCostWarehouses(LexCostWarehouses &s)
Constructor for cloning s.
Parametric base-class for scripts.
void iterations(unsigned int i)
Set default number of iterations.
int main(int argc, char *argv[])
Main-function.
const int n_warehouses
Number of warehouses.
Gecode::FloatVal c(-8, 8)
Model with cost defined as sum.
Example: Locating warehouses
IntValBranch INT_VAL_MIN(void)
Select smallest value.
void update(Space &home, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
Passing integer variables.
Passing integer arguments.
Warehouses(const Options &opt)
Actual model.
BoolVar expr(Home home, const BoolExpr &e, IntPropLevel ipl)
Post Boolean expression and return its value.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Warehouses(Warehouses &s)
Constructor for cloning s.
IntVarArray supplier
Which warehouse supplies a store.
SumCostWarehouses(const Options &opt)
Actual model.
SumCostWarehouses(SumCostWarehouses &s)
Constructor for cloning s.
Domain propagation Options: basic versus advanced propagation.
void solutions(unsigned int n)
Set default number of solutions to search for.
const int n_stores
Number of stores.
virtual Space * copy(void)
Copy during cloning.
void model(int v)
Set default model value.
Gecode toplevel namespace
LinFloatExpr sum(const FloatVarArgs &x)
Construct linear float expression as sum of float variables.
LexCostWarehouses(const Options &opt)
Actual model.
const int capacity[n_warehouses]
Capacity of a single warehouse.
IntVar c_open
Cost for open warehouses.
IntVar c_total
Total cost.
const int c_fixed
Fixed cost for one warehouse.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
IntVarArray c_store
Cost of a store.