Skip to main content

detect_soc

Function detect_soc 

Source
pub fn detect_soc(
    arena: &ExprArena,
    vars: &[Variable],
    c: &Constraint,
) -> Option<SocForm>
Expand description

Recognize an algebraic quadratic constraint as second-order-cone shaped.

A constraint is recognized iff:

  • it is single-sided lhs <= rhs (no ranges, >=, or equalities),
  • lhs - rhs is a pure quadratic form: no linear terms, no constant,
  • the Hessian is diagonal with exactly one negative entry -n (on the bound variable t) and at least one positive entry p_i,
  • t has lower bound >= 0.

That is sum_i p_i x_i^2 <= n t^2 with t >= 0, equivalent to || sqrt(p_i/n) x_i ||_2 <= t. Cross-term (Cholesky-factorized) quadratic forms are not detected, they classify as QCP instead.