Skip to content

Commit

Permalink
Fix: incorrect unless condition
Browse files Browse the repository at this point in the history
  • Loading branch information
senhalil committed Oct 18, 2021
1 parent 5eb9da2 commit e94ee9b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/wrapper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3070,9 +3070,9 @@ def test_assert_inapplicable_relations

vrp = TestHelper.create(problem)
assert_includes OptimizerWrapper.config[:services][:vroom].inapplicable_solve?(vrp),
:assert_no_relations_except_simple_shipments
refute_includes OptimizerWrapper.config[:services][:ortools].inapplicable_solve?(vrp),
:assert_no_relations_except_simple_shipments
:assert_no_overall_duration
assert_includes OptimizerWrapper.config[:services][:ortools].inapplicable_solve?(vrp),
:assert_no_overall_duration

problem = VRP.basic
problem[:relations] = [{
Expand Down
2 changes: 1 addition & 1 deletion wrappers/ortools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def solver_constraints
:assert_route_date_or_indice_if_periodic,
:assert_not_too_many_visits_in_route,
:assert_no_route_if_schedule_without_periodic_heuristic,
# :assert_no_overall_duration, # TODO: Requires a complete rework
:assert_no_overall_duration, # TODO: Requires a complete rework
]
end

Expand Down
1 change: 1 addition & 0 deletions wrappers/vroom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def solver_constraints
:assert_vehicles_no_late_multiplier_or_single_vehicle,
:assert_vehicles_no_overload_multiplier,
:assert_vehicles_start_or_end,
:assert_no_overall_duration,

# Mission constraints
:assert_no_activity_with_position,
Expand Down
3 changes: 2 additions & 1 deletion wrappers/wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def assert_one_sticky_at_most(vrp)
def assert_no_relations_except_simple_shipments(vrp)
vrp.relations.all?{ |r|
next true if r.linked_ids.empty? && r.linked_vehicle_ids.empty?
next false unless r.type == :shipment && r.linked_ids.size == 2
next true unless r.type == :shipment
next false unless r.linked_ids.size == 2

quantities = Hash.new {}
vrp.units.each{ |unit| quantities[unit.id] = [] }
Expand Down

0 comments on commit e94ee9b

Please sign in to comment.