Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

psolve

Solve a DCP Problem


Description

Solve a DCP compliant optimization problem.

Usage

psolve(
  object,
  solver = NA,
  ignore_dcp = FALSE,
  warm_start = FALSE,
  verbose = FALSE,
  parallel = FALSE,
  gp = FALSE,
  feastol = NULL,
  reltol = NULL,
  abstol = NULL,
  num_iter = NULL,
  ...
)

## S4 method for signature 'Problem'
psolve(
  object,
  solver = NA,
  ignore_dcp = FALSE,
  warm_start = FALSE,
  verbose = FALSE,
  parallel = FALSE,
  gp = FALSE,
  feastol = NULL,
  reltol = NULL,
  abstol = NULL,
  num_iter = NULL,
  ...
)

## S4 method for signature 'Problem,ANY'
solve(a, b = NA, ...)

Arguments

object, a

A Problem object.

solver, b

(Optional) A string indicating the solver to use. Defaults to "ECOS".

ignore_dcp

(Optional) A logical value indicating whether to override the DCP check for a problem.

warm_start

(Optional) A logical value indicating whether the previous solver result should be used to warm start.

verbose

(Optional) A logical value indicating whether to print additional solver output.

parallel

(Optional) A logical value indicating whether to solve in parallel if the problem is separable.

gp

(Optional) A logical value indicating whether the problem is a geometric program. Defaults to FALSE.

feastol

The feasible tolerance on the primal and dual residual.

reltol

The relative tolerance on the duality gap.

abstol

The absolute tolerance on the duality gap.

num_iter

The maximum number of iterations.

...

Additional options that will be passed to the specific solver. In general, these options will override any default settings imposed by CVXR.

Value

A list containing the solution to the problem:

status

The status of the solution. Can be "optimal", "optimal_inaccurate", "infeasible", "infeasible_inaccurate", "unbounded", "unbounded_inaccurate", or "solver_error".

value

The optimal value of the objective function.

solver

The name of the solver.

solve_time

The time (in seconds) it took for the solver to solve the problem.

setup_time

The time (in seconds) it took for the solver to set up the problem.

num_iters

The number of iterations the solver had to go through to find a solution.

getValue

A function that takes a Variable object and retrieves its primal value.

getDualValue

A function that takes a Constraint object and retrieves its dual value(s).

Examples

a <- Variable(name = "a")
prob <- Problem(Minimize(norm_inf(a)), list(a >= 2))
result <- psolve(prob, solver = "ECOS", verbose = TRUE)
result$status
result$value
result$getValue(a)
result$getDualValue(constraints(prob)[[1]])

CVXR

Disciplined Convex Optimization

v1.0-10
Apache License 2.0 | file LICENSE
Authors
Anqi Fu [aut, cre], Balasubramanian Narasimhan [aut], David W Kang [aut], Steven Diamond [aut], John Miller [aut], Stephen Boyd [ctb], Paul Kunsberg Rosenfield [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.