diff --git a/src/solver/modeler/api/include/antares/solver/modeler/api/linearProblem.h b/src/solver/modeler/api/include/antares/solver/modeler/api/linearProblem.h index 6885d81ac1..17cd8c6f8b 100644 --- a/src/solver/modeler/api/include/antares/solver/modeler/api/linearProblem.h +++ b/src/solver/modeler/api/include/antares/solver/modeler/api/linearProblem.h @@ -72,6 +72,8 @@ class ILinearProblem /// Solve the problem, returns a IMipSolution virtual IMipSolution* solve(bool verboseSolver) = 0; + virtual void Write(const std::string& filename) = 0; + // Definition of infinity virtual double infinity() const = 0; }; diff --git a/src/solver/modeler/main.cpp b/src/solver/modeler/main.cpp index 5e75b34a2d..837eabb08a 100644 --- a/src/solver/modeler/main.cpp +++ b/src/solver/modeler/main.cpp @@ -85,7 +85,7 @@ int main(int argc, const char** argv) { logs.info() << "Writing problem.mps..."; auto mps_path = std::filesystem::current_path() / "problem.mps"; - pb.MpSolver()->Write(mps_path.c_str()); + pb.Write(mps_path.c_str()); } logs.info() << "Launching resolution..."; diff --git a/src/solver/modeler/ortoolsImpl/include/antares/solver/modeler/ortoolsImpl/linearProblem.h b/src/solver/modeler/ortoolsImpl/include/antares/solver/modeler/ortoolsImpl/linearProblem.h index 3d69ee98e9..4cf5b72e90 100644 --- a/src/solver/modeler/ortoolsImpl/include/antares/solver/modeler/ortoolsImpl/linearProblem.h +++ b/src/solver/modeler/ortoolsImpl/include/antares/solver/modeler/ortoolsImpl/linearProblem.h @@ -65,6 +65,7 @@ class OrtoolsLinearProblem: public Api::ILinearProblem bool isMaximization() const override; OrtoolsMipSolution* solve(bool verboseSolver) override; + void Write(const std::string& filename) override; double infinity() const override; diff --git a/src/solver/modeler/ortoolsImpl/linearProblem.cpp b/src/solver/modeler/ortoolsImpl/linearProblem.cpp index feba47dda8..df07989c29 100644 --- a/src/solver/modeler/ortoolsImpl/linearProblem.cpp +++ b/src/solver/modeler/ortoolsImpl/linearProblem.cpp @@ -165,6 +165,11 @@ bool OrtoolsLinearProblem::isMaximization() const return objective_->maximization(); } +void OrtoolsLinearProblem::Write(const std::string& filename) +{ + mpSolver_->Write(filename); +} + MPSolver* OrtoolsLinearProblem::MpSolver() const { return mpSolver_;