TA9

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

9TA

ILP –Integer linear programing


algorithm Branch and Bound
And sensitivity analysis - rehersal

1 System analysis – spring 5778


Integer linear programing

• In many LPs, the decision variables must be integers,


e.g.:
– The number of airplanes that an airline company wish to buy.
– The number of hired personal.
– The number of production machines in a factory.
• In this case, a solution with non-integer decision
variables’ values is meaning less, thus we will look for
the best integer solution.
• One of the methods for solving ILP is the Branch &
Bound method.
Example 1 – maximum benefit
• The next problem is given:
max P  6x1  8x2
s.t.
30x1  20x2  310
5x1 10x2  113
0  x1 , x2  I

• Solve the problem, using the Branch & Bound


algorithm.
Step 1 – solving a regular LP problem

Problem 1
max P  6x1  8x2
s.t.
30x1  20x2  310
5x1 10x2  113
0  x1 , x2
16

15

14

13

12

11
Problem 1 solution:
10

9 x1  4.2
8 x2  9.2 ‫ ץוליא‬1
1Const
‫ ץוליא‬2
2Const
7
P  98.8
6

0
0 5 10 15 20 25
Step 2 – dividing the original problem to two
Branch-Problems
If we got a non integer solution, we will arbitrarily choose one of the
non-integer variables and solve 2 sub-problems – each problem is
with an additional constraint.
• We will choose to branch in relation to x1.
x1  4.2
x1  4 x1  5

Problem 2 Problem 3

max P  6x1  8x2 max P  6x1  8x2


s.t. s.t.
30x1  20x2  310 30x1  20x2  310
5x1 10x2  113 5x1  10x2  113
x1  4 x1  5
x1 , x2  0 x1 , x2  0
B&B
tree
Problem 2

x1  4
Problem 1
x1  4.2
x2  9.2
P  98.8
Problem 3
x1  5
16
x1  5
15

14 x1  4 Problem 2 solution:
13
x1  4
12
x2  9.3
11
P  98.4
10

9 ‫ ץוליא‬1
1Const
‫ ץוליא‬2
2Const
8 Problem 3 solution: ‫ ץוליא‬3
3Const
4 ‫ץוליא‬4
Cons
x1  5
7

x2  8
6

P  94
5
Problem 2
4

2
Problem 3
1

0
0 5 10 15 20 25
B&B
tree
We found an integer
solution to the
Problem 2
x1  4 problem, may we stop
x1  4 x2  9.3
the algorithm?
Problem 1 P  98.4
x1  4.2
x2  9.2
P  98.8
Problem 3
x1  5 x1  5
x2  8
P  94

Integer solution
Best-solution-so-far
• We must continue with a new developing point.
• For the next developing, we are choosing the best non
integer solution so far, and choosing a non integer
variable from that solution : x2
• Splitting the problem to two:
x2  9.3
x2  9 x2  10
Problem 4 Problem 5

max P  6x1  8x2 max P  6x1  8x2


s.t. s.t.
30x1  20x2  310 30x1  20x2  310
5x1  10x2  113 5x1 10x2  113
x1  4 x1  4
x2  9 x2  10
x1 , x2  0 x1 , x2  0
B&B
tree Problem 4

x2  9
Problem 2
x1  4
x1  4 x2  9.3
Problem 5
Problem 1 P  98.4
x1  4.2
x2  9.2 x2  10
P  98.8
Problem 3
x1  5 x1  5
x2  8
P  94

Integer solution
Best-solution-so-far
16
x1  2.6
15 Problem 5 solution:
14
x2  10
13
P  95.6

x1  4
12
Problem 4 solution:
x2  9
11
Prob 5
x2  10 10
P  96 ‫ ץוליא‬1
1 Const
x2  9 9 ‫ ץוליא‬2
2 Const
‫ ץוליא‬3
3 Const
8 Problem 3 solution: 4 Const
‫ ץוליא‬4
5 ‫ ץוליא‬5
Const
x1  5
7
6 Const
‫ ץוליא‬6

x2  8
6

5
Problem 4 P  94
4

2
Problem 3
1

0
0 5 10 15 20 25
B&B
tree Problem 4
x1  4 Optimal Solution of

x2  9
original integer
x2  9 problem
Problem 2 P  96
x1  4 Integer solution Best-solution-so-far
x1  4 x2  9.3
Problem 5
Problem 1 P  98.4
x1  2.6
x1  4.2
x2  9.2
x2  10 x2  10
P  95.6
P  98.8
Problem 3
x1  5 x1  5
x2  8 Do we need to
P  94 continue and
develop
Problem 5?
Branch & Bound algorithm – summary
• The ILP solution is bounded by the LP solution.
• At any step In the solution, a constraint is added, so
the solution can’t improve.
• At any step, we will choose a to develop the branch
with the best bound:
– Smallest solution (bound) value ➔ In a minimum problem.
– largest solution (bound) value ➔ In a maximum problem.
• Branch Blocking –In the following scenarios we’ll stop
developing a branch:
– We got an integer solution.
– We’ve already got a better integer solution on another branch.
– There is no solution to this branch (in this case it is clear that if
we add more constraints there will be no solution).
Example 2 – minimum cost
• Solve this minimum cost problem:

