Transportation Problem Balancing with Python

April 6, 2019

1 min read

Transportation Problem Balancing with Python

Introduction

Transportation Simplex Method works with a balanced transportation problem. Therefore we need to learn how to make problem balanced if it is not such. And it means to cover two cases — when supply is less than demand and otherwise.

Supply Less Than Demand

40 + 30 < 30 + 50
40 + 30 < 30 + 50

Here we can see that supply is less than demand. In such a case, we add a fake origin (d₃=10) so that supply became equal to demand. Values c₃₁, c₃₂ represent financial loss related to unmet demand.

c₃₁ = 3. It can mean that the first customer will lose 3$ with each not shipped unit.
c₃₁ = 3. It can mean that the first customer will lose 3$ with each not shipped unit.

Demand Less Than Supply

40 + 30 > 30 + 30
40 + 30 > 30 + 30

Here we can see that demand is less than supply. In such a case we add a fake destination (s₃ = 1) so that supply became equal to demand. for unused capacity there no cost involved therefor values c₁₃ and c₂₃ are equal to 0.

draw4

Programming

Let’s write a simple function that receives a transportation problem and returns its balanced version. When supply less than demand we also need to pass penalties(financial losses related to unmet demands).

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.