Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dcp2cone/canonicalizers/huber_canon.R
#####
## CVXPY SOURCE: reductions/dcp2cone/canonicalizers/huber_canon.py
## huber(x, M) = n^2 + 2*M*|s| where x = s + n
huber_canon <- function(expr, args, solver_context = NULL) {
M <- expr@M
x <- args[[1L]]
shape <- expr@shape
n <- Variable(shape = shape)
s <- Variable(shape = shape)
## n^2 via power_approx_canon
power_expr <- power(n, 2)
n2_result <- power_approx_canon(power_expr, power_expr@args)
n2 <- n2_result[[1L]]
constr_sq <- n2_result[[2L]]
## |s| via abs_canon
abs_expr <- Abs(s)
abs_result <- abs_canon(abs_expr, abs_expr@args)
abs_s <- abs_result[[1L]]
constr_abs <- abs_result[[2L]]
obj <- n2 + 2 * M * abs_s
## x == s + n
constraints <- c(constr_sq, constr_abs, list(x == s + n))
list(obj, constraints)
}
method(dcp_canonicalize, Huber) <- huber_canon
method(has_dcp_canon, Huber) <- function(expr) TRUE
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.