Go to the documentation of this file.
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));
201 return {c_open, c_stores};
216 os <<
"\tSupplier: " << supplier << std::endl
217 <<
"\tOpen warehouses: " << open << std::endl
218 <<
"\tOpen cost: " << c_open << std::endl
219 <<
"\tStores cost: " << c_stores << std::endl
238 IntMinimizeScript::run<SumCostWarehouses,BAB,Options>(
opt);
241 IntLexMinimizeScript::run<LexCostWarehouses,BAB,Options>(
opt);
LinFloatExpr sum(const FloatVarArgs &x)
Construct linear float expression as sum of float variables.
Model with cost defined as sum.
LexCostWarehouses(const Options &opt)
Actual model.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
LexCostWarehouses(LexCostWarehouses &s)
Constructor for cloning s.
virtual IntVar cost(void) const
Return solution cost.
Passing integer variables.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
Warehouses(Warehouses &s)
Constructor for cloning s.
IntVarArray supplier
Which warehouse supplies a store.
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 iterations(unsigned int i)
Set default number of iterations.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
IntVar c_stores
Cost for stores.
virtual void print(std::ostream &os) const
Print solution.
Model with cost defined lexicographically.
Gecode toplevel namespace
virtual Space * copy(void)
Copy during cloning.
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
virtual IntVarArgs cost(void) const
Return solution cost.
BoolVarArray open
Is a warehouse open (warehouse needed)
Parametric base-class for scripts.
IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl)
Select variable with largest min-regret.
Domain propagation Options: basic versus advanced propagation.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
const int capacity[n_warehouses]
Capacity of a single warehouse.
const int c_fixed
Fixed cost for one warehouse.
const int c_supply[n_stores][n_warehouses]
Cost for supply a store by a warehouse.
IntVarArray c_store
Cost of a store.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
IntVar c_open
Cost for open warehouses.
const int n_warehouses
Number of warehouses.
SumCostWarehouses(const Options &opt)
Actual model.
const int n_stores
Number of stores.
void update(Space &home, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
void solutions(unsigned int n)
Set default number of solutions to search for.
int main(int argc, char *argv[])
Main-function.
Gecode::FloatVal c(-8, 8)
IntVar c_total
Total cost.
virtual void print(std::ostream &os) const
Print solution.
void model(int v)
Set default model value.
SumCostWarehouses(SumCostWarehouses &s)
Constructor for cloning s.
Example: Locating warehouses
Passing integer arguments.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
virtual Space * copy(void)
Copy during cloning.
Warehouses(const Options &opt)
Actual model.