hops
LinearProgramClpImpl.hpp
Go to the documentation of this file.
1 #ifndef HOPS_LINEARPROGRAMCLPIMPL_HPP
2 #define HOPS_LINEARPROGRAMCLPIMPL_HPP
3 
4 #include <Eigen/Core>
5 #include "LinearProgram.hpp"
6 
7 #ifdef HOPS_CLP_FOUND
8 
9 #include <coin/ClpSimplex.hpp>
10 
11 namespace hops {
12  class LinearProgramClpImpl : public LinearProgram {
13  public:
14  LinearProgramClpImpl(const Eigen::MatrixXd &A, const Eigen::VectorXd &b);
15 
17 
18  LinearProgramClpImpl &operator=(const LinearProgramClpImpl &other);
19 
20  LinearProgramSolution solve(const Eigen::VectorXd &objective) const override;
21 
22  std::tuple<Eigen::MatrixXd, Eigen::VectorXd> removeRedundantConstraints(double tolerance) override;
23 
24  LinearProgramSolution computeChebyshevCenter() const override;
25 
26  std::vector<long> computeUnconstrainedDimensions() const override;
27 
28  std::tuple<Eigen::MatrixXd, Eigen::VectorXd>
29  addBoxConstraintsToUnconstrainedDimensions(double lb, double ub) override;
30 
31  private:
32  mutable ClpSimplex model;
33  };
34 }
35 
36 #else //HOPS_CLP_FOUND
37 
38 namespace hops {
40  public:
41  LinearProgramClpImpl(const Eigen::MatrixXd &A, const Eigen::VectorXd &b) : LinearProgram(A, b) {
42  throw std::runtime_error("HOPS did not find CLP during compilation.");
43  }
44 
45  [[nodiscard]] LinearProgramSolution solve(const Eigen::VectorXd &) const override {
46  throw std::runtime_error("HOPS did not find CLP during compilation.");
47  }
48 
49  std::tuple<Eigen::MatrixXd, Eigen::VectorXd> removeRedundantConstraints(double) override {
50  throw std::runtime_error("HOPS did not find CLP during compilation.");
51  }
52 
53  [[nodiscard]] LinearProgramSolution computeChebyshevCenter() const override {
54  throw std::runtime_error("HOPS did not find CLP during compilation.");
55  }
56 
57  [[nodiscard]] std::vector<long> computeUnconstrainedDimensions() const override {
58  throw std::runtime_error("HOPS did not find CLP during compilation.");
59  }
60 
61  std::tuple<Eigen::MatrixXd, Eigen::VectorXd>
62  addBoxConstraintsToUnconstrainedDimensions(double, double) override {
63  throw std::runtime_error("HOPS did not find CLP during compilation.");
64  }
65  };
66 }
67 
68 #endif //HOPS_CLP_FOUND
69 #endif //HOPS_LINEARPROGRAMCLPIMPL_HPP
hops::LinearProgramClpImpl::removeRedundantConstraints
std::tuple< Eigen::MatrixXd, Eigen::VectorXd > removeRedundantConstraints(double) override
Removes redundant constraints and returns system matrices. Changes to the system matrices are reflect...
Definition: LinearProgramClpImpl.hpp:49
hops::LinearProgram
Definition: LinearProgram.hpp:9
hops::LinearProgram::b
Eigen::VectorXd b
Definition: LinearProgram.hpp:54
hops::LinearProgramSolution
Definition: LinearProgramSolution.hpp:9
hops::LinearProgramClpImpl::computeChebyshevCenter
LinearProgramSolution computeChebyshevCenter() const override
Definition: LinearProgramClpImpl.hpp:53
hops::LinearProgramClpImpl
Definition: LinearProgramClpImpl.hpp:39
hops::LinearProgramClpImpl::computeUnconstrainedDimensions
std::vector< long > computeUnconstrainedDimensions() const override
Definition: LinearProgramClpImpl.hpp:57
hops::LinearProgramClpImpl::solve
LinearProgramSolution solve(const Eigen::VectorXd &) const override
Definition: LinearProgramClpImpl.hpp:45
hops::LinearProgramClpImpl::LinearProgramClpImpl
LinearProgramClpImpl(const Eigen::MatrixXd &A, const Eigen::VectorXd &b)
Definition: LinearProgramClpImpl.hpp:41
hops::LinearProgram::A
Eigen::MatrixXd A
Definition: LinearProgram.hpp:53
hops
Definition: CsvReader.hpp:8
LinearProgram.hpp
hops::LinearProgramClpImpl::addBoxConstraintsToUnconstrainedDimensions
std::tuple< Eigen::MatrixXd, Eigen::VectorXd > addBoxConstraintsToUnconstrainedDimensions(double, double) override
Adds box constraints to unconstrained dimensions and returns system matrices. Changes to the system m...
Definition: LinearProgramClpImpl.hpp:62