Home > other >  PTV Sequence Optimization: Special ordering of customers in a route
PTV Sequence Optimization: Special ordering of customers in a route

Time:02-03

We are trying to plan transports using the Sequence Optimization Service of PTV. We have customers of certain "types": Type 1, type 2 and type 3. Type 1 customers have to be visited in the beginning of the route. Then type 2 customers have to be visited. Type 3 customers have to be visited last. There may be multiple customers per type.

We have tried using the field "priority" of the transports, but that does not seem to have the effect we want.

We have an example request. In the calculated route, the transports are not ordered in the way we want them to be:

{
   "locations":[
      {
         "id":"Depot",
         "type":"Depot",
         "latitude":47.3834738721015,
         "longitude":0.703125
      },
      {
         "id":"Customer 1",
         "type":"Customer",
         "latitude":47.387193097780425,
         "longitude":0.76080322265625
      },
      {
         "id":"Customer 2",
         "type":"Customer",
         "latitude":47.3625715946783,
         "longitude":0.7446670532226564
      },
      {
         "id":"Customer 3",
         "type":"Customer",
         "latitude":47.35143118114693,
         "longitude":0.7175445556640625
      },
      {
         "id":"Customer 4",
         "type":"Customer",
         "latitude":47.36071114618885,
         "longitude":0.7371139526367188
      }
   ],
   "transports":[
      {
         "id":"Transport 1 (type 1)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 1"
      },
      {
         "id":"Transport 2 (type 2)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 2"
      },
      {
         "id":"Transport 3 (type 2)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 3"
      },
      {
         "id":"Transport 4 (type 3)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 4"
      }
   ],
   "driver":{
      "availability":{
         "start":"2022-02-01T08:00:00.000 00:00",
         "end":"2022-02-01T18:00:00.000 00:00"
      }
   }
}

CodePudding user response:

You mentioned transport priorities. These are only used for the decision if an order is planned at all. It is not used for the decision where it is planned in the route.

To achieve your goal, you can use the routeSectionNumber. It specifies the relative position of a customer location in a route. Note that this is a field at the location, not at the transport. Using this field you get the desired result:

{
   "locations":[
      {
         "id":"Depot",
         "type":"Depot",
         "latitude":47.3834738721015,
         "longitude":0.703125
      },
      {
         "id":"Customer 1",
         "type":"Customer",
         "latitude":47.387193097780425,
         "longitude":0.76080322265625,
         "customerLocationAttributes":{
            "routeSectionNumber":1
         }
      },
      {
         "id":"Customer 2",
         "type":"Customer",
         "latitude":47.3625715946783,
         "longitude":0.7446670532226564,
         "customerLocationAttributes":{
            "routeSectionNumber":2
         }
      },
      {
         "id":"Customer 3",
         "type":"Customer",
         "latitude":47.35143118114693,
         "longitude":0.7175445556640625,
         "customerLocationAttributes":{
            "routeSectionNumber":2
         }
      },
      {
         "id":"Customer 4",
         "type":"Customer",
         "latitude":47.36071114618885,
         "longitude":0.7371139526367188,
         "customerLocationAttributes":{
            "routeSectionNumber":3
         }
      }
   ],
   "transports":[
      {
         "id":"Transport 1 (type 1)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 1"
      },
      {
         "id":"Transport 2 (type 2)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 2"
      },
      {
         "id":"Transport 3 (type 2)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 3"
      },
      {
         "id":"Transport 4 (type 3)",
         "pickupLocationId":"Depot",
         "deliveryLocationId":"Customer 4"
      }
   ],
   "driver":{
      "availability":{
         "start":"2022-02-01T08:00:00.000 00:00",
         "end":"2022-02-01T18:00:00.000 00:00"
      }
   }
}
  •  Tags:  
  • Related