Version: | 1.0-1 |
Title: | 'quadprog' Plug-in for the 'R' Optimization Infrastructure |
Description: | Enhances the R Optimization Infrastructure ('ROI') package by registering the 'quadprog' solver. It allows for solving quadratic programming (QP) problems. |
Imports: | methods, quadprog, ROI (≥ 0.3-0), slam |
License: | GPL-3 |
URL: | http://roi.r-forge.r-project.org/, https://r-forge.r-project.org/projects/roi/ |
NeedsCompilation: | no |
Packaged: | 2023-07-07 17:48:26 UTC; theussl |
Author: | Stefan Theussl |
Maintainer: | Stefan Theussl <Stefan.Theussl@R-Project.org> |
Repository: | CRAN |
Date/Publication: | 2023-07-12 22:40:06 UTC |
Quadratic Problem 1
Description
maximize \ \ x_1^2 + x_2^2 + x_3^2 - 5 x_2
subject \ to:
-4 x_1 - 3 x_2 + \geq -8
2 x_1 + x_2 + \geq 2
- 2 x_2 + x_3 \geq 0
x_1, x_2, x_3 \geq 0
Examples
require("ROI")
A <- cbind(c(-4, -3, 0),
c( 2, 1, 0),
c( 0, -2, 1))
x <- OP(Q_objective(diag(3), L = c(0, -5, 0)),
L_constraint(L = t(A),
dir = rep(">=", 3),
rhs = c(-8, 2, 0)))
opt <- ROI_solve(x, solver="quadprog")
opt
## Optimal solution found.
## The objective value is: -2.380952e+00
solution(opt)
## [1] 0.4761905 1.0476190 2.0952381