diff --git a/docs/user-guide/solver/02-command-line.md b/docs/user-guide/solver/02-command-line.md index 8334a3e9f5..0ba9651690 100644 --- a/docs/user-guide/solver/02-command-line.md +++ b/docs/user-guide/solver/02-command-line.md @@ -18,7 +18,7 @@ hide: | --parallel | Enable [parallel](optional-features/multi-threading.md) computation of MC years | | --force-parallel=VALUE | Override the max number of years computed [simultaneously](optional-features/multi-threading.md) | | --linear-solver=VALUE | The optimization solver to use for linear problems. Possible values are: `sirius` (default), `coin`, `xpress`, `scip` | -| --quadratic-solver=VALUE | The optimization solver to use for quadratic problems. Possible values are: `sirius` (default), `scip` | +| --quadratic-solver=VALUE | The optimization solver to use for quadratic problems. Possible values are: `sirius` (default) | ## Parameters diff --git a/src/solver/application/application.cpp b/src/solver/application/application.cpp index c01d1726ad..c0df0acb51 100644 --- a/src/solver/application/application.cpp +++ b/src/solver/application/application.cpp @@ -48,10 +48,10 @@ namespace { void printSolvers() { - std::cout << "Available linear solvers: " // NOSONAR - << availableOrToolsSolversString(SolverClass::LINEAR) << std::endl; - std::cout << "Available quadratic solvers: " // NOSONAR - << availableOrToolsSolversString(SolverClass::QUADRATIC) << std::endl; + std::cout << "Available linear solvers: " // NOSONAR + << availableOrToolsSolversString(SolverClass::LINEAR) << std::endl; // NOSONAR + std::cout << "Available quadratic solvers: " // NOSONAR + << availableOrToolsSolversString(SolverClass::QUADRATIC) << std::endl; // NOSONAR } } // namespace diff --git a/src/solver/optimisation/post_process_commands.cpp b/src/solver/optimisation/post_process_commands.cpp index 44723952e2..8ce0e8c546 100644 --- a/src/solver/optimisation/post_process_commands.cpp +++ b/src/solver/optimisation/post_process_commands.cpp @@ -276,8 +276,7 @@ void CurtailmentSharingPostProcessCmd::execute(const optRuntimeData& opt_runtime logs.info() << "[adq-patch] CSR triggered for Year:" << year + 1 << " Hour:" << week * nbHoursInWeek + hourInWeek + 1; hourlyCsrProblem.setHour(hourInWeek); - auto opt = opt_runtime_data.options; - hourlyCsrProblem.run(week, year, opt); + hourlyCsrProblem.run(week, year, opt_runtime_data.options); } } diff --git a/src/solver/utils/include/antares/solver/utils/ortools_quadratic_wrapper.h b/src/solver/utils/include/antares/solver/utils/ortools_quadratic_wrapper.h index 5147aa70b7..a823a4bfbb 100644 --- a/src/solver/utils/include/antares/solver/utils/ortools_quadratic_wrapper.h +++ b/src/solver/utils/include/antares/solver/utils/ortools_quadratic_wrapper.h @@ -24,6 +24,12 @@ #include #include +/** + * This wrapper is an adapter that solves a QP stored in a PROBLEME_ANTARES_A_RESOUDRE + * using OR-Tools MathOpt API & solvers. + * Currently, QP support in MathOpt is implemented for Gurobi and SIP (though SCIP in OR-Tools + * has compilation issues), and under development for XPRESS. + */ void SolveQuadraticProblemWithOrtools( const Antares::Solver::Optimization::OptimizationOptions& options, PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre); diff --git a/src/solver/utils/ortools_quadratic_wrapper.cpp b/src/solver/utils/ortools_quadratic_wrapper.cpp index 0bfaa8152c..de17180b18 100644 --- a/src/solver/utils/ortools_quadratic_wrapper.cpp +++ b/src/solver/utils/ortools_quadratic_wrapper.cpp @@ -27,13 +27,6 @@ #include #include -/** - * This wrapper is an adapter that solves a QP stored in a PROBLEME_ANTARES_A_RESOUDRE - * using OR-Tools MathOpt API & solvers. - * Currently, QP support in MathOpt is implemented for Gurobi and SIP (though SCIP in OR-Tools - * has compilation issues), and under development for XPRESS. - */ - using Antares::Solver::Optimization::OptimizationOptions; using namespace operations_research::math_opt; diff --git a/src/solver/utils/ortools_utils.cpp b/src/solver/utils/ortools_utils.cpp index 3dce27d57b..53d30ae9d7 100644 --- a/src/solver/utils/ortools_utils.cpp +++ b/src/solver/utils/ortools_utils.cpp @@ -21,8 +21,6 @@ #include "antares/solver/utils/ortools_utils.h" #include -#include -#include #include #include @@ -217,15 +215,6 @@ static int iLp = 0; bool solveAndManageStatus(MPSolver* solver, int& resultStatus, const MPSolverParameters& params) { - //++iLp; - // std::string filename = "/home/mitripet/debug_antares/lp_" + std::to_string(iLp) + ".lp"; - /*std::string lp; - solver->ExportModelAsLpFormat(false, &lp); - std::ofstream myfile; - myfile.open(filename); - myfile << lp; - myfile.close();*/ - // solver->Write(filename); auto status = solver->Solve(params); if (status == MPSolver::OPTIMAL || status == MPSolver::FEASIBLE) @@ -340,9 +329,9 @@ const std::map OrtoolsUtils::mpSo {"glpk", {"glpk_lp", "glpk"}}, {"scip", {"scip", "scip"}}}; +// TODO: add SCIP support when fixed by google: {"scip", math_opt::SolverType::kGscip} +// TODO: add XPRESS support when added in or-tools: {"xpress", math_opt::SolverType::kXpress} const std::map OrtoolsUtils::mathoptSolverMap = {}; -// TODO: add skip when fixed by google {"scip", math_opt::SolverType::kGscip} -// TODO: add XPRESS when merged {"xpress", math_opt::SolverType::kXpress} std::list getAvailableLinearSolverNames() { diff --git a/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp b/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp index fafc242892..70946bc22a 100644 --- a/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp +++ b/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp @@ -138,15 +138,6 @@ BOOST_FIXTURE_TEST_CASE(weekly_BC_restricts_link_direct_capacity_to_50, StudyWit OutputRetriever output(simulation->rawSimu()); unsigned int nbDaysInWeek = 7; BOOST_TEST(output.flow(link).week(0) == rhsValue * nbDaysInWeek, tt::tolerance(0.001)); - // TODO : revert these extra tests - BOOST_TEST(output.overallCost(area1).week(0) == 17500, tt::tolerance(0.001)); - BOOST_TEST(output.overallCost(area2).week(0) == 16450000, tt::tolerance(0.001)); - BOOST_TEST(output.load(area1).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.load(area2).week(0) == 16800, tt::tolerance(0.001)); - BOOST_TEST(output.hydroStorage(area1).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.hydroStorage(area2).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.thermalGeneration(cluster.get()).week(0) == 350, tt::tolerance(0.001)); - BOOST_TEST(output.thermalNbUnitsON(cluster.get()).week(0) == 4, tt::tolerance(0.001)); } BOOST_FIXTURE_TEST_CASE(daily_BC_restricts_link_direct_capacity_to_60, StudyWithBConLink) @@ -250,15 +241,6 @@ BOOST_FIXTURE_TEST_CASE(On_year_2__RHS_TS_number_2_is_taken_into_account, StudyW OutputRetriever output(simulation->rawSimu()); BOOST_TEST(output.flow(link).hour(0) == bcGroupRHS2, tt::tolerance(0.001)); - // TODO : revert these extra tests - BOOST_TEST(output.overallCost(area1).week(0) == 588000, tt::tolerance(0.001)); - BOOST_TEST(output.overallCost(area2).week(0) == 5040000, tt::tolerance(0.001)); - BOOST_TEST(output.load(area1).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.load(area2).week(0) == 16800, tt::tolerance(0.001)); - BOOST_TEST(output.hydroStorage(area1).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.hydroStorage(area2).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.thermalGeneration(cluster.get()).week(0) == 11760, tt::tolerance(0.001)); - BOOST_TEST(output.thermalNbUnitsON(cluster.get()).week(0) == 168, tt::tolerance(0.001)); } BOOST_FIXTURE_TEST_CASE(On_year_9__RHS_TS_number_4_is_taken_into_account, StudyWithBConLink) @@ -296,15 +278,7 @@ BOOST_FIXTURE_TEST_CASE(On_year_9__RHS_TS_number_4_is_taken_into_account, StudyW OutputRetriever output(simulation->rawSimu()); BOOST_TEST(output.flow(link).hour(0) == 40., tt::tolerance(0.001)); - // TODO : revert these extra tests - BOOST_TEST(output.overallCost(area1).week(0) == 336000, tt::tolerance(0.001)); - BOOST_TEST(output.overallCost(area2).week(0) == 10080000, tt::tolerance(0.001)); - BOOST_TEST(output.load(area1).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.load(area2).week(0) == 16800, tt::tolerance(0.001)); - BOOST_TEST(output.hydroStorage(area1).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.hydroStorage(area2).week(0) == 0, tt::tolerance(0.001)); - BOOST_TEST(output.thermalGeneration(cluster.get()).week(0) == 6720, tt::tolerance(0.001)); - BOOST_TEST(output.thermalNbUnitsON(cluster.get()).week(0) == 168, tt::tolerance(0.001)); + BOOST_TEST(output.flow(link).hour(0) == 40., tt::tolerance(0.001)); } BOOST_FIXTURE_TEST_CASE(On_year_9__RHS_TS_number_4_out_of_bound_use_random_fallback_to_Oth_column,