pub fn lp_gradient(
c: &[f64],
a: &[Vec<f64>],
b: &[f64],
x_star: &[f64],
dl_dx: &[f64],
epsilon: f64,
) -> OptimizeResult<Vec<f64>>Expand description
Compute the gradient dL/dc for the entropy-regularized LP.
For the perturbed LP, the Jacobian of x* w.r.t. c is:
dx*/dc = -(1/ε) diag(x*) (I - 1ᵀ x* / Σ x*)
(from the softmax Jacobian, where x* = softmax(-c/ε)/ Σ x*).
The gradient dL/dc_i = Σ_j (dx*/dc)_{ji} * dL/dx_j.
For the simple case without constraints: dx*/dc = -(1/ε)(diag(x*) - x* x*ᵀ).