Skip to main content

Create an optimized route

There are 5 operations to load on 1 depot and to deliver on 5 distinct sites with 1 available vehicle.

useCase01a

note

This is a basic case without any additional logistical constraints. For the latter, refer to the section Additional logistics functionalities

The Operations:​

An operation corresponds to a transport order, in other words a collection or a delivery to be done on a given logistics site.

"operations": [
{
"id": "OPERATION_01",
"type": "DELIVERY",
"idSiteDestination": "AXIOROUTE"
},
{
"id": "OPERATION_02",
"type": "DELIVERY",
"idSiteDestination": "COFISOFT"
},
{
"id": "OPERATION_03",
"type": "DELIVERY",
"idSiteDestination": "CJM"
},
{
"id": "OPERATION_04",
"type": "DELIVERY",
"idSiteDestination": "GPI"
},
{
"id": "OPERATION_05",
"type": "DELIVERY",
"idSiteDestination": "XYRIC"
}
]
note
  • on a collection operation ("type": "COLLECTION"), the origin site is required. The destination site is optional: if it is not specified, it will be chosen during calculation from one of the logistics sites considered as a depot of the problem.
  • on the contrary: for a delivery operation ("type": "DELIVERY"), the destination site is required and the origin site is optional.

The Sites:​

A logistics site is a geographic location where it is necessary to do a specific action of the transport plan. It can therefore be a collection, loading, delivery, unloading, taking up a vehicle, etc.

"sites": [
{
"id": "AXIOROUTE",
"coordinates": {
"longitude": -0.561642,
"latitude": 47.462544
},
"isDepot": false
},
{
"id": "CJM",
"coordinates": {
"longitude": -0.345602,
"latitude": 48.597481
},
"isDepot": false
},
{
"id": "COFISOFT",
"coordinates": {
"longitude": 1.697037,
"latitude": 46.816713
},
"isDepot": false
},
{
"id": "GPI",
"coordinates": {
"longitude": 4.740329,
"latitude": 45.752201
},
"isDepot": false
},
{
"id": "SINARI",
"coordinates": {
"longitude": -1.604869,
"latitude": 48.113197
},
"isDepot": true
},
{
"id": "XYRIC",
"coordinates": {
"longitude": 5.09304,
"latitude": 47.310967
},
"isDepot": false
}
]

The Vehicles​

A vehicle is the means of transport with which a route will be done. We are also specify for a vehicle, its availability period(s), i.e. time window on which it can be used.

"trucks": [
{
"id": "VEHICLE_01",
"availablePeriods": [
{
"id": "PERIOD_01",
"timeWindow": {
"start": "2022-11-01T04:30:00.000+01:00",
"end": "2022-11-02T12:00:00.000+01:00"
},
"departureSite": "SINARI",
"arrivalSite": "SINARI"
}
]
}
]

Action​

The action tells the API what to do:

  • "type": "CREATE_ROUTE_OPTIMIZED": for the creation of an optimized route,
  • "operations": [...]: the list of operation(s) to schedule,
  • "to": {...}: the vehicle and its availability period(s) on which to schedule the operation(s)
"action": {
"type": "CREATE_ROUTE_OPTIMIZED",
"operations": [
{
"id": "OPERATION_01",
"type": "DELIVERY"
},
{
"id": "OPERATION_02",
"type": "DELIVERY"
},
{
"id": "OPERATION_03",
"type": "DELIVERY"
},
{
"id": "OPERATION_04",
"type": "DELIVERY"
},
{
"id": "OPERATION_05",
"type": "DELIVERY"
}
],
"to": {
"idTruck": "VEHICLE_01",
"idPeriod": "PERIOD_01"
}
}

The solution​

For each vehicle and each availability periods (in this case 1 single period), there is a list of scheduled routes (in this case 1 route).

