Package 'ROI.plugin.osqp'

Title: 'osqp' Plugin for the 'R' Optimization Infrastructure
Description: Enhances the 'R' Optimization Infrastructure ('ROI') package with the quadratic solver 'OSQP'. More information about 'OSQP' can be found at <https://osqp.org>.
Authors: Florian Schwendinger [aut, cre]
Maintainer: Florian Schwendinger <[email protected]>
License: GPL-3
Version: 1.0-0
Built: 2024-09-10 02:37:29 UTC
Source: https://github.com/r-forge/roi

Help Index


osqp

Description

This package provides an interface to OSQP. The OSQP solver is a numerical optimization package or solving convex quadratic programs written in C and based on the alternating direction method of multipliers.

Control Arguments

The following description of the control parameters is mostly copied from the osqp manual.

  • [] rho ADMM step rho

  • [] sigma ADMM step sigma

  • [] max_iter maximum iterations

  • [] abs_tol absolute convergence tolerance

  • [] rel_tol relative convergence tolerance

  • [] eps_prim_inf primal infeasibility tolerance

  • [] eps_dual_inf dual infeasibility tolerance

  • [] alpha relaxation parameter

  • [] linsys_solver which linear systems solver to use, 0=QDLDL, 1=MKL Pardiso

  • [] delta regularization parameter for polish

  • [] polish boolean, polish ADMM solution

  • [] polish_refine_iter iterative refinement steps in polish

  • [] verbose boolean, write out progress

  • [] scaled_termination boolean, use scaled termination criteria

  • [] check_termination integer, check termination interval. If 0, termination checking is disabled

  • [] warm_start boolean, warm start

  • [] scaling heuristic data scaling iterations. If 0, scaling disabled

  • [] adaptive_rho cboolean, is rho step size adaptive?

  • [] adaptive_rho_interval Number of iterations between rho adaptations rho. If 0, it is automatic

  • [] adaptive_rho_tolerance Tolerance X for adapting rho. The new rho has to be X times larger or 1/X times smaller than the current one to trigger a new factorization

  • [] adaptive_rho_fraction Interval for adapting rho (fraction of the setup time)

References

Bartolomeo Stellato and Goran Banjac and Paul Goulart and Alberto Bemporad and Stephen Boyd. OSQP: An Operator Splitting Solver for Quadratic Programs https://arxiv.org/abs/1711.08013, 2017

Bartolomeo Stellato and Goran Banjac. OSQP “webpage” https://osqp.org/, 2019


Quadratic Problem 1

Description

maximize  x12+x22+x325x2maximize \ \ x_1^2 + x_2^2 + x_3^2 - 5 x_2

subject to:subject \ to:

4x13x2+8-4 x_1 - 3 x_2 + \geq -8

2x1+x2+22 x_1 + x_2 + \geq 2

2x2+x30- 2 x_2 + x_3 \geq 0

x1,x2,x30x_1, x_2, x_3 \geq 0

Examples

require("ROI")
require("ROI.plugin.osqp")

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 = "osqp", abs_tol = 1e-8, rel_tol = 1e-8)
opt
## Optimal solution found.
## The objective value is: -2.380952e+00
solution(opt)
## [1] 0.4761905 1.0476191 2.0952381