Convex.jl solves problems by transforming them into linear optimization problems subject to conic constraints. This process often involves creating an "extended formulation," which adds auxiliary variables to the original problem to handle nonlinear or nonsmooth constructions (like abs, log_det, or norm).
To ensure these transformations are mathematically valid and preserve convexity, Convex.jl requires that the problem be modeled using its "atoms" (primitives) according to the Disciplined Convex Programming (DCP) ruleset. If atoms are combined in a way that violates DCP rules, the resulting extended formulation may be invalid, leading to incorrect or unbounded solutions. Convex.jl programmatically checks for DCP compliance and will throw a DCPViolationError if the rules are not satisfied.
using Convex, SCS
x = Variable();
t = Variable();
# An extended formulation adding auxiliary variable 't' to represent abs(x)
model_min_extended = minimize(t, [x >= 1, x <= 2, t >= x, t >= -x]);
solve!(model_min_extended, SCS.Optimizer; silent = true)