This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipoptr_qp <- function(Dmat, dvec, Amat, bvec, ub=100){ | |
# Solve the quadratic program | |
# | |
# min -d^T x + 1/2 x^T D x | |
# s.t. A%*%x>= b | |
# | |
# with ipoptr. | |
n <- length(bvec) | |
# Jacobian structural components |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist compares three methods for solving a randomly generated quadratic program in R. | |
# author: R. Walker ([email protected]) | |
# LICENSE: MIT | |
library(quadprog) | |
library(kernlab) | |
library(ipoptr) | |
library(ggplot2) | |
library(reshape2) | |
######################################################### | |
# Random QP Generation (in the style of quadprog) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist solves the hard-margin SVM problem in three ways: using quadprog, using kernlab's ipop, and by | |
# the e1071 wrapper around libsvm. | |
# | |
# author: R. Walker ([email protected]) | |
# LICENSE: MIT | |
library("quadprog") | |
library("kernlab") | |
library("e1071") | |
# Use Fisher iris data and binarize one of the species |