R/osqp.fit.R

Defines functions osqp.fit

################################################################################
#
# Function to fit model by osqp
#
################################################################################

osqp.fit <- function(Dmat, dvec, Cmat, lb, ub, qp_pars){
  
  # Fit
  res <- osqp::solve_osqp(P = Dmat, q = -dvec, A = Cmat, l = lb, u = ub, 
    pars = qp_pars)
  
  # Return
  list(solution = res$x, iterations = res$info$iter, 
    iact = which(res$y != 0))
}

Try the cirls package in your browser

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

cirls documentation built on Sept. 13, 2025, 1:09 a.m.