You are on page 1of 45

BITS Pilani presentation

BITS Pilani
Pilani Campus
BITS Pilani
Pilani | Dubai | Goa | Hyderabad

OR Models
Network Models
Caveat
For course related queries, my email id: shekhar.rajagopalan@pilani.bits-pilani.ac.in

For administrative and other queries, contact BITS WILP section directly
o Contact details would have been shared during the orientation

ZG568 OR Models 3 BITS-Pilani


Recap
 Sensitivity Analysis
 Changing objective coefficient in 1 decision variable
 Range in optimality
 Reduced cost
 Change in RHS of one constraint
 Range of feasibility
 Shadow price (Dual price)
 Equality Constraints
 Shadow price and Alternative solution
 Excel Solver Sensitivity Report

ZG568 OR Models 4 BITS-Pilani


Introduction
A network model is one which can be represented by a set of nodes, a set of arcs,
and functions (e.g. costs, supplies, demands, etc.) associated with the arcs and/or
nodes.
Transportation, transshipment, assignment, shortest-route, and maximal flow
problems are all examples of network problems.
Each of the problems of this class can be formulated as linear programs and solved
by general purpose linear programming codes.
However, there are many computer packages that contain separate computer codes
for these problems which take advantage of their network structure.
Provided all the coefficients in the constraints are integer, the optimal solution will
consist of integer values

ZG568 OR Models 5 BITS-Pilani


Transportation Problem
Seeks to minimize the total shipping costs of transporting goods from m origins (each
with a supply si) to n destinations (each with a demand dj), when the unit shipping cost
from an origin, i, to a destination, j, is cij.
d1

s1 1
c11
1 c12 d2
c13
Network Model
2
Or c21
Network Representation
2 c22 d3
c23
s2 3

ZG568 OR Models 6 BITS-Pilani


Network Representation & LP Formulation
Using the notation:
xij = number of units shipped from origin i to destination j
cij = cost per unit of shipping from origin i to destination j
si = supply or capacity in units at origin I & dj = demand in units at destination j

d1 m n

1
Min  c x
i 1 j 1
ij ij
s1 n
c11
1 c12 d2 x ij  si i 1, 2, ,m Supply
c13 j 1
2 m
c21
x ij = d j j 1, 2, ,n Demand
2 c22 d3 i 1
c23
s2 3 xij > 0 for all i and j

ZG568 OR Models 7 BITS-Pilani


LP Formulation Special Cases
• Total supply exceeds total demand:
No modification of LP formulation is necessary
• Total demand exceeds total supply:
Add a dummy origin with supply equal to the shortage amount. Assign a zero
shipping cost per unit. The amount “shipped” from the dummy origin (in the
solution) will not actually be shipped.
• Minimum shipping guarantee from i to j:
o xij ≥ Lij (Say, a contract with one carrier on route i-j)
• Maximum route capacity from i to j: xij ≤ Lij
• Unacceptable route: Remove the corresponding decision variable
• The objective is maximizing profit or revenue: Solve as a maximization problem.
ZG568 OR Models 8 BITS-Pilani
Example
The PSU has 3,000 Kg of material in each of its three warehouses that should be
shipped to three installations: B1, B2 & B3, which require 4,000, 2,500, and 2,500 Kg,
respectively.
The shipping costs per Kg from warehouses (A1, A2, A3) to installations (B1, B2, B3) are
Destination
Warehouse B1 B2 B3
A1 12 6 5
A2 20 11 9
A3 30 26 28
Formulate and solve a linear program to determine the shipping arrangements that will
minimize the total shipping cost.

ZG568 OR Models 9 BITS-Pilani


Decision Variables
We want to determine the Kgs of material, xij , to be shipped by warehouse i to
destination j. The following table summarizes the decision variables:
B1 B2 B3
A1 x11 x12 x13
A2 x21 x22 x23
A3 x31 x32 x33

ZG568 OR Models 10 BITS-Pilani


Objective Function
Decision Variables Shipping Costs
B1 B2 B3 B1 B2 B3
A1 x11 x12 x13 12 6 5
A2 x21 x22 x23 20 11 9
A3 x31 x32 x33 30 26 28

The objective is to minimize the total shipping cost.

