FICO Xpress Optimization Examples Repository
 FICO Optimization Community FICO Xpress Optimization Home

Ground transport

Description
E‑1 E‑2 E‑3 Problem name and type, features Difficulty Car rental: Transport problem *** data preprocessing, set operations, sqrt and ^2, if-then-elif Choosing the mode of transport: Minimum cost flow ** formulation with extra nodes for modes of transport; encoding of arcs, finalize, union of sets, nodes labeled with strings Depot location: Facility location problem *** modeling flows as fractions, definition of model cuts Heating oil delivery: Vehicle routing problem (VRP) **** elimination of inadmissible subtours, cuts; selection with `|', definition of model cuts Combining different modes of transport *** modeling implications, weak and strong formulation of bounding constraints; triple indices Fleet planning for vans *** maxlist, minlist, max, min

Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 10: Ground transport

Source Files

Data Files

e3depot.mos

```(!******************************************************
Mosel Example Problems
======================

file e3depot.mos
````````````````
Depot location

(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)

! 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)
if(getsol(fflow(d,c))>0) then
writeln(strfmt(d,2), " -> ", strfmt(c,2), ": ",
strfmt(getsol(fflow(d,c))*DEM(c),3) )
end-if

end-model

```