hops
MaximumVolumeEllipsoid.hpp
Go to the documentation of this file.
1 #ifndef HOPS_MAXIMUMVOLUMEELLIPSOID_HPP
2 #define HOPS_MAXIMUMVOLUMEELLIPSOID_HPP
3 
4 #include <cmath>
5 #include <Eigen/Core>
7 
8 namespace hops {
9  template<typename RealType>
24  public:
26 
27  MaximumVolumeEllipsoid(MaximumVolumeEllipsoid &&) noexcept = default;
28 
30 
36  [[nodiscard]] Eigen::Matrix<RealType, Eigen::Dynamic, 1>
37  applyRoundingTransformation(Eigen::Matrix<RealType, Eigen::Dynamic, 1> &x);
38 
39  [[nodiscard]] RealType computeVolume() const;
40 
41  [[nodiscard]] const Eigen::Matrix<RealType, Eigen::Dynamic, Eigen::Dynamic> &getRoundingTransformation() const;
42 
43  [[nodiscard]] const Eigen::Matrix<RealType, Eigen::Dynamic, 1> &getCenter() const;
44 
45  [[nodiscard]] Eigen::Matrix<RealType, Eigen::Dynamic, Eigen::Dynamic> getEllipsoid() const;
46 
47  [[nodiscard]] bool hasConverged() const;
48 
49  [[nodiscard]] size_t getNumberOfIterations() const;
50 
51  [[nodiscard]] RealType getCurrentError() const;
52 
53  [[nodiscard]] RealType getTolerance() const;
54 
56  construct(const Eigen::Matrix<RealType, Eigen::Dynamic, Eigen::Dynamic> &A,
57  const Eigen::Matrix<RealType, Eigen::Dynamic, 1> &b,
58  size_t maximumNumberOfIterationsToRun,
59  const Eigen::Matrix<RealType, Eigen::Dynamic, 1> &startingPoint,
60  RealType tolerance = 1e-6);
61 
63  construct(const Eigen::Matrix<RealType, Eigen::Dynamic, Eigen::Dynamic> &A,
64  const Eigen::Matrix<RealType, Eigen::Dynamic, 1> &b,
65  size_t maximumNumberOfIterationsToRun,
66  RealType tolerance = 1e-6);
67 
68  template<typename Derived>
69  friend std::ostream &
70  operator<<(std::ostream &out, const MaximumVolumeEllipsoid<Derived> &maximumVolumeEllipsoid);
71 
72  private:
73  template<typename Derived>
75 
76  MaximumVolumeEllipsoid() = default;
77 
78  Eigen::Matrix<RealType, Eigen::Dynamic, Eigen::Dynamic> roundingTransformation;
79  Eigen::Matrix<RealType, Eigen::Dynamic, Eigen::Dynamic> maximumVolumeEllipsoid;
80  Eigen::Matrix<RealType, Eigen::Dynamic, 1> center;
81 
82  size_t iterations = 0;
83  RealType currentError = 0;
84  RealType tolerance = 0;
85  bool converged = false;
86  };
87 }
88 
89 #endif //HOPS_MAXIMUMVOLUMEELLIPSOID_HPP
hops::MaximumVolumeEllipsoid::computeVolume
RealType computeVolume() const
Definition: MaximumVolumeEllipsoid.cpp:41
hops::MaximumVolumeEllipsoid::operator<<
friend std::ostream & operator<<(std::ostream &out, const MaximumVolumeEllipsoid< Derived > &maximumVolumeEllipsoid)
Definition: MaximumVolumeEllipsoid.cpp:11
hops::MaximumVolumeEllipsoid
[Deprectated] Use PolyRound (https://gitlab.com/csb.ethz/PolyRound) for effective and efficient round...
Definition: MaximumVolumeEllipsoid.hpp:23
hops::MaximumVolumeEllipsoid::hasConverged
bool hasConverged() const
Definition: MaximumVolumeEllipsoid.cpp:63
hops::MaximumVolumeEllipsoid::swap
friend void swap(MaximumVolumeEllipsoid< Derived > &first, MaximumVolumeEllipsoid< Derived > &second)
Definition: MaximumVolumeEllipsoid.cpp:24
hops::MaximumVolumeEllipsoid::construct
static MaximumVolumeEllipsoid construct(const Eigen::Matrix< RealType, Eigen::Dynamic, Eigen::Dynamic > &A, const Eigen::Matrix< RealType, Eigen::Dynamic, 1 > &b, size_t maximumNumberOfIterationsToRun, const Eigen::Matrix< RealType, Eigen::Dynamic, 1 > &startingPoint, RealType tolerance=1e-6)
Definition: MaximumVolumeEllipsoid.cpp:84
hops::MaximumVolumeEllipsoid::getEllipsoid
Eigen::Matrix< RealType, Eigen::Dynamic, Eigen::Dynamic > getEllipsoid() const
Definition: MaximumVolumeEllipsoid.cpp:58
hops::MaximumVolumeEllipsoid::applyRoundingTransformation
Eigen::Matrix< RealType, Eigen::Dynamic, 1 > applyRoundingTransformation(Eigen::Matrix< RealType, Eigen::Dynamic, 1 > &x)
Transforms vector x to the rounded space.
Definition: MaximumVolumeEllipsoid.cpp:36
hops::MaximumVolumeEllipsoid::getRoundingTransformation
const Eigen::Matrix< RealType, Eigen::Dynamic, Eigen::Dynamic > & getRoundingTransformation() const
Definition: MaximumVolumeEllipsoid.cpp:48
hops
Definition: CsvReader.hpp:8
hops::MaximumVolumeEllipsoid::operator=
MaximumVolumeEllipsoid & operator=(const MaximumVolumeEllipsoid &)=default
hops::MaximumVolumeEllipsoid::getTolerance
RealType getTolerance() const
Definition: MaximumVolumeEllipsoid.cpp:78
hops::MaximumVolumeEllipsoid::getCenter
const Eigen::Matrix< RealType, Eigen::Dynamic, 1 > & getCenter() const
Definition: MaximumVolumeEllipsoid.cpp:53
hops::MaximumVolumeEllipsoid::getNumberOfIterations
size_t getNumberOfIterations() const
Definition: MaximumVolumeEllipsoid.cpp:68
LinearProgramFactory.hpp
hops::MaximumVolumeEllipsoid::getCurrentError
RealType getCurrentError() const
Definition: MaximumVolumeEllipsoid.cpp:73