Min: 12x11 + 6x12 + 5x13 + 20x21 + 11x22 + 9x23 + 30x31 + 26x32 + 28x33

ZG568 OR Models 11 BITS-Pilani


Constraints
Supply Side Constraints:
The PSU has 9,000 Kg of material in
(1) x11 + x12 + x13 = 3000 (A1) three warehouses that should be
(2) x21 + x22 + x23 = 3000 (A2) shipped to three installations: B1, B2 &
(3) x31 + x32 + x33 = 3000 (A3) B3, which require 4,000, 2,500, and
2,500 Kg, respectively. Each warehouse
must ship equal quantities to each
Destination material requirements:
installation.
(4) x11 + x21 + x31 = 4000 (B1)
(5) x12 + x22 + x32 = 2500 (B2)
(6) x13 + x23 + x33 = 2500 (B3)

Non-negativity of variables:
xij > 0, i = 1, 2, 3 and j = 1, 2, 3
ZG568 OR Models 12 BITS-Pilani
Solution Summary
Objective Function Value = 142000.000 • B1 will receive 1000 Kg from A1 and
Variable Value Reduced Cost 3000 Kg from A3
x11 1000.000 0.000
x12 2000.000 0.000 • B2 will receive 2000 Kg from A1 and 500
x13 0.000 1.000 Kg from A2.
x21 0.000 3.000
x22 500.000 0.000 • B3 will receive 2500 Kg from A2.
x23 2500.000 0.000 • The total shipping cost will be $142,000
x31 3000.000 0.000
x32 0.000 2.000
x33 0.000 6.000

ZG568 OR Models 13 BITS-Pilani


Transshipment Problem
Transportation problems in which a shipment may move through intermediate
nodes (transshipment nodes) before reaching a particular destination node.

ZG568 OR Models 14 BITS-Pilani


Network Representation / Model
The network representation for a transshipment problem with two sources, three
intermediate nodes, and two destinations is shown below.

c36
3
c13
s1 1 c37 6 d1
c14
c15 c46
4 c47
c23
c24 c56
s2 2 7 d2
c25
5 c57
Sources Destinations
Intermediate Nodes
ZG568 OR Models 15 BITS-Pilani
Formulation
Using the notation:
xij = number of units shipped from node i to node j
cij = cost per unit of shipping from node i to node j
si = supply at origin node i
dj = demand at destination node j

Min σall arcs cij xij


Subject to
σarcs out xij ≤ si Origin nodes i
σarcs out xij − σarcs in xij = 0 Transshipment nodes
σarcs in xij = dj Destination nodes j
xij ≥ 0 for all I and j

ZG568 OR Models 16 BITS-Pilani


LP Formulation Special Cases
• Total supply not equal to total demand
• Maximization objective function
• Route capacities or route minimums
• Unacceptable routes

The LP model modifications required here are identical to those required for the
special cases in the transportation problem.

ZG568 OR Models 17 BITS-Pilani


Example
Kumar’s manufactures suits in two different locations: Textile Parks I & II (TP1 & TP2).
The items are stored in their two warehouses (KumarN & KumarS) from where they
are shipped to the retail outlets: Zrok, Glam, Rock.
Currently weekly demands at these outlets are 50 for Zrok, 60 for Glam, and 40 for
Rock. The factories can supply at most 75 units to its customers!
The unit cost to ship to the warehouses are:
KumarN KumarS
TP1 5 8
TP2 7 4
The unit costs to ship to the final destination:
Zrok Glam Rock
KumarN 1 5 8
KumarS 3 4 4

ZG568 OR Models 18 BITS-Pilani


Network Representation / Model

ZROX

Zrok
75
5 1
ARNOLD
TP1 K_N
50 Unit transportation cost:
5
KumarN KumarS
8 8 TP1 5 8
Glam
HEWES TP2 7 4
75 The costs to ship to final destination:
7 3 60
Zrok Glam Rock
TP2 WASH
K_S 4 40 KumarN 1 5 8
BURN
4 4 KumarS 3 4 4
Rock

ZG568 OR Models 19 BITS-Pilani


