From 931890b656b752fec4ce00549c5274b5b42e487a Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Mon, 8 Jan 2024 13:12:47 +0100 Subject: [PATCH] pdlp: replace `std::end` by `'/n'` ref: https://clang.llvm.org/extra/clang-tidy/checks/performance/avoid-endl.html --- ortools/pdlp/samples/simple_pdlp_program.cc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ortools/pdlp/samples/simple_pdlp_program.cc b/ortools/pdlp/samples/simple_pdlp_program.cc index 8784872397..5369cd7b28 100644 --- a/ortools/pdlp/samples/simple_pdlp_program.cc +++ b/ortools/pdlp/samples/simple_pdlp_program.cc @@ -86,34 +86,33 @@ int main(int argc, char* argv[]) { const pdlp::SolveLog& solve_log = result.solve_log; if (solve_log.termination_reason() == pdlp::TERMINATION_REASON_OPTIMAL) { - std::cout << "Solve successful" << std::endl; + std::cout << "Solve successful" << '\n'; } else { std::cout << "Solve not successful. Status: " << pdlp::TerminationReason_Name(solve_log.termination_reason()) - << std::endl; + << '\n'; } // Solutions vectors are always returned. *However*, their interpretation // depends on termination_reason! See primal_dual_hybrid_gradient.h for more // details on what the vectors mean if termination_reason is not // TERMINATION_REASON_OPTIMAL. - std::cout << "Primal solution:\n" << result.primal_solution << std::endl; - std::cout << "Dual solution:\n" << result.dual_solution << std::endl; - std::cout << "Reduced costs:\n" << result.reduced_costs << std::endl; + std::cout << "Primal solution:\n" << result.primal_solution << '\n'; + std::cout << "Dual solution:\n" << result.dual_solution << '\n'; + std::cout << "Reduced costs:\n" << result.reduced_costs << '\n'; const pdlp::PointType solution_type = solve_log.solution_type(); - std::cout << "Solution type: " << pdlp::PointType_Name(solution_type) - << std::endl; + std::cout << "Solution type: " << pdlp::PointType_Name(solution_type) << '\n'; const std::optional ci = pdlp::GetConvergenceInformation(solve_log.solution_stats(), solution_type); if (ci.has_value()) { - std::cout << "Primal objective: " << ci->primal_objective() << std::endl; - std::cout << "Dual objective: " << ci->dual_objective() << std::endl; + std::cout << "Primal objective: " << ci->primal_objective() << '\n'; + std::cout << "Dual objective: " << ci->dual_objective() << '\n'; } - std::cout << "Iterations: " << solve_log.iteration_count() << std::endl; - std::cout << "Solve time (sec): " << solve_log.solve_time_sec() << std::endl; + std::cout << "Iterations: " << solve_log.iteration_count() << '\n'; + std::cout << "Solve time (sec): " << solve_log.solve_time_sec() << '\n'; return 0; }