graph_analysis
ScipSolver.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_ALGORITHMS_SCIP_SOLVER_HPP
2 #define GRAPH_ANALYSIS_ALGORITHMS_SCIP_SOLVER_HPP
3 
4 #include <scip/scip.h>
5 #include "../../LPSolver.hpp"
6 
7 namespace graph_analysis {
8 namespace algorithms {
9 namespace lp {
10 namespace embedded {
11 
12 class ScipSolver : public LPSolver
13 {
14 public:
15  ScipSolver();
16  virtual ~ScipSolver();
17 
18  typedef shared_ptr<ScipSolver> Ptr;
19 
20  void debugSolution(bool enable);
21 
22  LPSolver::Type getSolverType() const override { return SCIP_SOLVER; }
23 
24  void doLoadProblem(const std::string& filename, LPSolver::ProblemFormat format = CPLEX) override;
25 
26  void saveProblem(const std::string& filename, LPSolver::ProblemFormat format = CPLEX) const override;
27 
28  void loadSolution(const std::string& filename, LPSolver::SolutionType format = BASIC_SOLUTION) override;
29 
30  void saveSolution(const std::string& filename, LPSolver::SolutionType format = BASIC_SOLUTION) const override;
31 
32  double getObjectiveValue() const override;
33 
34  double getVariableValue(const std::string& varName) const;
35 
36  double getVariableValueByColumnIdx(uint32_t idx) const override;
37 
38  Status run() override;
39 
40  Status getStatus() const;
41 
42  Status run(const std::string& problem, LPSolver::ProblemFormat problemFormat = CPLEX, bool useCaching = false) override;
43 
44 private:
45  SCIP* mpScip;
46  bool mDebugSolution;
47 
48 };
49 
50 } // end namespace embedded
51 } // end namespace lp
52 } // end namespace algorithms
53 } // end namespace graph_analysis
54 #endif // GRAPH_ANALYSIS_ALGORITHMS_SCIP_SOLVER_HPP
graph_analysis::algorithms::LPSolver
Definition: LPSolver.hpp:15
graph_analysis::algorithms::lp::embedded::ScipSolver::doLoadProblem
void doLoadProblem(const std::string &filename, LPSolver::ProblemFormat format=CPLEX) override
Definition: ScipSolver.cpp:41
graph_analysis::algorithms::lp::embedded::ScipSolver::getStatus
Status getStatus() const
Definition: ScipSolver.cpp:119
graph_analysis::algorithms::lp::embedded::ScipSolver
Definition: ScipSolver.hpp:12
graph_analysis::algorithms::lp::embedded::ScipSolver::getVariableValueByColumnIdx
double getVariableValueByColumnIdx(uint32_t idx) const override
Definition: ScipSolver.cpp:160
graph_analysis::algorithms::LPSolver::SCIP_SOLVER
@ SCIP_SOLVER
Definition: LPSolver.hpp:32
graph_analysis::algorithms::lp::embedded::ScipSolver::getSolverType
LPSolver::Type getSolverType() const override
Definition: ScipSolver.hpp:22
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
graph_analysis::algorithms::lp::embedded::ScipSolver::~ScipSolver
virtual ~ScipSolver()
Definition: ScipSolver.cpp:26
graph_analysis::algorithms::lp::embedded::ScipSolver::loadSolution
void loadSolution(const std::string &filename, LPSolver::SolutionType format=BASIC_SOLUTION) override
Definition: ScipSolver.cpp:72
graph_analysis::algorithms::lp::embedded::ScipSolver::saveProblem
void saveProblem(const std::string &filename, LPSolver::ProblemFormat format=CPLEX) const override
Definition: ScipSolver.cpp:57
graph_analysis::algorithms::LPSolver::SolutionType
SolutionType
Solution types: basic, IPT = interior point, MIP = mixed integer.
Definition: LPSolver.hpp:46
graph_analysis::algorithms::LPSolver::ProblemFormat
ProblemFormat
Definition: LPSolver.hpp:41
graph_analysis::algorithms::lp::embedded::ScipSolver::saveSolution
void saveSolution(const std::string &filename, LPSolver::SolutionType format=BASIC_SOLUTION) const override
Definition: ScipSolver.cpp:88
graph_analysis::algorithms::lp::embedded::ScipSolver::debugSolution
void debugSolution(bool enable)
Definition: ScipSolver.cpp:31
graph_analysis::algorithms::lp::embedded::ScipSolver::run
Status run() override
Definition: ScipSolver.cpp:138
graph_analysis::algorithms::lp::embedded::ScipSolver::Ptr
shared_ptr< ScipSolver > Ptr
Definition: ScipSolver.hpp:18
graph_analysis::algorithms::lp::embedded::ScipSolver::getVariableValue
double getVariableValue(const std::string &varName) const
Definition: ScipSolver.cpp:153
graph_analysis::algorithms::LPSolver::BASIC_SOLUTION
@ BASIC_SOLUTION
Definition: LPSolver.hpp:46
graph_analysis::algorithms::lp::embedded::ScipSolver::ScipSolver
ScipSolver()
Definition: ScipSolver.cpp:10
graph_analysis::algorithms::LPSolver::Status
Status
Definition: LPSolver.hpp:18
graph_analysis::algorithms::lp::embedded::ScipSolver::getObjectiveValue
double getObjectiveValue() const override
Definition: ScipSolver.cpp:113
graph_analysis::algorithms::LPSolver::CPLEX
@ CPLEX
Definition: LPSolver.hpp:41
graph_analysis::algorithms::LPSolver::Type
Type
Definition: LPSolver.hpp:28