This distance_optimized.py
contains the data, you can input the distance matrix by yourself acc to your need. Increasing the number of vehicle can also be done by changing data["vehicles_num"]
matrix
data["no_of_depot"] = 3
data["no_of_store"] = 22
data["distance_matrix"] = [
# fmt: off
[0, 500, 500, 180, 130, 240, 210, 220, 170, 180, 700, 720, 750, 320, 340, 750, 740, 600, 650, 650, 500, 540, 560, 580, 600],
[500, 0, 500, 600, 650, 700, 620, 630, 640, 650, 220, 250, 260, 270, 230, 240, 250, 260, 250, 235, 500, 510, 520, 530, 540],
[500, 500, 0, 500, 520, 530, 540, 600, 620, 540, 530, 550, 560, 590, 600, 630, 650, 620, 610, 500, 200, 210, 220, 230, 240],
[180, 600, 500, 0, 20, 25, 30, 26, 35, 15, 500, 510, 520, 540, 550, 530, 560, 500, 570, 600, 580, 540, 570, 576, 578],
[130, 650, 520, 20, 0, 15, 18, 20, 25, 24, 500, 510, 520, 540, 550, 530, 560, 500, 570, 600, 580, 540, 570, 576, 578],
[240, 700, 530, 25, 15, 0, 20, 24, 23, 21, 500, 510, 520, 540, 550, 530, 560, 500, 570, 600, 580, 540, 570, 576, 578],
[210, 620, 540, 30, 18, 20, 0, 25, 23, 20, 500, 510, 520, 540, 550, 530, 560, 500, 570, 600, 580, 540, 570, 576, 578],
[220, 630, 600, 26, 20, 24, 25, 0, 15, 18, 500, 510, 520, 540, 550, 530, 560, 500, 570, 600, 580, 540, 570, 576, 578],
[170, 640, 620, 35, 25, 23, 23, 15, 0, 20, 500, 510, 520, 540, 550, 530, 560, 500, 570, 600, 580, 540, 570, 576, 578],
[180, 650, 540, 15, 24, 21, 20, 18, 20, 0, 30, 20, 15, 13, 15, 16, 18, 20, 21, 23, 500, 510, 520, 530, 540],
[700, 220, 530, 500, 500, 500, 500, 500, 500, 30, 0, 15, 18, 20, 13, 18, 29, 14, 16, 19, 500, 510, 520, 530, 540],
[720, 250, 550, 510, 510, 510, 510, 510, 510, 20, 15, 0, 20, 21, 14, 15, 18, 20, 15, 18, 500, 510, 520, 530, 540],
[750, 260, 560, 520, 520, 520, 520, 520, 520, 15, 18, 20, 0, 24, 15, 16, 18, 12, 19, 20, 500, 510, 520, 530, 540],
[320, 270, 590, 540, 540, 540, 540, 540, 540, 13, 20, 21, 24, 0, 15, 23, 12, 15, 16, 18, 500, 510, 520, 530, 540],
[340, 230, 600, 550, 550, 550, 550, 550, 550, 15, 13, 14, 15, 15, 0, 15, 18, 17, 20, 15, 500, 510, 520, 530, 540],
[750, 240, 630, 530, 530, 530, 530, 530, 530, 16, 18, 15, 16, 23, 15, 0, 17, 25, 23, 15, 500, 510, 520, 530, 540],
[740, 250, 650, 560, 560, 560, 560, 560, 560, 18, 29, 18, 18, 12, 18, 17, 0, 24, 15, 18, 500, 510, 520, 530, 540],
[600, 260, 620, 500, 500, 500, 500, 500, 500, 20, 14, 20, 12, 15, 17, 25, 24, 0, 16, 17, 500, 510, 520, 530, 540],
[650, 250, 610, 570, 570, 570, 570, 570, 570, 21, 16, 15, 19, 16, 20, 23, 15, 16, 0, 18, 500, 510, 520, 530, 540],
[650, 235, 500, 600, 600, 600, 600, 600, 600, 23, 19, 18, 20, 18, 15, 15, 18, 17, 18, 0, 500, 510, 520, 530, 540],
[500, 500, 200, 580, 580, 580, 580, 580, 580, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 0, 15, 25, 35, 5],
[540, 510, 210, 540, 540, 540, 540, 540, 540, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 15, 0, 35, 45, 50],
[560, 520, 220, 570, 570, 570, 570, 570, 570, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 25, 35, 0, 10, 15],
[580, 530, 230, 576, 576, 576, 576, 576, 576, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 35, 45, 10, 0, 16],
[600, 540, 240, 578, 578, 578, 578, 578, 578, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 5, 50, 15, 16, 0]
# fmt: on
]
data["depots"] = [
[4, 5, 6, 7, 8, 9, 10],
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
[21, 22, 23, 24, 25]
]
# [[0, 3, 4, 5, 6, 7, 8, 9],
# [1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
# [2, 20, 21, 22, 23, 24]]
data["vehicles_num"] = [
[5, 1],
[3, 1],
[5, 1]
]
data["vehicle_specs"] = [
# wgt vol fixedCost varCost maxDist speed
[61200, 2389, 1000, 100, 10000, 40],
[61200, 2389, 2000, 60, 120, 45]
]
data['depot_timings'] = ['10:00', '12:00']
data["demands"] = [
['Demand1', 4, 5497, 322, '10:00', '12:00', '15:00', '19:00'],
['Demand2', 5, 6072, 460, '10:00', '12:00', '16:00', '19:00'],
['Demand3', 6, 11362, 345, '10:00', '12:00', '17:00', '19:00'],
['Demand4', 7, 9568, 552, '10:00', '12:00', '12:00', '19:00'],
['Demand5', 8, 7153, 391, '10:00', '12:00', '12:00', '19:00'],
['Demand6', 8, 5244, 437, '10:00', '12:00', '12:00', '19:00'],
['Demand7', 11, 6095, 483, '10:00', '12:00', '12:00', '19:00'],
['Demand8', 12, 6072, 253, '10:00', '12:00', '12:00', '19:00'],
['Demand9', 13, 10281, 460, '10:00', '12:00', '15:00', '19:00'],
['Demand10', 14, 11063, 391, '10:00', '12:00', '16:00', '19:00'],
['Demand11', 15, 5635, 322, '10:00', '12:00', '17:00', '19:00'],
['Demand12', 16, 9637, 437, '10:00', '12:00', '12:00', '19:00'],
['Demand13', 17, 6578, 322, '10:00', '12:00', '12:00', '19:00'],
['Demand14', 18, 8556, 253, '10:00', '12:00', '12:00', '19:00'],
['Demand15', 19, 5520, 230, '10:00', '12:00', '15:00', '19:00'],
['Demand16', 21, 5037, 575, '10:00', '12:00', '16:00', '19:00'],
['Demand17', 22, 8280, 368, '10:00', '12:00', '17:00', '19:00'],
['Demand18', 23, 11086, 506, '10:00', '12:00', '12:00', '19:00'],
['Demand19', 24, 10189, 414, '10:00', '12:00', '12:00', '19:00'],
['Demand20', 25, 8970, 322, '10:00', '12:00', '12:00', '19:00'],
['Demand21', 21, 11224, 529, '10:00', '12:00', '12:00', '19:00'],
['Demand22', 22, 10994, 552, '10:00', '12:00', '12:00', '19:00'],
['Demand23', 23, 7291, 414, '10:00', '12:00', '15:00', '19:00'],
['Demand24', 10, 11293, 552, '10:00', '12:00', '16:00', '19:00'],
['Demand25', 9, 5175, 299, '10:00', '12:00', '17:00', '19:00'],
['Demand26', 8, 8257, 299, '10:00', '12:00', '12:00', '19:00'],
['Demand27', 7, 5842, 230, '10:00', '12:00', '12:00', '19:00'],
['Demand28', 6, 10235, 345, '10:00', '12:00', '12:00', '19:00'],
['Demand29', 5, 9177, 414, '10:00', '12:00', '12:00', '19:00'],
['Demand30', 4, 5704, 345, '10:00', '12:00', '15:00', '19:00'],
['Demand31', 6, 5704, 414, '10:00', '12:00', '16:00', '19:00'],
['Demand32', 7, 6716, 368, '10:00', '12:00', '17:00', '19:00'],
['Demand33', 8, 9292, 562, '10:00', '12:00', '12:00', '19:00'],
['Demand34', 9, 4292, 562, '10:00', '12:00', '12:00', '19:00'],
['Demand35', 10, 5292, 563, '10:00', '12:00', '12:00', '19:00'],
['Demand36', 20, 6292, 564, '10:00', '12:00', '12:00', '19:00'],
['Demand37', 19, 6711, 562, '10:00', '12:00', '15:00', '19:00'],
['Demand38', 18, 11711, 563, '10:00', '12:00', '16:00', '19:00'],
['Demand39', 17, 6711, 564, '10:00', '12:00', '17:00', '19:00'],
['Demand40', 16, 6711, 565, '10:00', '12:00', '12:00', '19:00'],
['Demand41', 15, 6711, 566, '10:00', '12:00', '12:00', '19:00'],
['Demand42', 14, 6711, 567, '10:00', '12:00', '12:00', '19:00'],
['Demand43', 25, 6711, 568, '10:00', '12:00', '12:00', '19:00'],
['Demand44', 25, 6711, 569, '10:00', '12:00', '12:00', '19:00'],
['Demand45', 24, 6711, 570, '10:00', '12:00', '16:00', '19:00'],
['Demand46', 24, 6711, 571, '10:00', '12:00', '17:00', '19:00'],
['Demand47', 23, 6711, 572, '10:00', '12:00', '12:00', '19:00'],
['Demand48', 23, 6711, 573, '10:00', '12:00', '12:00', '19:00'],
['Demand49', 22, 6711, 574, '10:00', '12:00', '12:00', '19:00'],
['Demand50', 21, 6711, 575, '10:00', '12:00', '12:00', '19:00']]
3000
6
Route for vehicle 0:
0 Load(0) -> 18 Load(0) -> 17 Load(5292) -> 16 Load(9584) -> 15 Load(18876) -> 14 Load(25592) -> 13 Load(31296) -> 12 Load(37000) -> 11 Load(46177) -> 0 Load(56412)
Cost of the route: 153000 Ruppees
Route for vehicle 1:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Route for vehicle 2:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Route for vehicle 3:
0 Load(0) -> 3 Load(0) -> 1 Load(11362) -> 0 Load(16859)
Cost of the route: 45500 Ruppees
Route for vehicle 4:
0 Load(0) -> 10 Load(0) -> 9 Load(5842) -> 8 Load(14099) -> 7 Load(19343) -> 6 Load(30636) -> 5 Load(35811) -> 4 Load(42964) -> 2 Load(52532) -> 0 Load(58604)
Cost of the route: 88600 Ruppees
Route for vehicle 5:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Total Cost of all routes: 287100 Ruppees
2000
4
Route for vehicle 0:
0 Load(0) -> 6 Load(0) -> 15 Load(9637) -> 14 Load(16348) -> 13 Load(23059) -> 12 Load(29770) -> 11 Load(41481) -> 10 Load(48192) -> 9 Load(54484) -> 0 Load(60004)
Cost of the route: 177600 Ruppees
Route for vehicle 1:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Route for vehicle 2:
0 Load(0) -> 5 Load(0) -> 8 Load(5635) -> 1 Load(14191) -> 7 Load(20286) -> 4 Load(26864) -> 3 Load(37927) -> 2 Load(48208) -> 16 Load(54280) -> 0 Load(60991)
Cost of the route: 88200 Ruppees
Route for vehicle 3:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Total Cost of all routes: 265800 Ruppees
3000
6
Route for vehicle 0:
0 Load(0) -> 16 Load(0) -> 15 Load(6711) -> 14 Load(13422) -> 13 Load(20133) -> 12 Load(26844) -> 11 Load(33555) -> 10 Load(40266) -> 9 Load(46977) -> 8 Load(53688) -> 0 Load(60979)
Cost of the route: 208000 Ruppees
Route for vehicle 1:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Route for vehicle 2:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Route for vehicle 3:
0 Load(0) -> 1 Load(0) -> 0 Load(5037)
Cost of the route: 41000 Ruppees
Route for vehicle 4:
0 Load(0) -> 7 Load(0) -> 6 Load(10994) -> 5 Load(22218) -> 4 Load(31188) -> 3 Load(41377) -> 2 Load(52463) -> 0 Load(60743)
Cost of the route: 68000 Ruppees
Route for vehicle 5:
0 Load(0) -> 0 Load(0)
Cost of the route: 0 Ruppees
Total Cost of all routes: 317000 Ruppees