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
void saveProblem(const std::string &filename, LPSolver::ProblemFormat format=CPLEX) const override
Definition: ScipSolver.cpp:57
void doLoadProblem(const std::string &filename, LPSolver::ProblemFormat format=CPLEX) override
Definition: ScipSolver.cpp:41
void debugSolution(bool enable)
Definition: ScipSolver.cpp:31
double getVariableValueByColumnIdx(uint32_t idx) const override
Definition: ScipSolver.cpp:160
void loadSolution(const std::string &filename, LPSolver::SolutionType format=BASIC_SOLUTION) override
Definition: ScipSolver.cpp:72
double getObjectiveValue() const override
Definition: ScipSolver.cpp:113
SolutionType
Solution types: basic, IPT = interior point, MIP = mixed integer.
Definition: LPSolver.hpp:46
LPSolver::Type getSolverType() const override
Definition: ScipSolver.hpp:22
Definition: LPSolver.hpp:15
Status getStatus() const
Definition: ScipSolver.cpp:119
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
ProblemFormat
Definition: LPSolver.hpp:41
Status run() override
Definition: ScipSolver.cpp:138
double getVariableValue(const std::string &varName) const
Definition: ScipSolver.cpp:153
virtual ~ScipSolver()
Definition: ScipSolver.cpp:26
Status
Definition: LPSolver.hpp:18
shared_ptr< ScipSolver > Ptr
Definition: ScipSolver.hpp:18
Type
Definition: LPSolver.hpp:28
void saveSolution(const std::string &filename, LPSolver::SolutionType format=BASIC_SOLUTION) const override
Definition: ScipSolver.cpp:88