Skip to content

Commit

Permalink
Address SonarCloud issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoupey committed Oct 16, 2024
1 parent 15d832b commit bc82421
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
70 changes: 35 additions & 35 deletions src/algorithms/local_search/local_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ void LocalSearch<Route,

#ifdef LOG_LS
if (log_addition_step) {
steps.push_back({utils::now(),
log::EVENT::JOB_ADDITION,
OperatorName::MAX,
utils::SolutionIndicators(_input, _sol),
std::nullopt});
steps.emplace_back(utils::now(),
log::EVENT::JOB_ADDITION,
OperatorName::MAX,
utils::SolutionIndicators(_input, _sol),
std::nullopt);
}
#endif
}
Expand Down Expand Up @@ -1764,11 +1764,11 @@ void LocalSearch<Route,
#endif

#ifdef LOG_LS
steps.push_back({utils::now(),
log::EVENT::OPERATOR,
best_ops[best_source][best_target]->get_name(),
utils::SolutionIndicators(_input, _sol),
std::nullopt});
steps.emplace_back(utils::now(),
log::EVENT::OPERATOR,
best_ops[best_source][best_target]->get_name(),
utils::SolutionIndicators(_input, _sol),
std::nullopt);
#endif

#ifndef NDEBUG
Expand Down Expand Up @@ -1924,11 +1924,11 @@ void LocalSearch<Route,
bool try_ls_step = true;

#ifdef LOG_LS
steps.push_back({utils::now(),
log::EVENT::START,
OperatorName::MAX,
_best_sol_indicators,
utils::format_solution(_input, _best_sol)});
steps.emplace_back(utils::now(),
log::EVENT::START,
OperatorName::MAX,
_best_sol_indicators,
utils::format_solution(_input, _best_sol));
#endif

while (try_ls_step) {
Expand All @@ -1942,11 +1942,11 @@ void LocalSearch<Route,
_best_sol = _sol;

#ifdef LOG_LS
steps.push_back({utils::now(),
log::EVENT::LOCAL_MINIMA,
OperatorName::MAX,
_best_sol_indicators,
utils::format_solution(_input, _best_sol)});
steps.emplace_back(utils::now(),
log::EVENT::LOCAL_MINIMA,
OperatorName::MAX,
_best_sol_indicators,
utils::format_solution(_input, _best_sol));
#endif
} else {
// No improvement so back to previous best known for further
Expand All @@ -1956,11 +1956,11 @@ void LocalSearch<Route,
_sol_state.setup(_sol);
}
#ifdef LOG_LS
steps.push_back({utils::now(),
log::EVENT::ROLLBACK,
OperatorName::MAX,
_best_sol_indicators,
std::nullopt});
steps.emplace_back(utils::now(),
log::EVENT::ROLLBACK,
OperatorName::MAX,
_best_sol_indicators,
std::nullopt);
#endif

if (_completed_depth.has_value()) {
Expand Down Expand Up @@ -1998,11 +1998,11 @@ void LocalSearch<Route,
}

#ifdef LOG_LS
steps.push_back({utils::now(),
log::EVENT::RUIN,
OperatorName::MAX,
utils::SolutionIndicators(_input, _sol),
utils::format_solution(_input, _sol)});
steps.emplace_back(utils::now(),
log::EVENT::RUIN,
OperatorName::MAX,
utils::SolutionIndicators(_input, _sol),
utils::format_solution(_input, _sol));
#endif

// Update insertion ranks ranges.
Expand All @@ -2026,11 +2026,11 @@ void LocalSearch<Route,
}

#ifdef LOG_LS
steps.push_back({utils::now(),
log::EVENT::RECREATE,
OperatorName::MAX,
utils::SolutionIndicators(_input, _sol),
utils::format_solution(_input, _sol)});
steps.emplace_back(utils::now(),
log::EVENT::RECREATE,
OperatorName::MAX,
utils::SolutionIndicators(_input, _sol),
utils::format_solution(_input, _sol));
#endif
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/local_search/local_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class LocalSearch {
#endif

#ifdef LOG_LS
std::vector<log::Step> get_steps() {
std::vector<log::Step> get_steps() const {
return steps;
}
#endif
Expand Down

0 comments on commit bc82421

Please sign in to comment.