orderIdsNotPlanned in xTour response - pickup and delivery is not mixed

This forum deals with any kind of trip optimization whether it is automatic planning or manual dispatching, refering to transport orders or service planning.
Post Reply
szymon
Posts: 6
Joined: Wed Apr 20, 2022 6:34 am

orderIdsNotPlanned in xTour response - pickup and delivery is not mixed

Post by szymon »

Hello,
I would like to ask about the possibility to mix both pickup and delivery orders on one vehicle. Currently when using xTour request both pickup and delivery orders cannot be transported using one vehicle. A high performance routing matrix is used.

Example request:

Code: Select all

{"distanceMode":{"$type":"ExistingDistanceMatrixPerVehicle"},"locations":[{"$type":"CustomerSite","id":605467,"routeLocation":{"$type":"OffRoadRouteLocation","offRoadCoordinate":{"x":22.334842,"y":50.326853}}},{"$type":"DepotSite","id":15171,"routeLocation":{"$type":"OffRoadRouteLocation","offRoadCoordinate":{"x":20.898809,"y":50.134567}},"additionalServiceTimePerPickupStop":4500,"additionalServiceTimePerDeliveryStop":4500,"openingIntervals":[{"$type":"StartEndInterval","start":"2023-06-23T07:00:00+02:00","end":"2023-06-23T15:00:00+02:00"}]},{"$type":"CustomerSite","id":605497,"routeLocation":{"$type":"OffRoadRouteLocation","offRoadCoordinate":{"x":22.303586,"y":50.308412}}},{"$type":"CustomerSite","id":605825,"routeLocation":{"$type":"OffRoadRouteLocation","offRoadCoordinate":{"x":22.238824,"y":50.160289}}}],"orders":[{"$type":"PickupDeliveryOrder","id":"30172","pickupLocationId":"605467","deliveryLocationId":"15171","quantities":[],"serviceTimeForPickup":1200},{"$type":"PickupDeliveryOrder","id":"30176","pickupLocationId":"15171","deliveryLocationId":"605497","quantities":[],"requiredVehicleEquipment":["A"],"serviceTimeForDelivery":1200},{"$type":"PickupDeliveryOrder","id":"30191","pickupLocationId":"15171","deliveryLocationId":"605825","quantities":[],"requiredVehicleEquipment":["A"],"serviceTimeForDelivery":1200}],"fleet":{"vehicles":[{"ids":["ADR_x05_39_0"],"distanceMatrixId":"d097109b-187b-495d-9e75-7ef3c02d3e19","startLocationId":"15171","equipment":["A","D5","HC","PD","PK","RB","WD"],"maximumTravelTime":54000,"maximumDrivingTime":32400}]},"planToursOptions":{"$type":"PlanToursOptions","restrictions":{"$type":"TourRestrictions","singleTripPerTour":true,"singleDepotPerTour":true,"workingHours":{"$type":"MultiDayWorkingHours","drivingTimeRegulation":"EU_EC_561_2006","dailyRestPositions":"BETWEEN_TRIPS"},"maximumNumberOfCustomerStopsPerTour":99},"calculationMode":"QUALITY"}}
Response:

Code: Select all

