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 Exception when retrieving the solution #574

Open
pchtsp opened this issue Sep 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@pchtsp
Copy link

pchtsp commented Sep 9, 2024

Describe the bug

Followed this guide:

https://github.com/TimefoldAI/timefold-quickstarts/tree/stable/python/vehicle-routing

  • Installed everything
  • Created a virtual environment
  • Started the web server in the command line.
  • Clicked on the solve button in the web UI.

Expected behavior

The solution is loaded without errors in the console.

Actual behavior

IMPORTANT: this does not happen everytime, it seems the first time after starting the web server it always fails.

The results partially load. But I got an exception in the console:

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

and the UI shows:

Getting route plan has failed.

500: Internal Server Error

Code: unknown
Error id: ----

To Reproduce

Follow the quickstart README.

Environment

Timefold Solver Version or Git ref:

  • I followed the instructions, that clone from master.
  • python 3.10

As per the pyproject.toml:

[project]
name = "vehicle_routing"
version = "1.0.0"
requires-python = ">=3.10"
dependencies = [
    'timefold == 1.13.0b0',
    'fastapi == 0.111.0',
    'pydantic == 2.7.3',
    'uvicorn == 0.30.1',
    'pytest == 8.2.2',
]

Output of java -version:

openjdk version "17.0.12" 2024-07-16
OpenJDK Runtime Environment (build 17.0.12+7-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 17.0.12+7-Ubuntu-1ubuntu222.04, mixed mode, sharing)

Output of uname -a or ver:

(uname -a)

Linux system76-pc 6.9.3-76060903-generic #202405300957~1721174657~22.04~abb7c06~dev-Ubuntu SMP PREEMPT_DY x86_64 x86_64 x86_64 GNU/Linux

Additional information

I also tried running the solver through the REST API using the commands provided in the "GUIDE" section:

curl -X GET -H 'Accept:application/json' http://localhost:8080/demo-data/FIRENZE -o sample.json
curl -X POST -H 'Content-Type:application/json' http://localhost:8080/route-plans [email protected]
curl -X GET -H 'Accept:application/json' http://localhost:8080/route-plans/ID

If I keep runing the third command during solving, I get solutions most of the times, but it also raises errors often.

@pchtsp pchtsp added the bug Something isn't working label Sep 9, 2024
@triceo
Copy link
Contributor

triceo commented Sep 16, 2024

Hello @pchtsp and thanks for reporting!
We'll take a look when time permits.

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

3 participants