Day7 8 - Lp-Upt
Day7 8 - Lp-Upt
programming
Linear programming
• Overview
– Mathematical and linear programs
– Linear programming and resolution methods;
– Modeling in (integer) linear programming;
• Scheduling problems;
• Optimization problems in logistics and transportation
• Examples, exercises.
– Integer linear programming: arborescent methods,
examples, exercises.
A linear program
• A mathematical program is an optimization problem with an objective
(or optimization) function of n-variables satisfying m constraints. If at
least one constraint or the objective function are not linear, it is called a
non-linear program, otherwise it is a linear program.
n
z cjxj
That is :
Max
Interpretation : j 1
max: Z = 2x1 + x2
Subject to: x1+2x2 7
x1+x2 5
x1 1
x1 4
xi 0
Introduction to linear
programming
Linear programming (LP) is a technique for optimization of a linear
objective function of variables x1, x2, …xn, subject to linear equality and
linear inequality constraints.
– Alternative methods :
• the ellipsoid method by Leonid Khachiyan in 1979
• In 1984, N. Karmarkar proposed a new interior point projective method
for linear programming. (Karmarkar's algorithm)
Simplex algorithm : basics
The simplex method explores extreme points and improves the value of
optimization function in each step.
Advantages :
Efficiency (not polynomial but polynomial-time in average).
Nice theoretical properties (duality).
A simple example (I)
Example. Determine the quantities to be produced such that all the production
constraints are satisfied and the benefit is maximized. We suppose that two
products A and B can be produced, each of them passing through cutting
and packing stages, respectively (C) and (P) :
Cutting Packing
Necessary time to produce 1 unity of A 2 hours 3 hours
Necessary time to produce 1 unity of B 2 hours 1 hours
Availability in working hours 200 hours 100 hours
Economic interpretation :
a will give the cost/price of one hour for the cutting process and b
the price for the packing one.
Linear program modeling
General cases :
– “multiplicative” functions
• Min 1/x => Max x;
• y=ax, where x binary variable and a [0, .., M].
– y <= a; y <= Mx; y >= a + (x-1)M.
– how to do when both binary variables ?
Linear program modeling
• Expressing constraints :
– Capacity constraints
• Usually they give rise to upper bound constraints;
– Demand constraints
• Usually they give rise to lower bound constraints;
– Proportion constraints
• a, b and c give all, and a is exactly 30%: a = 0,3 (a+b+c)
LP modeling techniques
N xj
j j
Min
D xj
j j
s.t. A x
j
ij j Ri i
1
Set : d ; yj d xj;
Dj xj
j
Obj.Function Min N
j
j yj
s.t. D j
j y j 1;
A y
j
j j dR i ;
Integer Linear Programming
Introduction to integer linear
programming
• Integer Linear Programming (ILP)
– An integer linear program is a linear programming problem
with variables taking values in Z.
– Binary or 0-1 linear programming problems are a special
case.
Problem modeling
– data: ri (ready time), pi (processing time), di (due time);
– Decision variables : ti (start date of execution), xij (execution order
between i and j), ci (completion execution time).
– Precedence/conjunctive constraints: task i before task j : ti + pi <= tj:
– Disjunctive constraints: ti + pi <= tj or tj + pj <= ti :
ti + pi <= tj + M(1-b) ; tj + pj <= ti + Mb ; b {0,1}
19
The one machine scheduling
problem
We consider the n-job one-machine scheduling problem with ready time ri,
processing time pi, and due time di for each job i. Preemption is not
allowed, and precedence constraints among jobs are not considered.
• Decision variables:
– xij (boolean variables): task i executed at the j-th order ;
– tj (>= 0) start time for task placed at order j ;
• LP formulation
f.obj. : Min tn + i xin*pi ;
s.t. for all i : j xij=1 ;
for all j :i xij=1 ;
for all j : tj >= i xij*ri ;
for all j : tj+1 >= tj + i xij*pi ;
for all j : tj + i xij*pi <= i xij*di ;
2
1
Examples in LP modeling
Problem. Computer production planning
The company ORDI produces laptops. Selling previsions (in thousands of unities)
for the next six months are reported in the following table. The production
capacity of the company is 30000 per month. It is possible to produce more at
higher cost, 300 Euros per piece instead of 250.
30 15 15 25 33 40 45
Selling previsions for the next six months
There are 2000 laptops in stock. The storing cost is of 25 Euros per unity for
what is in stock at the end of the month. We suppose that the stocking capacities
are unlimited. We begin at the 1st January. What is the production plan for the
next six months such that all demands are satisfied and the cost is minimized.
2
2
LP model
Decision variables :
xi : quantity produced with nominal tariff during month i ;
yi : quantity produced with secondary tariff during month i ;
si : stock of month i, and s0 initial stock (=2000) ;
Objective function:
Min (i xi*250 + i yi*300 + i si*25).
Modeling optimization problems in
logistics and transportation
Modeling optimization problems in
logistics and transportation
Related problems:
• Partitioning, generalized matching, covering, facility
location problems;
• Lp models for transportation problems:
– Transportation programs,
– Minimal cost flows and multiflows, vehicle routing problems,
etc.
Partitioning, covering
• Partitioning problems ask whether is possible to split a given set in subsets
satisfying some criteria.
– (bi)partition problem : the problem is to decide whether a given a set of
integers can be partitioned into two "halves" that have the same sum.
• Covering problems ask whether a certain combinatorial structure 'covers'
another, or how large the structure has to be to do that.
– A cover of a set X is a collection of sets such that X is a subset of the union of
sets in the collection. An exact cover is a subcollection such that each element
in X is contained in exactly one subset in it.
– The vertex cover problem : a vertex cover of a graph is a set of vertices such
that each edge of the graph is incident to at least one vertex of the set.
• Propose an ILP model for the vertex cover problem.
Covering problems
total cover
- Data:
n candidate sites (indexed by i)
m demands (indexed by j)
Dc maximum cover (reaching) distance.
constants (0,1) noted as aij indicating if j can be covered by i.
ci installation cost of i.
dij distances between any i and j.
Goal: compute which sites will be open such that all clients are covered at
minimal installation cost of sites.
PL01 Formulation:
Min c x
i
i i
a x 1
i, j i j
xi 0,1 i.
i
maximal cover
- It occurs when one wants to maximize the area/demand covered
when the number of allowed sites is bounded.
additional coefficients and variables:
p maximum number of sites allowed to be installed;
dj demand j (known data)
zj binary variable indicating if some j is covered.
PL01 formulation:
Max d z j
j j
zj a x i, j i j
i
x p
i
i
xi 0,1 i
z j 0,1 j.
p-center and p-median problems
Data:
- A set of demands/clients to satisfy
- A set of n sites, such that only p are allowed to open
- Distance dij between demands/clients and sites;
“p-center” problems
Goal:
– Where placing sites in order to minimize the maximal distance;
– Example : placing firestations, etc.
“p-median” problems
Goal:
– Minimize the average distance
– Example : distribution centers...
p-center problem
LP model:
Min z
y
i
i, j 1; j
x p;
i
i
yi , j xi , i, j
d
i
y z,
i, j i, j j,
z 0;
p-median problem
LP model:
Min q d
j
j
i
y
i, j i, j
y i
i, j 1; j
y d
i
i, j j j
y j
i, j Mxi i
xi 0,1 i
yi , j 0 i, j.
33
LP model
Minimize 3x1,1 + 5x1,2 +3x1,3 + 2x2,1 +7x2,2 + x2,3
Subject to:
x1,1 + x2,1 ≥ 8;
x1,2 + x2,2 ≥ 7;
x1,3 + x2,3 ≥ 5;
x1,1 + x1,2 + x1,3 ≤ 12;
x2,1 + x2,2 + x2,3 ≤ 8;
xi,j Z+;
34
Transportation program
transport unitary cost matrix supply
demand
Min c
i, j
x
i, j i, j
x
j
i, j ai i 1, ... , m
x
i
i, j bj j 1, ... , n
xi , j 0 i, j.
The TSP
In 1859, Sir W. R. Hamilton built a puzzle dodecahedron in wood. This
dodecahedron has 20 vertices and 12 faces:
Min d
i, j
x
i, j i, j
x
j
i, j 1 i 0, ... , n (a)
x i
i, j 1 j 0, ... , n (b)
xi , j 0,1 i, j.
x _
i, j 1 ui u j nxi , j n 1 1 i j n, ui N ; (c)
iS , jS
Path problems LP formulations
LP model for the shortest path problem
Min w
i
x
i, j i, j
(!) x
j succ i
i, j x ;
j prec i
j ,i i, j X , i, j s, t.
(!!) x
j succ s
s, j x
j prec t
j ,t 1;
x x
i
(!) i, j j ,i ; i, j X .
The directed cycle with minimum j succ i j prec i
weight/length is called the minimum
cycle mean.
(!!) x
all ( i , j )
i, j 1;
The LP formulation :
xi , j 0,1 i, j.
Maximum flow problem
Data: let be G=(X,U,C,s,t) where:
• X, a set of n nodes, U a set of m arcs, Cij capacity set on arc (i,j),
source s and sink t.
• A flow is an application de U to R+ :
– Satisfy capacity constraints (1)
– Kirchoff constraints (2)
Max F
(1) i , j Ci , j ; (i, j ) U .
(2)
j succ i
i, j
j prec i
j ,i ; i, j X , i, j s, t.
(3)
j succ s
s, j
j prec t
j ,t F;
Min cost flow problem
Data: let be given G=(X,U,C,w,s,t) with:
– X, a set of n nodes, U a set of m arcs, Cij capacity of arc (i,j)
and wij, unitary cost of use of arc (i,j). Let s and t be
respectively the source and the sink, and F the flow value
to be satisfied.
Min w i
i, j i, j
(!) i , j Ci , j ; (i, j ) U .
(!!)
j succ i
i, j
j prec i
j ,i ; i, j X , i, j s, t.
(!!!)
j succ s
s, j
j prec t
j ,t F;
Multi-commodity flow problem
Quite similar to the flow problem:
• Satisfy capacity constraints (!)
• Flow conservation (!!)
• Flow values to satisfy (!!!)
(!) i , j d i , j Ci , j ; (i, j ) U .
d
(!!)
j succ i
d
i, j
j prec i
d
j ,i ; i, j X , d D, i, j s d , t d .
(!!!) d
s, j d
j ,t Fd,
j succ s d j prec t d
A simple application to
telecommunications (I)
Minimum cost flow allocation problem
• Data:
– Network represented by G(X,U,D), where :
• X the set of nodes;
• U the set of arcs (i,j), with capacity Cij
• D the traffic demand, where Td give the demand traffic value to be satisfied
for commodity d.
• Goal:
– Determine a routing scheme in the network such that the capacity
constraints and traffic demands are both satisfied, while the use of
resources (bandwidth) over the network is minimized.
A simple application to
telecommunications (II)
LP formulation : Min
( i , j )U
i, j
j succ i
d
i, j
j prec i
d
j ,i ; i, j X , d D, i, j s d , t d .
s, j
d
d
j , t F d
, d D.
j succ s d j prec t d
i , j d i , j Ci , j ; (i, j ) U .
d
d i , j 0; (i, j ) U , d D.
The art gallery problem
• The art gallery or museum problem originates from a real-
world problem of guarding an art gallery with the minimum
number of guards which together can observe the whole
gallery.
• Evaluation:
– Solve the associated relaxed LP problems :
• PLS’ = PLS + xk ≤ xk ;
• PLS’’ = PLS + xk ≥ xk +1 ;
Branching and bounding
• Node examination choice
– Breadth first
– Depth first
Combined with cutting planes it gives the Branch and Cut algorithm (B&C).
An example
Solve the following binary LP: