MyNixOS website logo
Description

Interface to the 'qpmad' Quadratic Programming Solver.

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

qpmadr

qpmadr provides R-bindings to the quadratic programming-solver qpmad, written by Alexander Sherikov.

Installation

You can install the released version of qpmadr from CRAN with:

install.packages("qpmadr")

Example

This is an example which shows you how to solve a simple problem:

[ \min_{\rm x}{ \space x'H x} ]

[ s.t. \space \sum_{i}{x_i} = n ]

[ -2 \leq x_i \leq 2 ]

where (H) is a random positive definite matrix of size (n \times n), and (x) is a (column) vector of size (n).

The code below will run a benchmark against the quadprog solver for n=100, checking that both give the same results.

library(qpmadr)
library(quadprog)
library(microbenchmark)


set.seed(42)

n = 100

H = crossprod(matrix(rnorm(n*n), n))

# constraint specification for qpmadr
lb = -2
ub = 2
A = matrix(1, 1, n)
Alb = n
Aub = n

# constraint specification for quadprog
At = cbind(rep_len(1, n), diag(1, n, n), diag(-1, n, n))
b = c(n, rep_len(-2, 2*n))



bm = microbenchmark(
  check    = "equal",
  qpmadr   = qpmadr::solveqp(H, lb=lb, ub=ub, A=A, Alb=Alb, Aub=Aub)$solution,
  quadprog = quadprog::solve.QP(H, numeric(n), At, b, meq=1)$solution
)


knitr::kable(summary(bm, "relative"), digits=1)
exprminlqmeanmedianuqmaxneval
qpmadr1.01.01.01.01.01.0100
quadprog2.72.52.52.82.42.5100

Timings are relative.

C++-interface

The solver is a c++ header-only library and can be used in other packages via the LinkingTo: field.

Metadata

Version

1.1.0-0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows