GIScience / openrouteservice

🌍 The open source route planner api with plenty of features.
https://openrouteservice.org
GNU General Public License v3.0
1.48k stars 402 forks source link

CoreMatrix returns null as durations #1855

Open mohammad-babaei opened 1 month ago

mohammad-babaei commented 1 month ago

Is there an existing issue for this?

Where did you encounter this issue?

self-hosted instance

Request URL

http://localhost:8080/ors/v2/matrix/driving-car/json

POST Request Body

{
    "locations": [
        [
            51.40108388764645,
            35.71356951328444
        ],
        [
            51.40761078866774,
            35.720287886540945
        ],
        [
            51.42363602188439,
            35.720676986229435
        ],
        [
            51.43465263873796,
            35.70920069102276
        ],
        [
            51.42399284883916,
            35.70384959916653
        ],
        [
            51.40696910180182,
            35.70385172520926
        ]
    ],
    "sources": [
        1
    ],
    "destinations": [
        3,
        4,
        5
    ],
    "metrics": [
        "duration"
    ],
    "options": {
        "dynamic_speeds": true
    }
}

Response

Response ```JSON { "metadata": { "attribution": "openrouteservice.org, OpenStreetMap contributors", "service": "matrix", "timestamp": 1727785570989, "query": { "locations": [ [ 51.40108388764645, 35.71356951328444 ], [ 51.40761078866774, 35.720287886540945 ], [ 51.42363602188439, 35.720676986229435 ], [ 51.43465263873796, 35.70920069102276 ], [ 51.42399284883916, 35.70384959916653 ], [ 51.40696910180182, 35.70385172520926 ] ], "profile": "driving-car", "responseType": "json", "sources": [ "1" ], "destinations": [ "3", "4", "5" ], "metrics": [ "duration" ], "options": { "dynamic_speeds": true } }, "engine": { "version": "8.2.1", "build_date": "2024-09-30T09:13:38Z", "graph_date": null } }, "durations": [ [ null, null, null ] ], "destinations": [ { "location": [ 51.434501, 35.708999 ], "snapped_distance": 26.3 }, { "location": [ 51.423992, 35.703781 ], "snapped_distance": 7.64 }, { "location": [ 51.4067, 35.70452 ], "snapped_distance": 78.14 } ], "sources": [ { "location": [ 51.407625, 35.720403 ], "snapped_distance": 12.87 } ] } ```

Current behavior

in DijkstraManyToMany, In updateTarget function; the targetmap never gets filled because no node in targetSet is visited. Using algorithms like simple Dijkstra this problem does not happen and we have a response with meaningful response. i have tried a lot of locations and it never works the way it has to.

Expected behavior

have numbers as durations

Openrouteservice Version

8.2.1

Build date

No response

Graph date

No response

Forum Topic Link

No response

aoles commented 1 month ago

Thanks for reporting this!

The observed behavior might be related to #1785.

Please note that the core matrix implementation is currently considered as experimental, which is the reason why it is not enabled in the public API (see also https://github.com/GIScience/openrouteservice/issues/1164).

However, there are currently ongoing efforts towards finalizing the implementation and making core matrix production-ready, so stay tuned 📣

aoles commented 1 month ago

After some further investigation this issue doesn't seem to be related to https://github.com/GIScience/openrouteservice/issues/1785, as a query without the dynamic_speeds parameter succeeds. However, when I tried to reproduce the example above with ORS public API I've run into the error [6020] Unable to compute a distance/duration matrix: Search exceeds the limit of visited nodes.

@mohammad-babaei What is the configuration setting for maximum_visited_nodes on your self-hosted instance?

mohammad-babaei commented 1 month ago

Hi @aoles I have set maximum_visited_nodes = 10000000 and maximum_search_radius: 20000 so that i don't get that error you mentioned. I was able to give some locations that produce some of duration records. in this request body for example:

{
    "locations": [
        [
            51.444049483897004,
            35.666960593546776
        ],
        [
            51.443619344276584,
            35.68891637256898
        ],
        [
            51.41894048682505,
            35.70543424794617
        ],
        [
            51.36860255214674,
            35.690512280992365
        ]
    ],
    "sources": [
        0
    ],
    "destinations": [
        1,
        2,
        3
    ],
    "metrics": [
        "duration"
    ],
    "options": {
        "dynamic_speeds": true
    }
}

the result is this:

{
    "metadata": {
        "attribution": "openrouteservice.org, OpenStreetMap contributors",
        "service": "matrix",
        "timestamp": 1727800180112,
        "query": {
            "locations": [
                [
                    51.444049483897004,
                    35.666960593546776
                ],
                [
                    51.443619344276584,
                    35.68891637256898
                ],
                [
                    51.41894048682505,
                    35.70543424794617
                ],
                [
                    51.36860255214674,
                    35.690512280992365
                ]
            ],
            "profile": "driving-car",
            "responseType": "json",
            "sources": [
                "0"
            ],
            "destinations": [
                "1",
                "2",
                "3"
            ],
            "metrics": [
                "duration"
            ],
            "options": {
                "dynamic_speeds": true
            }
        },
        "engine": {
            "version": "8.2.1",
            "build_date": "2024-09-30T09:13:38Z",
            "graph_date": null
        }
    },
    "durations": [
        [
            null,
            null,
            862.7
        ]
    ],
    "destinations": [
        {
            "location": [
                51.443641,
                35.688964
            ],
            "snapped_distance": 5.67
        },
        {
            "location": [
                51.418948,
                35.705367
            ],
            "snapped_distance": 7.55
        },
        {
            "location": [
                51.368591,
                35.690617
            ],
            "snapped_distance": 11.7
        }
    ],
    "sources": [
        {
            "location": [
                51.444039,
                35.666848
            ],
            "snapped_distance": 12.6
        }
    ]
}

After debugging i noticed that the prioQueue gets empty before some target nodes are visited; if it was because of disconnected subgraphs, i wonder why the request without CoreMatrix algo works fine

aoles commented 1 month ago

Thanks for your feedback!

The ORS team will look into the issue and get back to you soon.

Cheers!