Skip to main content

with_penalty

Function with_penalty 

Source
pub fn with_penalty(
    q: &[Vec<f64>],
    b: &[f64],
    g: &[f64],
    c: f64,
    lambda: f64,
) -> (Vec<Vec<f64>>, Vec<f64>)
Expand description

Fold one soft equality constraint gᵀx = c into the quadratic as a virtual spring: f(x) + λ(gᵀx − c)² ⇒ Q += 2λ·ggᵀ, b −= 2λc·g. Stiffer springs pull the settled answer closer to the constraint surface — the quadratic-penalty form (primal-dual dynamics are the ledgered future).