Below is my input:
order | lat/long | pickup_location_address | pickup_date | pickup_time_window | delivery_date | delivery_time_window | lat/long | delivery_address | capacity |
1 | 1.314898, 103.764304 | 3155 Commonwealth Avenue West, Singapore | 07-07-2018 | 09:00-10:00 | 07-07-2018 | 11:00-12:00 | 1.347001, 103.872794 | 404 Serangoon Avenue 1, Singapore | 3 |
2 | 1.314898, 103.764304 | 3155 Commonwealth Avenue West, Singapore | 07-07-2018 | 09:00-10:00 | 07-07-2018 | 12:30-14:30 | 1.379894, 103.932164 | 3 PASIR RIS DRIVE 12, Singapore | 2 |
3 | 1.314898, 103.764304 | 3155 Commonwealth Avenue West, Singapore | 07-07-2018 | 09:30-10:30 | 07-07-2018 | 15:00-17:00 | 1.326698, 103.879546 | 629 ALJUNIED ROAD, Singapore | 3 |
4 | 1.313737, 103.901596 | 54 Joo Chiat Place, Singapore | 07-07-2018 | 09:30-10:30 | 07-07-2018 | 11:00-13:00 | 1.282814, 103.853475 | 70 Collyer Quay, Singapore | 3 |
5 | 1.313737, 103.901596 | 54 Joo Chiat Place, Singapore | 07-07-2018 | 09:30-10:30 | 07-07-2018 | 13:00-15:00 | 1.333385, 103.839171 | 510 Thomson Rd, Singapore 298135 | 2 |
6 | 1.313737, 103.901596 | 54 Joo Chiat Place, Singapore | 07-07-2018 | 09:30-10:30 | 07-07-2018 | 15:00-17:00 | 1.373910, 103.879204 | 941 Hougang Street 92, Singapore | 3 |
How can I tell Vehicle Routing Problem that 3 orders are coming from warehouse1(1.314898, 103.764304) and another 3 orders are from warehouse2(1.313737, 103.901596). There seems to be no way to bind an order to a warehouse unless we make use of the order_pairs. Right now VRP is assuming all order is presence at warehouse2. Any other options if we wish to use multiple Depots?
Thanks.
--INPUT------------------------------------------------------------------------
// Orders
{
"features": [
{
"geometry": {
"x": 103.872794,
"y": 1.347001
},
"attributes": {
"Name": "Deliver Order 1",
"TimeWindowStart1": "1530961200000",
"TimeWindowEnd1": "1530964800000",
"MaxViolationTime1": 0,
"DeliveryQuantities": "3"
}
},
{
"geometry": {
"x": 103.932164,
"y": 1.379894
},
"attributes": {
"Name": "Deliver Order 2",
"TimeWindowStart1": "1530966600000",
"TimeWindowEnd1": "1530973800000",
"MaxViolationTime1": 0,
"DeliveryQuantities": "2"
}
},
{
"geometry": {
"x": 103.879546,
"y": 1.326698
},
"attributes": {
"Name": "Deliver Order 3",
"TimeWindowStart1": "1530975600000",
"TimeWindowEnd1": "1530982800000",
"MaxViolationTime1": 0,
"DeliveryQuantities": "3"
}
},
{
"geometry": {
"x": 103.853475,
"y": 1.282814
},
"attributes": {
"Name": "Deliver Order 4",
"TimeWindowStart1": "1530961200000",
"TimeWindowEnd1": "1530968400000",
"MaxViolationTime1": 0,
"DeliveryQuantities": "3"
}
},
{
"geometry": {
"x": 103.839171,
"y": 1.333385
},
"attributes": {
"Name": "Deliver Order 5",
"TimeWindowStart1": "1530968400000",
"TimeWindowEnd1": "1530975600000",
"MaxViolationTime1": 0,
"DeliveryQuantities": "2"
}
},
{
"geometry": {
"x": 103.879204,
"y": 1.373910
},
"attributes": {
"Name": "Deliver Order 6",
"TimeWindowStart1": "1530975600000",
"TimeWindowEnd1": "1530982800000",
"MaxViolationTime1": 0,
"DeliveryQuantities": "3"
}
}
]
}
// Depots
{
"features": [
{
"geometry": {
"x": 103.764304,
"y": 1.314898
},
"attributes": {
"Name": "Warehouse1",
"TimeWindowStart1": "1530923400000",
"TimeWindowEnd1": "1531007700000"
}
},
{
"geometry": {
"x": 103.901596,
"y": 1.313737
},
"attributes": {
"Name": "Warehouse2",
"TimeWindowStart1": "1530923400000",
"TimeWindowEnd1": "1531007700000"
}
}
]
}
// Routes
{
"features": [
{
"attributes": {
"Name": "Driver 1",
"Capacities": "10",
"StartDepotName": "Warehouse1",
"EndDepotName": "Warehouse1",
"SpecialtyNames": "Foo Test",
"EarliestStartTime": "1530954000000",
"LatestStartTime": "1530954060000",
"MaxTotalTime": 540
}
},
{
"attributes": {
"Name": "Driver 2",
"Capacities": "10",
"StartDepotName": "Warehouse1",
"EndDepotName": "Warehouse1",
"SpecialtyNames": "Foo Test",
"EarliestStartTime": "1530954000000",
"LatestStartTime": "1530954060000",
"MaxTotalTime": 540
}
},
{
"attributes": {
"Name": "Driver 3",
"Capacities": "10",
"StartDepotName": "Warehouse1",
"EndDepotName": "Warehouse1",
"SpecialtyNames": "Foo Test",
"EarliestStartTime": "1530954000000",
"LatestStartTime": "1530954060000",
"MaxTotalTime": 540
}
},
{
"attributes": {
"Name": "Driver 4",
"Capacities": "10",
"StartDepotName": "Warehouse2",
"EndDepotName": "Warehouse2",
"SpecialtyNames": "Foo Test",
"EarliestStartTime": "1530954000000",
"LatestStartTime": "1530954060000",
"MaxTotalTime": 540
}
},
{
"attributes": {
"Name": "Driver 5",
"Capacities": "10",
"StartDepotName": "Warehouse2",
"EndDepotName": "Warehouse2",
"SpecialtyNames": "Foo Test",
"EarliestStartTime": "1530954000000",
"LatestStartTime": "1530954060000",
"MaxTotalTime": 540
}
}
]
}
//Route renewals
{
"features": [
{
"attributes": {
"RouteName": "Driver 1",
"DepotName": "Warehouse1",
"ServiceTime": 15
}
},
{
"attributes": {
"RouteName": "Driver 2",
"DepotName": "Warehouse1",
"ServiceTime": 15
}
},
{
"attributes": {
"RouteName": "Driver 3",
"DepotName": "Warehouse1",
"ServiceTime": 15
}
},
{
"attributes": {
"RouteName": "Driver 4",
"DepotName": "Warehouse2",
"ServiceTime": 15
}
},
{
"attributes": {
"RouteName": "Driver 5",
"DepotName": "Warehouse2",
"ServiceTime": 15
}
}
]
}
---OUTPUT--------------------------------------------------------------------------------------
"features": [
{
"attributes": {
"ObjectID": 1,
"Name": "Deliver Order 1",
"PickupQuantities": "",
"DeliveryQuantities": "3",
"StopType": 0,
"RouteName": "Driver 4",
"Sequence": 3,
"FromPrevTravelTime": 14.568498218432069,
"FromPrevDistance": 7.5999960895595287,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530962074110,
"DepartTime": 1530962074110,
"ArriveTimeUTC": 1530933274110,
"DepartTimeUTC": 1530933274110,
"WaitTime": 0,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 2,
"Name": "Deliver Order 2",
"PickupQuantities": "",
"DeliveryQuantities": "2",
"StopType": 0,
"RouteName": "Driver 4",
"Sequence": 4,
"FromPrevTravelTime": 13.064347792416811,
"FromPrevDistance": 6.8808205874669905,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530962857971,
"DepartTime": 1530966600000,
"ArriveTimeUTC": 1530934057971,
"DepartTimeUTC": 1530937800000,
"WaitTime": 62.36715398915112,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 3,
"Name": "Deliver Order 3",
"PickupQuantities": "",
"DeliveryQuantities": "3",
"StopType": 0,
"RouteName": "Driver 4",
"Sequence": 8,
"FromPrevTravelTime": 12.730662224814296,
"FromPrevDistance": 4.5926895059833823,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530976363840,
"DepartTime": 1530976363840,
"ArriveTimeUTC": 1530947563840,
"DepartTimeUTC": 1530947563840,
"WaitTime": 0,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 4,
"Name": "Deliver Order 4",
"PickupQuantities": "",
"DeliveryQuantities": "3",
"StopType": 0,
"RouteName": "Driver 4",
"Sequence": 2,
"FromPrevTravelTime": 11.475185578688979,
"FromPrevDistance": 4.749702059431125,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530954748511,
"DepartTime": 1530961200000,
"ArriveTimeUTC": 1530925948511,
"DepartTimeUTC": 1530932400000,
"WaitTime": 107.52481442131102,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 5,
"Name": "Deliver Order 5",
"PickupQuantities": "",
"DeliveryQuantities": "2",
"StopType": 0,
"RouteName": "Driver 4",
"Sequence": 5,
"FromPrevTravelTime": 19.972407326102257,
"FromPrevDistance": 11.379289689279743,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530967798344,
"DepartTime": 1530968400000,
"ArriveTimeUTC": 1530938998344,
"DepartTimeUTC": 1530939600000,
"WaitTime": 10.027592673897743,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 6,
"Name": "Deliver Order 6",
"PickupQuantities": "",
"DeliveryQuantities": "3",
"StopType": 0,
"RouteName": "Driver 4",
"Sequence": 7,
"FromPrevTravelTime": 16.051344607025385,
"FromPrevDistance": 5.9227465212197998,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530971041335,
"DepartTime": 1530975600000,
"ArriveTimeUTC": 1530942241335,
"DepartTimeUTC": 1530946800000,
"WaitTime": 75.977754762396216,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 7,
"Name": "Warehouse2",
"PickupQuantities": "10.000000",
"DeliveryQuantities": "0.000000",
"StopType": 1,
"RouteName": "Driver 4",
"Sequence": 1,
"FromPrevTravelTime": 0,
"FromPrevDistance": 0,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530954060000,
"DepartTime": 1530954060000,
"ArriveTimeUTC": 1530925260000,
"DepartTimeUTC": 1530925260000,
"WaitTime": 0,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 8,
"Name": "Warehouse2",
"PickupQuantities": "6.000000",
"DeliveryQuantities": "0.000000",
"StopType": 1,
"RouteName": "Driver 4",
"Sequence": 6,
"FromPrevTravelTime": 12.970900630578399,
"FromPrevDistance": 5.5322542714797294,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530969178254,
"DepartTime": 1530970078254,
"ArriveTimeUTC": 1530940378254,
"DepartTimeUTC": 1530941278254,
"WaitTime": 0,
"ViolationTime": 0
}
},
{
"attributes": {
"ObjectID": 9,
"Name": "Warehouse2",
"PickupQuantities": "0.000000",
"DeliveryQuantities": "0.000000",
"StopType": 1,
"RouteName": "Driver 4",
"Sequence": 9,
"FromPrevTravelTime": 8.8413176070898771,
"FromPrevDistance": 2.6554258066698684,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1530976894319,
"DepartTime": 1530976894319,
"ArriveTimeUTC": 1530948094319,
"DepartTimeUTC": 1530948094319,
"WaitTime": 0,
"ViolationTime": 0
}
}
],
Solved! Go to Solution.
Hello,
Although order pairs is a good way to solve this type of requirement, here is another option that might work. It looks like from your request that you have five routes three of which are assigned to warehouse 1 and only use warehouse 1 as a route renewal and two that are assigned to warehouse 2 and only use ware house 2 as a route renewal. If you will be continuing this separation of routes to a specific warehouse for starting and renewals then you could use specialties to make sure the orders that have to come from a specific warehouse are serviced by the routes that are from that warehouse.
For example, in your problem you could have two specialties: Warehouse1 and Warehouse2. For the orders that have to come from those specific warehouses give them the appropriate specialty. Then mark the three routes from warehouse 1 with the specialty Warehouse1 and similarly for the two routes from warehouse 2 give them a specialty of Warehouse2. This will force the orders that have to come from a specific warehouse to be serviced by one of the routes that comes from that warehouse but will allow the orders that do not need to come from a specific warehouse to be serviced by any route.
Let me know if this works to solve your problem or if you have any more questions.
Heather
Hello,
Although order pairs is a good way to solve this type of requirement, here is another option that might work. It looks like from your request that you have five routes three of which are assigned to warehouse 1 and only use warehouse 1 as a route renewal and two that are assigned to warehouse 2 and only use ware house 2 as a route renewal. If you will be continuing this separation of routes to a specific warehouse for starting and renewals then you could use specialties to make sure the orders that have to come from a specific warehouse are serviced by the routes that are from that warehouse.
For example, in your problem you could have two specialties: Warehouse1 and Warehouse2. For the orders that have to come from those specific warehouses give them the appropriate specialty. Then mark the three routes from warehouse 1 with the specialty Warehouse1 and similarly for the two routes from warehouse 2 give them a specialty of Warehouse2. This will force the orders that have to come from a specific warehouse to be serviced by one of the routes that comes from that warehouse but will allow the orders that do not need to come from a specific warehouse to be serviced by any route.
Let me know if this works to solve your problem or if you have any more questions.
Heather
What if I wish to have routes assigned to Warehouse1 to be able to do route renewals at both Warehouse1 and Warehouse2?
Then the best modeling option is to use the order pairs.