math::QPSolver#
rb::math::QPSolver is the quadratic-programming helper used by advanced
control and optimization code. The related QPSolverException is documented
on this page because it is tightly coupled to solver setup and failure modes.
Header
Header |
|
Declaration
Namespace |
|
Kind |
|
Primary role |
Configure and solve constrained quadratic programs. |
Public Member Functions
Method group |
Purpose |
Notes |
|---|---|---|
|
Allocate the solver and initialize its problem dimensions. |
Call before setting cost or constraints. |
|
Define one or more least-squares cost terms. |
|
|
Define bound and constraint data plus the initial guess. |
Needed before solving most nontrivial problems. |
|
Execute the QP solve. |
May throw or return failure information via the paired exception type. |
|
Inspect the assembled matrices and bounds. |
Useful for debugging a solver configuration. |
Detailed Reference
-
class QPSolver#
Public Functions
-
QPSolver()#
-
~QPSolver()#
-
void AddCostFunction(const Eigen::MatrixXd &A, const Eigen::VectorXd &b)#
-
Eigen::MatrixXd GetAConst() const#
-
Eigen::MatrixXd GetACost() const#
-
Eigen::VectorXd GetBCost() const#
-
Eigen::VectorXd GetLowerBound() const#
-
Eigen::VectorXd GetUpperBound() const#
-
void InitFunction()#
-
void ResetIsFirst()#
-
void SetConstraintsFunction(const Eigen::MatrixXd &A, const Eigen::VectorXd &lb, const Eigen::VectorXd &ub)#
-
void SetCostFunction(const Eigen::MatrixXd &A, const Eigen::VectorXd &b)#
-
void SetPrimalVariable(const Eigen::VectorXd &pv)#
-
void Setup(int n_var, int n_const, double time_limit = 2e-3)#
-
Eigen::VectorXd Solve()#
Solve the QP problem
- Throws:
- Returns:
Solution
-
QPSolver()#
-
class QPSolverException : public std::exception#
Public Functions
-
explicit QPSolverException(int error_code)#
-
int code() const noexcept#
-
const char *what() const noexcept override#
Public Static Functions
-
static std::string GenerateMessage(int code)#
Public Static Attributes
-
static unsigned int kStatusOffset = 100#
-
explicit QPSolverException(int error_code)#
Related Types
Examples
optimal_control.cppis the main end-to-end example for this solver path.