15 #ifndef OSQP_INTERFACE__OSQP_INTERFACE_HPP_
16 #define OSQP_INTERFACE__OSQP_INTERFACE_HPP_
25 #include "eigen3/Eigen/Core"
26 #include "osqp/osqp.h"
37 constexpr c_float
INF = OSQP_INFTY;
48 std::unique_ptr<OSQPWorkspace, std::function<void(OSQPWorkspace *)>> m_work;
49 std::unique_ptr<OSQPSettings> m_settings;
50 std::unique_ptr<OSQPData> m_data;
52 OSQPInfo m_latest_work_info;
56 bool8_t m_work_initialized =
false;
61 std::tuple<std::vector<float64_t>, std::vector<float64_t>, int64_t, int64_t, int64_t> solve();
63 static void OSQPWorkspaceDeleter(OSQPWorkspace * ptr) noexcept;
68 const c_float eps_abs = std::numeric_limits<c_float>::epsilon(),
const bool8_t polish =
true);
77 const Eigen::MatrixXd & P,
const Eigen::MatrixXd & A,
const std::vector<float64_t> & q,
78 const std::vector<float64_t> & l,
const std::vector<float64_t> &
u,
const c_float eps_abs);
81 const std::vector<float64_t> & l,
const std::vector<float64_t> &
u,
const c_float eps_abs);
104 std::tuple<std::vector<float64_t>, std::vector<float64_t>, int64_t, int64_t, int64_t> optimize();
122 std::tuple<std::vector<float64_t>, std::vector<float64_t>, int64_t, int64_t, int64_t> optimize(
123 const Eigen::MatrixXd & P,
const Eigen::MatrixXd & A,
const std::vector<float64_t> & q,
124 const std::vector<float64_t> & l,
const std::vector<float64_t> &
u);
132 int64_t initializeProblem(
133 const Eigen::MatrixXd & P,
const Eigen::MatrixXd & A,
const std::vector<float64_t> & q,
134 const std::vector<float64_t> & l,
const std::vector<float64_t> &
u);
135 int64_t initializeProblem(
137 const std::vector<float64_t> & l,
const std::vector<float64_t> &
u);
147 void updateP(
const Eigen::MatrixXd & P_new);
149 void updateA(
const Eigen::MatrixXd & A_new);
151 void updateQ(
const std::vector<double> & q_new);
152 void updateL(
const std::vector<double> & l_new);
153 void updateU(
const std::vector<double> & u_new);
154 void updateBounds(
const std::vector<double> & l_new,
const std::vector<double> & u_new);
155 void updateEpsAbs(
const double eps_abs);
156 void updateEpsRel(
const double eps_rel);
157 void updateMaxIter(
const int iter);
158 void updateVerbose(
const bool verbose);
159 void updateRhoInterval(
const int rho_interval);
160 void updateRho(
const double rho);
161 void updateAlpha(
const double alpha);
164 inline int64_t
getTakenIter()
const {
return static_cast<int64_t
>(m_latest_work_info.iter);}
168 return static_cast<std::string
>(m_latest_work_info.status);
171 inline int64_t
getStatus()
const {
return static_cast<int64_t
>(m_latest_work_info.status_val);}
175 return static_cast<int64_t
>(m_latest_work_info.status_polish);
189 #endif // OSQP_INTERFACE__OSQP_INTERFACE_HPP_