{"$type":"ToursResponse","costReport":{"travelTime":17193.0,"drivingTime":10293.0,"serviceTime":6900.0,"distance":147434.0,"monetaryCostsReport":{"totalCost":0.0,"travelTimeCost":0.0,"distanceCost":0.0,"fixedCost":0.0}},"tours":[{"vehicleId":"ADR_x05_39_0","vehicleStartLocationId":"15171","trips":[{"id":"867b8c6d-d597-433e-981b-8d7ea25b583b","stops":[{"locationId":"15171","tasks":[{"orderId":"30176","taskType":"PICKUP"},{"orderId":"30191","taskType":"PICKUP"}]},{"locationId":"605825","tasks":[{"orderId":"30191","taskType":"DELIVERY"}]},{"locationId":"605497","tasks":[{"orderId":"30176","taskType":"DELIVERY"}]}]}]}],"tourReports":[{"vehicleId":"ADR_x05_39_0","costReport":{"travelTime":17193.0,"drivingTime":10293.0,"serviceTime":6900.0,"distance":147434.0,"monetaryCostsReport":{"totalCost":0.0,"travelTimeCost":0.0,"distanceCost":0.0,"fixedCost":0.0}},"tripReports":[{"tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","costReport":{"travelTime":17193.0,"drivingTime":10293.0,"serviceTime":6900.0,"distance":147434.0,"monetaryCostsReport":{"totalCost":0.0,"travelTimeCost":0.0,"distanceCost":0.0,"fixedCost":0.0}}}],"tourEvents":[{"startTime":"2023-06-23T07:00:00.000+02:00","locationId":"15171","eventTypes":["TOUR_START"],"duration":0.0},{"startTime":"2023-06-23T07:00:00.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","locationId":"15171","eventTypes":["TRIP_START"],"duration":0.0},{"startTime":"2023-06-23T07:00:00.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","locationId":"15171","orderId":"30176","eventTypes":["SERVICE"],"duration":4500.0},{"startTime":"2023-06-23T08:15:00.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","locationId":"15171","orderId":"30191","eventTypes":["SERVICE"],"duration":0.0},{"startTime":"2023-06-23T08:15:00.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","eventTypes":["DRIVING"],"duration":7470.0},{"startTime":"2023-06-23T10:19:30.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","locationId":"605825","orderId":"30191","eventTypes":["SERVICE"],"duration":1200.0},{"startTime":"2023-06-23T10:39:30.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","eventTypes":["DRIVING"],"duration":2823.0},{"startTime":"2023-06-23T11:26:33.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","locationId":"605497","orderId":"30176","eventTypes":["SERVICE"],"duration":1200.0},{"startTime":"2023-06-23T11:46:33.000+02:00","tripId":"867b8c6d-d597-433e-981b-8d7ea25b583b","locationId":"605497","eventTypes":["TRIP_END"],"duration":0.0},{"startTime":"2023-06-23T11:46:33.000+02:00","locationId":"605497","eventTypes":["TOUR_END"],"duration":0.0}],"legReports":[{"startTourEventIndex":4,"endTourEventIndex":4,"drivingTime":7470.0,"distance":121220.0,"estimatedByDirectDistance":false,"routeViolated":false,"maximumQuantityScenarioIndex":0},{"startTourEventIndex":6,"endTourEventIndex":6,"drivingTime":2823.0,"distance":26214.0,"estimatedByDirectDistance":false,"routeViolated":false,"maximumQuantityScenarioIndex":0}]}],"orderIdsNotPlanned":["30172"],"violated":false,"routeViolated":false}
I would greatly appreciate your help in evaluating the above code.

Regards,
Sz.
Joost
Posts: 307
Joined: Fri Apr 25, 2014 1:46 pm

Re: orderIdsNotPlanned in xTour response - pickup and delivery is not mixed

Post by Joost »

Mixing them is possible out of the box. So there is another reason why the order remained unplanned. This can be figured out with the findChangeTourProposal.

Note: since i do not know you parameters for building the dima I'm using Direct Distance in the rest of my explanation.

First of all: store the request en result server side when you do your initial planning by setting the PlanToursRequest.storeRequest to true.

Request:

Code: Select all

