When applying a vrptw::MixedExchange, we replace two jobs in target route (note the t_rank and t_rank + 2 arguments) by a single job from source route:
|
_tw_t_route.replace(_input, |
|
s_job_ranks.begin(), |
|
s_job_ranks.end(), |
|
t_rank, |
|
t_rank + 2); |
The problem is that the matching validity check applies to replacing a single job in target route (note the t_rank and t_rank + 1 arguments):
|
valid = |
|
valid && _tw_t_route.is_valid_addition_for_tw(_input, |
|
s_route.begin() + s_rank, |
|
s_route.begin() + s_rank + 1, |
|
t_rank, |
|
t_rank + 1); |
This is bad since it means that we could theoretically apply an invalid operator, but then this would show up in the replace asserts. Now I've traced the introduction of this operator back to October 2018 with this problem already present. I guess the reason why this went unnoticed for so long are:
- the capacity check in
cvrp::MixedExchange::is_valid are OK;
- the check for replacing a single job rather than two is actually more demanding.
That last point means that the mismatch always resulted in not applying some valid moves rather than apply invalid ones.
When applying a
vrptw::MixedExchange, we replace two jobs in target route (note thet_rankandt_rank + 2arguments) by a single job from source route:vroom/src/problems/vrptw/operators/mixed_exchange.cpp
Lines 97 to 101 in 8cc9b06
The problem is that the matching validity check applies to replacing a single job in target route (note the
t_rankandt_rank + 1arguments):vroom/src/problems/vrptw/operators/mixed_exchange.cpp
Lines 40 to 45 in 8cc9b06
This is bad since it means that we could theoretically apply an invalid operator, but then this would show up in the
replaceasserts. Now I've traced the introduction of this operator back to October 2018 with this problem already present. I guess the reason why this went unnoticed for so long are:cvrp::MixedExchange::is_validare OK;That last point means that the mismatch always resulted in not applying some valid moves rather than apply invalid ones.