Description Usage Arguments Details Value Author(s) Examples
Solve Quadratic Programming problems
1 2 |
c |
Vector or one column matrix appearing in the quadratic function |
H |
square matrix appearing in the quadratic function, or the
decomposed form |
A |
Matrix defining the constrains under which we minimize the quadratic function |
b |
Vector or one column matrix defining the constraints |
l |
Lower bound vector or one column matrix |
u |
Upper bound vector or one column matrix |
r |
Upper bound vector or one column matrix |
sigf |
Precision (default: 7 significant figures) |
maxiter |
Maximum number of iterations |
margin |
how close we get to the constrains |
bound |
Clipping bound for the variables |
Adopted from the kernlab::ipop() R function
ipop solves the quadratic programming problem
minimize c\' * primal + 1/2 primal\' * H * primal
subject to b <= A*primal <= b + r
l <= x <= u
d is the optimizer itself
returns primal and dual variables (i.e. x and the Lagrange
multipliers for b <= A * primal <= b + r)
for additional documentation see
R. Vanderbei
LOQO: an Interior Point Code for Quadratic Programming, 1992
Author: R version Alexandros Karatzoglou, orig. matlab Alex J. Smola
A list with the output with the "primal" solution, the "dual" solution, and convergence information
Chandler Lutz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##Comparison to kernlab::ipop()
library(kernlab)
## solve the Support Vector Machine optimization problem
data(spam)
## sample a scaled part (500 points) of the spam data set
m <- 500
set <- sample(1:dim(spam)[1],m)
x <- scale(as.matrix(spam[,-58]))[set,]
y <- as.integer(spam[set,58])
y[y==2] <- -1
##set C parameter and kernel
C <- 5
rbf <- rbfdot(sigma = 0.1)
## create H matrix etc.
H <- kernelPol(rbf,x,,y)
c <- matrix(rep(-1,m))
A <- t(y)
b <- matrix(0)
l <- matrix(rep(0,m))
u <- matrix(rep(C,m))
r <- matrix(0)
sv <- ipop(c,H,A,b,l,u,r)
sv2 <- ipopCpp(c,H,A,b,l,u,r)
all.equal(ipop(c,H,A,b,l,u,r)@primal, as.numeric(ipopCpp(c,H,A,b,l,u,r)$primal))
all.equal(ipop(c,H,A,b,l,u,r)@dual, as.numeric(ipopCpp(c,H,A,b,l,u,r)$dual))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.