Solves the problem and returns the optimal objective value. After solving,
variable values can be retrieved with value, constraint
dual values with dual_value, and solver information with
solver_stats.
Usage
psolve(
problem,
solver = NULL,
gp = FALSE,
qcp = FALSE,
verbose = FALSE,
warm_start = FALSE,
requires_grad = FALSE,
nlp = FALSE,
enforce_dpp = FALSE,
ignore_dpp = FALSE,
solver_path = NULL,
...
)Arguments
- problem
A
Problemobject.- solver
Character string naming the solver to use (e.g.,
"CLARABEL","SCS","OSQP","HIGHS"), orNULLfor automatic selection.- gp
Logical; if
TRUE, solve as a geometric program (DGP).- qcp
Logical; if
TRUE, solve as a quasiconvex program (DQCP) via bisection. Only needed for non-DCP DQCP problems.- verbose
Logical; if
TRUE, print solver output.- warm_start
Logical; if
TRUE, use the current variable values as a warm-start point for the solver.- requires_grad
Logical; if
TRUE, route the solve through the DIFFCP wrapper sobackward()/derivative()can recover gradients.- nlp
Logical; if
TRUE, solve the problem as a disciplined nonlinear program (DNLP) using the NLP reduction chain and an NLP solver (e.g."UNO"). The problem must satisfyis_dnlp().- enforce_dpp
Logical; if
TRUE, raise an error when a parametrized problem is not DPP instead of compiling it as non-DPP.- ignore_dpp
Logical; if
TRUE, treat a DPP problem as non-DPP (skip the DPP fast path).- solver_path
Optional fallback chain. A character vector of solver names or a list whose entries are either character names or length-2
list(name, opts)pairs. Each solver is tried in sequence; the first that succeeds returns its result. If every solver fails, aSolverError-classed condition is raised with the per-solver error messages. Cannot be combined withsolver. Mirrors CVXPY'ssolver_pathargument.- ...
Solver options passed to
solver_opts(). Includes chain-construction options (use_quad_obj), standard tolerances (feastol,reltol,abstol,num_iter), and solver-specific parameters (e.g.,eps_abs,scip_params). Seesolver_optsfor details. For DQCP problems (qcp = TRUE), additional arguments includelow,high,eps,max_iters, andmax_iters_interval_search.
Value
The optimal objective value (numeric scalar), or Inf /
-Inf for infeasible / unbounded problems.
