irafhy
Interval arithmetic based Reachability Analysis Framework for Hybrid Automaton
evaluation.hpp
Go to the documentation of this file.
1 #ifndef UTILITY_OPTIMIZER_LINEAR_PROG_EVALUATION_H
2 #define UTILITY_OPTIMIZER_LINEAR_PROG_EVALUATION_H
3 
4 #include <Eigen/Core>
5 #include <utility>
7 
8 namespace irafhy
9 {
10  class Evaluation
11  {
12  private:
16  double supportValue_;
20  Eigen::VectorXd optimalCoordinate_;
25 
26  public:
31  : supportValue_(0.0)
32  , optimalCoordinate_(Eigen::VectorXd::Zero(0))
33  , solution_(LINEPROG_SOLUTION::INFEASIBLE)
34  {}
40  : supportValue_(0.0)
41  , optimalCoordinate_(Eigen::VectorXd::Zero(0))
42  , solution_(solution)
43  {}
50  : supportValue_(0.0)
51  , optimalCoordinate_(std::move(optimalCoordinate))
52  , solution_(solution)
53  {}
60  Evaluation(const double& supportValue, Eigen::VectorXd optimalCoordinate, const LINEPROG_SOLUTION& solution)
61  : supportValue_(supportValue)
62  , optimalCoordinate_(std::move(optimalCoordinate))
63  , solution_(solution)
64  {}
69  [[nodiscard]] double supportValue() const { return supportValue_; }
74  [[nodiscard]] Eigen::VectorXd optimalCoordinate() const { return optimalCoordinate_; }
79  [[nodiscard]] LINEPROG_SOLUTION solution() const { return solution_; }
86  friend std::ostream& operator<<(std::ostream& out, const Evaluation& rhs)
87  {
88  out << "optimal value: " << rhs.supportValue_ << std::endl;
89  out << "optimal coordinate: (";
90  for (std::size_t index = 0; index < rhs.optimalCoordinate_.rows(); ++index)
91  out << rhs.optimalCoordinate_(index) << " ";
92  out << ")[";
93  switch (rhs.solution_)
94  {
96  {
97  out << "INFEASIBLE";
98  break;
99  }
101  {
102  out << "FEASIBLE";
103  break;
104  }
106  {
107  out << "NO FEASIBLE";
108  break;
109  }
111  {
112  out << "OPTIMAL";
113  break;
114  }
116  {
117  out << "UNBOUNDED";
118  break;
119  }
121  {
122  out << "UNDEFINED";
123  break;
124  }
125  default:
126  exit(EXIT_FAILURE);
127  }
128  out << "]";
129  return out;
130  }
131  };
132 } // namespace irafhy
133 #endif //UTILITY_OPTIMIZER_LINEAR_PROG_EVALUATION_H
double supportValue() const
get the optimal value of the object function
Definition: evaluation.hpp:69
Evaluation()
constructor
Definition: evaluation.hpp:30
LINEPROG_SOLUTION solution_
status of the linear programing
Definition: evaluation.hpp:24
LINEPROG_SOLUTION solution() const
get the status of the linear programming solution
Definition: evaluation.hpp:79
Evaluation(const double &supportValue, Eigen::VectorXd optimalCoordinate, const LINEPROG_SOLUTION &solution)
constructor with given information
Definition: evaluation.hpp:60
friend std::ostream & operator<<(std::ostream &out, const Evaluation &rhs)
out the given evaluation object to the standard out stream
Definition: evaluation.hpp:86
Definition: enum.h:95
Evaluation(Eigen::VectorXd optimalCoordinate, const LINEPROG_SOLUTION &solution)
constructor with given information
Definition: evaluation.hpp:49
Definition: extEigen.cpp:3
Eigen::VectorXd optimalCoordinate_
vector which can get the optimal solution of the object function
Definition: evaluation.hpp:20
Eigen::VectorXd optimalCoordinate() const
get the optimal solution of the linear programming
Definition: evaluation.hpp:74
Evaluation(const LINEPROG_SOLUTION &solution)
constructor with given status of the solution
Definition: evaluation.hpp:39
Definition: evaluation.hpp:10
Definition: enum.h:97
Definition: enum.h:94
LINEPROG_SOLUTION
status of the solution return by glpk
Definition: enum.h:91
Definition: condition.cpp:3
double supportValue_
optimal value of the object function
Definition: evaluation.hpp:16
Definition: enum.h:93
Definition: enum.h:98
Definition: enum.h:96