Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"exploration_level": 4,
"solver": "vroom",
"threads": 6,
"version": "1.15.0"
"version": "1.15.1"
},
"solution": {
"unplanned": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"exploration_level": 4,
"solver": "vroom",
"threads": 6,
"version": "1.15.0"
"version": "1.15.1"
},
"solution": {
"unplanned": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"exploration_level": 4,
"solver": "vroom",
"threads": 6,
"version": "1.15.0"
"version": "1.15.1"
},
"solution": {
"unplanned": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"exploration_level": 4,
"solver": "vroom",
"threads": 6,
"version": "1.15.0"
"version": "1.15.1"
},
"solution": {
"unplanned": [],
Expand Down
16 changes: 12 additions & 4 deletions python-pyvroom-routing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ def solve(self, input: nextmv.Input) -> nextmv.Output:
nextmv.redirect_stdout() # Solver chatter is logged to stderr.
input.options.solver = "vroom"
input.options.version = version("pyvroom")

# TODO: use duration to limit the runtime of the solver
_ = input.options.duration
if input.options.duration is not None and isinstance(input.options.duration, numbers.Number):
if input.options.duration <= 0:
timeout = None # No timeout if duration is 0 or negative.
else:
timeout = timedelta(seconds=input.options.duration)
elif input.options.duration is None:
timeout = None
else:
raise ValueError(f"Invalid duration option {input.options.duration}.")

# Prepare data.
speed_factors = [v["speed_factor"] if "speed_factor" in v else 1 for v in input.data["vehicles"]]
Expand Down Expand Up @@ -97,7 +103,9 @@ def solve(self, input: nextmv.Input) -> nextmv.Output:

# Solve the problem.
solution = problem_instance.solve(
exploration_level=input.options.exploration_level, nb_threads=input.options.threads
exploration_level=input.options.exploration_level,
nb_threads=input.options.threads,
timeout=timeout,
)
solve_end_time = time.time()

Expand Down
2 changes: 1 addition & 1 deletion python-pyvroom-routing/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyvroom==1.15.0
pyvroom==1.15.1
nextmv==1.6.2
Loading