Calculate excess costs per tour
Maintaining operational costs under control is critical for efficient logistics operations. In some scenarios, additional costs related to your vehicle fleet might arise, such as when a vehicle serves more stops during a tour than the maximum number specified in a contract, which can result in extra payments for each stop beyond the limit that a vehicle makes.
These excess expenses or the lack of means to calculate them can negatively impact profitability and competitiveness, which underscores the importance of effective cost management. The HERE Tour Planning API helps in excess cost management by optimizing key areas that can impact costs: stop count, tour duration, waiting time, and distance, through the excessCosts feature.
Note
- This is an ALPHA feature, which means it is new or experimental and under active development.
- Alpha features are provided for testing and feedback purposes. They may change significantly or might not become generally available. For more information, see Explore experimental features.
- To enable this feature, add
excessCoststo theexperimentalFeaturesarray in the problem specification.
Understand the excess costs feature
The excess cost feature works similarly to soft time windows which imposes soft limits on the time windows for pickup or delivery of goods, applying abstract penalties when the windows are violated, which prompts the optimization algorithm to find a solution that minimizes penalties. The excess cost feature follows the same principle but applies it to the tour planning area focused on optimizing costs. In this case, you can impose specific soft limits on one or several categories for which you want to minimize excess costs, such as tour distance, tour duration, the number of stops during a tour, or accumulated waiting time for a vehicle.
When a vehicle exceeds one of these limits, you can incur a one-time fixed cost penalty, and then define a step interval in the applicable units of measurement, for example, every 10 minutes started past the one hour limit, that a specific cost penalty is applied to the vehicle. As a result, the optimization algorithm strives to provide a solution primarily without penalties at all. However, given the provided tour constraints in the problem JSON, such as the number of vehicles available, or the number of stops to serve, some additional costs might not be avoidable.
Define excess costs
Within the costs object of the problem JSON file, the excessCosts object can contain the following objects, each representing an excess cost category to minimize:
distance: Specifies the maximum distance a vehicle can travel before incurring additional costs.duration: Defines the maximum duration a vehicle can operate without incurring additional costs.stops: Represents the maximum number of stops a vehicle can make during a tour without incurring additional costs.waitingTime: Defines the maximum accumulated waiting time allowed for a vehicle during a tour, indicating the duration that a vehicle can spend waiting without incurring cost penalties.
You can specify any number of excess cost types, as needed. Each object within excessCosts specifies the associated cost penalty if its respective limit is exceeded through the following properties:
-
limit: The maximum value that a solution should not exceed. If this limit is exceeded, a penalty is added to the solution's cost. -
fixedCost: A fixed cost penalty that is incurred when the limit is exceeded. This cost is incurred only once. -
stepSize: The fixed amount of excess that corresponds to one penalty unit. The penalty is calculated as:penalty = ceil(excess / step_size)
For example, if step size =
12and excess =14, then penalty =2.Note
As the previous example demonstrates, any fraction of a step still counts as a full penalty.
-
stepCost: The cost per step of excess.
Tip
This model allows you to address a variety of use cases, for example, you can specify no
fixedCost("fixedCost": 0) while only settingstepSizeandstepCost. Conversely, you can configure the cost penalty to consist only offixedCost, leaving bothstepSizeandstepCostset to0.
For more information on the excessCost feature as well as the supported units of measurement for calculating the available excess cost types, see the API Reference.
Example: tour duration
The following snippet shows a sample excessCost object that sets a soft limit on the duration of a vehicle's tour and defines the cost penalty when this limit is exceeded:
"excessCosts": {
"duration": {
"limit": 28800,
"fixedCost": 200,
"stepSize": 3600,
"stepCost": 100,
}
}In this example:
- The
limitvalue represents a soft duration limit of eight hours (equivalent to28800seconds). - The
fixedCostvalue indicates that when a vehicle travels for more than eight hours during a tour, it incurs a one-time cost penalty of200. - The
stepSizevalue specifies that for every hour (3600seconds) started past thelimit, the vehicle incurs additional costs, as determined by thestepCostvalue. - The
stepCostvalue represents the incremental cost per step, which is triggered whenever the penalty is incurred and increases by100for every hour (or3600seconds).
The following figure shows an excess cost calculated based on a sample use case when a vehicle's tour exceeded the duration limit, with the excessCosts configuration as specified in the previous example:
Note
As the previous example demonstrates, the
stepCostpenalty applies at the start of each step of excess, regardless of the step duration.
Manage excess costs
This example illustrates the use of the excessCosts feature in a full problem JSON, highlighting how this feature can lead to reduced operation costs by optimizing tour duration. The following sections compare two solutions that share the same core problem configuration, with the key difference being the presence or absence of the excessCosts feature.
Starting problem - no excess cost calculation
The starting problem does not utilize the excessCosts feature. In this scenario, a fleet of five vehicles is assigned to complete 49 jobs within an eight-hour time frame.
Because of the absence of the excessCosts feature for calculating potential extra costs within the tour, the vehicles are constrained by the hard eight-hour shift limit as part of strict expense control measures. For the purposes of this demonstration, the fixed cost associated with each vehicle's operations is set to 600, with time and distance costs minimized at 0.0001.
Click to expand/collapse the sample JSON
{
"fleet": {
"types": [
{
"profile": "car",
"amount": 5,
"capacity": [
50
],
"costs": {
"time": 0.0001,
"distance": 0.0001,
"fixed": 600
},
"id": "vehicle_1",
"shifts": [
{
"start": {
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": "2024-06-24T08:00:00+02:00"
},
"end": {
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": "2024-06-24T16:00:00+02:00"
}
}
]
}
],
"profiles": [
{
"name": "car",
"type": "car"
}
]
},
"plan": {
"jobs": [
{
"id": "Job_1",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.63329,
"lng": 13.3138
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_2",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_3",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679571
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_4",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.456,
"lng": 13.403260583257188
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_5",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.63256,
"lng": 13.37322
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_6",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.45810373923444,
"lng": 13.331808942475499
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_7",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.439442845393685,
"lng": 13.336118100685782
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_8",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.53213114000045,
"lng": 13.373517153879769
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_9",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4823,
"lng": 13.4703
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_10",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5313,
"lng": 13.35356
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_11",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.457844833248835,
"lng": 13.322525701671735
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_12",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_13",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48128598928299,
"lng": 13.4944
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_14",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.580380893737356,
"lng": 13.304479222218161
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_15",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.444597854004236,
"lng": 13.42729037972278
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_16",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_17",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48903177127663,
"lng": 13.495944342993262
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_18",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.62863,
"lng": 13.3621182
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_19",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_20",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.61955,
"lng": 13.29845
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_21",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_22",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_23",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_24",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5293,
"lng": 13.38507204916371
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_25",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_26",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.53754,
"lng": 13.34152
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_27",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_28",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4745,
"lng": 13.42
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_29",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.58884270031872,
"lng": 13.352068415230912
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_30",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.60079217247425,
"lng": 13.339813254226156
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_31",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4779,
"lng": 13.5012
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_32",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.60066027234286,
"lng": 13.502741838681837
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_33",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.55437436208552,
"lng": 13.503142187091647
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_34",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48446152479127,
"lng": 13.392004256315916
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_35",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.482203294624796,
"lng": 13.391214601891551
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_36",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.60842932011795,
"lng": 13.46922174529483
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_37",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.47651505101506,
"lng": 13.459944175857151
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_38",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_39",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.6029,
"lng": 13.3113
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_40",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.6543,
"lng": 13.39278
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_41",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.51508491755749,
"lng": 13.38
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_42",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.63313572894435,
"lng": 13.506488581249922
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_43",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.459450803409204,
"lng": 13.396015195980405
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_44",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.54433793446157,
"lng": 13.49579242116612
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_45",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.486517527979494,
"lng": 13.382057792236846
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_46",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.55606147412602,
"lng": 13.41517487839967
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_47",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.591995183321515,
"lng": 13.36000789424169
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_48",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.56223251898173,
"lng": 13.471999398223556
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_49",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.595251760429065,
"lng": 13.456764166098564
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
}
]
},
"objectives": [
{
"type": "minimizeUnassigned"
},
{
"type": "minimizeCost"
}
]
}Solution
Given the problem constraints, the most efficient solution comprises two tours, each conforming with the eight-hour shift constraint. The combined tour cost for both vehicles is 1223. See the following figure for tour highlights:
The following section contains the full solution of the previously mentioned problem, in the JSON format:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 1222.7158,
"distance": 189478,
"duration": 37680,
"times": {
"driving": 22980,
"serving": 14700,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"tours": [
{
"vehicleId": "vehicle_1_3",
"typeId": "vehicle_1",
"stops": [
{
"time": {
"arrival": "2024-06-24T06:00:00Z",
"departure": "2024-06-24T06:00:00Z"
},
"load": [
34
],
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T06:00:00Z",
"end": "2024-06-24T06:00:00Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 0
},
{
"time": {
"arrival": "2024-06-24T06:01:15Z",
"departure": "2024-06-24T06:06:15Z"
},
"load": [
33
],
"activities": [
{
"jobId": "Job_24",
"type": "delivery",
"location": {
"lat": 52.5293,
"lng": 13.38507204916371
},
"time": {
"start": "2024-06-24T06:01:15Z",
"end": "2024-06-24T06:06:15Z"
}
}
],
"location": {
"lat": 52.5293,
"lng": 13.38507204916371
},
"distance": 485
},
{
"time": {
"arrival": "2024-06-24T06:12:08Z",
"departure": "2024-06-24T06:17:08Z"
},
"load": [
32
],
"activities": [
{
"jobId": "Job_41",
"type": "delivery",
"location": {
"lat": 52.51508491755749,
"lng": 13.38
},
"time": {
"start": "2024-06-24T06:12:08Z",
"end": "2024-06-24T06:17:08Z"
}
}
],
"location": {
"lat": 52.51508491755749,
"lng": 13.38
},
"distance": 2709
},
{
"time": {
"arrival": "2024-06-24T06:24:11Z",
"departure": "2024-06-24T06:29:11Z"
},
"load": [
31
],
"activities": [
{
"jobId": "Job_3",
"type": "delivery",
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
},
"time": {
"start": "2024-06-24T06:24:11Z",
"end": "2024-06-24T06:29:11Z"
}
}
],
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
},
"distance": 6478
},
{
"time": {
"arrival": "2024-06-24T06:34:20Z",
"departure": "2024-06-24T06:39:20Z"
},
"load": [
30
],
"activities": [
{
"jobId": "Job_16",
"type": "delivery",
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"time": {
"start": "2024-06-24T06:34:20Z",
"end": "2024-06-24T06:39:20Z"
}
}
],
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"distance": 8769
},
{
"time": {
"arrival": "2024-06-24T06:43:27Z",
"departure": "2024-06-24T06:48:27Z"
},
"load": [
29
],
"activities": [
{
"jobId": "Job_38",
"type": "delivery",
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"time": {
"start": "2024-06-24T06:43:27Z",
"end": "2024-06-24T06:48:27Z"
}
}
],
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"distance": 10209
},
{
"time": {
"arrival": "2024-06-24T06:56:00Z",
"departure": "2024-06-24T07:01:00Z"
},
"load": [
28
],
"activities": [
{
"jobId": "Job_21",
"type": "delivery",
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"time": {
"start": "2024-06-24T06:56:00Z",
"end": "2024-06-24T07:01:00Z"
}
}
],
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"distance": 14694
},
{
"time": {
"arrival": "2024-06-24T07:08:27Z",
"departure": "2024-06-24T07:13:27Z"
},
"load": [
27
],
"activities": [
{
"jobId": "Job_27",
"type": "delivery",
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"time": {
"start": "2024-06-24T07:08:27Z",
"end": "2024-06-24T07:13:27Z"
}
}
],
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"distance": 18078
},
{
"time": {
"arrival": "2024-06-24T07:17:28Z",
"departure": "2024-06-24T07:22:28Z"
},
"load": [
26
],
"activities": [
{
"jobId": "Job_45",
"type": "delivery",
"location": {
"lat": 52.486517527979494,
"lng": 13.382057792236846
},
"time": {
"start": "2024-06-24T07:17:28Z",
"end": "2024-06-24T07:22:28Z"
}
}
],
"location": {
"lat": 52.486517527979494,
"lng": 13.382057792236846
},
"distance": 19290
},
{
"time": {
"arrival": "2024-06-24T07:26:39Z",
"departure": "2024-06-24T07:31:39Z"
},
"load": [
25
],
"activities": [
{
"jobId": "Job_34",
"type": "delivery",
"location": {
"lat": 52.48446152479127,
"lng": 13.392004256315916
},
"time": {
"start": "2024-06-24T07:26:39Z",
"end": "2024-06-24T07:31:39Z"
}
}
],
"location": {
"lat": 52.48446152479127,
"lng": 13.392004256315916
},
"distance": 20440
},
{
"time": {
"arrival": "2024-06-24T07:36:02Z",
"departure": "2024-06-24T07:41:02Z"
},
"load": [
24
],
"activities": [
{
"jobId": "Job_35",
"type": "delivery",
"location": {
"lat": 52.4822032946248,
"lng": 13.391214601891551
},
"time": {
"start": "2024-06-24T07:36:02Z",
"end": "2024-06-24T07:41:02Z"
}
}
],
"location": {
"lat": 52.4822032946248,
"lng": 13.391214601891551
},
"distance": 22068
},
{
"time": {
"arrival": "2024-06-24T07:48:22Z",
"departure": "2024-06-24T07:53:22Z"
},
"load": [
23
],
"activities": [
{
"jobId": "Job_28",
"type": "delivery",
"location": {
"lat": 52.4745,
"lng": 13.42
},
"time": {
"start": "2024-06-24T07:48:22Z",
"end": "2024-06-24T07:53:22Z"
}
}
],
"location": {
"lat": 52.4745,
"lng": 13.42
},
"distance": 25275
},
{
"time": {
"arrival": "2024-06-24T08:02:07Z",
"departure": "2024-06-24T08:07:07Z"
},
"load": [
22
],
"activities": [
{
"jobId": "Job_4",
"type": "delivery",
"location": {
"lat": 52.456,
"lng": 13.403260583257188
},
"time": {
"start": "2024-06-24T08:02:07Z",
"end": "2024-06-24T08:07:07Z"
}
}
],
"location": {
"lat": 52.456,
"lng": 13.403260583257188
},
"distance": 29437
},
{
"time": {
"arrival": "2024-06-24T08:09:15Z",
"departure": "2024-06-24T08:14:15Z"
},
"load": [
21
],
"activities": [
{
"jobId": "Job_43",
"type": "delivery",
"location": {
"lat": 52.4594508034092,
"lng": 13.396015195980404
},
"time": {
"start": "2024-06-24T08:09:15Z",
"end": "2024-06-24T08:14:15Z"
}
}
],
"location": {
"lat": 52.4594508034092,
"lng": 13.396015195980404
},
"distance": 30339
},
{
"time": {
"arrival": "2024-06-24T08:24:05Z",
"departure": "2024-06-24T08:29:05Z"
},
"load": [
20
],
"activities": [
{
"jobId": "Job_6",
"type": "delivery",
"location": {
"lat": 52.45810373923444,
"lng": 13.3318089424755
},
"time": {
"start": "2024-06-24T08:24:05Z",
"end": "2024-06-24T08:29:05Z"
}
}
],
"location": {
"lat": 52.45810373923444,
"lng": 13.3318089424755
},
"distance": 35443
},
{
"time": {
"arrival": "2024-06-24T08:32:20Z",
"departure": "2024-06-24T08:37:20Z"
},
"load": [
19
],
"activities": [
{
"jobId": "Job_11",
"type": "delivery",
"location": {
"lat": 52.457844833248835,
"lng": 13.322525701671736
},
"time": {
"start": "2024-06-24T08:32:20Z",
"end": "2024-06-24T08:37:20Z"
}
}
],
"location": {
"lat": 52.457844833248835,
"lng": 13.322525701671736
},
"distance": 37037
},
{
"time": {
"arrival": "2024-06-24T08:45:57Z",
"departure": "2024-06-24T08:50:57Z"
},
"load": [
18
],
"activities": [
{
"jobId": "Job_7",
"type": "delivery",
"location": {
"lat": 52.439442845393685,
"lng": 13.336118100685782
},
"time": {
"start": "2024-06-24T08:45:57Z",
"end": "2024-06-24T08:50:57Z"
}
}
],
"location": {
"lat": 52.439442845393685,
"lng": 13.336118100685782
},
"distance": 41040
},
{
"time": {
"arrival": "2024-06-24T08:58:42Z",
"departure": "2024-06-24T09:03:42Z"
},
"load": [
17
],
"activities": [
{
"jobId": "Job_12",
"type": "delivery",
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"time": {
"start": "2024-06-24T08:58:42Z",
"end": "2024-06-24T09:03:42Z"
}
}
],
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"distance": 45325
},
{
"time": {
"arrival": "2024-06-24T09:12:46Z",
"departure": "2024-06-24T09:17:46Z"
},
"load": [
16
],
"activities": [
{
"jobId": "Job_15",
"type": "delivery",
"location": {
"lat": 52.44459785400424,
"lng": 13.42729037972278
},
"time": {
"start": "2024-06-24T09:12:46Z",
"end": "2024-06-24T09:17:46Z"
}
}
],
"location": {
"lat": 52.44459785400424,
"lng": 13.42729037972278
},
"distance": 50346
},
{
"time": {
"arrival": "2024-06-24T09:25:44Z",
"departure": "2024-06-24T09:30:44Z"
},
"load": [
15
],
"activities": [
{
"jobId": "Job_23",
"type": "delivery",
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"time": {
"start": "2024-06-24T09:25:44Z",
"end": "2024-06-24T09:30:44Z"
}
}
],
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"distance": 54657
},
{
"time": {
"arrival": "2024-06-24T09:43:15Z",
"departure": "2024-06-24T09:48:15Z"
},
"load": [
14
],
"activities": [
{
"jobId": "Job_37",
"type": "delivery",
"location": {
"lat": 52.47651505101506,
"lng": 13.459944175857151
},
"time": {
"start": "2024-06-24T09:43:15Z",
"end": "2024-06-24T09:48:15Z"
}
}
],
"location": {
"lat": 52.47651505101506,
"lng": 13.459944175857151
},
"distance": 62938
},
{
"time": {
"arrival": "2024-06-24T09:54:21Z",
"departure": "2024-06-24T09:59:21Z"
},
"load": [
13
],
"activities": [
{
"jobId": "Job_9",
"type": "delivery",
"location": {
"lat": 52.4823,
"lng": 13.4703
},
"time": {
"start": "2024-06-24T09:54:21Z",
"end": "2024-06-24T09:59:21Z"
}
}
],
"location": {
"lat": 52.4823,
"lng": 13.4703
},
"distance": 65650
},
{
"time": {
"arrival": "2024-06-24T10:09:34Z",
"departure": "2024-06-24T10:14:34Z"
},
"load": [
12
],
"activities": [
{
"jobId": "Job_13",
"type": "delivery",
"location": {
"lat": 52.48128598928299,
"lng": 13.4944
},
"time": {
"start": "2024-06-24T10:09:34Z",
"end": "2024-06-24T10:14:34Z"
}
}
],
"location": {
"lat": 52.48128598928299,
"lng": 13.4944
},
"distance": 67777
},
{
"time": {
"arrival": "2024-06-24T10:29:09Z",
"departure": "2024-06-24T10:34:09Z"
},
"load": [
11
],
"activities": [
{
"jobId": "Job_22",
"type": "delivery",
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"time": {
"start": "2024-06-24T10:29:09Z",
"end": "2024-06-24T10:34:09Z"
}
}
],
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"distance": 72430
},
{
"time": {
"arrival": "2024-06-24T10:40:58Z",
"departure": "2024-06-24T10:45:58Z"
},
"load": [
10
],
"activities": [
{
"jobId": "Job_31",
"type": "delivery",
"location": {
"lat": 52.4779,
"lng": 13.5012
},
"time": {
"start": "2024-06-24T10:40:58Z",
"end": "2024-06-24T10:45:58Z"
}
}
],
"location": {
"lat": 52.4779,
"lng": 13.5012
},
"distance": 74931
},
{
"time": {
"arrival": "2024-06-24T10:50:51Z",
"departure": "2024-06-24T10:55:51Z"
},
"load": [
9
],
"activities": [
{
"jobId": "Job_17",
"type": "delivery",
"location": {
"lat": 52.48903177127663,
"lng": 13.495944342993262
},
"time": {
"start": "2024-06-24T10:50:51Z",
"end": "2024-06-24T10:55:51Z"
}
}
],
"location": {
"lat": 52.48903177127663,
"lng": 13.495944342993262
},
"distance": 76296
},
{
"time": {
"arrival": "2024-06-24T11:09:46Z",
"departure": "2024-06-24T11:14:46Z"
},
"load": [
8
],
"activities": [
{
"jobId": "Job_44",
"type": "delivery",
"location": {
"lat": 52.54433793446157,
"lng": 13.49579242116612
},
"time": {
"start": "2024-06-24T11:09:46Z",
"end": "2024-06-24T11:14:46Z"
}
}
],
"location": {
"lat": 52.54433793446157,
"lng": 13.49579242116612
},
"distance": 84434
},
{
"time": {
"arrival": "2024-06-24T11:18:57Z",
"departure": "2024-06-24T11:23:57Z"
},
"load": [
7
],
"activities": [
{
"jobId": "Job_33",
"type": "delivery",
"location": {
"lat": 52.55437436208552,
"lng": 13.503142187091647
},
"time": {
"start": "2024-06-24T11:18:57Z",
"end": "2024-06-24T11:23:57Z"
}
}
],
"location": {
"lat": 52.55437436208552,
"lng": 13.503142187091647
},
"distance": 86442
},
{
"time": {
"arrival": "2024-06-24T11:30:29Z",
"departure": "2024-06-24T11:35:29Z"
},
"load": [
6
],
"activities": [
{
"jobId": "Job_48",
"type": "delivery",
"location": {
"lat": 52.56223251898173,
"lng": 13.471999398223556
},
"time": {
"start": "2024-06-24T11:30:29Z",
"end": "2024-06-24T11:35:29Z"
}
}
],
"location": {
"lat": 52.56223251898173,
"lng": 13.471999398223556
},
"distance": 90439
},
{
"time": {
"arrival": "2024-06-24T11:43:20Z",
"departure": "2024-06-24T11:48:20Z"
},
"load": [
5
],
"activities": [
{
"jobId": "Job_32",
"type": "delivery",
"location": {
"lat": 52.60066027234286,
"lng": 13.502741838681835
},
"time": {
"start": "2024-06-24T11:43:20Z",
"end": "2024-06-24T11:48:20Z"
}
}
],
"location": {
"lat": 52.60066027234286,
"lng": 13.502741838681835
},
"distance": 96104
},
{
"time": {
"arrival": "2024-06-24T12:01:15Z",
"departure": "2024-06-24T12:06:15Z"
},
"load": [
4
],
"activities": [
{
"jobId": "Job_42",
"type": "delivery",
"location": {
"lat": 52.63313572894435,
"lng": 13.506488581249922
},
"time": {
"start": "2024-06-24T12:01:15Z",
"end": "2024-06-24T12:06:15Z"
}
}
],
"location": {
"lat": 52.63313572894435,
"lng": 13.506488581249922
},
"distance": 104935
},
{
"time": {
"arrival": "2024-06-24T12:10:25Z",
"departure": "2024-06-24T12:15:25Z"
},
"load": [
3
],
"activities": [
{
"jobId": "Job_25",
"type": "delivery",
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"time": {
"start": "2024-06-24T12:10:25Z",
"end": "2024-06-24T12:15:25Z"
}
}
],
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"distance": 106494
},
{
"time": {
"arrival": "2024-06-24T12:24:22Z",
"departure": "2024-06-24T12:29:22Z"
},
"load": [
2
],
"activities": [
{
"jobId": "Job_36",
"type": "delivery",
"location": {
"lat": 52.60842932011795,
"lng": 13.46922174529483
},
"time": {
"start": "2024-06-24T12:24:22Z",
"end": "2024-06-24T12:29:22Z"
}
}
],
"location": {
"lat": 52.60842932011795,
"lng": 13.46922174529483
},
"distance": 111730
},
{
"time": {
"arrival": "2024-06-24T12:34:40Z",
"departure": "2024-06-24T12:39:40Z"
},
"load": [
1
],
"activities": [
{
"jobId": "Job_49",
"type": "delivery",
"location": {
"lat": 52.595251760429065,
"lng": 13.456764166098564
},
"time": {
"start": "2024-06-24T12:34:40Z",
"end": "2024-06-24T12:39:40Z"
}
}
],
"location": {
"lat": 52.595251760429065,
"lng": 13.456764166098564
},
"distance": 114574
},
{
"time": {
"arrival": "2024-06-24T12:51:52Z",
"departure": "2024-06-24T12:56:52Z"
},
"load": [
0
],
"activities": [
{
"jobId": "Job_46",
"type": "delivery",
"location": {
"lat": 52.55606147412602,
"lng": 13.41517487839967
},
"time": {
"start": "2024-06-24T12:51:52Z",
"end": "2024-06-24T12:56:52Z"
}
}
],
"location": {
"lat": 52.55606147412602,
"lng": 13.41517487839967
},
"distance": 121663
},
{
"time": {
"arrival": "2024-06-24T13:05:35Z",
"departure": "2024-06-24T13:05:35Z"
},
"load": [
0
],
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T13:05:35Z",
"end": "2024-06-24T13:05:35Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 126208
}
],
"statistic": {
"cost": 615.1743,
"distance": 126208,
"duration": 25535,
"times": {
"driving": 15335,
"serving": 10200,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"shiftIndex": 0
},
{
"vehicleId": "vehicle_1_5",
"typeId": "vehicle_1",
"stops": [
{
"time": {
"arrival": "2024-06-24T06:00:00Z",
"departure": "2024-06-24T06:00:00Z"
},
"load": [
15
],
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T06:00:00Z",
"end": "2024-06-24T06:00:00Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 0
},
{
"time": {
"arrival": "2024-06-24T06:02:25Z",
"departure": "2024-06-24T06:07:25Z"
},
"load": [
14
],
"activities": [
{
"jobId": "Job_8",
"type": "delivery",
"location": {
"lat": 52.53213114000045,
"lng": 13.373517153879767
},
"time": {
"start": "2024-06-24T06:02:25Z",
"end": "2024-06-24T06:07:25Z"
}
}
],
"location": {
"lat": 52.53213114000045,
"lng": 13.373517153879767
},
"distance": 1079
},
{
"time": {
"arrival": "2024-06-24T06:25:25Z",
"departure": "2024-06-24T06:30:25Z"
},
"load": [
13
],
"activities": [
{
"jobId": "Job_29",
"type": "delivery",
"location": {
"lat": 52.58884270031872,
"lng": 13.352068415230912
},
"time": {
"start": "2024-06-24T06:25:25Z",
"end": "2024-06-24T06:30:25Z"
}
}
],
"location": {
"lat": 52.58884270031872,
"lng": 13.352068415230912
},
"distance": 9138
},
{
"time": {
"arrival": "2024-06-24T06:47:18Z",
"departure": "2024-06-24T06:52:18Z"
},
"load": [
12
],
"activities": [
{
"jobId": "Job_2",
"type": "delivery",
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"time": {
"start": "2024-06-24T06:47:18Z",
"end": "2024-06-24T06:52:18Z"
}
}
],
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"distance": 16973
},
{
"time": {
"arrival": "2024-06-24T06:59:58Z",
"departure": "2024-06-24T07:04:58Z"
},
"load": [
11
],
"activities": [
{
"jobId": "Job_18",
"type": "delivery",
"location": {
"lat": 52.62863,
"lng": 13.3621182
},
"time": {
"start": "2024-06-24T06:59:58Z",
"end": "2024-06-24T07:04:58Z"
}
}
],
"location": {
"lat": 52.62863,
"lng": 13.3621182
},
"distance": 19755
},
{
"time": {
"arrival": "2024-06-24T07:07:52Z",
"departure": "2024-06-24T07:12:52Z"
},
"load": [
10
],
"activities": [
{
"jobId": "Job_5",
"type": "delivery",
"location": {
"lat": 52.63256,
"lng": 13.37322
},
"time": {
"start": "2024-06-24T07:07:52Z",
"end": "2024-06-24T07:12:52Z"
}
}
],
"location": {
"lat": 52.63256,
"lng": 13.37322
},
"distance": 20807
},
{
"time": {
"arrival": "2024-06-24T07:22:02Z",
"departure": "2024-06-24T07:27:02Z"
},
"load": [
9
],
"activities": [
{
"jobId": "Job_40",
"type": "delivery",
"location": {
"lat": 52.6543,
"lng": 13.39278
},
"time": {
"start": "2024-06-24T07:22:02Z",
"end": "2024-06-24T07:27:02Z"
}
}
],
"location": {
"lat": 52.6543,
"lng": 13.39278
},
"distance": 25810
},
{
"time": {
"arrival": "2024-06-24T07:32:03Z",
"departure": "2024-06-24T07:37:03Z"
},
"load": [
8
],
"activities": [
{
"jobId": "Job_19",
"type": "delivery",
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"time": {
"start": "2024-06-24T07:32:03Z",
"end": "2024-06-24T07:37:03Z"
}
}
],
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"distance": 28530
},
{
"time": {
"arrival": "2024-06-24T07:43:41Z",
"departure": "2024-06-24T07:48:41Z"
},
"load": [
7
],
"activities": [
{
"jobId": "Job_1",
"type": "delivery",
"location": {
"lat": 52.63329,
"lng": 13.3138
},
"time": {
"start": "2024-06-24T07:43:41Z",
"end": "2024-06-24T07:48:41Z"
}
}
],
"location": {
"lat": 52.63329,
"lng": 13.3138
},
"distance": 33402
},
{
"time": {
"arrival": "2024-06-24T07:54:51Z",
"departure": "2024-06-24T07:59:51Z"
},
"load": [
6
],
"activities": [
{
"jobId": "Job_20",
"type": "delivery",
"location": {
"lat": 52.61955,
"lng": 13.29845
},
"time": {
"start": "2024-06-24T07:54:51Z",
"end": "2024-06-24T07:59:51Z"
}
}
],
"location": {
"lat": 52.61955,
"lng": 13.29845
},
"distance": 36663
},
{
"time": {
"arrival": "2024-06-24T08:08:12Z",
"departure": "2024-06-24T08:13:12Z"
},
"load": [
5
],
"activities": [
{
"jobId": "Job_39",
"type": "delivery",
"location": {
"lat": 52.6029,
"lng": 13.3113
},
"time": {
"start": "2024-06-24T08:08:12Z",
"end": "2024-06-24T08:13:12Z"
}
}
],
"location": {
"lat": 52.6029,
"lng": 13.3113
},
"distance": 41036
},
{
"time": {
"arrival": "2024-06-24T08:18:39Z",
"departure": "2024-06-24T08:23:39Z"
},
"load": [
4
],
"activities": [
{
"jobId": "Job_30",
"type": "delivery",
"location": {
"lat": 52.60079217247425,
"lng": 13.339813254226156
},
"time": {
"start": "2024-06-24T08:18:39Z",
"end": "2024-06-24T08:23:39Z"
}
}
],
"location": {
"lat": 52.60079217247425,
"lng": 13.339813254226156
},
"distance": 43822
},
{
"time": {
"arrival": "2024-06-24T08:29:21Z",
"departure": "2024-06-24T08:34:21Z"
},
"load": [
3
],
"activities": [
{
"jobId": "Job_47",
"type": "delivery",
"location": {
"lat": 52.591995183321515,
"lng": 13.36000789424169
},
"time": {
"start": "2024-06-24T08:29:21Z",
"end": "2024-06-24T08:34:21Z"
}
}
],
"location": {
"lat": 52.591995183321515,
"lng": 13.36000789424169
},
"distance": 46074
},
{
"time": {
"arrival": "2024-06-24T08:44:06Z",
"departure": "2024-06-24T08:49:06Z"
},
"load": [
2
],
"activities": [
{
"jobId": "Job_14",
"type": "delivery",
"location": {
"lat": 52.58038089373736,
"lng": 13.30447922221816
},
"time": {
"start": "2024-06-24T08:44:06Z",
"end": "2024-06-24T08:49:06Z"
}
}
],
"location": {
"lat": 52.58038089373736,
"lng": 13.30447922221816
},
"distance": 50689
},
{
"time": {
"arrival": "2024-06-24T09:01:34Z",
"departure": "2024-06-24T09:06:34Z"
},
"load": [
1
],
"activities": [
{
"jobId": "Job_26",
"type": "delivery",
"location": {
"lat": 52.53754,
"lng": 13.34152
},
"time": {
"start": "2024-06-24T09:01:34Z",
"end": "2024-06-24T09:06:34Z"
}
}
],
"location": {
"lat": 52.53754,
"lng": 13.34152
},
"distance": 58307
},
{
"time": {
"arrival": "2024-06-24T09:10:48Z",
"departure": "2024-06-24T09:15:48Z"
},
"load": [
0
],
"activities": [
{
"jobId": "Job_10",
"type": "delivery",
"location": {
"lat": 52.5313,
"lng": 13.35356
},
"time": {
"start": "2024-06-24T09:10:48Z",
"end": "2024-06-24T09:15:48Z"
}
}
],
"location": {
"lat": 52.5313,
"lng": 13.35356
},
"distance": 60132
},
{
"time": {
"arrival": "2024-06-24T09:22:25Z",
"departure": "2024-06-24T09:22:25Z"
},
"load": [
0
],
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T09:22:25Z",
"end": "2024-06-24T09:22:25Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 63270
}
],
"statistic": {
"cost": 607.5415,
"distance": 63270,
"duration": 12145,
"times": {
"driving": 7645,
"serving": 4500,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"shiftIndex": 0
}
]
}Add excess cost calculation
This scenario extends the previously discussed problem by leveraging the excessCosts feature to introduce cost penalties when a vehicle is driven for more than eight hours, as illustrated by the following code snippet:
"excessCosts": {
"duration": {
"limit": 28800,
"fixedCost": 0,
"stepCost": 100,
"stepSize": 3600
}
}According to the previous snippet, for each hour exceeding the eight-hour soft limit, the vehicle incurs an additional cost of 100, with no additional, one-time fixed penalty.
In addition, the following problem specification takes advantage of the ability to calculate excess duration costs by extending the shift time to 12 hours. This allows the optimization algorithm to find the most efficient tour solution, even if it requires incurring excess cost penalties in certain cases.
Click to expand/collapse the sample JSON
{
"fleet": {
"types": [
{
"profile": "car",
"amount": 5,
"capacity": [
50
],
"costs": {
"time": 0.0001,
"distance": 0.0001,
"fixed": 600,
"excessCosts": {
"duration": {
"limit": 28800,
"fixedCost": 0,
"stepCost": 100,
"stepSize": 3600
}
}
},
"id": "vehicle_1",
"shifts": [
{
"start": {
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": "2024-06-24T08:00:00+02:00"
},
"end": {
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": "2024-06-24T20:00:00+02:00"
}
}
]
}
],
"profiles": [
{
"name": "car",
"type": "car"
}
]
},
"plan": {
"jobs": [
{
"id": "Job_1",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.63329,
"lng": 13.3138
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_2",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_3",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679571
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_4",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.456,
"lng": 13.403260583257188
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_5",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.63256,
"lng": 13.37322
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_6",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.45810373923444,
"lng": 13.331808942475499
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_7",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.439442845393685,
"lng": 13.336118100685782
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_8",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.53213114000045,
"lng": 13.373517153879769
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_9",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4823,
"lng": 13.4703
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_10",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5313,
"lng": 13.35356
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_11",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.457844833248835,
"lng": 13.322525701671735
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_12",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_13",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48128598928299,
"lng": 13.4944
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_14",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.580380893737356,
"lng": 13.304479222218161
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_15",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.444597854004236,
"lng": 13.42729037972278
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_16",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_17",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48903177127663,
"lng": 13.495944342993262
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_18",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.62863,
"lng": 13.3621182
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_19",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_20",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.61955,
"lng": 13.29845
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_21",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_22",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_23",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_24",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5293,
"lng": 13.38507204916371
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_25",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_26",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.53754,
"lng": 13.34152
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_27",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_28",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4745,
"lng": 13.42
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_29",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.58884270031872,
"lng": 13.352068415230912
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_30",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.60079217247425,
"lng": 13.339813254226156
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_31",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4779,
"lng": 13.5012
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_32",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.60066027234286,
"lng": 13.502741838681837
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_33",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.55437436208552,
"lng": 13.503142187091647
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_34",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48446152479127,
"lng": 13.392004256315916
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_35",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.482203294624796,
"lng": 13.391214601891551
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_36",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.60842932011795,
"lng": 13.46922174529483
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_37",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.47651505101506,
"lng": 13.459944175857151
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_38",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_39",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.6029,
"lng": 13.3113
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_40",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.6543,
"lng": 13.39278
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_41",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.51508491755749,
"lng": 13.38
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_42",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.63313572894435,
"lng": 13.506488581249922
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_43",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.459450803409204,
"lng": 13.396015195980405
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_44",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.54433793446157,
"lng": 13.49579242116612
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_45",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.486517527979494,
"lng": 13.382057792236846
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_46",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.55606147412602,
"lng": 13.41517487839967
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_47",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.591995183321515,
"lng": 13.36000789424169
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_48",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.56223251898173,
"lng": 13.471999398223556
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_49",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.595251760429065,
"lng": 13.456764166098564
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
}
]
},
"objectives": [
{
"type": "minimizeUnassigned"
},
{
"type": "minimizeCost"
}
],
"configuration": {
"experimentalFeatures": [
"excessCosts"
]
}
}Solution
The following figure provides a visual solution overview:
As depicted in the visual overview, this solution differs from the previous one in several key aspects. Specifically, the number of tours has been reduced to a single instance. Furthermore, the vehicle participating in the tour exceeded its eight-hour limit by two hours and ten minutes, resulting in additional costs of 300 for its tour. Most significantly, the total cost of the tour was 922, which represents a substantial reduction (24.7%) compared to the previously discussed solution (1223).
The following section provides the full solution JSON for reference:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 921.6154,
"distance": 179553,
"duration": 36601,
"times": {
"driving": 21901,
"serving": 14700,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"tours": [
{
"vehicleId": "vehicle_1_3",
"typeId": "vehicle_1",
"stops": [
{
"time": {
"arrival": "2024-06-24T06:00:00Z",
"departure": "2024-06-24T06:00:00Z"
},
"load": [
49
],
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T06:00:00Z",
"end": "2024-06-24T06:00:00Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 0
},
{
"time": {
"arrival": "2024-06-24T06:01:15Z",
"departure": "2024-06-24T06:06:15Z"
},
"load": [
48
],
"activities": [
{
"jobId": "Job_24",
"type": "delivery",
"location": {
"lat": 52.5293,
"lng": 13.38507204916371
},
"time": {
"start": "2024-06-24T06:01:15Z",
"end": "2024-06-24T06:06:15Z"
}
}
],
"location": {
"lat": 52.5293,
"lng": 13.38507204916371
},
"distance": 485
},
{
"time": {
"arrival": "2024-06-24T06:09:44Z",
"departure": "2024-06-24T06:14:44Z"
},
"load": [
47
],
"activities": [
{
"jobId": "Job_8",
"type": "delivery",
"location": {
"lat": 52.53213114000045,
"lng": 13.373517153879767
},
"time": {
"start": "2024-06-24T06:09:44Z",
"end": "2024-06-24T06:14:44Z"
}
}
],
"location": {
"lat": 52.53213114000045,
"lng": 13.373517153879767
},
"distance": 1679
},
{
"time": {
"arrival": "2024-06-24T06:20:38Z",
"departure": "2024-06-24T06:25:38Z"
},
"load": [
46
],
"activities": [
{
"jobId": "Job_10",
"type": "delivery",
"location": {
"lat": 52.5313,
"lng": 13.35356
},
"time": {
"start": "2024-06-24T06:20:38Z",
"end": "2024-06-24T06:25:38Z"
}
}
],
"location": {
"lat": 52.5313,
"lng": 13.35356
},
"distance": 4551
},
{
"time": {
"arrival": "2024-06-24T06:29:53Z",
"departure": "2024-06-24T06:34:53Z"
},
"load": [
45
],
"activities": [
{
"jobId": "Job_26",
"type": "delivery",
"location": {
"lat": 52.53754,
"lng": 13.34152
},
"time": {
"start": "2024-06-24T06:29:53Z",
"end": "2024-06-24T06:34:53Z"
}
}
],
"location": {
"lat": 52.53754,
"lng": 13.34152
},
"distance": 6353
},
{
"time": {
"arrival": "2024-06-24T06:41:46Z",
"departure": "2024-06-24T06:46:46Z"
},
"load": [
44
],
"activities": [
{
"jobId": "Job_3",
"type": "delivery",
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
},
"time": {
"start": "2024-06-24T06:41:46Z",
"end": "2024-06-24T06:46:46Z"
}
}
],
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
},
"distance": 9645
},
{
"time": {
"arrival": "2024-06-24T06:51:55Z",
"departure": "2024-06-24T06:56:55Z"
},
"load": [
43
],
"activities": [
{
"jobId": "Job_16",
"type": "delivery",
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"time": {
"start": "2024-06-24T06:51:55Z",
"end": "2024-06-24T06:56:55Z"
}
}
],
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"distance": 11936
},
{
"time": {
"arrival": "2024-06-24T07:01:02Z",
"departure": "2024-06-24T07:06:02Z"
},
"load": [
42
],
"activities": [
{
"jobId": "Job_38",
"type": "delivery",
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"time": {
"start": "2024-06-24T07:01:02Z",
"end": "2024-06-24T07:06:02Z"
}
}
],
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"distance": 13376
},
{
"time": {
"arrival": "2024-06-24T07:12:03Z",
"departure": "2024-06-24T07:17:03Z"
},
"load": [
41
],
"activities": [
{
"jobId": "Job_41",
"type": "delivery",
"location": {
"lat": 52.51508491755749,
"lng": 13.38
},
"time": {
"start": "2024-06-24T07:12:03Z",
"end": "2024-06-24T07:17:03Z"
}
}
],
"location": {
"lat": 52.51508491755749,
"lng": 13.38
},
"distance": 16161
},
{
"time": {
"arrival": "2024-06-24T07:24:39Z",
"departure": "2024-06-24T07:29:39Z"
},
"load": [
40
],
"activities": [
{
"jobId": "Job_21",
"type": "delivery",
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"time": {
"start": "2024-06-24T07:24:39Z",
"end": "2024-06-24T07:29:39Z"
}
}
],
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"distance": 19563
},
{
"time": {
"arrival": "2024-06-24T07:37:06Z",
"departure": "2024-06-24T07:42:06Z"
},
"load": [
39
],
"activities": [
{
"jobId": "Job_27",
"type": "delivery",
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"time": {
"start": "2024-06-24T07:37:06Z",
"end": "2024-06-24T07:42:06Z"
}
}
],
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"distance": 22947
},
{
"time": {
"arrival": "2024-06-24T07:46:07Z",
"departure": "2024-06-24T07:51:07Z"
},
"load": [
38
],
"activities": [
{
"jobId": "Job_45",
"type": "delivery",
"location": {
"lat": 52.486517527979494,
"lng": 13.382057792236846
},
"time": {
"start": "2024-06-24T07:46:07Z",
"end": "2024-06-24T07:51:07Z"
}
}
],
"location": {
"lat": 52.486517527979494,
"lng": 13.382057792236846
},
"distance": 24159
},
{
"time": {
"arrival": "2024-06-24T07:55:18Z",
"departure": "2024-06-24T08:00:18Z"
},
"load": [
37
],
"activities": [
{
"jobId": "Job_34",
"type": "delivery",
"location": {
"lat": 52.48446152479127,
"lng": 13.392004256315916
},
"time": {
"start": "2024-06-24T07:55:18Z",
"end": "2024-06-24T08:00:18Z"
}
}
],
"location": {
"lat": 52.48446152479127,
"lng": 13.392004256315916
},
"distance": 25309
},
{
"time": {
"arrival": "2024-06-24T08:04:41Z",
"departure": "2024-06-24T08:09:41Z"
},
"load": [
36
],
"activities": [
{
"jobId": "Job_35",
"type": "delivery",
"location": {
"lat": 52.4822032946248,
"lng": 13.391214601891551
},
"time": {
"start": "2024-06-24T08:04:41Z",
"end": "2024-06-24T08:09:41Z"
}
}
],
"location": {
"lat": 52.4822032946248,
"lng": 13.391214601891551
},
"distance": 26937
},
{
"time": {
"arrival": "2024-06-24T08:17:01Z",
"departure": "2024-06-24T08:22:01Z"
},
"load": [
35
],
"activities": [
{
"jobId": "Job_28",
"type": "delivery",
"location": {
"lat": 52.4745,
"lng": 13.42
},
"time": {
"start": "2024-06-24T08:17:01Z",
"end": "2024-06-24T08:22:01Z"
}
}
],
"location": {
"lat": 52.4745,
"lng": 13.42
},
"distance": 30144
},
{
"time": {
"arrival": "2024-06-24T08:31:38Z",
"departure": "2024-06-24T08:36:38Z"
},
"load": [
34
],
"activities": [
{
"jobId": "Job_15",
"type": "delivery",
"location": {
"lat": 52.44459785400424,
"lng": 13.42729037972278
},
"time": {
"start": "2024-06-24T08:31:38Z",
"end": "2024-06-24T08:36:38Z"
}
}
],
"location": {
"lat": 52.44459785400424,
"lng": 13.42729037972278
},
"distance": 34632
},
{
"time": {
"arrival": "2024-06-24T08:44:36Z",
"departure": "2024-06-24T08:49:36Z"
},
"load": [
33
],
"activities": [
{
"jobId": "Job_23",
"type": "delivery",
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"time": {
"start": "2024-06-24T08:44:36Z",
"end": "2024-06-24T08:49:36Z"
}
}
],
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"distance": 38943
},
{
"time": {
"arrival": "2024-06-24T09:02:47Z",
"departure": "2024-06-24T09:07:47Z"
},
"load": [
32
],
"activities": [
{
"jobId": "Job_12",
"type": "delivery",
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"time": {
"start": "2024-06-24T09:02:47Z",
"end": "2024-06-24T09:07:47Z"
}
}
],
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"distance": 46633
},
{
"time": {
"arrival": "2024-06-24T09:16:09Z",
"departure": "2024-06-24T09:21:09Z"
},
"load": [
31
],
"activities": [
{
"jobId": "Job_7",
"type": "delivery",
"location": {
"lat": 52.439442845393685,
"lng": 13.336118100685782
},
"time": {
"start": "2024-06-24T09:16:09Z",
"end": "2024-06-24T09:21:09Z"
}
}
],
"location": {
"lat": 52.439442845393685,
"lng": 13.336118100685782
},
"distance": 50941
},
{
"time": {
"arrival": "2024-06-24T09:27:21Z",
"departure": "2024-06-24T09:32:21Z"
},
"load": [
30
],
"activities": [
{
"jobId": "Job_11",
"type": "delivery",
"location": {
"lat": 52.457844833248835,
"lng": 13.322525701671736
},
"time": {
"start": "2024-06-24T09:27:21Z",
"end": "2024-06-24T09:32:21Z"
}
}
],
"location": {
"lat": 52.457844833248835,
"lng": 13.322525701671736
},
"distance": 53701
},
{
"time": {
"arrival": "2024-06-24T09:35:18Z",
"departure": "2024-06-24T09:40:18Z"
},
"load": [
29
],
"activities": [
{
"jobId": "Job_6",
"type": "delivery",
"location": {
"lat": 52.45810373923444,
"lng": 13.3318089424755
},
"time": {
"start": "2024-06-24T09:35:18Z",
"end": "2024-06-24T09:40:18Z"
}
}
],
"location": {
"lat": 52.45810373923444,
"lng": 13.3318089424755
},
"distance": 54889
},
{
"time": {
"arrival": "2024-06-24T09:48:57Z",
"departure": "2024-06-24T09:53:57Z"
},
"load": [
28
],
"activities": [
{
"jobId": "Job_43",
"type": "delivery",
"location": {
"lat": 52.4594508034092,
"lng": 13.396015195980404
},
"time": {
"start": "2024-06-24T09:48:57Z",
"end": "2024-06-24T09:53:57Z"
}
}
],
"location": {
"lat": 52.4594508034092,
"lng": 13.396015195980404
},
"distance": 59645
},
{
"time": {
"arrival": "2024-06-24T09:56:01Z",
"departure": "2024-06-24T10:01:01Z"
},
"load": [
27
],
"activities": [
{
"jobId": "Job_4",
"type": "delivery",
"location": {
"lat": 52.456,
"lng": 13.403260583257188
},
"time": {
"start": "2024-06-24T09:56:01Z",
"end": "2024-06-24T10:01:01Z"
}
}
],
"location": {
"lat": 52.456,
"lng": 13.403260583257188
},
"distance": 60547
},
{
"time": {
"arrival": "2024-06-24T10:10:16Z",
"departure": "2024-06-24T10:15:16Z"
},
"load": [
26
],
"activities": [
{
"jobId": "Job_37",
"type": "delivery",
"location": {
"lat": 52.47651505101506,
"lng": 13.459944175857151
},
"time": {
"start": "2024-06-24T10:10:16Z",
"end": "2024-06-24T10:15:16Z"
}
}
],
"location": {
"lat": 52.47651505101506,
"lng": 13.459944175857151
},
"distance": 67193
},
{
"time": {
"arrival": "2024-06-24T10:21:22Z",
"departure": "2024-06-24T10:26:22Z"
},
"load": [
25
],
"activities": [
{
"jobId": "Job_9",
"type": "delivery",
"location": {
"lat": 52.4823,
"lng": 13.4703
},
"time": {
"start": "2024-06-24T10:21:22Z",
"end": "2024-06-24T10:26:22Z"
}
}
],
"location": {
"lat": 52.4823,
"lng": 13.4703
},
"distance": 69905
},
{
"time": {
"arrival": "2024-06-24T10:36:35Z",
"departure": "2024-06-24T10:41:35Z"
},
"load": [
24
],
"activities": [
{
"jobId": "Job_13",
"type": "delivery",
"location": {
"lat": 52.48128598928299,
"lng": 13.4944
},
"time": {
"start": "2024-06-24T10:36:35Z",
"end": "2024-06-24T10:41:35Z"
}
}
],
"location": {
"lat": 52.48128598928299,
"lng": 13.4944
},
"distance": 72032
},
{
"time": {
"arrival": "2024-06-24T10:56:10Z",
"departure": "2024-06-24T11:01:10Z"
},
"load": [
23
],
"activities": [
{
"jobId": "Job_22",
"type": "delivery",
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"time": {
"start": "2024-06-24T10:56:10Z",
"end": "2024-06-24T11:01:10Z"
}
}
],
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"distance": 76685
},
{
"time": {
"arrival": "2024-06-24T11:07:59Z",
"departure": "2024-06-24T11:12:59Z"
},
"load": [
22
],
"activities": [
{
"jobId": "Job_31",
"type": "delivery",
"location": {
"lat": 52.4779,
"lng": 13.5012
},
"time": {
"start": "2024-06-24T11:07:59Z",
"end": "2024-06-24T11:12:59Z"
}
}
],
"location": {
"lat": 52.4779,
"lng": 13.5012
},
"distance": 79186
},
{
"time": {
"arrival": "2024-06-24T11:17:52Z",
"departure": "2024-06-24T11:22:52Z"
},
"load": [
21
],
"activities": [
{
"jobId": "Job_17",
"type": "delivery",
"location": {
"lat": 52.48903177127663,
"lng": 13.495944342993262
},
"time": {
"start": "2024-06-24T11:17:52Z",
"end": "2024-06-24T11:22:52Z"
}
}
],
"location": {
"lat": 52.48903177127663,
"lng": 13.495944342993262
},
"distance": 80551
},
{
"time": {
"arrival": "2024-06-24T11:36:47Z",
"departure": "2024-06-24T11:41:47Z"
},
"load": [
20
],
"activities": [
{
"jobId": "Job_44",
"type": "delivery",
"location": {
"lat": 52.54433793446157,
"lng": 13.49579242116612
},
"time": {
"start": "2024-06-24T11:36:47Z",
"end": "2024-06-24T11:41:47Z"
}
}
],
"location": {
"lat": 52.54433793446157,
"lng": 13.49579242116612
},
"distance": 88689
},
{
"time": {
"arrival": "2024-06-24T11:45:58Z",
"departure": "2024-06-24T11:50:58Z"
},
"load": [
19
],
"activities": [
{
"jobId": "Job_33",
"type": "delivery",
"location": {
"lat": 52.55437436208552,
"lng": 13.503142187091647
},
"time": {
"start": "2024-06-24T11:45:58Z",
"end": "2024-06-24T11:50:58Z"
}
}
],
"location": {
"lat": 52.55437436208552,
"lng": 13.503142187091647
},
"distance": 90697
},
{
"time": {
"arrival": "2024-06-24T11:57:30Z",
"departure": "2024-06-24T12:02:30Z"
},
"load": [
18
],
"activities": [
{
"jobId": "Job_48",
"type": "delivery",
"location": {
"lat": 52.56223251898173,
"lng": 13.471999398223556
},
"time": {
"start": "2024-06-24T11:57:30Z",
"end": "2024-06-24T12:02:30Z"
}
}
],
"location": {
"lat": 52.56223251898173,
"lng": 13.471999398223556
},
"distance": 94694
},
{
"time": {
"arrival": "2024-06-24T12:10:21Z",
"departure": "2024-06-24T12:15:21Z"
},
"load": [
17
],
"activities": [
{
"jobId": "Job_32",
"type": "delivery",
"location": {
"lat": 52.60066027234286,
"lng": 13.502741838681835
},
"time": {
"start": "2024-06-24T12:10:21Z",
"end": "2024-06-24T12:15:21Z"
}
}
],
"location": {
"lat": 52.60066027234286,
"lng": 13.502741838681835
},
"distance": 100359
},
{
"time": {
"arrival": "2024-06-24T12:28:16Z",
"departure": "2024-06-24T12:33:16Z"
},
"load": [
16
],
"activities": [
{
"jobId": "Job_42",
"type": "delivery",
"location": {
"lat": 52.63313572894435,
"lng": 13.506488581249922
},
"time": {
"start": "2024-06-24T12:28:16Z",
"end": "2024-06-24T12:33:16Z"
}
}
],
"location": {
"lat": 52.63313572894435,
"lng": 13.506488581249922
},
"distance": 109190
},
{
"time": {
"arrival": "2024-06-24T12:37:26Z",
"departure": "2024-06-24T12:42:26Z"
},
"load": [
15
],
"activities": [
{
"jobId": "Job_25",
"type": "delivery",
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"time": {
"start": "2024-06-24T12:37:26Z",
"end": "2024-06-24T12:42:26Z"
}
}
],
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"distance": 110749
},
{
"time": {
"arrival": "2024-06-24T12:51:23Z",
"departure": "2024-06-24T12:56:23Z"
},
"load": [
14
],
"activities": [
{
"jobId": "Job_36",
"type": "delivery",
"location": {
"lat": 52.60842932011795,
"lng": 13.46922174529483
},
"time": {
"start": "2024-06-24T12:51:23Z",
"end": "2024-06-24T12:56:23Z"
}
}
],
"location": {
"lat": 52.60842932011795,
"lng": 13.46922174529483
},
"distance": 115985
},
{
"time": {
"arrival": "2024-06-24T13:01:41Z",
"departure": "2024-06-24T13:06:41Z"
},
"load": [
13
],
"activities": [
{
"jobId": "Job_49",
"type": "delivery",
"location": {
"lat": 52.595251760429065,
"lng": 13.456764166098564
},
"time": {
"start": "2024-06-24T13:01:41Z",
"end": "2024-06-24T13:06:41Z"
}
}
],
"location": {
"lat": 52.595251760429065,
"lng": 13.456764166098564
},
"distance": 118829
},
{
"time": {
"arrival": "2024-06-24T13:21:40Z",
"departure": "2024-06-24T13:26:40Z"
},
"load": [
12
],
"activities": [
{
"jobId": "Job_2",
"type": "delivery",
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"time": {
"start": "2024-06-24T13:21:40Z",
"end": "2024-06-24T13:26:40Z"
}
}
],
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"distance": 127959
},
{
"time": {
"arrival": "2024-06-24T13:34:20Z",
"departure": "2024-06-24T13:39:20Z"
},
"load": [
11
],
"activities": [
{
"jobId": "Job_18",
"type": "delivery",
"location": {
"lat": 52.62863,
"lng": 13.3621182
},
"time": {
"start": "2024-06-24T13:34:20Z",
"end": "2024-06-24T13:39:20Z"
}
}
],
"location": {
"lat": 52.62863,
"lng": 13.3621182
},
"distance": 130741
},
{
"time": {
"arrival": "2024-06-24T13:42:14Z",
"departure": "2024-06-24T13:47:14Z"
},
"load": [
10
],
"activities": [
{
"jobId": "Job_5",
"type": "delivery",
"location": {
"lat": 52.63256,
"lng": 13.37322
},
"time": {
"start": "2024-06-24T13:42:14Z",
"end": "2024-06-24T13:47:14Z"
}
}
],
"location": {
"lat": 52.63256,
"lng": 13.37322
},
"distance": 131793
},
{
"time": {
"arrival": "2024-06-24T13:56:24Z",
"departure": "2024-06-24T14:01:24Z"
},
"load": [
9
],
"activities": [
{
"jobId": "Job_40",
"type": "delivery",
"location": {
"lat": 52.6543,
"lng": 13.39278
},
"time": {
"start": "2024-06-24T13:56:24Z",
"end": "2024-06-24T14:01:24Z"
}
}
],
"location": {
"lat": 52.6543,
"lng": 13.39278
},
"distance": 136796
},
{
"time": {
"arrival": "2024-06-24T14:06:25Z",
"departure": "2024-06-24T14:11:25Z"
},
"load": [
8
],
"activities": [
{
"jobId": "Job_19",
"type": "delivery",
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"time": {
"start": "2024-06-24T14:06:25Z",
"end": "2024-06-24T14:11:25Z"
}
}
],
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"distance": 139516
},
{
"time": {
"arrival": "2024-06-24T14:18:03Z",
"departure": "2024-06-24T14:23:03Z"
},
"load": [
7
],
"activities": [
{
"jobId": "Job_1",
"type": "delivery",
"location": {
"lat": 52.63329,
"lng": 13.3138
},
"time": {
"start": "2024-06-24T14:18:03Z",
"end": "2024-06-24T14:23:03Z"
}
}
],
"location": {
"lat": 52.63329,
"lng": 13.3138
},
"distance": 144388
},
{
"time": {
"arrival": "2024-06-24T14:29:13Z",
"departure": "2024-06-24T14:34:13Z"
},
"load": [
6
],
"activities": [
{
"jobId": "Job_20",
"type": "delivery",
"location": {
"lat": 52.61955,
"lng": 13.29845
},
"time": {
"start": "2024-06-24T14:29:13Z",
"end": "2024-06-24T14:34:13Z"
}
}
],
"location": {
"lat": 52.61955,
"lng": 13.29845
},
"distance": 147649
},
{
"time": {
"arrival": "2024-06-24T14:42:34Z",
"departure": "2024-06-24T14:47:34Z"
},
"load": [
5
],
"activities": [
{
"jobId": "Job_39",
"type": "delivery",
"location": {
"lat": 52.6029,
"lng": 13.3113
},
"time": {
"start": "2024-06-24T14:42:34Z",
"end": "2024-06-24T14:47:34Z"
}
}
],
"location": {
"lat": 52.6029,
"lng": 13.3113
},
"distance": 152022
},
{
"time": {
"arrival": "2024-06-24T14:55:01Z",
"departure": "2024-06-24T15:00:01Z"
},
"load": [
4
],
"activities": [
{
"jobId": "Job_14",
"type": "delivery",
"location": {
"lat": 52.58038089373736,
"lng": 13.30447922221816
},
"time": {
"start": "2024-06-24T14:55:01Z",
"end": "2024-06-24T15:00:01Z"
}
}
],
"location": {
"lat": 52.58038089373736,
"lng": 13.30447922221816
},
"distance": 155814
},
{
"time": {
"arrival": "2024-06-24T15:06:58Z",
"departure": "2024-06-24T15:11:58Z"
},
"load": [
3
],
"activities": [
{
"jobId": "Job_30",
"type": "delivery",
"location": {
"lat": 52.60079217247425,
"lng": 13.339813254226156
},
"time": {
"start": "2024-06-24T15:06:58Z",
"end": "2024-06-24T15:11:58Z"
}
}
],
"location": {
"lat": 52.60079217247425,
"lng": 13.339813254226156
},
"distance": 159862
},
{
"time": {
"arrival": "2024-06-24T15:17:40Z",
"departure": "2024-06-24T15:22:40Z"
},
"load": [
2
],
"activities": [
{
"jobId": "Job_47",
"type": "delivery",
"location": {
"lat": 52.591995183321515,
"lng": 13.36000789424169
},
"time": {
"start": "2024-06-24T15:17:40Z",
"end": "2024-06-24T15:22:40Z"
}
}
],
"location": {
"lat": 52.591995183321515,
"lng": 13.36000789424169
},
"distance": 162114
},
{
"time": {
"arrival": "2024-06-24T15:34:04Z",
"departure": "2024-06-24T15:39:04Z"
},
"load": [
1
],
"activities": [
{
"jobId": "Job_29",
"type": "delivery",
"location": {
"lat": 52.58884270031872,
"lng": 13.352068415230912
},
"time": {
"start": "2024-06-24T15:34:04Z",
"end": "2024-06-24T15:39:04Z"
}
}
],
"location": {
"lat": 52.58884270031872,
"lng": 13.352068415230912
},
"distance": 166769
},
{
"time": {
"arrival": "2024-06-24T15:56:18Z",
"departure": "2024-06-24T16:01:18Z"
},
"load": [
0
],
"activities": [
{
"jobId": "Job_46",
"type": "delivery",
"location": {
"lat": 52.55606147412602,
"lng": 13.41517487839967
},
"time": {
"start": "2024-06-24T15:56:18Z",
"end": "2024-06-24T16:01:18Z"
}
}
],
"location": {
"lat": 52.55606147412602,
"lng": 13.41517487839967
},
"distance": 175008
},
{
"time": {
"arrival": "2024-06-24T16:10:01Z",
"departure": "2024-06-24T16:10:01Z"
},
"load": [
0
],
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T16:10:01Z",
"end": "2024-06-24T16:10:01Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 179553
}
],
"statistic": {
"cost": 921.6154,
"distance": 179553,
"duration": 36601,
"times": {
"driving": 21901,
"serving": 14700,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"shiftIndex": 0
}
]
}Conclusions
This tutorial demonstrated how to use the excessCosts feature within the full problem context as well as showcases the advantages of the excessCosts feature. As shown in the tutorial, using the feature enabled more cost-efficient tour optimization in a scenario where the algorithm could operate beyond the established limits within a reasonable scope. By allowing the algorithm to exceed these limits, the optimization led to significant cost savings as compared with the scenario that did not include excess cost calculation.
Updated 29 days ago