Skip to content

Commit

Permalink
Improve consistency checkers after fix in max_split
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsecadeline committed Apr 26, 2021
1 parent e0c088d commit b84d0e2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions models/concerns/validate_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ def check_consistency(hash)
check_matrices
check_vehicles
check_relations(periodic_heuristic)
# TODO : this should be replaced by schedule when max_split does not use visits_number > 1 without schedule anymore
# indeed, no configuration implies no schedule and there should be no visits_number > 1 in this case
# check_services_and_shipments(schedule)
check_services_and_shipments(configuration, schedule)
check_services_and_shipments(schedule)
check_shipments_specificities

check_routes(periodic_heuristic)
Expand Down Expand Up @@ -113,15 +110,13 @@ def check_vehicles
}
end

def check_services_and_shipments(configuration, schedule)
def check_services_and_shipments(schedule)
(@hash[:services].to_a + @hash[:shipments].to_a).each{ |mission|
if (mission[:minimum_lapse] || 0) > (mission[:maximum_lapse] || 2**32)
raise OptimizerWrapper::DiscordantProblemError.new('Minimum lapse can not be bigger than maximum lapse')
end

# TODO : this should be replaced next line when max_split does not use visits_number > 1 without schedule anymore
# next if schedule && schedule[:range_indices] || mission[:visits_number].to_i <= 1
next if configuration.nil? || schedule && schedule[:range_indices] || mission[:visits_number].to_i <= 1
next if schedule && schedule[:range_indices] || mission[:visits_number].to_i <= 1

raise OptimizerWrapper::DiscordantProblemError.new('There can not be more than one visit without schedule')
}
Expand Down

0 comments on commit b84d0e2

Please sign in to comment.