From 1e1dcdd60bf2c39904c4c7b586d3039a28cd0c0e Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Wed, 31 Jul 2024 09:48:44 +0200 Subject: [PATCH] fix compile --- .../solver/optim/ortoolsImpl/mipVariable.h | 2 +- src/solver/optim/ortoolsImpl/linearSolver.cpp | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/solver/optim/ortoolsImpl/include/antares/solver/optim/ortoolsImpl/mipVariable.h b/src/solver/optim/ortoolsImpl/include/antares/solver/optim/ortoolsImpl/mipVariable.h index 9deca33a8c..ba4c2bc540 100644 --- a/src/solver/optim/ortoolsImpl/include/antares/solver/optim/ortoolsImpl/mipVariable.h +++ b/src/solver/optim/ortoolsImpl/include/antares/solver/optim/ortoolsImpl/mipVariable.h @@ -43,9 +43,9 @@ class OrtoolsMipVariable: virtual public Api::MipVariable ~OrtoolsMipVariable() = default; + explicit OrtoolsMipVariable(operations_research::MPVariable*); private: // TODO: add friend class - explicit OrtoolsMipVariable(operations_research::MPVariable*); operations_research::MPVariable* mpVar_; }; diff --git a/src/solver/optim/ortoolsImpl/linearSolver.cpp b/src/solver/optim/ortoolsImpl/linearSolver.cpp index 40ae9d1ec8..fa8cf16146 100644 --- a/src/solver/optim/ortoolsImpl/linearSolver.cpp +++ b/src/solver/optim/ortoolsImpl/linearSolver.cpp @@ -20,8 +20,12 @@ */ #include +#include + #include +#include + namespace Antares::Solver::Optim::OrtoolsImpl { @@ -34,19 +38,22 @@ OrtoolsLinearSolver::OrtoolsLinearSolver(bool isMip, const std::string& solverNa Api::MipVariable* OrtoolsLinearSolver::addNumVariable(double lb, double ub, const std::string& name) { - auto mpVar = mpSolver_->MakeNumVar(lb, ub, name); - variables_.try_emplace(name, std::make_shared(mpVar)); + auto* mpVar = mpSolver_->MakeNumVar(lb, ub, name); + auto mipVar = std::make_shared(mpVar); + + /* variables_.try_emplace(name, mipVar); */ return variables_.at(name).get(); } -Api::MipVariable* OrtoolsLinearSolver::addIntVariable(double lb, double ub, const std::string& name) -{ - auto mpVar = mpSolver_->MakeIntVar(lb, ub, name); - variables_.try_emplace(name, std::make_shared(mpVar)); +/* Api::MipVariable* OrtoolsLinearSolver::addIntVariable(double lb, double ub, const std::string& name) */ +/* { */ +/* auto* mpVar = mpSolver_->MakeIntVar(lb, ub, name); */ +/* auto mipVar = std::make_shared(mpVar); */ +/* variables_.try_emplace(name, mipVar); */ - return variables_.at(name).get(); -} +/* return variables_.at(name).get(); */ +/* } */ /* Api::MipVariable* OrtoolsLinearSolver::getVariable(const std::string& name) */ /* { */