| solve_piqp | R Documentation |
Solves
arg\min_x 0.5 x'P x + c'x
s.t.
A x = b
h_l \leq G x \leq h_u
x_l \leq x \leq x_u
for real matrices P (nxn, positive semidefinite), A (pxn) with p number of equality constraints, and G (mxn) with m number of inequality constraints
solve_piqp(
P = NULL,
c = NULL,
A = NULL,
b = NULL,
G = NULL,
h_l = NULL,
h_u = NULL,
x_l = NULL,
x_u = NULL,
settings = list(),
backend = c("auto", "sparse", "dense")
)
P |
dense or sparse matrix of class dgCMatrix or coercible into such, must be positive semidefinite |
c |
numeric vector |
A |
dense or sparse matrix of class dgCMatrix or coercible into such |
b |
numeric vector |
G |
dense or sparse matrix of class dgCMatrix or coercible into such |
h_l |
numeric vector of lower inequality bounds, default |
h_u |
numeric vector of upper inequality bounds, default |
x_l |
a numeric vector of lower variable bounds, default |
x_u |
a numeric vector of upper variable bounds, default |
settings |
list with optimization parameters, empty by default; see |
backend |
which backend to use, if auto and P, A or G are sparse then sparse backend is used ( |
A list with elements solution elements
Schwan, R., Jiang, Y., Kuhn, D., Jones, C.N. (2023). “PIQP: A Proximal Interior-Point Quadratic Programming Solver.” doi:10.48550/arXiv.2304.00290
piqp(), piqp_settings() and the underlying PIQP documentation: https://predict-epfl.github.io/piqp/
## example, adapted from PIQP documentation
library(piqp)
library(Matrix)
P <- Matrix(c(6., 0.,
0., 4.), 2, 2, sparse = TRUE)
c <- c(-1., -4.)
A <- Matrix(c(1., -2.), 1, 2, sparse = TRUE)
b <- c(1.)
G <- Matrix(c(1., 2., -1., 0.), 2, 2, sparse = TRUE)
h_u <- c(0.2, -1.)
x_l <- c(-1., -Inf)
x_u <- c(1., Inf)
settings <- list(verbose = TRUE)
# Solve with PIQP
res <- solve_piqp(P, c, A, b, G, h_u = h_u, x_l = x_l, x_u = x_u, settings = settings)
res$x
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.