Optimization23 12
Optimization23 12
Techniques
for AI
Lecture
CS/AI 12
2101
Recap
Linear Programming
Simplex Method
Duality
Checking Optimality
Transportation Problem
u-v Method
Integer Programming
integer.
Mixed ILP- Some variables are restricted to be
…+ Inequalit
y
…+ Constrai
….. nts
n >>
…+ m
…, NonNegative Constraints
PLP PILP
Max z = 5x1 + Max z = 5x1 +
8x2 8x2
s.t. x1 + x2 6 s.t. x1 + x2 6
5x1 + 9x2 45 5x1 + 9x2 45
x1 , optimal
the x2 ≥ 0 x1 , x2 ≥ function
value of the objective 0 of PLP
P
z*ILP the optimal value of theinteger
objective
function of PILP
Can we find a technique to solve PILP if we
know the solution technique of PLP
Linear ProgrammingP
LP
Max z = 5x1 + 8x2
6
x1 + x2 = 6 s.t. x1 + x2 6
5 5x1 + 9x2 45
x1 , x2 ≥ 0
4 (2.25, 3.75)
Z=41.25
2 5x1 + 9x2 = 45
1
Z=20
0 1 2 3 4 5 6 7 8
Integer Linear Programming
PILP
Max z = 5x1 + 8x2
6
x1 + x2 = 6 s.t. x1 + x2 6
5 5x1 + 9x2 45
x1 , x2 ≥ 0 integer
4 (2.25, 3.75)
Z=41.25
2 5x1 + 9x2 = 45
1
Z=20
0 1 2 3 4 5 6 7 8
Strategy I
Given an Integer Linear Programming
Problem PILP to find optimal solution x*ILP
and optimal value z*ILP
PPILP PPLP x*
x*LP and
andz*z*
LP
ILP Ignore Relx Solve Relx Relx
Relax any Solve
integer PLP
constraint PRelx
constraints
Known Algo
Relaxati
on
Yes
x*ILP = x*LP Is x*LPx*
Does integer?
Relx satisfy
N
o
Our Example
PILP PLP
Max z = 5x1 + Max z = 5x1 +
8x2 8x2
s.t. x1 + x2 6 s.t. x1 + x2 6
5x1 + 9x2 45 5x1 + 9x2 45
x1 , x 2 ≥ 0 x1 , x 2 ≥ 0
x* LP =(x1,
integer x2) = (2.25, 3.75) is the
optimal solution of the PLP
It is not integral.
z*LP =41.25 .
Strategy II
4 x1 , x 2 ≥ 0
(1.8, 4)integer NOTE- x2*Subproblem
LP = x *ILP
2
2 and
z2*LP = z2*ILP
P2ILP
3 (3, 3)
Max z = 5x1 +
8x2
2 s.t. x1 + x2 6
5x1 + 9x2 45
1 Z=39 x2 3
x1 , x 2 ≥ 0
0 integer
1 2 3 4 5 6 7 8
3 Important Concepts for
solving
Relaxation
Solving Relaxed problem by simpler
method
Subproblem Generation
Relaxation and its effect-
Bound
Any optimization problem P – Maximize z= f(x) subject to
constraints C
In a general sense, Constraints C consists of several kind of
constraints; linear/nonlinear, inequality constraints, non-
negativity constraints, integer constraints.
A feasible set- set of values of x satisfying the constraints, say
Feasible(C)
Relaxation – to ignore some of the constraints in C, relaxing
the set of constraints resulting in another optimization
problem.
We get a different feasible set when C is relaxed to get C’;
Feasible (C ) Feasible(C’) .
∈ [ 0, 1] for all i = 1, 2, …, n
Relaxation
A primary
assumption is that
the relaxed
problem is easier
to solve
Simple Technique to Solve
Psimple
A LP technique to solve LP-relaxed Knapsack
Problem PLP
Technique to solve
1. Arrange the variables in the decreasing order of
the ratio as follows.
2. Choose the largest k such that
3. Assign , for i =1, 2, .., k
PLP
Maximize z = 8x1 + 11x2 + 6x3 + 4x4
5x1 + 7x2 + 4x3 + 3x4 ≤ 14 STEP 3a
xi ∈ [ 0, 1] for all i = 1, 2, 3, 4
Assign , for i =1, 2, .., k ,
STEP 1
STEP 3b
,,,
Check that the variables
are arranged as
STEP 2
Choose the largest k such that
k = 1, means (=5) is less than (=14)
k = 2, means , 5+7 is less than 14
k=3, means , 5+7+4 is not less than 14
PLP
Maximize z = 15x1 + 100x2 + 90x3 + 60x4 +40x5 + 15x6 + 10x7 + 1x8
2x1 + 20x2 + 20x3 + 30x4 +40x5 + 30x6 + 60x7 + 10x8 ≤ 102
xi ∈ [ 0, 1] for all i = 1, 2, …, 8
,,,,,,,
Ignore
integer Solve
P(0,1) constraints PLP PLP x*LP and z*LP
Max z = 8x1 + 11x2 + Max z = 8x1 + 11x2 +
6x3 + 4x4 6x3 + 4x4
5x1 + 7x2 + 4x3 + 3x4 ≤ 5x1 + 7x2 + 4x3 + 3x4 ≤
14 14
xi ∈ { 0, 1} for all i = xi ∈ [ 0, 1] for all i =
1, 2, 3, 4 1, 2, 3, 4
Is x*LP integer?
N
o
Strategy II P1(0, 1)
x3 =
x3 = 0
1
P2(0, 1)
P1
(0, 1)
x2 =
x2 = 0
1