Skip to content

Commit

Permalink
Add a function to get all values for mip solution
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Jan 8, 2025
1 parent 9707d60 commit 794e6a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#pragma once

#include <map>
#include <string>
#include <vector>

#include "mipVariable.h"
Expand Down Expand Up @@ -51,6 +53,7 @@ class IMipSolution
virtual double getObjectiveValue() const = 0;
virtual double getOptimalValue(const IMipVariable* var) const = 0;
virtual std::vector<double> getOptimalValues(const std::vector<IMipVariable*>& vars) const = 0;
virtual std::map<std::string, double> getAllValues() const = 0;
};

} // namespace Antares::Solver::Modeler::Api
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class OrtoolsMipSolution final: public Api::IMipSolution
double getOptimalValue(const Api::IMipVariable* var) const override;
std::vector<double> getOptimalValues(
const std::vector<Api::IMipVariable*>& vars) const override;
std::map<std::string, double> getAllValues() const override;

private:
operations_research::MPSolver::ResultStatus status_;
Expand Down
5 changes: 5 additions & 0 deletions src/solver/modeler/ortoolsImpl/mipSolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,9 @@ std::vector<double> OrtoolsMipSolution::getOptimalValues(
return solution;
}

std::map<std::string, double> OrtoolsMipSolution::getAllValues() const
{
return solution_;
}

} // namespace Antares::Solver::Modeler::OrtoolsImpl

0 comments on commit 794e6a5

Please sign in to comment.