smooth_feedback
Control and estimation on Lie groups
Loading...
Searching...
No Matches
qp.hpp
Go to the documentation of this file.
1// Copyright (C) 2022 Petter Nilsson, John B. Mains. MIT License.
2
3#pragma once
4
10#include <Eigen/Dense>
11#include <Eigen/Sparse>
12
13namespace smooth::feedback {
14
31template<Eigen::Index M, Eigen::Index N, typename Scalar = double>
33{
35 Eigen::Matrix<Scalar, N, N> P;
37 Eigen::Matrix<Scalar, N, 1> q;
38
40 Eigen::Matrix<Scalar, M, N> A;
42 Eigen::Matrix<Scalar, M, 1> l;
44 Eigen::Matrix<Scalar, M, 1> u;
45};
46
60template<typename Scalar = double>
62{
64 Eigen::SparseMatrix<Scalar> P;
66 Eigen::Matrix<Scalar, -1, 1> q;
67
74 Eigen::SparseMatrix<Scalar, Eigen::RowMajor> A;
76 Eigen::Matrix<Scalar, -1, 1> l;
78 Eigen::Matrix<Scalar, -1, 1> u;
79};
80
82enum class QPSolutionStatus {
83 Optimal,
90 MaxTime,
91 Unknown
92};
93
95template<Eigen::Index M, Eigen::Index N, typename Scalar = double>
97{
99 QPSolutionStatus code = QPSolutionStatus::Unknown;
101 uint32_t iter;
103 Eigen::Matrix<Scalar, N, 1> primal;
105 Eigen::Matrix<Scalar, M, 1> dual;
107 Scalar objective{0.};
108};
109
110} // namespace smooth::feedback
QPSolutionStatus
Solver exit codes.
Definition: qp.hpp:82
@ PrimalInfeasible
Solution satisfies optimality condition but is not polished.
@ Unknown
Max time was reached, returned solution is not optimal.
@ MaxIterations
A certificate of dual infeasibility was found, no solution returned.
@ PolishFailed
Solution satisifes optimality condition. Solution is polished if QPSolverParams::polish = true.
@ MaxTime
Max number of iterations was reached, returned solution is not optimal.
@ DualInfeasible
A certificate of primal infeasibility was found, no solution returned.
Solver solution.
Definition: qp.hpp:97
QPSolutionStatus code
Exit code.
Definition: qp.hpp:99
Eigen::Matrix< Scalar, N, 1 > primal
Primal vector.
Definition: qp.hpp:103
Scalar objective
Solution objective value.
Definition: qp.hpp:107
uint32_t iter
Number of iterations.
Definition: qp.hpp:101
Eigen::Matrix< Scalar, M, 1 > dual
Dual vector.
Definition: qp.hpp:105
Sparse quadratic program definition.
Definition: qp.hpp:62
Eigen::Matrix< Scalar, -1, 1 > u
Inequality upper bound.
Definition: qp.hpp:78
Eigen::Matrix< Scalar, -1, 1 > l
Inequality lower bound.
Definition: qp.hpp:76
Eigen::SparseMatrix< Scalar, Eigen::RowMajor > A
Inequality matrix.
Definition: qp.hpp:74
Eigen::Matrix< Scalar, -1, 1 > q
Linear cost.
Definition: qp.hpp:66
Eigen::SparseMatrix< Scalar > P
Positive semi-definite square cost (only upper trianglular part is used)
Definition: qp.hpp:64
Quadratic program definition.
Definition: qp.hpp:33
Eigen::Matrix< Scalar, N, N > P
Positive semi-definite square cost (only upper triangular part is used)
Definition: qp.hpp:35
Eigen::Matrix< Scalar, M, N > A
Inequality matrix.
Definition: qp.hpp:40
Eigen::Matrix< Scalar, M, 1 > u
Inequality upper bound.
Definition: qp.hpp:44
Eigen::Matrix< Scalar, M, 1 > l
Inequality lower bound.
Definition: qp.hpp:42
Eigen::Matrix< Scalar, N, 1 > q
Linear cost.
Definition: qp.hpp:37