piqp_model function

The PIQP Solver Model Class

The PIQP Solver Model Class

This class wraps around the PIQP C++ Solver and exposes methods and fields of the C++ object. Users will never need to directly create instances this class and should use the more user-friendly functions piqp() and solve_piqp().

Methods

Public methods

Method new()

Create a new piqp_model object

Usage

piqp_model$new(
  P,
  c,
  A,
  b,
  G,
  h,
  x_lb,
  x_ub,
  settings = list(),
  dense_backend,
  dims
)

Arguments

  • P: dense or sparse matrix of class dgCMatrix or coercible into such, must be positive semidefinite

  • c: numeric vector

  • A: dense or sparse matrix of class dgCMatrix or coercible into such

  • b: numeric vector

  • G: dense or sparse matrix of class dgCMatrix or coercible into such

  • h: numeric vector

  • x_lb: a numeric vector of lower bounds

  • x_ub: a numeric vector of upper bounds

  • settings: list with optimization parameters

  • dense_backend: a flag indicating if the dense solver is to be used

  • dims: the dimensions of the problem, a named list containing n, p and m.

Returns

a piqp_model object that can be used to solve the QP

Method solve()

Solve the QP model

Usage

piqp_model$solve()

Returns

a list containing the solution

Method update()

Update the current piqp_model with new data

Usage

piqp_model$update(
  P = NULL,
  c = NULL,
  A = NULL,
  b = NULL,
  G = NULL,
  h = NULL,
  x_lb = NULL,
  x_ub = NULL
)

Arguments

  • P: dense or sparse matrix of class dgCMatrix or coercible into such, must be positive semidefinite

  • c: numeric vector

  • A: dense or sparse matrix of class dgCMatrix or coercible into such

  • b: numeric vector

  • G: dense or sparse matrix of class dgCMatrix or coercible into such

  • h: numeric vector

  • x_lb: a numeric vector of lower bounds

  • x_ub: a numeric vector of upper bounds

  • settings: list with optimization parameters

  • dense_backend: a flag indicating if the dense solver is to be used

  • dims: the dimensions of the problem, a named list containing n, p and m.

Method get_settings()

Obtain the current settings for this model

Usage

piqp_model$get_settings()

Method get_dims()

Obtain the dimensions of this model

Usage

piqp_model$get_dims()

Method update_settings()

Update the current settings with new values for this model

Usage

piqp_model$update_settings(new_settings = list())

Arguments

  • new_settings: a list of named values for settings, default empty list; see piqp_settings() for a comprehensive list of defaults

Method clone()

The objects of this class are cloneable with this method.

Usage

piqp_model$clone(deep = FALSE)

Arguments

  • deep: Whether to make a deep clone.

  • Maintainer: Balasubramanian Narasimhan
  • License: BSD_2_clause + file LICENSE
  • Last published: 2023-08-14