QuadraticProgram<T>
Models & Types · AiDotNet.Solvers.QuadraticProgramming
Describes a convex quadratic program: a quadratic objective minimized subject to linear constraints and bounds.
For Beginners
A linear program has a flat objective, so its answer is always at a corner. A quadratic program’s objective is bowl-shaped, so its answer can sit anywhere — in the middle of the bowl if no constraint interferes, or pressed against whichever constraints do. That bowl shape is exactly what “least squares” means, which is why fitting problems with side conditions land here so often.
How It Works
The problem solved is
Q must be symmetric positive semi-definite, which is what makes the problem convex and
therefore exactly solvable: any local minimum is the global minimum.
This form covers a surprising amount of machine learning. Ridge regression, the support-vector machine dual, non-negative least squares, mean-variance portfolio selection, the projection step of gradient-episodic-memory continual learning, and every step of a linear model-predictive controller are all quadratic programs.
Constructors
| Constructor | Summary |
|---|---|
QuadraticProgram(Matrix<T> quadratic, Vector<T> linear, Matrix<T> inequalityMatrix, Vector<T> inequalityBounds, Matrix<T> equalityMatrix, Vector<T> equalityBounds, Vector<T> lowerBounds, Vector<T> upperBounds) |
Creates a quadratic program. |
Properties
| Property | Summary |
|---|---|
Matrix<T> EqualityMatrix { get; } |
Gets the equality constraint matrix A_eq, or null when there are none. |
Matrix<T> InequalityMatrix { get; } |
Gets the inequality constraint matrix A_ub, or null when there are none. |
Matrix<T> Quadratic { get; } |
Gets the symmetric positive semi-definite matrix Q of the quadratic term ½·xᵀQx. |
Vector<T> EqualityBounds { get; } |
Gets the equality right-hand side b_eq, or null. |
Vector<T> InequalityBounds { get; } |
Gets the inequality right-hand side b_ub, or null. |
Vector<T> Linear { get; } |
Gets the linear objective coefficients c. |
Vector<T> LowerBounds { get; } |
Gets the lower bound per variable, or null to leave every variable unbounded below. |
Vector<T> UpperBounds { get; } |
Gets the upper bound per variable, or null for unbounded above. |
int VariableCount { get; } |
Gets the number of decision variables. |