"vehicleRoutes": [
{
"truck": "VEHICLE_01",
"period": "PERIOD_01",
"routes": [
{
"id": "NewRoute_1_1",
"activities": [

And for each of the routes, the chronological list of all its activities: loading, collection, delivery, unloading, driving, waiting, etc.

  • On all activities, we find the time window on which it has been planned
"activity": "LOADING",
"timeWindow": {
"start": "2022-11-01T03:30:00Z",
"end": "2022-11-01T03:30:00Z"
}
  • On loading, unloading, collection or delivery activities, we find the list of related operations
{
"activity": "DELIVERY",
"timeWindow": {
"start": "2022-11-01T05:03:06Z",
"end": "2022-11-01T05:03:06Z"
},
"site": "CJM",
"fixedTimeSite": 0,
"operations": [
{
"id": "OPERATION_03"
}
]
}
  • On other activities (example: driving), we will find a set of specific fields (example: distance)
{
"activity": "DRIVING",
"timeWindow": {
"start": "2022-11-01T05:03:06Z",
"end": "2022-11-01T10:04:19Z"
},
"departureSite": "CJM",
"arrivalSite": "XYRIC",
"distance": 572917,
"nominalDuration": 18073
}

Full Problem
{
"action": {
"type": "CREATE_ROUTE_OPTIMIZED",
"operations": [
{
"id": "OPERATION_01",
"type": "DELIVERY"
},
{
"id": "OPERATION_02",
"type": "DELIVERY"
},
{
"id": "OPERATION_03",
"type": "DELIVERY"
},
{
"id": "OPERATION_04",
"type": "DELIVERY"
},
{
"id": "OPERATION_05",
"type": "DELIVERY"
}
],
"to": {
"idTruck": "VEHICLE_01",
"idPeriod": "PERIOD_01"
}
},
"sites": [
{
"id": "AXIOROUTE",
"coordinates": {
"longitude": -0.561642,
"latitude": 47.462544
},
"isDepot": false
},
{
"id": "CJM",
"coordinates": {
"longitude": -0.345602,
"latitude": 48.597481
},
"isDepot": false
},
{
"id": "COFISOFT",
"coordinates": {
"longitude": 1.697037,
"latitude": 46.816713
},
"isDepot": false
},
{
"id": "GPI",
"coordinates": {
"longitude": 4.740329,
"latitude": 45.752201
},
"isDepot": false
},
{
"id": "SINARI",
"coordinates": {
"longitude": -1.604869,
"latitude": 48.113197
},
"isDepot": true
},
{
"id": "XYRIC",
"coordinates": {
"longitude": 5.09304,
"latitude": 47.310967
},
"isDepot": false
}
],
"trucks": [
{
"id": "VEHICLE_01",
"availablePeriods": [
{
"id": "PERIOD_01",
"timeWindow": {
"start": "2022-11-01T04:30:00.000+01:00",
"end": "2022-11-02T12:00:00.000+01:00"
},
"departureSite": "SINARI",
"arrivalSite": "SINARI"
}
]
}
],
"operations": [
{
"id": "OPERATION_01",
"type": "DELIVERY",
"idSiteDestination": "AXIOROUTE"
},
{
"id": "OPERATION_02",
"type": "DELIVERY",
"idSiteDestination": "COFISOFT"
},
{
"id": "OPERATION_03",
"type": "DELIVERY",
"idSiteDestination": "CJM"
},
{
"id": "OPERATION_04",
"type": "DELIVERY",
"idSiteDestination": "GPI"
},
{
"id": "OPERATION_05",
"type": "DELIVERY",
"idSiteDestination": "XYRIC"
}
]
}
Full Solution
{
"vehicleRoutes": [
{
"truck": "VEHICLE_01",
"period": "PERIOD_01",
"routes": [
{
"id": "NewRoute_1_1",
"activities": [
{
"activity": "ROUTE_START",
"timeWindow": {
"start": "2022-11-01T03:30:00Z",
"end": "2022-11-01T03:30:00Z"
},
"site": "SINARI"
},
{
"activity": "LOADING",
"timeWindow": {
"start": "2022-11-01T03:30:00Z",
"end": "2022-11-01T03:30:00Z"
},
"site": "SINARI",
"fixedTimeSite": 0,
"operations": [
{
"id": "OPERATION_03"
},
{
"id": "OPERATION_05"
},
{
"id": "OPERATION_04"
},
{
"id": "OPERATION_02"
},
{
"id": "OPERATION_01"
}
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": "2022-11-01T03:30:00Z",
"end": "2022-11-01T05:03:06Z"
},
"departureSite": "SINARI",
"arrivalSite": "CJM",
"distance": 134994,
"nominalDuration": 5586
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": "2022-11-01T05:03:06Z",
"end": "2022-11-01T05:03:06Z"
},
"site": "CJM",
"fixedTimeSite": 0,
"operations": [
{
"id": "OPERATION_03"
}
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": "2022-11-01T05:03:06Z",
"end": "2022-11-01T10:04:19Z"
},
"departureSite": "CJM",
"arrivalSite": "XYRIC",
"distance": 572917,
"nominalDuration": 18073
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": "2022-11-01T10:04:19Z",
"end": "2022-11-01T10:04:19Z"
},
"site": "XYRIC",
"fixedTimeSite": 0,
"operations": [
{
"id": "OPERATION_05"
}
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": "2022-11-01T10:04:19Z",
"end": "2022-11-01T11:51:40Z"
},
"departureSite": "XYRIC",
"arrivalSite": "GPI",
"distance": 192769,
"nominalDuration": 6441
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": "2022-11-01T11:51:40Z",
"end": "2022-11-01T11:51:40Z"
},
"site": "GPI",
"fixedTimeSite": 0,
"operations": [
{
"id": "OPERATION_04"
}
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": "2022-11-01T11:51:40Z",
"end": "2022-11-01T15:19:38Z"
},
"departureSite": "GPI",
"arrivalSite": "COFISOFT",
"distance": 346142,
"nominalDuration": 12478
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": "2022-11-01T15:19:38Z",
"end": "2022-11-01T15:19:38Z"
},
"site": "COFISOFT",
"fixedTimeSite": 0,
"operations": [
{
"id": "OPERATION_02"
}
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": "2022-11-01T15:19:38Z",
"end": "2022-11-01T17:51:19Z"
},
"departureSite": "COFISOFT",
"arrivalSite": "AXIOROUTE",
"distance": 296527,
"nominalDuration": 9101
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": "2022-11-01T17:51:19Z",
"end": "2022-11-01T17:51:19Z"
},
"site": "AXIOROUTE",
"fixedTimeSite": 0,
"operations": [
{
"id": "OPERATION_01"
}
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": "2022-11-01T17:51:19Z",
"end": "2022-11-01T19:19:42Z"
},
"departureSite": "AXIOROUTE",
"arrivalSite": "SINARI",
"distance": 126761,
"nominalDuration": 5303
},
{
"activity": "ROUTE_END",
"timeWindow": {
"start": "2022-11-01T19:19:42Z",
"end": "2022-11-01T19:19:42Z"
},
"site": "SINARI"
}
]
}
]
}
],
"modifiedData": []
}