Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Mitri <[email protected]>
  • Loading branch information
pet-mit committed Jan 17, 2025
1 parent c49ca2e commit d5d90f0
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 54 deletions.
2 changes: 1 addition & 1 deletion docs/user-guide/solver/02-command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/solver/application/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions src/solver/optimisation/post_process_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#include <antares/optimization-options/options.h>
#include <antares/solver/optimisation/opt_structure_probleme_a_resoudre.h>

/**
* 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);
7 changes: 0 additions & 7 deletions src/solver/utils/ortools_quadratic_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@
#include <antares/solver/utils/ortools_quadratic_wrapper.h>
#include <antares/solver/utils/ortools_utils.h>

/**
* 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;

Expand Down
15 changes: 2 additions & 13 deletions src/solver/utils/ortools_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include "antares/solver/utils/ortools_utils.h"

#include <filesystem>
#include <fstream>
#include <iostream>
#include <optional>
#include <ortools/math_opt/cpp/parameters.h>

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -340,9 +329,9 @@ const std::map<std::string, struct OrtoolsUtils::SolverNames> 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<std::string, math_opt::SolverType> 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<std::string> getAvailableLinearSolverNames()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d5d90f0

Please sign in to comment.