R/266_reductions_solvers_nlp_solvers_knitro_nlpif.R

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

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

KNITRO_NLP_Solver <- new_class("KNITRO_NLP_Solver", parent = NLPsolver, package = "CVXR",
  constructor = function() {
    if (FALSE) new_object(S7_object())  ## S7 static-check guard
    .fast_new(KNITRO_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, KNITRO_NLP_Solver) <- function(x) KNITRO_SOLVER

method(solve_via_data, KNITRO_NLP_Solver) <- function(x, data, warm_start = FALSE,
                                                      verbose = FALSE,
                                                      solver_opts = list(), ...) {
  cli_abort(c(
    "NLP solver {.val KNITRO} 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.