Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Jul 31, 2024
1 parent ee0033c commit 1e1dcdd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
};
Expand Down
23 changes: 15 additions & 8 deletions src/solver/optim/ortoolsImpl/linearSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
*/

#include <antares/solver/optim/ortoolsImpl/linearSolver.h>
#include <antares/solver/optim/ortoolsImpl/mipVariable.h>

#include <antares/solver/utils/ortools_utils.h>

#include <memory>

namespace Antares::Solver::Optim::OrtoolsImpl
{

Expand All @@ -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<Api::MipVariable>(mpVar));
auto* mpVar = mpSolver_->MakeNumVar(lb, ub, name);
auto mipVar = std::make_shared<OrtoolsMipVariable>(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<Api::MipVariable>(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<Api::MipVariable>(mpVar); */
/* variables_.try_emplace(name, mipVar); */

return variables_.at(name).get();
}
/* return variables_.at(name).get(); */
/* } */

/* Api::MipVariable* OrtoolsLinearSolver::getVariable(const std::string& name) */
/* { */
Expand Down

0 comments on commit 1e1dcdd

Please sign in to comment.