Decision Variables & Objective Function
xij = amount shipped from manufacturer i to warehouse j
xjk = amount shipped from warehouse j to customer k
where ZROX
Zrok
i = 1 (TP1), 2 (TP2) 5
75
j = 3 (KumarN), 4 (KumarS) 1
TP1 5
ARNOLD K_N 50
k = 5 (Zrok), 6 (Glam), 7 (Rock) 1 3 5
8 8
Glam
Minimize Overall Shipping Costs: HEWES
6
Min 5x13 + 8x14 75 3 60
7
+ 7x23 + 4x24 TP2 K_S
WASH 4 40
+ 1x35 + 5x36 + 8x37 2 4
BURN
4 4 Rock
+ 3x45 + 4x46 + 4x47 7

ZG568 OR Models 20 BITS-Pilani


Constraints
Amt Out of TP1: x13 + x14 < 75
Amt Out of TP2: x23 + x24 < 75
ZROX
Amt Through KumarN: x13 + x23 - x35 - x36 - x37 = 0 Zrok
Amt Through KumarS: x14 + x24 - x45 - x46 - x47 = 0 5
75
Amt Into Zrok: x35 + x45 = 50 1 50
Amt Into Glam: x36 + x46 = 60 TP1
ARNOLD 5 K_N
1 3 5
Amt Into Rock: x37 + x47 = 40
8 8
Glam
Non-negativity of Variables: xij > 0, for all i and j. HEWES
6
75 3 60
7
TP2 K_S
WASH 4
2 4
BURN 40
4 4 Rock
7

ZG568 OR Models 21 BITS-Pilani


Solution Summary
Objective Function Value = 1150.000
Variable Value ZROX
X13 75.000 Zrok 50
X14 0.000
5 75 1
X23 0.000 ARNOLD
75 TP1 K_N 5
X24 75.000
X35 50.000 8 8
X36 25.000 Glam
HEWES 60
X37 0.000
7 3 4
X45 0.000
X46 35.000 75 TP2 WASH
K_S
BURN
X47 40.000 4 4
Rock 40

ZG568 OR Models 22 BITS-Pilani


Assignment Problem & Network Model
Seeks to minimize the total cost in
assigning m workers to m jobs, given that
the cost of worker i performing job j is cij. c11
1 1
We assume all workers are assigned and c12
each job is performed. c13
Agents Tasks
c21
c22
An assignment problem is a special case 2 2
of a transportation problem in which all c23
supplies and all demands are equal to 1;
c31
Assignment problems is an LPP c32
Assignment problems are 0-1 LPP 3 c33 3
• The decision variables xij = 0 / 1

ZG568 OR Models 23 BITS-Pilani


Assignment Problem: LP Formulation
Using the notation:
xij = 1 if agent i is assigned to task j
0 otherwise

cij = cost of assigning agent i to task j


m n
Min  c x
i 1 j 1
ij ij

x
j 1
ij 1 i 1, 2, ,m Agents
m

x
i 1
ij 1 j 1, 2, ,n Tasks

xij > 0 for all i and j

ZG568 OR Models 24 BITS-Pilani


Assignment Problem: Special Cases
• Number of agents exceeds the number of tasks: Extra agents will remain unassigned

• Number of tasks exceeds the number of agents:


o Add dummy agents to equalize the number of agents and the number of tasks.
o The objective function coefficients for these new variable would be zero.

• The assignment alternatives are evaluated in terms of revenue or profit:

• An assignment is unacceptable:

• An agent is permitted to work t tasks: σnj=1 xij ≤ 𝑡𝑖 , where i = 1, 2, … m Agents

ZG568 OR Models 25 BITS-Pilani


Example
An electrical contractor pays his subcontractors a fixed fee plus travel mileage. On a
given day the contractor is faced with three electrical jobs associated with various
projects. Given below are the distances between the subcontractors and the projects.
Projects
Subcontractor A B C
Westside 50 36 16
Federated 28 30 18
Goliath 35 32 20
Universal 25 25 14

How should the contractors be assigned so that total mileage is minimized?

ZG568 OR Models 26 BITS-Pilani


Network Representation / Model
Subcontractors Projects
50
West. A
36
16 Projects
Subcontractor A B C
28
Fed. 30 B
Westside 50 36 16
Federated 28 30 18
18
Goliath 35 32 20
35 32
Universal 25 25 14
Gol. C
20
25 25
Univ.
14

