Skip to content

Commit

Permalink
Merge branch 'fix/delivery-values'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoupey committed Nov 15, 2024
2 parents 0146e4c + e92bd04 commit accff72
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#### Core solving

- Crash due to wrong delivery values in some validity checks (#1164)
- Crash when input is valid JSON but not an object (#1172)
- Capacity array check consistency (#1086)
- Segfault when using the C++ API with empty vehicles (#1187)
Expand Down
5 changes: 4 additions & 1 deletion src/algorithms/local_search/local_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2379,9 +2379,12 @@ void LocalSearch<Route,
std::vector<Index> between_pd(_sol[v].route.begin() + r + 1,
_sol[v].route.begin() + delivery_r);

const auto delivery_between_pd =
_sol[v].delivery_in_range(r + 1, delivery_r);

valid_removal =
_sol[v].is_valid_addition_for_tw(_input,
_input.zero_amount(),
delivery_between_pd,
between_pd.begin(),
between_pd.end(),
r,
Expand Down
6 changes: 4 additions & 2 deletions src/problems/vrptw/operators/pd_shift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ PDShift::PDShift(const Input& input,

void PDShift::compute_gain() {
// Check for valid removal wrt TW constraints.
if (!_tw_s_route.is_valid_addition_for_tw(_input,
_input.zero_amount(),
if (const auto delivery_between_pd =
_tw_s_route.delivery_in_range(_s_p_rank + 1, _s_d_rank);
!_tw_s_route.is_valid_addition_for_tw(_input,
delivery_between_pd,
s_route.begin() + _s_p_rank + 1,
s_route.begin() + _s_d_rank,
_s_p_rank,
Expand Down

0 comments on commit accff72

Please sign in to comment.