graph_analysis
SoplexSolver.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_ALGORITHMS_SOPLEX_SOLVER_HPP
2 #define GRAPH_ANALYSIS_ALGORITHMS_SOPLEX_SOLVER_HPP
3 
4 #include <soplex.h>
5 #include "../../LPSolver.hpp"
6 
7 namespace graph_analysis {
8 namespace algorithms {
9 namespace lp {
10 namespace embedded {
11 
12 class SoplexSolver : public LPSolver
13 {
14 public:
15  SoplexSolver();
16  virtual ~SoplexSolver();
17 
18  LPSolver::Type getSolverType() const override { return SOPLEX_SOLVER; }
19 
20  void saveProblem(const std::string& filename, ProblemFormat format = CPLEX) const override;
21 
22  void loadSolution(const std::string& filename, SolutionType format = BASIC_SOLUTION) override;
23 
29  void saveSolution(const std::string& filename, LPSolver::SolutionType format = BASIC_SOLUTION) const override;
30 
34  double getObjectiveValue() const override;
35 
41  double getVariableValueByColumnIdx(uint32_t idx) const override;
42 
43  Status run() override { throw std::runtime_error("graph_analysis::algorithms::SoplexSolver::run not implemented"); }
44 
45  Status run(const std::string& problem, LPSolver::ProblemFormat problemFormat = CPLEX, bool useCaching = false) override;
46 
47  std::vector<size_t> infeasibleConstraints() const override { return mInfeasibleConstraints; }
48 
49 protected:
50  soplex::SoPlex mSoplex;
51  soplex::NameSet mRowNames;
52  soplex::NameSet mColumnNames;
53  std::vector<size_t> mInfeasibleConstraints;
54  virtual void doLoadProblem(const std::string& filename, ProblemFormat format = CPLEX) override;
55 
56 };
57 
58 } // end namespace embedded
59 } // end namespace lp
60 } // end namespace algorithms
61 } // end namespace graph_analysis
62 #endif // GRAPH_ANALYSIS_ALGORITHMS_SOPLEX_SOLVER_HPP
double getObjectiveValue() const override
Definition: SoplexSolver.cpp:39
void saveProblem(const std::string &filename, ProblemFormat format=CPLEX) const override
Definition: SoplexSolver.cpp:17
std::vector< size_t > mInfeasibleConstraints
Definition: SoplexSolver.hpp:53
double getVariableValueByColumnIdx(uint32_t idx) const override
Definition: SoplexSolver.cpp:44
Status run() override
Definition: SoplexSolver.hpp:43
std::vector< size_t > infeasibleConstraints() const override
Definition: SoplexSolver.hpp:47
SolutionType
Solution types: basic, IPT = interior point, MIP = mixed integer.
Definition: LPSolver.hpp:46
void loadSolution(const std::string &filename, SolutionType format=BASIC_SOLUTION) override
Definition: SoplexSolver.cpp:29
Definition: LPSolver.hpp:15
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
soplex::NameSet mRowNames
Definition: SoplexSolver.hpp:51
ProblemFormat
Definition: LPSolver.hpp:41
soplex::SoPlex mSoplex
Definition: SoplexSolver.hpp:50
void saveSolution(const std::string &filename, LPSolver::SolutionType format=BASIC_SOLUTION) const override
Definition: SoplexSolver.cpp:34
virtual ~SoplexSolver()
Definition: SoplexSolver.cpp:13
virtual void doLoadProblem(const std::string &filename, ProblemFormat format=CPLEX) override
Definition: SoplexSolver.cpp:157
LPSolver::Type getSolverType() const override
Definition: SoplexSolver.hpp:18
Status
Definition: LPSolver.hpp:18
Type
Definition: LPSolver.hpp:28
soplex::NameSet mColumnNames
Definition: SoplexSolver.hpp:52