ZG568 OR Models 27 BITS-Pilani


LP Formulation
Min 50x11+36x12+16x13+28x21+30x22+18x23 Subcontractors Projects
+35x31+32x32+20x33+25x41+25x42+14x43 50 A
West.
1 36 1
s.t. x11+x12+x13 < 1
16
x21+x22+x23 < 1
28
x31+x32+x33 < 1 Fed. 30 B
2 2
x41+x42+x43 < 1 18
x11+x21+x31+x41 = 1 35 32
x12+x22+x32+x42 = 1 Gol. C
3 20 3
x13+x23+x33+x43 = 1
25 25
xij = 0 or 1 for all i and j
Univ.
4 14
ZG568 OR Models 28 BITS-Pilani
The Optimal Assignment
Subcontractor Project Distance
Westside C 16
Federated A 28
Goliath (unassigned)
Universal B 25

Total Distance = 69 miles

ZG568 OR Models 29 BITS-Pilani


Shortest-Route Problem
The shortest-route problem is concerned with finding the shortest path in a network
from one node (or set of nodes) to another node (or set of nodes).
If all arcs in the network have nonnegative values then a labeling algorithm can be
used to find the shortest paths from a particular node to all other nodes in the network.
The criterion to be minimized in the shortest-route problem is not limited to distance
even though the term "shortest" is used in describing the procedure. Other criteria
include time and cost. (Neither time nor cost are necessarily linearly related to
distance.)
“It is not crazy to say that the internet wouldn't work as efficiently as it does if it wasn't
for Dijkstra’s algorithm for computing the shortest path between two nodes”

ZG568 OR Models 30 BITS-Pilani


Linear Programming Formulation
Decision Variable
xij = 1 if the arc from node i to node j is on the shortest route
0 otherwise
cij = distance, time, or cost associated with the arc from node i to node j

Min 
all arcs
c ij xij

s.t. 
arcs out
xij 1 Origin node i


arcs out
xij  x
arcs in
ij 0 Transhipment nodes

x
arcs in
ij 1 Destination node j

ZG568 OR Models 31 BITS-Pilani


Network Representation / Model
The following network model represents the cost from travelling from one node to the next.
Formulate the problem to find the path from 1 to 6 with the least cost.

60
2 5
100
30
80 90
130
40 130
3
180 6
1
80 30 50 90

ZG568 OR Models 32 BITS-Pilani


Example: Network Representation
60 Objective Function
2 5 Min 80x12 + 40x13 + 80x14 + 130x15 + 180x16
100
30 + 60x25 + 100x26
80 90 + 30x34 + 90x35 + 120x36
130 + 30x43 + 50x45 + 90x46
40 130
3 + 60x52 + 90x53 + 50x54 + 30x56 )
180 6
1
80 30 50 90
Node Flow-Conservation Constraints
4 x12 + x13 + x14 + x15 + x16 = 1 (origin)
– x12 + x25 + x26 – x52 = 0 (node 2)
– x13 + x34 + x35 + x36 – x43 – x53 = 0 (node 3)
– x14 – x34 + x43 + x45 + x46 – x54 = 0 (node 4)
– x15 – x25 – x35 – x45 + x52 + x53 + x54 + x56 = 0 (node 5)
x16 + x26 + x36 + x46 + x56 = 1 (destination)

All xij >= 0

ZG568 OR Models 33 BITS-Pilani


Shortest Route: Solution Summary
Minimum total cost = $150

x12 = 0 x25 = 0 x34 = 1 x43 = 0 x52 = 0


x13 = 1 x26 = 0 x35 = 0 x45 = 1 x53 = 0
x14 = 0 x36 = 0 x46 = 0 x54 = 0
x15 = 0 x56 = 1
x16 = 0 2 5
30

40 3
6
1
30 50

4
ZG568 OR Models 34 BITS-Pilani
Maximal Flow Problem
The maximal flow problem is concerned with determining the maximal volume
of flow from one node (called the source) to another node (called the sink).
In the maximal flow problem, each arc has a maximum arc flow capacity which
limits the flow through the arc.
We will add an arc from the sink node back to the source node to represent
the total flow through the network.
There is no capacity on the newly added sink-to-source arc.
We want to maximize the flow over the sink-to-source arc.

