Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: 'Vehicle routing with capacity and time windows' python demo sometimes raises run-time, also I wanted to try it for my dataset and I followed the instruction but it didn't give me the ID #629

Open
HodaBinaei opened this issue Nov 15, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@HodaBinaei
Copy link

Describe the bug
Describe the issue you are experiencing here.
Tell us what you were trying to do and what happened.

Expected behavior
Describe clearly and concisely what you expected to happen.

Actual behavior
Describe clearly and concisely what actually happened.

To Reproduce
Link to a small reproducer or attach an archive containing the reproducer to the issue.
Alternatively, provide clear and concise steps to reproduce the behavior.

Environment

Timefold Solver Version or Git ref:

Output of java -version:

Output of uname -a or ver:

Additional information

Provide any and all other information which might be relevant to the issue.

@HodaBinaei HodaBinaei added the bug Something isn't working label Nov 15, 2024
@Christopher-Chianelli
Copy link
Contributor

What was the RuntimeError raised, and on what dataset? What is your Python version? Additionally, all problems passed to /route-plans endpoint in the vehicle routing quickstart share the same ID: 'ID'. To pass a custom dataset, pass it directly to the /route-plans endpoint (which would return the constant string 'ID'). To get the best solution found so far, use /route-plans/ID.

@HodaBinaei
Copy link
Author

HodaBinaei commented Nov 15, 2024 via email

@Christopher-Chianelli
Copy link
Contributor

Was this in your logs?

  File ".../type_adapter.py", line 339, in dump_python
    return self.serializer.to_python(
  File ".../python/vehicle-routing/src/vehicle_routing/domain.py", line 130, in arrival_time
    return (self.visits[-1].departure_time +
TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'

This appears to be a rare bug that occurs when fetching a best solution; the error does not occur during solving (and it finishes solving in the background). My best guess is that a new best solution is found when the old best solution is being converted to JSON, and that inadvertently updates the objects of the old best solution during conversion.

When sending a dataset to route-plans, you need to send the JSON as the body, which can be specified with -d:

curl -X POST -H 'Content-Type:application/json' http://localhost:8080/route-plans -d @combined_output.json

@HodaBinaei
Copy link
Author

HodaBinaei commented Nov 15, 2024 via email

@Christopher-Chianelli
Copy link
Contributor

The ID is always 'ID'. To get the output, run

curl -X 'GET' \
  'http://localhost:8080/route-plans/ID' \
  -H 'accept: application/json'

(taken from the REST API page)

@HodaBinaei
Copy link
Author

Thank you so much for your help.
I tried it, but it didn't solve it. I curl -X 'GET' 'http://localhost:8080/route-plans/ID' -H 'accept: application/json'
{"name":"demo_data_carer","southWestCorner":[53.2,-9.2],"northEastCorner":[53.4,-8.9],"vehicles":[],"visits":[],"solverStatushave this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants