Skip to content

Commit

Permalink
Update wrappers/ortools.rb
Browse files Browse the repository at this point in the history
Co-authored-by: Gwénaël Rault <rgwenael@gmail.com>
  • Loading branch information
fonsecadeline and braktar committed Sep 23, 2021
1 parent 2ad5430 commit da16d04
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wrappers/ortools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,10 @@ def solve(vrp, job, thread_proc = nil, &block)
OrtoolsVrp::Rest.new(
# Ortools can only deal with one and exactly one timewindow per rest :
time_windows:
[(rest.timewindows.collect{ |tw|
OrtoolsVrp::TimeWindow.new(start: tw.start, end: tw.end || 2**56)
} + [OrtoolsVrp::TimeWindow.new(start: 0, end: 2**56)])[0]], # write test: avec, sans pause ça doit reprendre bon truc dans run_ortools
rest.timewindows.any? ?
(rest.timewindows.collect{ |tw|
OrtoolsVrp::TimeWindow.new(start: tw.start, end: tw.end || 2**56)
} : [OrtoolsVrp::TimeWindow.new(start: 0, end: 2**56)], # Rests should always have a timewindow
duration: rest.duration,
id: rest.id.to_s,
late_multiplier: rest.late_multiplier,
Expand Down

0 comments on commit da16d04

Please sign in to comment.