if (FALSE) {
x <- Variable(3)
t <- Variable(3)
abs_x <- partial_optimize(
Problem(Minimize(sum_entries(t)), list(-t <= x, x <= t)),
opt_vars = list(t)
)
## abs_x is now an expression of x alone, equivalent to sum(abs(x)).
}
Run the code above in your browser using DataLab