Skip to content

Commit

Permalink
Properly handle capacity constraints for RouteSplit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoupey committed Sep 22, 2023
1 parent b0afd61 commit 0d293ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- Refactor heuristics to be able to operate on a subset of jobs and vehicles (#837)
- Account for vehicle/job compatibility in heuristic regrets values (#982)
- Slightly reduce computing times for SWAP* operator (#987)
- Refactor `RouteSplit` operator (#996)

### Fixed

Expand All @@ -40,6 +41,7 @@
- Meaningless `location_index` provided in output for break steps (#877)
- `max_travel_time` not accounted for with vehicle steps in solving mode (#954)
- `max_travel_time` not accounted for in `RouteSplit` (#941)
- Wrong capacity checks in `RouteSplit` (#981)
- Address sonarcloud "bugs" reports (#984)
- Address some sonarcloud "code smell" reports (#986)

Expand Down
8 changes: 4 additions & 4 deletions src/algorithms/local_search/route_split_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ compute_best_route_split_choice(const Input& input,
auto second_best_end_eval = NO_EVAL;
Index second_v_end = 0; // dummy init

const auto& end_load = source.bwd_peak(r);
const auto end_max_load = source.sub_route_max_load_after(r);
const auto end_delivery = source.delivery_in_range(r, source.size());

for (Index v_rank = 0; v_rank < empty_route_ranks.size(); ++v_rank) {
const auto v = empty_route_ranks[v_rank];
const auto& end_v = input.vehicles[v];

if (r < sol_state.bwd_skill_rank[s_vehicle][v] ||
!(end_load <= end_v.capacity) ||
!(end_max_load <= end_v.capacity) ||
end_v.max_tasks < source.size() - r) {
continue;
}
Expand Down Expand Up @@ -131,15 +131,15 @@ compute_best_route_split_choice(const Input& input,
auto second_best_begin_eval = NO_EVAL;
Index second_v_begin = 0; // dummy init

const auto& begin_load = source.fwd_peak(r - 1);
const auto begin_max_load = source.sub_route_max_load_before(r);
const auto begin_delivery = source.delivery_in_range(0, r);

for (Index v_rank = 0; v_rank < empty_route_ranks.size(); ++v_rank) {
const auto v = empty_route_ranks[v_rank];
const auto& begin_v = input.vehicles[v];

if (sol_state.fwd_skill_rank[s_vehicle][v] < r ||
!(begin_load <= begin_v.capacity) || begin_v.max_tasks < r) {
!(begin_max_load <= begin_v.capacity) || begin_v.max_tasks < r) {
continue;
}

Expand Down

0 comments on commit 0d293ed

Please sign in to comment.