[Logistics Network Design Issues](http://www.orsj.or.jp/~wiki/wiki/index.php/%E3%80%8A%E3%83%AD%E3%82%B8%E3% 82% B9% E3% 83% 86% E3% 82% A3% E3% 82% AF% E3% 82% B9% E3% 83% 8D% E3% 83% 83% E3% 83% 88% E3% 83% AF% E3% 83% BC% E3% 82% AF% E8% A8% AD% E8% A8% 88% E5% 95% 8F% E9% A1% 8C% E3% 80% 8B)
Find out where, what, how much, and how to transport so that the sum of transportation and production costs is minimized while satisfying demand.
Specifications
python
Product= list('AB')
Demand area= list('PQ')
factory= list('XY')
lane= (2, 2)
Shipping cost table
python
import numpy as np, pandas as pd
tbdi = pd.DataFrame(((j, k)for j in demand area for k in factory), columns=['Demand area', 'factory'])
tbdi['Shipping costs'] = [1,2,3,1]
tbdi
Demand area th> | Factory th> | Shipping costs th> | |
---|---|---|---|
0 | P | X | 1 |
1 | P | Y | 2 |
2 | Q | X | 3 |
3 | Q | Y | 1 |
Demand table
python
tbde = pd.DataFrame(((j, i)for j in demand area for i in products), columns=['Demand area', 'Product'])
tbde['demand'] = [10, 10, 20, 20]
tbde
Demand area th> | Product th> | Demand th> | |
---|---|---|---|
0 | P | A | 10 |
1 | P | B | 10 |
2 | Q | A | 20 |
3 | Q | B | 20 |
Production table
python
tbfa = pd.DataFrame(((k, l, i, 0, np.inf) for k, nl in zip(factory,lane)
for l in range(nl)for i in product), columns=['factory', 'lane', 'Product', 'lower limit', 'upper limit'])
tbfa['Production cost'] = [1, np.nan, np.nan, 1, 3, np.nan, 5, 3]
tbfa.dropna(inplace=True)
tbfa.ix[4, 'upper limit'] = 10
tbfa
Factory th> | Lane th> | Product th> | Lower limit th> | Upper limit th> | Production cost th> | |
---|---|---|---|---|---|---|
0 | X | 0 | A | 0 | inf | 1.0 |
3 | X | 1 | B | 0 | inf | 1.0 |
4 | Y | 0 | A | 0 | 10.000000 | 3.0 |
6 | Y | 1 | A | 0 | inf | 5.0 |
7 | Y | 1 | B | 0 | inf | 3.0 |
solve
python
from ortoolpy import logistics_network
_, tbdi2, _ = logistics_network(tbde, tbdi, tbfa)
Result: Production volume (ValY)
python
tbfa
Factory th> | Lane th> | Product th> | Lower limit th> | Upper limit th> | Production cost th> | VarY | ValY | |
---|---|---|---|---|---|---|---|---|
0 | X | 0 | A | 0 | inf | 1.0 | v9 | 20.0 |
3 | X | 1 | B | 0 | inf | 1.0 | v10 | 10.0 |
4 | Y | 0 | A | 0 | 10.000000 | 3.0 | v11 | 10.0 |
6 | Y | 1 | A | 0 | inf | 5.0 | v12 | 0.0 |
7 | Y | 1 | B | 0 | inf | 3.0 | v13 | 20.0 |
Result: Transport volume (ValX)
python
tbdi2
Demand area th> | Factory th> | Shipping costs th> | Product th> | VarX | ValX | |
---|---|---|---|---|---|---|
0 | P | X | 1 | A | v1 | 10.0 |
1 | P | X | 1 | B | v2 | 10.0 |
2 | Q | X | 3 | A | v3 | 10.0 |
3 | Q | X | 3 | B | v4 | 0.0 |
4 | P | Y | 2 | A | v5 | 0.0 |
5 | P | Y | 2 | B | v6 | 0.0 |
6 | Q | Y | 1 | A | v7 | 10.0 |
7 | Q | Y | 1 | B | v8 | 20.0 |
that's all