Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dcp2cone/canonicalizers/logistic_canon.R
#####
## CVXPY SOURCE: reductions/dcp2cone/canonicalizers/logistic_canon.py
## log(1 + exp(x)) <= t <=> exp(-t) + exp(x - t) <= 1
## Recursive: calls exp_canon twice
logistic_canon <- function(expr, args, solver_context = NULL) {
x <- args[[1L]]
shape <- expr@shape
t0 <- Variable(shape = shape)
t1_result <- exp_canon(expr, list(-t0))
t1 <- t1_result[[1L]]
constr1 <- t1_result[[2L]]
t2_result <- exp_canon(expr, list(x - t0))
t2 <- t2_result[[1L]]
constr2 <- t2_result[[2L]]
ones <- Constant(matrix(1, nrow = shape[1L], ncol = shape[2L]))
constraints <- c(constr1, constr2, list(t1 + t2 <= ones))
list(t0, constraints)
}
method(dcp_canonicalize, Logistic) <- logistic_canon
method(has_dcp_canon, Logistic) <- 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.