-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Legacy ortools behind API : correction due to review
- Loading branch information
1 parent
b4ef65f
commit ef29f1d
Showing
5 changed files
with
41 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/solver/optimisation/include/antares/solver/optimisation/LegacyOrtoolsFiller.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include "antares/solver/modeler/api/linearProblemFiller.h" | ||
#include "ortools/linear_solver/linear_solver.h" | ||
#include "antares/solver/utils/named_problem.h" | ||
#include "antares/solver/utils/ortools_utils.h" | ||
|
||
using namespace Antares::Solver::Modeler::Api; | ||
|
||
namespace Antares::Optimization | ||
{ | ||
class LegacyOrtoolsFiller: public LinearProblemFiller | ||
{ | ||
public: | ||
explicit LegacyOrtoolsFiller(const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* problemeSimplexe); | ||
void addVariables(ILinearProblem& pb, LinearProblemData& data) override; | ||
void addConstraints(ILinearProblem& pb, LinearProblemData& data) override; | ||
void addObjective(ILinearProblem& pb, LinearProblemData& data) override; | ||
|
||
private: | ||
operations_research::MPSolver* mpSolver_ = nullptr; | ||
const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* problemeSimplexe_; | ||
Nomenclature variableNameManager_ = Nomenclature('x'); | ||
Nomenclature constraintNameManager_ = Nomenclature('c'); | ||
|
||
void CreateVariable(unsigned idxVar, MPSolver* solver, MPObjective* const objective) const; | ||
void CopyVariables(MPSolver* solver) const; | ||
void UpdateContraints(unsigned idxRow, MPSolver* solver) const; | ||
void CopyRows(MPSolver* solver) const; | ||
void CopyMatrix(const MPSolver* solver) const; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters