Skip to content

Commit

Permalink
Remove some restrictions as the heuristic checks for validity.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoupey committed Aug 29, 2023
1 parent cb943d2 commit 5cbb4db
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/algorithms/local_search/local_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,25 +1111,20 @@ void LocalSearch<Route,
}

// RouteFix stuff
if (!_input.has_shipments()) {
// TODO no shipments for current route only.

for (const auto& s_t : s_t_pairs) {
if (s_t.second != s_t.first or best_priorities[s_t.first] > 0 or
_sol[s_t.first].size() < 2) {
// TODO do not try with binding constraints.
continue;
}
for (const auto& s_t : s_t_pairs) {
if (s_t.second != s_t.first or best_priorities[s_t.first] > 0 or
_sol[s_t.first].size() < 2) {
continue;
}

#ifdef LOG_LS_OPERATORS
++tried_moves[OperatorName::RouteFix];
++tried_moves[OperatorName::RouteFix];
#endif
RouteFix op(_input, _sol_state, _sol[s_t.first], s_t.first);
RouteFix op(_input, _sol_state, _sol[s_t.first], s_t.first);

if (op.gain() > best_gains[s_t.first][s_t.second]) {
best_gains[s_t.first][s_t.second] = op.gain();
best_ops[s_t.first][s_t.second] = std::make_unique<RouteFix>(op);
}
if (op.gain() > best_gains[s_t.first][s_t.second]) {
best_gains[s_t.first][s_t.second] = op.gain();
best_ops[s_t.first][s_t.second] = std::make_unique<RouteFix>(op);
}
}

Expand Down

0 comments on commit 5cbb4db

Please sign in to comment.