Route optimization taking longer than necessary path

We’ve found a route optimization request where the optimization takes a longer than necessary path (17km vs 24km). Video explaining more: Loom | Free Screen & Video Recording Software

Route on OSM: OpenStreetMap

Route on Google Maps:

https://www.google.co.uk/maps/dir/Culvert+Pl,+London+SW11+5BA/26+Yeatman+Road,+London+N6+4DT,+UK/@51.5304956,-0.2398721,12z/data=!4m16!4m15!1m5!1m1!1s0x487605a7c79d91ef:0x6dc769c5b79f5eaf!2m2!1d-0.1539481!2d51.4711882!1m5!1m1!1s0x48761a387702a98d:0x74309c503bb438a4!2m2!1d-0.1550986!2d51.5782079!2m1!2b1!3e0?hl=en&authuser=0

Route optimization request:

{
  "configuration": {
    "routing": {
      "calc_points": true,
      "consider_traffic": false,
      "fail_fast": false,
      "network_data_provider": "openstreetmap",
      "return_snapped_waypoints": true,
      "snap_preventions": [
        "motorway",
        "tunnel",
        "ferry"
      ]
    }
  },
  "objectives": [
    {
      "type": "min",
      "value": "completion_time"
    }
  ],
  "services": [
    {
      "address": {
        "curbside": "any",
        "lat": 51.5782079,
        "location_id": "AOd1XMc3P8N85SjTxTS7",
        "lon": -0.1550986
      },
      "duration": 60,
      "group": "medium",
      "id": "AOd1XMc3P8N85SjTxTS7"
    }
  ],
  "vehicle_types": [
    {
      "profile": "car",
      "type_id": "vhc_NY9b5iAZZJm5XLsFm47O"
    }
  ],
  "vehicles": [
    {
      "earliest_start": 1660035119,
      "return_to_depot": false,
      "start_address": {
        "curbside": "any",
        "lat": 51.4711882,
        "location_id": "HTy8YKOX",
        "lon": -0.1539481,
        "name": "SW11 5BA, Culvert Place"
      },
      "type_id": "vhc_NY9b5iAZZJm5XLsFm47O",
      "vehicle_id": "NY9b5iAZZJm5XLsFm47O"
    }
  ]
}

In this specific case I think the reason for a different route in the route editor vs. OSM is that you used a slightly different location resulting in the different route:

shorter distance: Driving Directions - GraphHopper Maps

longer distance Driving Directions - GraphHopper Maps

But in general, yes, it can happen that we accept “distance” detours to “save” time. The algorithm has to balance time and distance “somehow”. (Note that this “balancing” is only configurable if you use a custom_model). To see what I mean with the “balancing” you can force the first example (with the shorter distance) into using the “distance” detour and notice that the time of the route is even slightly smaller: Driving Directions - GraphHopper Maps

Powered by Discourse