Assignment 1 - Opti 2 - Report
Assignment 1 - Opti 2 - Report
DEPARTMENT OF MATHEMATICS
ASSIGNMENT 1
Network Simplex method and Upper Bound
technique for Minimum Cost Flow Problems
Subject: Optimization 2
2
I. Introduction
1. Minimum cost flow problems
If
𝑏𝑖 > 0 then node i is a supply node
The objective is to minimize the total cost of sending the available supply
through the network to satisfy the given demand. Therefore the linear
programming formulation of this problem is:
𝑛 𝑛
Minimize: 𝑍 = ∑ ∑ 𝑐𝑖𝑗𝑥𝑖𝑗
𝑖 = 1 𝑗=1
subject to:
𝑛 𝑛
∑ 𝑥𝑖𝑗 − ∑ 𝑥𝑗𝑖 = 𝑏𝑖
𝑗=1 𝑗=1
and
0 ≤ 𝑥𝑖𝑗 ≤ 𝑢𝑖𝑗
For a minimum cost flow problem to have any feasible solutions then:
𝑛
∑ 𝑏𝑖 = 0
𝑖=1
3
An example:
Minimize: 𝑍 = 2𝑥𝐴𝐵 + 4𝑥𝐴𝐶 + 9𝑥𝐴𝐷 + 3𝑥𝐵𝐶 + 𝑥𝐶𝐸 + 3𝑥𝐷𝐸 + 2𝑥𝐸𝐷
subject to:
𝑥𝐴𝐵 + 𝑥𝐴𝐶 + 𝑥𝐴𝐷 = 50
− 𝑥𝐴𝐵 + 𝑥𝐵𝐶 = 40
− 𝑥𝐴𝐶 − 𝑥𝐵𝐶 + 𝑥𝐶𝐸 = 0
− 𝑥𝐴𝐷 + 𝑥𝐷𝐸 − 𝑥𝐸𝐷 =− 30
− 𝑥𝐶𝐸 − 𝑥𝐷𝐸 + 𝑥𝐸𝐷 =− 60
and
𝑥𝐴𝐵 ≤ 10, 𝑥𝐶𝐸 ≤ 80, 𝑎𝑙𝑙 𝑥𝑖𝑗 ≥ 0
with the network representation:
We can see that the above example can be solved by using linear
programming method and one of them is simplex method with the
simplex tableau. However, for these problems which can be re-written in a
network structure then the network simplex method is more transparent
and more productive. Network simplex method is a highly streamlined
4
version of the simplex method for solving minimum cost flow problems.
As such, it goes through the same basic steps at each iteration
- Finding the entering basic variable
- Determining the leaving basic variable
- Solving for the new BF solution — in order to move from the
current BF solution to a better adjacent one.
However, it executes these steps in ways that exploit the special network
structure of the problem without ever needing a simplex tableau. The
network flow simplex method will be explained in detail in Section III.
The upper bound technique will be used to deal efficiently with the arc
capacity constraints 𝑥𝑖𝑗 ≤ 𝑢𝑖𝑗.
In particular, as the entering basic variable is increased from zero, the
leaving basic variable is the first basic variable that reaches either its
lower bound (0) or its upper bound (𝑢𝑖𝑗). A nonbasic variable at its upper
bound 𝑥𝑖𝑗 = 𝑢𝑖𝑗 is replaced by 𝑥𝑖𝑗 = 𝑢𝑖𝑗 − 𝑦𝑖𝑗, so 𝑦𝑖𝑗= 0 becomes the
nonbasic variable. Moreover, we will replace the real arc i → j by the
reverse arc j → i with the arc capacity 𝑢𝑖𝑗 and the cost − 𝑐𝑖𝑗. In another
word, if a basic variable becomes leaving variables by reaching its
capacity, then the flow is reversed.
The upper bound technique can be used to solve and obtain the initial
basic feasible solutions.
Basic feasible solutions can be obtained by solving the spanning tree:
- For the arcs not in the spanning tree (nonbasic arcs), set the
corresponding variables (𝑥𝑖𝑗 or 𝑦𝑖𝑗) equal to zero.
- For the arcs that are in the spanning tree (basic arcs), solve for the
corresponding variables (𝑥𝑖𝑗 or 𝑦𝑖𝑗) in the system of linear equations
provided by the node constraints.
A feasible spanning tree is a spanning tree whose solution from the node
constraints also satisfies all the other constraints (0 ≤ 𝑥𝑖𝑗 ≤ 𝑢𝑖𝑗 or
0 ≤ 𝑦𝑖𝑗 ≤ 𝑢𝑖𝑗). The fundamental theorem for the network simplex
method:
- Basic solutions are spanning tree solutions (and conversely).
5
- Basic feasible solutions are solutions for feasible spanning trees
(and conversely).
II. Algorithm
- Step 1: Computing the dual vector 𝑦 = (𝑦1, 𝑦2,..., 𝑦𝑛) by solving the
following system:
𝑐𝑖𝑗 = 𝑦𝑗 − 𝑦𝑖 (𝑖, 𝑗) ∈ 𝑇 and set 𝑦𝑛 = 0
- Step 2: Calculating the reduced cost
𝑐𝑖𝑗 = 𝑐𝑖𝑗 + 𝑦𝑖 − 𝑦𝑗 (𝑖, 𝑗) ∉ 𝑇
- Step 3: Selecting the entering basic variables
● If 𝑐𝑖𝑗 ≥ 0 (𝑖, 𝑗) ∉ 𝑇, then go to the final step.
● If ∃𝑐𝑖𝑗 < 0, then:
Choose 𝑐𝑚𝑛 = 𝑚𝑖𝑛{𝑐𝑖𝑗|(𝑖, 𝑗) ∉ 𝑇} and take (m,n) as an entering
arc
- Step 4: Considering cycle from the feasible spanning tree T and the
entering arc C(T, mn).
● If all arcs of cycle C have the same direction as (m,n) and there is
no arc which has a limited capacity, the minimum cost is negative
infinity.
● Else, let
*
θ = 𝑚𝑖𝑛{𝑚𝑖𝑛{𝑥𝑖𝑗|(𝑖, 𝑗) ∈ 𝐵}; 𝑚𝑖𝑛{𝑢𝑖𝑗 − 𝑥𝑖𝑗|(𝑖, 𝑗) ∈ 𝐹}}
*
And we choose the arc associated with the value of θ as leaving
arc.
*
● If θ = 𝑚𝑖𝑛{𝑥𝑖𝑗|(𝑖, 𝑗) ∈ 𝐵}, continue with step 5.1.
*
● If θ = 𝑚𝑖𝑛{𝑢𝑖𝑗 − 𝑥𝑖𝑗|(𝑖, 𝑗) ∈ 𝐹}, continue with step 5.2.
- Step 5.1: Create a new feasible solution.
* *
Calculate the new flow: 𝑥𝑖𝑗 = 𝑥𝑘𝑙 + θ if (𝑘, 𝑙) ∈ 𝐹; 𝑥𝑖𝑗 = 𝑥𝑘𝑙 − θ if
(𝑘, 𝑙) ∈ 𝐵 and 𝑥𝑖𝑗 = 𝑥𝑘𝑙 otherwise.
Return to step 1.
- Step 5.2: Reverse the leaving arc and create a new feasible solution
6
● Replacing the leaving (m,n) arc with (n,m) in the original network
with the cost 𝑐𝑛𝑚 =− 𝑐𝑚𝑛.
● Calculate new flows:
Given 𝑥𝑚𝑛 is the flow before (m,n) becomes the leaving arc.
*
𝑥𝑖𝑗 = θ if (𝑘, 𝑙) ≡ (𝑚, 𝑛)
𝑥𝑖𝑗 = 0 if (𝑘, 𝑙) ≡ (𝑛, 𝑚)
*
𝑥𝑖𝑗 = 𝑥𝑘𝑙 + θ − 𝑥𝑚𝑛 if (𝑘, 𝑙) ∈ 𝐹
*
𝑥𝑖𝑗 = 𝑥𝑘𝑙 − θ + 𝑥𝑚𝑛 if (𝑘, 𝑙) ∈ 𝐵
𝑥𝑖𝑗 = 𝑥𝑘𝑙 otherwise
Return to step 1.
- Step 6: Conclusion.
III. Application
Consider the minimum cost flow problem shown below, where the 𝑏𝑖
values are given by the nodes, the 𝑐𝑖𝑗 values are given by the arcs, and the
finite 𝑢𝑖𝑗 values are given in parentheses by the arcs. Obtain an initial BF
solution by solving the feasible spanning tree with basic arcs A→C, B→A,
C→D, and C→E, where one of the nonbasic arcs (D→A) is a reverse arc.
Then use the network simplex method yourself (without an automatic
computer routine) to solve this problem.
1. Using the upper bound technique to solve for the initial feasible tree.
7
When using the upper bound technique to solve the initial spanning tree in
this problem, we let D → A be the reversed arc. It means that at the
beginning, we let (A,D) be the leaving variable by letting it reach the upper
bound 𝑢𝐴𝐷 = 40. Then the network flow is:
Notice that the amount of demand and supply at node A and D changed
accordingly: 𝑏𝐴 changed from 50 to 10 and 𝑏𝐷 changed from -70 to -30.
Now we need to complete the spanning tree by solving the system:
8
Iteration 1
9
The first tree is the new feasible tree with the number on the arc is 𝑥𝑖𝑗 and
the second one is the updated network with the reversed arc and the
number of the arc is the cost 𝑐𝑖𝑗.
10
2. Iteration 2
Here, in the cycle, there is no arc with the upper limit, then we can just
choose θ as the minimum of the backward arc.
11
12
3. Iteration 3
Since all of the 𝑐𝑖𝑗 > 0, then the feasible tree at step 4, iteration 2 is
optimal. So now we update the network based on the optimal feasible
tree.
13