R/267_reductions_solvers_nlp_solvers_copt_nlpif.R

#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/solvers/nlp_solvers/copt_nlpif.R
#####

## CVXPY SOURCE: reductions/solvers/nlp_solvers/copt_nlpif.py
## @v19-pending: COPT NLP interface [now] -- no R COPT package exists, so this
## is a registered-but-unavailable stub. The class is present so SOLVER_MAP_NLP
## (defines.R) can mirror cvxpy defines.py:86-88; `.nlp_solver_available`
## reports it unavailable, and solve_via_data aborts if invoked explicitly.
## Port the full interface (cvxpy copt_nlpif.py) when an R COPT binding lands.

COPT_NLP_Solver <- new_class("COPT_NLP_Solver", parent = NLPsolver, package = "CVXR",
  constructor = function() {
    if (FALSE) new_object(S7_object())  ## S7 static-check guard
    .fast_new(COPT_NLP_Solver, S7_object(),
      .cache = new.env(parent = emptyenv()),
      MIP_CAPABLE = FALSE,
      BOUNDED_VARIABLES = TRUE,
      PSD_TRIANGLE_KIND = NA_character_,
      PSD_SQRT2_SCALING = NA
    )
  }
)

method(solver_name, COPT_NLP_Solver) <- function(x) COPT_SOLVER

method(solve_via_data, COPT_NLP_Solver) <- function(x, data, warm_start = FALSE,
                                                    verbose = FALSE,
                                                    solver_opts = list(), ...) {
  cli_abort(c(
    "NLP solver {.val COPT} is not available in R.",
    "i" = "Use {.val UNO} for nonlinear programs ({.code psolve(p, solver = \"UNO\", nlp = TRUE)})."
  ))
}

Try the CVXR package in your browser

Any scripts or data that you put into this service are public.

CVXR documentation built on Aug. 24, 2026, 9:10 a.m.