ipopCpp: Quadratic Optimization Solver

Description Usage Arguments Details Value Author(s) Examples

View source: R/RcppExports.R

Description

Solve Quadratic Programming problems

Usage

1
2
ipopCpp(c, H, A, b, l, u, r, sigf = 7L, maxiter = 40L, margin = 0.05,
  bound = 10)

Arguments

c

Vector or one column matrix appearing in the quadratic function

H

square matrix appearing in the quadratic function, or the decomposed form Z of the H matrix where Z is a n x m matrix with n > m and ZZ\' = H.

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

Details

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

Value

A list with the output with the "primal" solution, the "dual" solution, and convergence information

Author(s)

Chandler Lutz

Examples

 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))

ChandlerLutz/ipopCpp documentation built on May 6, 2019, 9:56 a.m.