0% found this document useful (0 votes)
10 views57 pages

Day7 8 - Lp-Upt

The document provides an introduction to linear programming (LP) and integer linear programming (ILP), outlining their definitions, components, and various modeling techniques. It discusses methods for solving LP problems, including the simplex algorithm and alternative approaches, as well as applications in scheduling, logistics, and transportation. Additionally, it covers specific examples and formulations for optimization problems, including production planning and facility location problems.

Uploaded by

ana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views57 pages

Day7 8 - Lp-Upt

The document provides an introduction to linear programming (LP) and integer linear programming (ILP), outlining their definitions, components, and various modeling techniques. It discusses methods for solving LP problems, including the simplex algorithm and alternative approaches, as well as applications in scheduling, logistics, and transportation. Additionally, it covers specific examples and formulations for optimization problems, including production planning and facility location problems.

Uploaded by

ana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Introduction to linear

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.

Un program is convex if the optimization function is convex and the domain


defined by the constraints is also convex : then, any local optimum is
also a global optimum and it is achieved at some extreme point of the
domain.
A real-valued function f(x) defined on an interval is called convex if the
graph of the function lies below the line segment joining any two points
of the graph.

A linear program is a convex program.


A linear program
• There can be distinguished:
– Decision variables
– Objective (or optimization) function
– Constraints;
– Domain of variables;
A linear program
General case
Suppose that a linear program is composed of :
- The objective function of n variables xj (maximization) ;
- All variables take positive values.
- The constraints are linear functions bounded by some constant

n
z  cjxj
That is :
Max
Interpretation : j 1

n activities, m resources… s.c. A11 x1  A12 x 2 ...  A1n x n  b1 ;


A21 x1  A22 x 2 ...  A2 n x n  b2 ;
...
Am1 x1  Am 2 x 2 ...  Amn x n  bm ;
x1, x2, ..., xn ,  0.
Geometrical interpretation

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.

• How to solve linear programming :


– The simplex algorithm (1951, 1963), developed by George Dantzig, solves LP
problems by constructing an admissible solution at a vertex of the polyhedron
and then walking along edges of the polyhedron to vertices with successively
higher values of the objective function until the optimum is reached. (CPLEX,
EXPRESS-MP, etc.).

– 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 domain formed by linear constraints gives a polyhedron, and the


search for optimal solutions can be restricted to extreme points.

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

The unitary benefits for A et B are respectively 20 € and 10 €.


A simple example (II)
Primal PL : Dual :
Max 20A + 10B Min 200a + 100b
Subject to : Subject to :
2A + 2B  200; 2a + 3b  20;
3A + B  100; 2a + b  10;
A  0 et B  0; a  0 et b  0;

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 :

lower and upper bounds;

render inequalities to equalities;

express unsigned variables as nonnegative ones;


Linear program modeling
Expressing the objective function:
– maxmin or minmax functions;
• Let be given variables x 1, x2, …, xn. The objective function consists
in maximizing the minimum of them.
– Intro duce a new variable y which is a lower bound of xj;
– The objective function becomes: Max y;

– “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;

– Mass balance 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.

• How to solve integer linear programming :


– Cutting planes, Branch and bound methods, branch and
cut…
Modeling by binary variables
Linear programming modeling
Modeling constraints in scheduling problems:
disjunctive constraints :
task A before task B or task B before task A;
conjunctive constraints;
task A before task B; or task A before B and C…

Expressing disjunctive constraints:


Scheduling problems
Problem formalization:
Data: tasks (ready time, processing time, due time), number of machines,
precedence constraints, preemption, etc …

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}

– Objective function: minimize the completion time (makespan), total


lateness, number of delayed tasks, etc.

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.

january february march april may june july

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

Mass conservation constraints :


For i from 1 to 6 : si-1 + xi + yi = Di + si ;
Capacity constraint:
xi <= 30000 ;
Positivity and integrality constraints:
xi, yi, si >= 0 ; xi, yi, si are integers

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,

xi  0,1 i xi -> site i;


yi , j  0,1 i, j ,
yi,j -> demand j covered by i

z  0;
p-median problem
LP model:
Min q d
j
j
i
y
i, j i, j

y i
i, j  1; j

 x  p; i qj -> quantity of demand j;


y  xi , i, j
i
i, j
xi -> site i;
yi,j -> demand j covered by i
xi  0,1 i
yi , j  0,1 i, j ,
Facility location problems
• Facility location, is concerned with computing optimal
placement of facilities in order to minimize transportation
costs, satisfy client demands, outperform competitors'
facilities…
– Examples : medical urgency centers, distribution centers, placing
concentrators in a network... etc.
Warehouse facility location problem
Minimizing the total cost including installation cost and the
transport cost. Determine which sites/warehouse facilities
have to be installed and what quantities they should deliver
to each client.
LP model :
Min  f x  c
i
i i
i j
y
i, j i, j

