Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/solution.R
#####
## CVXPY SOURCE: reductions/solution.py
## Solution -- holds solver result for inversion through the reduction chain
# -- Solution class ------------------------------------------------
## CVXPY SOURCE: solution.py lines 56-94
Solution <- new_class("Solution", package = "CVXR",
properties = list(
status = class_character,
opt_val = class_any, # numeric or NA_real_
primal_vars = class_list, # named list: as.character(var_id) -> matrix
dual_vars = class_list, # named list: as.character(constr_id) -> matrix
attr = class_list # misc solver info
),
constructor = function(status, opt_val = NA_real_,
primal_vars = list(), dual_vars = list(),
attr = list()) {
new_object(S7_object(),
status = status,
opt_val = opt_val,
primal_vars = primal_vars,
dual_vars = dual_vars,
attr = attr
)
}
)
# -- print --------------------------------------------------------
method(print, Solution) <- function(x, ...) {
cat(sprintf("Solution(status=%s, opt_val=%s, %d primal, %d dual)\n",
x@status,
if (is.na(x@opt_val)) "NA" else format(x@opt_val, digits = 6),
length(x@primal_vars),
length(x@dual_vars)))
invisible(x)
}
# -- failure_solution: factory for infeasible/unbounded -----------
## CVXPY SOURCE: solution.py lines 30-53
failure_solution <- function(status, attr = list()) {
if (status %in% c(INFEASIBLE, INFEASIBLE_INACCURATE)) {
opt_val <- Inf
} else if (status %in% c(UNBOUNDED, UNBOUNDED_INACCURATE)) {
opt_val <- -Inf
} else {
opt_val <- NA_real_
}
if (status == INFEASIBLE_OR_UNBOUNDED) {
attr[["message"]] <- paste(
"The problem is either infeasible or unbounded, but the solver",
"cannot tell which. Disable any solver-specific presolve methods",
"and re-solve to determine the precise problem status.")
}
Solution(status = status, opt_val = opt_val, primal_vars = list(),
dual_vars = list(), attr = attr)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.