ZG568 OR Models 35 BITS-Pilani


Network Representation / Model
1: The Source Node
6: The Sink Node
The capacity of each edge is shown above the edge
The sink-source arc (6, 1) is added

ZG568 OR Models 36 BITS-Pilani


LP Formulation
• There is a decision variable for every arc.
• There is a constraint for every node; the flow out must equal the flow in.
• There is a constraint for every arc (except the added sink-to-source arc); arc
capacity cannot be exceeded.
• The objective is to maximize the flow over the added sink-to-source arc.

xij represents the flow from node i to node j)


Max xk1 (k is sink node, 1 is source node)
s.t. xij - xji = 0 (conservation of flow)
i j
xij < cij (cij is capacity of ij arc)
xij > 0, for all i and j (non-negativity)
ZG568 OR Models 37 BITS-Pilani
Example
National Express operates a fleet of cargo planes and is in the package delivery
business. NatEx is interested in knowing what is the maximum it could transport in
one day indirectly from San Diego to Tampa if its direct flight was out of service.

NatEx's indirect routes from San Diego to Tampa, along with their respective
estimated excess shipping capacities (measured in thousands of cubic feet per day),
are shown on the next slide.

Is there sufficient excess capacity to indirectly ship 5000 cubic feet of packages in
one day?

ZG568 OR Models 38 BITS-Pilani


Example: Network Representation Model

3
Denver 2 5 St. Louis
4 2 3 2
3 4
San 4 3
Diego 1 4 7 Tampa
3 1
3 5 5 Dallas
Houston 3 6 Atlanta
6

These are the possible routes.


Note there are one-way and two-way routes
• While we can go from 2 to 5 and back, there is no direct path from 6 to 3.
ZG568 OR Models 39 BITS-Pilani
Network Representation / Model
3
2 5
3
4 2 3 2
Source 3 4 Sink
4 3
1 4 7
3 1
3 5 1 5
3 6
6

These are the possible routes.


Note there are one-way and two-way routes
• While we can go from 2 to 5 and back, there is no direct path from 6 to 3.
ZG568 OR Models 40 BITS-Pilani
Example: LP Formulation
18 variables (for 17 “original” arcs and 1 added Arc Capacity Constraints
arc) x12 < 4 x13 < 3 x14 < 4
24 constraints x24 < 2 x25 < 3
x34 < 3 x36 < 6
• 7 node flow-conservation constraints
x42 < 3 x43 < 5 x45 < 3 x46 < 1 x47 < 3
• 17 arc capacity constraints (for original arcs) x52 < 3 x54 < 4 x57 < 2
x64 < 1 x67 < 5

Node Flow-Conservation Constraints


x12 + x13 + x14 – x71 = 0 (node 1) Objective Function: Max x71
– x12 + x24 + x25 – x42 – x52 = 0 (node 2)
– x13 + x34 + x36 – x43 = 0 (and so on)
– x14 – x24 – x34 + x42 + x43 + x45 + x46 + x47 – x54 – x64 = 0
– x25 – x45 + x52 + x54 + x57 = 0
– x36 – x46 + x64 + x67 = 0
– x47 – x57 – x67 + x71 = 0

ZG568 OR Models 41 BITS-Pilani


Example: Optimal Solution

Objective Function Value = 10.000


2
Variable Value Variable Value 2 5
x12 3.000 x45 0.000 3 1 2
x13 3.000 x46 0.000
x14 4.000 x47 3.000 4 3
x24 1.000 x52 0.000 1 4 7
x25 2.000 x54 0.000
x34 0.000 x57 2.000 3 5
2
x36 5.000 x64 0.000
x42 0.000 x67 5.000 10 3 6
5
x43 2.000 x71 10.000

ZG568 OR Models 42 BITS-Pilani


Exercises

Page 451 Exercises 1, 10, 20, 26, 33,

ZG568 OR Models 43 BITS-Pilani


Takeaway

 Transportation problem
 Assignment problem
 Transshipment problem
 Shortest Route problem
 Maximal Flow problem

ZG568 OR Models 44 BITS-Pilani


BITS Pilani
Pilani | Dubai | Goa | Hyderabad

Thank you!!

You might also like