Title: | Interface to the 'qpmad' Quadratic Programming Solver |
---|---|
Description: | Efficiently solve quadratic problems with linear inequality, equality and box constraints. The method used is outlined in D. Goldfarb, and A. Idnani (1983) <doi:10.1007/BF02591962>. |
Authors: | Eric Anderson [aut, cre], Alexander Sherikov [cph, ctb] |
Maintainer: | Eric Anderson <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.0 |
Built: | 2024-11-06 03:40:49 UTC |
Source: | https://github.com/anderic1/qpmadr |
Set qpmad parameters
qpmadParameters( isFactorized = FALSE, maxIter = -1, tol = 1e-12, checkPD = TRUE )
qpmadParameters( isFactorized = FALSE, maxIter = -1, tol = 1e-12, checkPD = TRUE )
isFactorized |
If |
maxIter |
Maximum number of iterations, if not positive then no limit. |
tol |
Convergence tolerance. |
checkPD |
If |
a list suitable to be used as the pars-argument to solveqp
qpmadParameters(checkPD = TRUE)
qpmadParameters(checkPD = TRUE)
Solves
s.t.
solveqp( H, h = NULL, lb = NULL, ub = NULL, A = NULL, Alb = NULL, Aub = NULL, pars = list() )
solveqp( H, h = NULL, lb = NULL, ub = NULL, A = NULL, Alb = NULL, Aub = NULL, pars = list() )
H |
Symmetric positive definite matrix, n*n. Only the lower triangular part is used. |
h |
Optional, vector of length n. |
lb , ub
|
Optional, lower/upper bounds of |
A |
Optional, constraints matrix of dimension p*n, where each row corresponds to a constraint. For equality constraints let corresponding elements in |
Alb , Aub
|
Optional, lower/upper bounds for |
pars |
Optional, qpmad-solver parameters, conveniently set with |
At least one of lb
, ub
or A
must be specified. If A
has been
specified then also at least one of Alb
or Aub
. Returns a list with elements solution
(the solution vector),
status
(a status code) and message
(a human readable message). If status
= 0
the algorithm has converged.
Possible status codes:
0
: Ok
-1
: Numerical issue, matrix (probably) not positive definite
1
: Inconsistent
2
: Infeasible equality
3
: Infeasible inequality
4
: Maximal number of iterations
## Assume we want to minimize: -(0 5 0) %*% b + 1/2 b^T b ## under the constraints: A^T b >= b0 ## with b0 = (-8,2,0)^T ## and (-4 2 0) ## A = (-3 1 -2) ## ( 0 0 1) ## we can use solveqp as follows: ## Dmat <- diag(3) dvec <- c(0,-5,0) Amat <- t(matrix(c(-4,-3,0,2,1,0,0,-2,1),3,3)) bvec <- c(-8,2,0) solveqp(Dmat,dvec,A=Amat,Alb=bvec)
## Assume we want to minimize: -(0 5 0) %*% b + 1/2 b^T b ## under the constraints: A^T b >= b0 ## with b0 = (-8,2,0)^T ## and (-4 2 0) ## A = (-3 1 -2) ## ( 0 0 1) ## we can use solveqp as follows: ## Dmat <- diag(3) dvec <- c(0,-5,0) Amat <- t(matrix(c(-4,-3,0,2,1,0,0,-2,1),3,3)) bvec <- c(-8,2,0) solveqp(Dmat,dvec,A=Amat,Alb=bvec)