Re-Optimization: Unassigned Tasks
NextBillion.ai’s Route Optimization Flexible API offers a powerful re-optimization feature which allows the users to fulfill previously unassigned tasks by readjusting some variables. These variables can be the number of vehicles included in the optimization request, modifying the shift timings or capacities of the vehicles involved or changing the task time windows or any other strategy that would increase the chances of higher task assignments.
Re-optimization works based on a previous solution which had some unassigned tasks. The users are expected to rebuild the request using some of the above strategies and specify the unassigned tasks explicitly. Upon receiving a re-optimization request, the solver will try to accommodate the new tasks into the original solution without many changes. This way businesses can make quick or last-minute adjustments to their route planning without needing to make extravagant changes to the existing plans.
We cover this example through 2 steps - in the first step, we intentionally configure some tasks so that they remain unassigned in the original solution. In the next step, using the unassigned
attribute, we re-optimize our existing solution so that all tasks are assigned. Let’s start with building the original request.
Get Started
Readers would need a valid NextBillion API key to try this example out. If you don’t have one, please contact us to get your API key now!
Setup
Once you have a valid API Key, you can start setting up the components to be used in this example. Let’s take a look at them below.
Jobs & Shipments
We start by defining 5 jobs and 2 shipments. For these tasks we add:
-
A unique identifier for each task
-
Location indexes for each task
-
Specify the schedule of tasks. This is done by adding time windows within which a task must be completed. We have added a 15 min time window for all tasks.
-
The actual time taken to complete the tasks once the driver/vehicle is at the task’s location i.e. the service time for each task.
-
Skills needed to perform each task
-
Pickup and Delivery amounts for all jobs
Let’s take a look at the jobs
JSON after the above properties are configured:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
{ "jobs": [ { "id": 1, "location_index": 0, "service": 120, "pickup": [ 1 ], "skills": [ 1 ], "time_windows": [ [ 1693391400, 1693392300 ] ] }, { "id": 2, "location_index": 1, "service": 120, "skills": [ 1 ], "pickup": [ 1 ], "time_windows": [ [ 1693387800, 1693388700 ] ] }, { "id": 3, "location_index": 2, "service": 120, "pickup": [ 1 ], "skills": [ 2 ], "time_windows": [ [ 1693396800, 1693397700 ] ] }, { "id": 4, "location_index": 3, "service": 120, "skills": [ 1 ], "pickup": [ 1 ], "time_windows": [ [ 1693395900, 1693396800 ] ] }, { "id": 5, "location_index": 4, "service": 120, "skills": [ 2 ], "pickup": [ 1 ], "time_windows": [ [ 1693400400, 1693401300 ] ] } ], "shipments": [ { "pickup": { "description": "Shipment Pickup 1", "id": 1, "location_index": 5, "time_windows": [ [ 1693398600, 1693399500 ] ] }, "delivery": { "description": "Shipment Delivery 1", "id": 1, "location_index": 6, "time_windows": [ [ 1693400400, 1693401300 ] ] }, "skills": [ 2, 3 ], "amount": [ 3 ] }, { "pickup": { "description": "Shipment Pickup 2", "id": 2, "location_index": 7, "time_windows": [ [ 1693429200, 1693430100 ] ] }, "delivery": { "description": "Shipment Delivery 2", "id": 2, "location_index": 8, "time_windows": [ [ 1693431000, 1693431900 ] ] }, "skills": [ 2, 3 ], "amount": [ 2 ] } ] }
Vehicles
Next, we add 4 vehicles that are going to fulfill the tasks within the defined constraints. To describe the vehicles and their properties we add:
-
A unique ID for each vehicle
-
Vehicle shift time or the time window. We have kept this same for both vehicles in the first step.
-
Capacity to denote the amount of load that the vehicle can take
-
Start_index to denote the point from where the vehicle would start
-
Skills for all vehicles
Once the vehicle and their properties are defined, the resulting vehicles
JSON is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
{ "vehicles": [ { "id": 1, "start_index": 10, "skills": [ 1 ], "capacity": [ 10 ], "time_window": [ 1693382400, 1693411200 ] }, { "id": 2, "start_index": 9, "skills": [ 2, 3 ], "capacity": [ 10 ], "time_window": [ 1693382400, 1693411200 ] } ] }
Locations
Next, we define the locations
object and add all the locations used in the problem along with a valid id
. The locations
object with all the points used in this example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{ "locations": { "id": 1, "location": [ "34.083950,-118.318640", "34.054927,-118.323726", "34.075525,-118.361588", "34.076350,-118.338519", "34.090425,-118.338933", "34.076646,-118.376969", "34.094986,-118.300885", "34.018780,-118.317919", "33.996658,-118.261708", "34.059244,-118.376969", "34.057106,-118.361326" ] } }
Step 1: Get the original Solution
Now that we have built the basic components of an optimization problem with one shipment deliberately scheduled outside the vehicle’s shift timings so that it remains unassigned, we can submit this request using the Optimization POST method and retrieve the solution.
Optimized POST request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
curl --location 'https://api.nextbillion.io/optimization/v2?key=<your_api_key>' \ --header 'Content-Type: application/json' \ --data '{ "description": "Re-optimization (Unassigned) Example", "jobs": [ { "id": 1, "location_index": 0, "service": 120, "pickup":[1], "skills": [1], "time_windows": [ [ 1693391400, 1693392300 ] ] }, { "id": 2, "location_index": 1, "service": 120, "skills": [1], "pickup":[1], "time_windows": [ [ 1693387800, 1693388700 ] ] }, { "id": 3, "location_index": 2, "service": 120, "pickup":[1], "skills": [2], "time_windows": [ [ 1693396800, 1693397700 ] ] }, { "id": 4, "location_index": 3, "service": 120, "skills": [1], "pickup":[1], "time_windows": [ [ 1693395900, 1693396800 ] ] }, { "id": 5, "location_index": 4, "service": 120, "skills": [2], "pickup":[1], "time_windows": [ [ 1693400400, 1693401300 ] ] } ], "shipments": [ { "pickup":{ "description": "Shipment Pickup 1", "id":1, "location_index":5, "time_windows":[[1693398600,1693399500]] }, "delivery":{ "description": "Shipment Delivery 1", "id":1, "location_index":6, "time_windows":[[1693400400,1693401300]] }, "skills":[2,3], "amount":[3] }, { "pickup":{ "description": "Shipment Pickup 2", "id":2, "location_index":7, "time_windows":[[1693429200,1693430100]] }, "delivery":{ "description": "Shipment Delivery 2", "id":2, "location_index":8, "time_windows":[[1693431000,1693431900]] }, "skills":[2,3], "amount":[2] } ], "vehicles": [ { "id": 1, "start_index": 10, "skills":[1], "capacity":[10], "time_window": [ 1693382400, 1693411200 ] }, { "id": 2, "start_index": 9, "skills": [ 2,3 ], "capacity":[10], "time_window": [ 1693382400, 1693411200 ] } ], "locations": { "id": 1, "location": ["34.083950,-118.318640","34.054927,-118.323726","34.075525,-118.361588","34.076350,-118.338519","34.090425,-118.338933","34.076646,-118.376969","34.094986,-118.300885","34.018780,-118.317919","33.996658,-118.261708","34.059244,-118.376969","34.057106,-118.361326"] } } '
Optimized POST response
Once the request is made, we get a unique ID in the API response:
1 2 3 4 5
{ "id": "68b637d43438d84ae2fcd8ea3be063b6", "message": "Optimization job created", "status": "Ok" }
Optimized GET request
We take the ID and use the Optimization GET request to retrieve the original result. Here is the GET request:
1 2
curl --location 'https://api.nextbillion.io/optimization/v2/result?id=68b637d43438d84ae2fcd8ea3be063b6 &key=<your_api_key>'
Let's take a look at the summary
and the unassigned
section of the original solution.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
{ "result": { "code": 0, "summary": { "cost": 3193, "routes": 2, "unassigned": 2, "setup": 0, "service": 600, "duration": 3193, "waiting_time": 7687, "priority": 0, "delivery": [3], "pickup": [8], "distance": 24418.9 }, "unassigned": [ { "id": 2, "type": "pickup", "location": [34.01878, -118.317919], "reason": "cannot be completed due to time constraint" }, { "id": 2, "type": "delivery", "location": [33.996658, -118.261708], "reason": "cannot be completed due to time constraint" } ] } }
Following is a visual representation of the initial locations of tasks, vehicles and the routes suggested after optimization as per the given constraints.
Step 2: Prepare for re-optimization
In the summary
section of the original response, we can see that there was 1 unassigned task and the unassigned
attribute gives the details of the unassigned shipment. Readers are encouraged to observe the routes and task distribution as well in this solution.
As a business operator it might be in our interest to keep the unassigned tasks to a minimum. In order to do that, we now reconfigure our input request so that the unassigned task gets assigned. To achieve this we first need to understand why some jobs or shipments remain unassigned. In our example, we know it is because the shipment was scheduled outside the shift timings of both vehicles.
We add the details of the unassigned shipment to the unassigned
section of the input request. Next, we modify the shift timings of vehicle 2 so that it covers the time window of the unassigned shipment pickup and delivery steps and makes the task assignment feasible. We chose vehicle 2 for this modification because, in the original solution, it didn't start until almost 4 hours into its shift.
Vehicles for re-optimization
After updating the vehicle 2 shift timings, the updated vehicles
JSON is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
{ "vehicles": [ { "id": 1, "start_index": 10, "skills": [ 1 ], "capacity": [ 10 ], "time_window": [ 1693382400, 1693411200 ] }, { "id": 2, "start_index": 9, "skills": [ 2, 3 ], "capacity": [ 10 ], "time_window": [ 1693396800, 1693432800 ] } ] }
Unassigned
Finally, we add the details of the unassigned shipment as per the original solution to the input request.
1 2 3
"unassigned": { "shipment": [[2,2]] }
Optimization POST Request
Now let’s put all these components together and create the final POST request that we will submit to the optimizer. Please ensure to add the new vehicle attributes, reflecting the updated shift timings, instead of the original object. Following is the final re-optimization request.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
curl --location 'https://api.nextbillion.io/optimization/v2?key=<your_api_key>' \ --header 'Content-Type: application/json' \ --data '{ "description": "Re-optimization (Unassigned) Example", "jobs": [ { "id": 1, "location_index": 0, "service": 120, "pickup":[1], "skills": [1], "time_windows": [ [ 1693391400, 1693392300 ] ] }, { "id": 2, "location_index": 1, "service": 120, "skills": [1], "pickup":[1], "time_windows": [ [ 1693387800, 1693388700 ] ] }, { "id": 3, "location_index": 2, "service": 120, "pickup":[1], "skills": [2], "time_windows": [ [ 1693396800, 1693397700 ] ] }, { "id": 4, "location_index": 3, "service": 120, "skills": [1], "pickup":[1], "time_windows": [ [ 1693395900, 1693396800 ] ] }, { "id": 5, "location_index": 4, "service": 120, "skills": [2], "pickup":[1], "time_windows": [ [ 1693400400, 1693401300 ] ] } ], "shipments": [ { "pickup":{ "description": "Shipment Pickup 1", "id":1, "location_index":5, "time_windows":[[1693398600,1693399500]] }, "delivery":{ "description": "Shipment Delivery 1", "id":1, "location_index":6, "time_windows":[[1693400400,1693401300]] }, "skills":[2,3], "amount":[3] }, { "pickup":{ "description": "Shipment Pickup 2", "id":2, "location_index":7, "time_windows":[[1693429200,1693430100]] }, "delivery":{ "description": "Shipment Delivery 2", "id":2, "location_index":8, "time_windows":[[1693431000,1693431900]] }, "skills":[2,3], "amount":[2] } ], "vehicles": [ { "id": 1, "start_index": 10, "skills":[1], "capacity":[10], "time_window": [ 1693382400, 1693411200 ] }, { "id": 2, "start_index": 9, "skills": [ 2,3 ], "capacity":[10], "time_window": [ 1693396800, 1693432800 ] } ], "locations": { "id": 1, "location": ["34.083950,-118.318640","34.054927,-118.323726","34.075525,-118.361588","34.076350,-118.338519","34.090425,-118.338933","34.076646,-118.376969","34.094986,-118.300885","34.018780,-118.317919","33.996658,-118.261708","34.059244,-118.376969","34.057106,-118.361326"] }, "unassigned": { "shipment": [[2,2]] } } '
Optimization POST Response
Once the request is made, we get a unique ID in the API response:
1 2 3 4 5
{ "id": "151f2e007b0774958e837ec8dcacfc9c", "message": "Optimization job created", "status": "Ok" }
Optimization GET Request
We take the ID and use the Optimization GET request to retrieve the result. Here is the GET request:
1 2
curl --location 'https://api.nextbillion.io/optimization/v2/result?id=151f2e007b0774958e837ec8dcacfc9c &key=<your_api_key>'
Optimization GET Response
Following is the optimized route plan:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
{ "description": "Re-optimization (Unassigned) Example", "result": { "code": 0, "summary": { "cost": 5256, "routes": 2, "unassigned": 0, "service": 600, "duration": 5256, "waiting_time": 35512, "priority": 0, "delivery": [ 5 ], "pickup": [ 10 ], "distance": 48607.9 }, "routes": [ { "vehicle": 1, "cost": 1324, "steps": [ { "type": "start", "arrival": 1693388346, "duration": 0, "service": 0, "waiting_time": 0, "location": [ 34.057106, -118.361326 ], "location_index": 10, "load": [ 0 ] }, { "type": "job", "arrival": 1693388700, "duration": 354, "service": 120, "waiting_time": 0, "location": [ 34.054927, -118.323726 ], "location_index": 1, "id": 2, "load": [ 1 ] }, { "type": "job", "arrival": 1693389425, "duration": 959, "service": 120, "waiting_time": 1975, "location": [ 34.08395, -118.31864 ], "location_index": 0, "id": 1, "load": [ 2 ] }, { "type": "job", "arrival": 1693391885, "duration": 1324, "service": 120, "waiting_time": 4015, "location": [ 34.07635, -118.338519 ], "location_index": 3, "id": 4, "load": [ 3 ] }, { "type": "end", "arrival": 1693396020, "duration": 1324, "service": 0, "waiting_time": 0, "location": [ 34.07635, -118.338519 ], "location_index": 3, "load": [ 3 ] } ], "service": 360, "duration": 1324, "waiting_time": 5990, "priority": 0, "delivery": [ 0 ], "pickup": [ 3 ], "distance": 10485.900000000001, "geometry": "ywznEjmlqUBG@G@GAEEEMIw@[q@WLoA@KB[JmAB_@?U@[?a@?iABiD?u@@c@@aB@iB@g@?S@_ABsF@aB?s@?k@@o@?m@@g@?UBgBB{EDcF@s@@qD@aB@[@gA?y@?]BuB?}@?W@m@?Q?W@{@?]?K@M?kA?Q?U?I@_@BuE@qA@W?c@DcB?u@?y@?M@}B@mA?]@g@@y@@s@@c@@aA?S?U@aB@g@?e@@s@?c@@uA?m@@o@?cC@u@@{@@o@?sA?Y?Q?I?Y@m@@g@AG?A?g@@[BUBUDUFYVmA@GH_@RgAb@}B\\mB`@sBX{ADUFUNy@ZgBReABQTgADSFYBKFc@BWD[F}@@IHaBZqFLaCPuCDo@D}@BS_@C^BCRE|@En@QtCM`C[Oe@S_A]eIqDkCqAAtCiJ}DaIqDa@QOGMAG@I?U@cA@U?uF?uI@kJ@iG@iA?U?OAYEa@Ig@OcDiAk@Uk@UmAk@OWMYk@]gFyBGAs@[cAYQCcC@sJ?Q?Q?O??m@?o@AuB?m@?e@?c@?m@?u@?m@?g@?a@iB?yE@}B?aB?yO?oJB?s@_B@A`@@B?@?@?@DDBB@@@B?P?R?N?b@?d@?J?K?e@?c@?O?S?QACAACCEE?A?A?AAC@a@~AA?r@nJCxO?`B?|B?xEAhB??`@?f@?l@?t@?l@?b@?d@?l@@tB?n@?l@?l@@hB?n@?l@?vB?j@A^?T?R?d@?pA?R?bBAf@@T?v@?~@?b@AbC?n@?T?F?F?H@L?DDb@D\\DRDN?BHXJVHVFRJ\\@FH^D`@?B?B@T@L?TENAX?V?LAPCVCVWnC[dDEf@CXCZARAp@?tC@nA?JAN?LA\\DNA~@?nA?^?^AXANANAN?JAJ?N@r@@hA?d@?d@?x@?tC?d@?x@@nA?Z?h@?r@?p@a@???" }, { "vehicle": 2, "cost": 3932, "steps": [ { "type": "start", "arrival": 1693397306, "duration": 0, "service": 0, "waiting_time": 0, "location": [ 34.059244, -118.376969 ], "location_index": 9, "load": [ 0 ] }, { "type": "job", "arrival": 1693397700, "duration": 394, "service": 120, "waiting_time": 0, "location": [ 34.075525, -118.361588 ], "location_index": 2, "id": 3, "load": [ 1 ] }, { "type": "pickup", "arrival": 1693398090, "duration": 664, "service": 0, "waiting_time": 510, "location": [ 34.076646, -118.376969 ], "location_index": 5, "id": 1, "load": [ 4 ], "description": "Shipment Pickup 1" }, { "type": "job", "arrival": 1693399223, "duration": 1287, "service": 120, "waiting_time": 1177, "location": [ 34.090425, -118.338933 ], "location_index": 4, "id": 5, "load": [ 5 ] }, { "type": "delivery", "arrival": 1693401031, "duration": 1798, "service": 0, "waiting_time": 0, "location": [ 34.094986, -118.300885 ], "location_index": 6, "id": 1, "load": [ 2 ], "description": "Shipment Delivery 1" }, { "type": "pickup", "arrival": 1693402322, "duration": 3089, "service": 0, "waiting_time": 26878, "location": [ 34.01878, -118.317919 ], "location_index": 7, "id": 2, "load": [ 4 ], "description": "Shipment Pickup 2" }, { "type": "delivery", "arrival": 1693430043, "duration": 3932, "service": 0, "waiting_time": 957, "location": [ 33.996658, -118.261708 ], "location_index": 8, "id": 2, "load": [ 2 ], "description": "Shipment Delivery 2" }, { "type": "end", "arrival": 1693431000, "duration": 3932, "service": 0, "waiting_time": 0, "location": [ 33.996658, -118.261708 ], "location_index": 8,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@A]?w@?w@?g@?e@?_@AmBAiBAaI?_@?y@?U?y@?EAI?A?iDA_BA_BC_H?i@?S?W?_A@gA?o@AMAwP??" } ] }, "status": "Ok", "message": "" }
Following is a visual representation of all the task locations, location of vehicles and the routes suggested after re-optimization as per the given constraints.
Analyzing the Solution
Looking at the new result we can observe some interesting insights:
-
All the tasks are assigned within the same 2 routes.
-
The task distribution, sequence, costs, waiting times for vehicle 1 is almost the same as the original solution.
-
For vehicle 2, apart from the newly assigned shipment 2 steps, all properties for other tasks it had originally - like sequence of assigned tasks, wait times for those tasks, costs, arrival times etc - remain more or less similar.
-
The previously unassigned shipment is now fulfilled by vehicle 2, as the new shift timings make it possible.
-
The optimizer has proficiently added two more steps (the originally unassigned shipment steps) to the new solution, without making many changes to the original solution's existing parameters.
Above example showcases the powerful re-optimization capabilities of NextBillion.ai’s Route Optimization Flexible API. Users can leverage this feature to make last minute adjustments to their optimization plans to improve overall task fulfillment. To explore this feature more, users can play around with strategies like adding more vehicles, changing the task time window and see how the API takes those changes into account without major changes to the original solution.
We hope this example was helpful. Check out some more use cases that Route Optimization Flexible API can handle for you!