y d
i
i, j j j

y j
i, j  Mxi i

xi  0,1 i
yi , j  0 i, j.

Deduce the signification of variables used in the above model.


A transportation program
The transportation problem deals with sources where a supply of some commodity
is available, and destinations where the commodity is demanded.

Example. Cars to rent


A company specialized in car’s rent has two garages with respectively 12 et 8 cars in
stock, and three rent shops demanding for respectively 8, 7 and 5 cars. The
unitary costs of transport are given in the following table. What would be the
transport plan of minimal cost ?

Garages Shops  1 2 3 Supply


 1 3 5 3 12
2 2 7 1 8
Demand 8 7 5

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+;

xij : decision variables : number of cars to be sent from i to j.

Exercise : Give the general LP model for the transportation program :


There are a1, a2, ... , am units in the warehouses 1,2 ,..., m. We want
to transport these units to the destinations 1,2 ,..., n where the
requests b1, b2 ,..., bn occur, with Σai = Σbj.

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:

Question. Find an hamiltonien cycle passing


through the vertices of dodécahédron.
TSP : LP formulation
To each arc (i,j), we associate some variable xij taking 1 if
(i,j) is included in the hamiltonian cycle and 0 otherwise.

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)
iS , jS
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;

xi , j  0,1 i, j. Min w x i, j i, j

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.

• Propose an ILP model.


The fair loading problem
Let be given N train wagons with a load capacity limited to P. We have m boxes
1,2, .., m with weights p1, p2, .., pm.
Question 1. Propose an ILP model for the assignment of boxes to wagons such
that minimizing the total weight of the most loaded wagon.
Question 2. Study the case with only two wagons and propose a simplified ILP
model.
Exercise
Employment planning for a restaurant

• The manager of a restaurant needs to ensure permanence


and service in his restaurant on the basis of some
statistics (say for day i (1≤i≤7), are needed ai employees):

• He needs to find the minimal number of employees when any


of them should work 5 consecutive days and next takes two
days of break. Give an LP model for this problem.
Resolution methods for ILP
Exact methods
branch and bound method
Initially proposed to solve ILP problems by Lang e&Doig (1960) and
Dakin (1965).
Principle. It combines the primal and dual simplex algorithm with
Branch and Bound principle.

Consider the maximization problem:


Max cx = z,
Ax = b
xjN, j=1..n
• Initialization : the relaxed problem gives the root of the tree S0
– solve the relaxed problem, if the solution is integer, END.
– otherwise, we obtain a default evaluation;
• continue with splitting.
Branching and bounding
• Branching:
– Split on xk that is not integer : xk ≤ xk and xk ≥ xk +1 ,
which gives two subsets (nodes) S’ et S’’;

• 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

Default evaluation : the best feasible (integer) solution


currently obtained (z0).

• Pruning rule: v(S)≤v(z0).


Example of B&B on a minimization
problem.
Example
The general branch and bound
method

• Principle. Branch and bound (B&B) consists of a


complete enumeration of all candidate solutions,
where subsets of fruitless candidates are discarded, by
using upper and lower estimated bounds of the
quantity being optimized.
The general Branch and bound
method
Consider a minimization problem:
– Principle: build a tree structure (the root could be the
associated relaxed problem).
– Split the set of feasible solutions in subsets that cover the
initial set (giving subproblems):
• Any infeasible subproblem is discarded;
• If possible compute the optimal solution for the subproblem, or a lower
bound (bounding);
– if it is larger than the current best solution, discard the subproblem
(pruning).
– Otherwise split again and repeat the procedure (branching).

Combined with cutting planes it gives the Branch and Cut algorithm (B&C).
An example
Solve the following binary LP:

Max 4x1 + 4x2 - 3x3


4x1 + 2x2 - x3 ≤ 7
6x1 + 2x2 + 3x3 ≤ 10
x1 + x2 - x3 ≤ 2
x1, x2, x3N.
Solvers and modelers
There are two types of products: solvers et modelers

• Solvers : specialized computer programs designated to solve


mathematical programs (linear or not)
– Freewares:
• Lp-solve, Lp_optimiser, SoPlex, Coin, PCx, Ms-excel solver …
– The others:
• CPLEX, XPRESS-MP, AIMMS, MINOS, OSL, LINDO, MPSIII…

• Modelers : designated to model the problem by non


specialists:
– (MPS, AMPL), recognized by most important solvers, allow also to analyze
and interpret the results …,
• Other modelers:
– AIMMS, GAMS, LINGO, LP-TOOLKIT, MathPro, MIMI, MINOPT, MPL, OMNI,
OPL Studio .
END

You might also like