min C  4x1  3x2  5x3


s.t.
2x1  2x2  4x3  7
2x1  4x2  2x3  5
x1, x2 , x3  0 integers
Example 2 – minimum cost
• Step 1 – Ignore the integer term, and solve a regular LP problem:

Problem 1
5
min C  4x1  3x2  5x3 x1  2
6
s.t. x2  0
2x1  2x2  4x3  7 1
x3 
2x1  4x2  2x3  5 3
x1 , x2 , x3  0 C  13

Two variables x1 , x3 have non integer values.


We’ll arbitrarily choose x1 :
Problem 2 x1  2

Problem 3 x1  3
Example 2 – B & B tree

Problem 2
x1  2
5
x 
x1  2 2
6
1
x 1
Problem 1 3
6
5
x 2 C  16
1
1
6 3
x2  0
1
x
3
3
C  13 Problem 3
x1  3 x1  3
x2  0
1
x3 
4
1
C  13
4
Developing problem 3
• Problem 3 has the lowest Z value, that’s why we will choose to develop
this branch:
Problem 4 x3  0 or x3  0

Problem 5 x3  1
Problems 4 and 5 include the original problem’s constraints, with the
additional constraint of problem 3:

x1  3 
Example 2 – B & B tree

Problem 2
x1  2
5
x 
x1  2 2
6
x 1
1 Problem 4
Problem 1 3
6 1
1 x 3
5 C  16
x1  2 1
2
x2  0
6 3 x3  0 x2  0
x3  0
x3 
1
3
or C  14
Problem 3
C  13
x1  3 x1  3
x3  0
x2  0

x3 
1 Problem 5
4 x1  3
1
C  13
x3  1
1
4 x2 
4
x3  1
3
C  17
4
Developing problem 4
Between problems 2,4,5 – problem 4 has the best value C=14

Problem 6 x1  3

Problem 7 x1  4
Example 2 – B & B tree

Problem 6
Problem 2
x1  2
x 
5
x1  3 infeasible
x1  2 2
6
x 1
1 Problem 4
Problem 1 3
6
1
5 1 x1  3
x1  2 C  16
x3  0
2
6 3
x2  0
x2  0
x3  0 Problem 7
x3 
1
3
or C  14
x1  4
C  13
x1  3
Problem 3
x3  0 x1  4 x2  0
x1  3
x2  0 x3  0
x3 
1 Problem 5 C  16
4 x1  3
1
C  13
x3  1
1
4 x2  Integer solution
4
Upper bound = 16
x3  1
Optimal
3
C  17
4
System analysis –term A exam – spring 5772 -014004
Question 2)20%(
The following binary problem is given:
Min 2 x1 - x2 + 7 x3 + 3 x4 + 2 x5
s.t. x1 - 2 x2 + 4 x3 + 2 x4 - x 5 ≥ 1
- 2x1 + x2 + 4 x3 + 2 x4+ 4x 5 ≥ 8
x1 , x2 , x3 , x4 , x5 {0,1}
Displayed below is a partial B & B solution tree:

X*= (0, 2/3, 1/3, 1, 1)


prob
0
x2= 0 x2= 1

prob
prob X*= (0, 1, 9/20, 1, 4/5)
1
2
X*= (0, 0, 1/2, 1, 1) x3= 0 x3= 1

prob prob
3 4
Non feasible region X*= (0, 1, 1, 0, 3/4)
Required:
• calculate the lower bounds of each problem.
•Show the developing of problem 4 (problems 5 and 6) Home ex.
•Explain – does the solution you get is optimal? (bonus)
Sensitivity analysis

1. Solve the dual and primal problems. Decision variables and optimal solution.

2. What is the validity range of b1?

3. What is the reduced cost of x1? Explain the meaning of this value

4. What is the shadow price of constraint 1 in the dual problem? Explain the meaning of this

value
initial
x1 x2 x3 x4 s1 s2 RHS

s1 2 1 1 0 1 0 40

s2 1 -1 2 5 0 1 20

Z’ -10 -10 -15 -8 0 0 Z’

Optimal

x1 x2 x3 x4 s1 s2 RHS

x2 1 1 0 -5/3 2/3 -1/3 20

x3 1 0 1 5/3 1/3 1/3 20

Z’ 15 0 0 1/3 11 2/3 5/3 Z’+500

You might also like