{
  "storeRequest":true,
  "distanceMode": {
    "$type": "DirectDistance"
  },
  "locations": [{
      "$type": "CustomerSite",
      "id": 605467,
      "routeLocation": {
        "$type": "OffRoadRouteLocation",
        "offRoadCoordinate": {
          "x": 22.334842,
          "y": 50.326853
        }
      }
    }, {
      "$type": "DepotSite",
      "id": 15171,
      "routeLocation": {
        "$type": "OffRoadRouteLocation",
        "offRoadCoordinate": {
          "x": 20.898809,
          "y": 50.134567
        }
      },
      "additionalServiceTimePerPickupStop": 4500,
      "additionalServiceTimePerDeliveryStop": 4500,
      "openingIntervals": [{
          "$type": "StartEndInterval",
          "start": "2023-06-23T07:00:00+02:00",
          "end": "2023-06-23T15:00:00+02:00"
        }
      ]
    }, {
      "$type": "CustomerSite",
      "id": 605497,
      "routeLocation": {
        "$type": "OffRoadRouteLocation",
        "offRoadCoordinate": {
          "x": 22.303586,
          "y": 50.308412
        }
      }
    }, {
      "$type": "CustomerSite",
      "id": 605825,
      "routeLocation": {
        "$type": "OffRoadRouteLocation",
        "offRoadCoordinate": {
          "x": 22.238824,
          "y": 50.160289
        }
      }
    }
  ],
  "orders": [{
      "$type": "PickupDeliveryOrder",
      "id": "30172",
      "pickupLocationId": "605467",
      "deliveryLocationId": "15171",
      "quantities": [],
      "serviceTimeForPickup": 1200
    }, {
      "$type": "PickupDeliveryOrder",
      "id": "30176",
      "pickupLocationId": "15171",
      "deliveryLocationId": "605497",
      "quantities": [],
      "requiredVehicleEquipment": ["A"],
      "serviceTimeForDelivery": 1200
    }, {
      "$type": "PickupDeliveryOrder",
      "id": "30191",
      "pickupLocationId": "15171",
      "deliveryLocationId": "605825",
      "quantities": [],
      "requiredVehicleEquipment": ["A"],
      "serviceTimeForDelivery": 1200
    }
  ],
  "fleet": {
    "vehicles": [{
        "ids": ["ADR_x05_39_0"],
        "startLocationId": "15171",
        "equipment": ["A", "D5", "HC", "PD", "PK", "RB", "WD"],
        "maximumTravelTime": 54000,
        "maximumDrivingTime": 32400
      }
    ]
  },
  "planToursOptions": {
    "$type": "PlanToursOptions",
    "restrictions": {
      "$type": "TourRestrictions",
      "singleTripPerTour": true,
      "singleDepotPerTour": true,
      "workingHours": {
        "$type": "MultiDayWorkingHours",
        "drivingTimeRegulation": "EU_EC_561_2006",
        "dailyRestPositions": "BETWEEN_TRIPS"
      },
      "maximumNumberOfCustomerStopsPerTour": 99
    },
    "calculationMode": "QUALITY"
  }
}
Response:

Code: Select all

