-
Notifications
You must be signed in to change notification settings - Fork 22
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
v1: use function to reduce memory usage #71
v1: use function to reduce memory usage #71
Conversation
fb0c8bc
to
8058065
Compare
8058065
to
35e0042
Compare
35e0042
to
e7d21d9
Compare
e7d21d9
to
2a55a12
Compare
a25641e
to
4f21d4d
Compare
# TODO : need to uniformize generated relations whether mission has minimum AND maximum lapse or only one of them | ||
return unless mission.visits_number > 1 | ||
|
||
if mission.minimum_lapse && mission.maximum_lapse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you factorise the relation definition ? and give the specific mission_ids in a single place. It is a bit difficult to see the distinction between the cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now the goal was to group code that was identical for shipment and services.
I would indeed like to factorise but it is not that easy because of https://gitlab.com/mapotempo/optimizer-api/-/issues/339 . There can be an impact we need to test.
a25641e
to
db9cb60
Compare
wrappers/ortools.rb
Outdated
@@ -472,7 +472,7 @@ def build_costs(costs) | |||
|
|||
def check_services_compatible_days(vrp, vehicle, service) | |||
if vrp.schedule_range_indices && (service.minimum_lapse || service.maximum_lapse) | |||
(vehicle.global_day_index >= service[:first_possible_day] && vehicle.global_day_index <= service[:last_possible_day]) ? true : false | |||
(vehicle.global_day_index >= service[:first_possible_days].first && vehicle.global_day_index <= service[:last_possible_days].first) ? true : false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition already returns true or false ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content of the function could be replaced with:
!vrp.schedule_range_indices || (!service.minimum_lapse && !service.maximum_lapse) ||
(vehicle.global_day_index >= service[:first_possible_days].first && vehicle.global_day_index <= service[:last_possible_days].first)
db9cb60
to
90baa85
Compare
No description provided.