| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ground transport Description
Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 10: Ground transport
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
Data Files
e3depot.mos (!****************************************************** Mosel Example Problems ====================== file e3depot.mos ```````````````` Depot location A company is planning to open new locations to supply its sales centers. Each new location has a fixed set-up cost. Each delivery from supply location to sales center has a distance dependent delivery cost. There are 12 possible new locations to supply 12 sales centers. Demand for sales centers can be met by multiple supply locations. Which locations should be opened to meet demand but also minimize total cost of set-up and delivery? The model formulation represents flows as fraction (percentage) of the demand (variables 'fflow'). It also shows how redundant constraints can be stated as model cuts (=additional constraints that do not form part of the problem matrix). (c) 2008 Fair Isaac Corporation author: S. Heipcke, Mar. 2002 *******************************************************!) model "E-3 Depot location" uses "mmxprs" declarations DEPOTS = 1..12 ! Set of depots CUST = 1..12 ! Set of customers COST: array(DEPOTS,CUST) of integer ! Delivery cost CFIX: array(DEPOTS) of integer ! Fix cost of depot construction CAP: array(DEPOTS) of integer ! Depot capacity DEM: array(CUST) of integer ! Demand by customers fflow: array(DEPOTS,CUST) of mpvar ! Perc. of demand supplied from depot build: array(DEPOTS) of mpvar ! 1 if depot built, 0 otherwise end-declarations initializations from 'e3depot.dat' COST CFIX CAP DEM end-initializations ! Objective: total cost TotCost:= sum(d in DEPOTS, c in CUST) COST(d,c)*fflow(d,c) + sum(d in DEPOTS) CFIX(d)*build(d) ! Satisfy demands forall(c in CUST) sum(d in DEPOTS) fflow(d,c) = 1 ! Capacity limits at depots forall(d in DEPOTS) sum(c in CUST) DEM(c)*fflow(d,c) <= CAP(d)*build(d) ! Additional constraints: ! If there is any delivery from depot d, then this depot must be built (! declarations ModCut: array(DEPOTS,CUST) of linctr end-declarations forall(d in DEPOTS, c in CUST) do ModCut(d,c):= DEM(c) * fflow(d,c) <= CAP(d) * build(d) setmodcut(ModCut(d,c)) end-do !) forall(d in DEPOTS) build(d) is_binary forall(d in DEPOTS, c in CUST) fflow(d,c) <= 1 ! Uncomment the following line to see the Optimizer log ! setparam("XPRS_VERBOSE",true) ! Solve the problem minimize(TotCost) ! Solution printing writeln("Total cost: ", getobjval) forall(d in DEPOTS, c in CUST | getsol(fflow(d,c))>0) writeln(strfmt(d,2), " -> ", strfmt(c,2), ": ", strfmt(getsol(fflow(d,c))*DEM(c),3) ) end-model | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
© Copyright 2024 Fair Isaac Corporation. |