{
  "$type": "ToursResponse",
  "costReport": {
    "travelTime": 31422,
    "drivingTime": 17322,
    "serviceTime": 11400,
    "distance": 288665,
    "monetaryCostsReport": {
      "totalCost": 0,
      "travelTimeCost": 0,
      "distanceCost": 0,
      "fixedCost": 0
    }
  },
  "tours": [
    {
      "vehicleId": "ADR_x05_39_0",
      "vehicleStartLocationId": "15171",
      "trips": [
        {
          "id": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "stops": [
            {
              "locationId": "15171",
              "tasks": [
                {
                  "orderId": "30176",
                  "taskType": "PICKUP"
                }
              ]
            },
            {
              "locationId": "605497",
              "tasks": [
                {
                  "orderId": "30176",
                  "taskType": "DELIVERY"
                }
              ]
            },
            {
              "locationId": "605467",
              "tasks": [
                {
                  "orderId": "30172",
                  "taskType": "PICKUP"
                }
              ]
            },
            {
              "locationId": "15171",
              "tasks": [
                {
                  "orderId": "30172",
                  "taskType": "DELIVERY"
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "tourReports": [
    {
      "vehicleId": "ADR_x05_39_0",
      "costReport": {
        "travelTime": 31422,
        "drivingTime": 17322,
        "serviceTime": 11400,
        "distance": 288665,
        "monetaryCostsReport": {
          "totalCost": 0,
          "travelTimeCost": 0,
          "distanceCost": 0,
          "fixedCost": 0
        }
      },
      "tripReports": [
        {
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "costReport": {
            "travelTime": 31422,
            "drivingTime": 17322,
            "serviceTime": 11400,
            "distance": 288665,
            "monetaryCostsReport": {
              "totalCost": 0,
              "travelTimeCost": 0,
              "distanceCost": 0,
              "fixedCost": 0
            }
          }
        }
      ],
      "tourEvents": [
        {
          "startTime": "2023-06-23T07:00:00.000+02:00",
          "locationId": "15171",
          "eventTypes": [
            "TOUR_START"
          ],
          "duration": 0
        },
        {
          "startTime": "2023-06-23T07:00:00.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "locationId": "15171",
          "eventTypes": [
            "TRIP_START"
          ],
          "duration": 0
        },
        {
          "startTime": "2023-06-23T07:00:00.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "locationId": "15171",
          "orderId": "30176",
          "eventTypes": [
            "SERVICE"
          ],
          "duration": 4500
        },
        {
          "startTime": "2023-06-23T08:15:00.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "eventTypes": [
            "DRIVING"
          ],
          "duration": 8429
        },
        {
          "startTime": "2023-06-23T10:35:29.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "locationId": "605497",
          "orderId": "30176",
          "eventTypes": [
            "SERVICE"
          ],
          "duration": 1200
        },
        {
          "startTime": "2023-06-23T10:55:29.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "eventTypes": [
            "DRIVING"
          ],
          "duration": 251
        },
        {
          "startTime": "2023-06-23T10:59:40.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "locationId": "605467",
          "orderId": "30172",
          "eventTypes": [
            "SERVICE"
          ],
          "duration": 1200
        },
        {
          "startTime": "2023-06-23T11:19:40.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "eventTypes": [
            "DRIVING"
          ],
          "duration": 7520
        },
        {
          "startTime": "2023-06-23T13:25:00.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "eventTypes": [
            "BREAK"
          ],
          "duration": 2700
        },
        {
          "startTime": "2023-06-23T14:10:00.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "eventTypes": [
            "DRIVING"
          ],
          "duration": 1122
        },
        {
          "startTime": "2023-06-23T14:28:42.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "locationId": "15171",
          "orderId": "30172",
          "eventTypes": [
            "SERVICE"
          ],
          "duration": 4500
        },
        {
          "startTime": "2023-06-23T15:43:42.000+02:00",
          "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
          "locationId": "15171",
          "eventTypes": [
            "TRIP_END"
          ],
          "duration": 0
        },
        {
          "startTime": "2023-06-23T15:43:42.000+02:00",
          "locationId": "15171",
          "eventTypes": [
            "TOUR_END"
          ],
          "duration": 0
        }
      ],
      "legReports": [
        {
          "startTourEventIndex": 3,
          "endTourEventIndex": 3,
          "drivingTime": 8429,
          "distance": 140477,
          "estimatedByDirectDistance": true,
          "routeViolated": false,
          "maximumQuantityScenarioIndex": 0
        },
        {
          "startTourEventIndex": 5,
          "endTourEventIndex": 5,
          "drivingTime": 251,
          "distance": 4170,
          "estimatedByDirectDistance": true,
          "routeViolated": false,
          "maximumQuantityScenarioIndex": 0
        },
        {
          "startTourEventIndex": 7,
          "endTourEventIndex": 9,
          "drivingTime": 8642,
          "distance": 144018,
          "estimatedByDirectDistance": true,
          "routeViolated": false,
          "maximumQuantityScenarioIndex": 0
        }
      ]
    }
  ],
  "orderIdsNotPlanned": [
    "30191"
  ],
  "vehicleIdsWithDirectDistanceEstimation": [
    "ADR_x05_39_0"
  ],
  "violated": false,
  "routeViolated": false,
  "storedRequestId": "d9462192-4596-4a13-a7bb-8848066b8721"
}
No you can use findChangeTourProposal. Use the InsertionPositionsForOrdersQuery type for the proposalsQuery and in the proposalsOptions set returnViolatedTours to true.

Request:

Code: Select all

{
  "$type": "FindChangeToursProposalsRequest",
  "proposalsQuery": {
    "$type": "InsertionPositionsForOrdersQuery",
    "storedRequestId": "d9462192-4596-4a13-a7bb-8848066b8721",
    "orderIds": [
      "30191"
    ]
  },
  "proposalsOptions": {
    "returnViolatedTours": true
  }
}
Response:

Code: Select all

{
  "$type": "ChangeToursProposalsResponse",
  "proposals": [
    {
      "changeToursAction": {
        "$type": "MoveOrdersAction",
        "storedRequestId": "d9462192-4596-4a13-a7bb-8848066b8721",
        "orderIds": [
          "30191"
        ],
        "targetTripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
        "pickupInsertionPosition": {
          "$type": "InsertionBeforeSpecifiedPosition",
          "position": 0
        },
        "deliveryInsertionPosition": {
          "$type": "InsertionAfterSpecifiedPosition",
          "position": 0
        }
      },
      "tours": [
        {
          "vehicleId": "ADR_x05_39_0",
          "vehicleStartLocationId": "15171",
          "trips": [
            {
              "id": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "stops": [
                {
                  "locationId": "15171",
                  "tasks": [
                    {
                      "orderId": "30176",
                      "taskType": "PICKUP"
                    },
                    {
                      "orderId": "30191",
                      "taskType": "PICKUP"
                    }
                  ]
                },
                {
                  "locationId": "605825",
                  "tasks": [
                    {
                      "orderId": "30191",
                      "taskType": "DELIVERY"
                    }
                  ]
                },
                {
                  "locationId": "605497",
                  "tasks": [
                    {
                      "orderId": "30176",
                      "taskType": "DELIVERY"
                    }
                  ]
                },
                {
                  "locationId": "605467",
                  "tasks": [
                    {
                      "orderId": "30172",
                      "taskType": "PICKUP"
                    }
                  ]
                },
                {
                  "locationId": "15171",
                  "tasks": [
                    {
                      "orderId": "30172",
                      "taskType": "DELIVERY"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "tourReports": [
        {
          "vehicleId": "ADR_x05_39_0",
          "costReport": {
            "travelTime": 33520,
            "drivingTime": 18220,
            "serviceTime": 12600,
            "distance": 303616,
            "monetaryCostsReport": {
              "totalCost": 0,
              "travelTimeCost": 0,
              "distanceCost": 0,
              "fixedCost": 0
            }
          },
          "violationReport": {
            "$type": "TourViolationReport",
            "maximumOpeningIntervalExceedance": 220,
            "restPositionViolated": false,
            "customerStopPositionInTripViolated": false,
            "tripSectionViolated": false,
            "compartmentAccessViolated": false
          },
          "tripReports": [
            {
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "costReport": {
                "travelTime": 33520,
                "drivingTime": 18220,
                "serviceTime": 12600,
                "distance": 303616,
                "monetaryCostsReport": {
                  "totalCost": 0,
                  "travelTimeCost": 0,
                  "distanceCost": 0,
                  "fixedCost": 0
                }
              },
              "violationReport": {
                "$type": "TripViolationReport",
                "maximumOpeningIntervalExceedance": 220,
                "restPositionViolated": false,
                "customerStopPositionInTripViolated": false,
                "tripSectionViolated": false,
                "compartmentAccessViolated": false
              }
            }
          ],
          "tourEvents": [
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "locationId": "15171",
              "eventTypes": [
                "TOUR_START"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "eventTypes": [
                "TRIP_START"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30176",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 4500
            },
            {
              "startTime": "2023-06-23T08:15:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30191",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T08:15:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 7910
            },
            {
              "startTime": "2023-06-23T10:26:50.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605825",
              "orderId": "30191",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T10:46:50.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 1417
            },
            {
              "startTime": "2023-06-23T11:10:27.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605497",
              "orderId": "30176",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T11:30:27.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 251
            },
            {
              "startTime": "2023-06-23T11:34:38.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605467",
              "orderId": "30172",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T11:54:38.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 6622
            },
            {
              "startTime": "2023-06-23T13:45:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "BREAK"
              ],
              "duration": 2700
            },
            {
              "startTime": "2023-06-23T14:30:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 2020
            },
            {
              "startTime": "2023-06-23T15:03:40.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30172",
              "eventTypes": [
                "SERVICE"
              ],
              "tourViolations": [
                {
                  "$type": "TimeViolation",
                  "causedByThisEvent": true,
                  "type": "OPENING_INTERVAL",
                  "exceedance": 220
                }
              ],
              "duration": 4500
            },
            {
              "startTime": "2023-06-23T16:18:40.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "eventTypes": [
                "TRIP_END"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T16:18:40.000+02:00",
              "locationId": "15171",
              "eventTypes": [
                "TOUR_END"
              ],
              "duration": 0
            }
          ],
          "legReports": [
            {
              "startTourEventIndex": 4,
              "endTourEventIndex": 4,
              "drivingTime": 7910,
              "distance": 131826,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 6,
              "endTourEventIndex": 6,
              "drivingTime": 1417,
              "distance": 23602,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 8,
              "endTourEventIndex": 8,
              "drivingTime": 251,
              "distance": 4170,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 10,
              "endTourEventIndex": 12,
              "drivingTime": 8642,
              "distance": 144018,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            }
          ]
        }
      ],
      "violated": true,
      "preferencesRespected": true
    },
    {
      "changeToursAction": {
        "$type": "MoveOrdersAction",
        "storedRequestId": "d9462192-4596-4a13-a7bb-8848066b8721",
        "orderIds": [
          "30191"
        ],
        "targetTripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
        "pickupInsertionPosition": {
          "$type": "InsertionBeforeSpecifiedPosition",
          "position": 0
        },
        "deliveryInsertionPosition": {
          "$type": "InsertionAfterSpecifiedPosition",
          "position": 2
        }
      },
      "tours": [
        {
          "vehicleId": "ADR_x05_39_0",
          "vehicleStartLocationId": "15171",
          "trips": [
            {
              "id": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "stops": [
                {
                  "locationId": "15171",
                  "tasks": [
                    {
                      "orderId": "30191",
                      "taskType": "PICKUP"
                    },
                    {
                      "orderId": "30176",
                      "taskType": "PICKUP"
                    }
                  ]
                },
                {
                  "locationId": "605497",
                  "tasks": [
                    {
                      "orderId": "30176",
                      "taskType": "DELIVERY"
                    }
                  ]
                },
                {
                  "locationId": "605467",
                  "tasks": [
                    {
                      "orderId": "30172",
                      "taskType": "PICKUP"
                    }
                  ]
                },
                {
                  "locationId": "605825",
                  "tasks": [
                    {
                      "orderId": "30191",
                      "taskType": "DELIVERY"
                    }
                  ]
                },
                {
                  "locationId": "15171",
                  "tasks": [
                    {
                      "orderId": "30172",
                      "taskType": "DELIVERY"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "tourReports": [
        {
          "vehicleId": "ADR_x05_39_0",
          "costReport": {
            "travelTime": 33525,
            "drivingTime": 18225,
            "serviceTime": 12600,
            "distance": 303714,
            "monetaryCostsReport": {
              "totalCost": 0,
              "travelTimeCost": 0,
              "distanceCost": 0,
              "fixedCost": 0
            }
          },
          "violationReport": {
            "$type": "TourViolationReport",
            "maximumOpeningIntervalExceedance": 225,
            "restPositionViolated": false,
            "customerStopPositionInTripViolated": false,
            "tripSectionViolated": false,
            "compartmentAccessViolated": false
          },
          "tripReports": [
            {
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "costReport": {
                "travelTime": 33525,
                "drivingTime": 18225,
                "serviceTime": 12600,
                "distance": 303714,
                "monetaryCostsReport": {
                  "totalCost": 0,
                  "travelTimeCost": 0,
                  "distanceCost": 0,
                  "fixedCost": 0
                }
              },
              "violationReport": {
                "$type": "TripViolationReport",
                "maximumOpeningIntervalExceedance": 225,
                "restPositionViolated": false,
                "customerStopPositionInTripViolated": false,
                "tripSectionViolated": false,
                "compartmentAccessViolated": false
              }
            }
          ],
          "tourEvents": [
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "locationId": "15171",
              "eventTypes": [
                "TOUR_START"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "eventTypes": [
                "TRIP_START"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30191",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 4500
            },
            {
              "startTime": "2023-06-23T08:15:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30176",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T08:15:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 8429
            },
            {
              "startTime": "2023-06-23T10:35:29.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605497",
              "orderId": "30176",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T10:55:29.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 251
            },
            {
              "startTime": "2023-06-23T10:59:40.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605467",
              "orderId": "30172",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T11:19:40.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 1635
            },
            {
              "startTime": "2023-06-23T11:46:55.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605825",
              "orderId": "30191",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T12:06:55.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 5885
            },
            {
              "startTime": "2023-06-23T13:45:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "BREAK"
              ],
              "duration": 2700
            },
            {
              "startTime": "2023-06-23T14:30:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 2025
            },
            {
              "startTime": "2023-06-23T15:03:45.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30172",
              "eventTypes": [
                "SERVICE"
              ],
              "tourViolations": [
                {
                  "$type": "TimeViolation",
                  "causedByThisEvent": true,
                  "type": "OPENING_INTERVAL",
                  "exceedance": 225
                }
              ],
              "duration": 4500
            },
            {
              "startTime": "2023-06-23T16:18:45.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "eventTypes": [
                "TRIP_END"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T16:18:45.000+02:00",
              "locationId": "15171",
              "eventTypes": [
                "TOUR_END"
              ],
              "duration": 0
            }
          ],
          "legReports": [
            {
              "startTourEventIndex": 4,
              "endTourEventIndex": 4,
              "drivingTime": 8429,
              "distance": 140477,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 6,
              "endTourEventIndex": 6,
              "drivingTime": 251,
              "distance": 4170,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 8,
              "endTourEventIndex": 8,
              "drivingTime": 1635,
              "distance": 27241,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 10,
              "endTourEventIndex": 12,
              "drivingTime": 7910,
              "distance": 131826,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            }
          ]
        }
      ],
      "violated": true,
      "preferencesRespected": true
    },
    {
      "changeToursAction": {
        "$type": "MoveOrdersAction",
        "storedRequestId": "d9462192-4596-4a13-a7bb-8848066b8721",
        "orderIds": [
          "30191"
        ],
        "targetTripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
        "pickupInsertionPosition": {
          "$type": "InsertionBeforeSpecifiedPosition",
          "position": 0
        },
        "deliveryInsertionPosition": {
          "$type": "InsertionAfterSpecifiedPosition",
          "position": 1
        }
      },
      "tours": [
        {
          "vehicleId": "ADR_x05_39_0",
          "vehicleStartLocationId": "15171",
          "trips": [
            {
              "id": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "stops": [
                {
                  "locationId": "15171",
                  "tasks": [
                    {
                      "orderId": "30191",
                      "taskType": "PICKUP"
                    },
                    {
                      "orderId": "30176",
                      "taskType": "PICKUP"
                    }
                  ]
                },
                {
                  "locationId": "605497",
                  "tasks": [
                    {
                      "orderId": "30176",
                      "taskType": "DELIVERY"
                    }
                  ]
                },
                {
                  "locationId": "605825",
                  "tasks": [
                    {
                      "orderId": "30191",
                      "taskType": "DELIVERY"
                    }
                  ]
                },
                {
                  "locationId": "605467",
                  "tasks": [
                    {
                      "orderId": "30172",
                      "taskType": "PICKUP"
                    }
                  ]
                },
                {
                  "locationId": "15171",
                  "tasks": [
                    {
                      "orderId": "30172",
                      "taskType": "DELIVERY"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "tourReports": [
        {
          "vehicleId": "ADR_x05_39_0",
          "costReport": {
            "travelTime": 35423,
            "drivingTime": 20123,
            "serviceTime": 12600,
            "distance": 335338,
            "monetaryCostsReport": {
              "totalCost": 0,
              "travelTimeCost": 0,
              "distanceCost": 0,
              "fixedCost": 0
            }
          },
          "violationReport": {
            "$type": "TourViolationReport",
            "maximumOpeningIntervalExceedance": 2123,
            "restPositionViolated": false,
            "customerStopPositionInTripViolated": false,
            "tripSectionViolated": false,
            "compartmentAccessViolated": false
          },
          "tripReports": [
            {
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "costReport": {
                "travelTime": 35423,
                "drivingTime": 20123,
                "serviceTime": 12600,
                "distance": 335338,
                "monetaryCostsReport": {
                  "totalCost": 0,
                  "travelTimeCost": 0,
                  "distanceCost": 0,
                  "fixedCost": 0
                }
              },
              "violationReport": {
                "$type": "TripViolationReport",
                "maximumOpeningIntervalExceedance": 2123,
                "restPositionViolated": false,
                "customerStopPositionInTripViolated": false,
                "tripSectionViolated": false,
                "compartmentAccessViolated": false
              }
            }
          ],
          "tourEvents": [
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "locationId": "15171",
              "eventTypes": [
                "TOUR_START"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "eventTypes": [
                "TRIP_START"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T07:00:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30191",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 4500
            },
            {
              "startTime": "2023-06-23T08:15:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30176",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T08:15:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 8429
            },
            {
              "startTime": "2023-06-23T10:35:29.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605497",
              "orderId": "30176",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T10:55:29.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 1417
            },
            {
              "startTime": "2023-06-23T11:19:06.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605825",
              "orderId": "30191",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T11:39:06.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 1635
            },
            {
              "startTime": "2023-06-23T12:06:21.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "605467",
              "orderId": "30172",
              "eventTypes": [
                "SERVICE"
              ],
              "duration": 1200
            },
            {
              "startTime": "2023-06-23T12:26:21.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 4719
            },
            {
              "startTime": "2023-06-23T13:45:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "BREAK"
              ],
              "duration": 2700
            },
            {
              "startTime": "2023-06-23T14:30:00.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "eventTypes": [
                "DRIVING"
              ],
              "duration": 3923
            },
            {
              "startTime": "2023-06-23T15:35:23.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "orderId": "30172",
              "eventTypes": [
                "SERVICE"
              ],
              "tourViolations": [
                {
                  "$type": "TimeViolation",
                  "causedByThisEvent": true,
                  "type": "OPENING_INTERVAL",
                  "exceedance": 2123
                }
              ],
              "duration": 4500
            },
            {
              "startTime": "2023-06-23T16:50:23.000+02:00",
              "tripId": "13dfaa4a-245f-4859-92c9-fc04e6289fc4",
              "locationId": "15171",
              "eventTypes": [
                "TRIP_END"
              ],
              "duration": 0
            },
            {
              "startTime": "2023-06-23T16:50:23.000+02:00",
              "locationId": "15171",
              "eventTypes": [
                "TOUR_END"
              ],
              "duration": 0
            }
          ],
          "legReports": [
            {
              "startTourEventIndex": 4,
              "endTourEventIndex": 4,
              "drivingTime": 8429,
              "distance": 140477,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 6,
              "endTourEventIndex": 6,
              "drivingTime": 1417,
              "distance": 23602,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 8,
              "endTourEventIndex": 8,
              "drivingTime": 1635,
              "distance": 27241,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            },
            {
              "startTourEventIndex": 10,
              "endTourEventIndex": 12,
              "drivingTime": 8642,
              "distance": 144018,
              "estimatedByDirectDistance": true,
              "routeViolated": false,
              "maximumQuantityScenarioIndex": 0
            }
          ]
        }
      ],
      "violated": true,
      "preferencesRespected": true
    }
  ]
}
Now you can iterate through the ChangeToursProposalsResponse.proposals and see what is going wrong and find a common cause. I usually look at the ChangeToursProposal.tourReports[].violationReport . In this case I'm seeing maximumOpeningIntervalExceedance in all the proposals. So the tour simply because to long in time to back at the depot to unload.

Note: i used DirectDistance, if you use an actual dima it probably lead to a different outcome, but i reckon that the cause will still be something time related
Note 2: This function does not scale well with large plans since it tries every possible option. For larger plans I do recommend taking a look at the maximumNumberOfMoveOrdersActions and maximumDistanceOfAdjacentStops and setting them to appropriate values for you plan.
Joost Claessen
Senior Technical Consultant
PTV Benelux
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: orderIdsNotPlanned in xTour response - pickup and delivery is not mixed

Post by Bernd Welter »

Thanks for the check, Joost!

Here's also a generic article about how to understand unscheduled orders...
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply