pympcc.autoscale_comp_pairs¶
- pympcc.autoscale_comp_pairs(problem, *, threshold=1000.0, n_probes=5, seed=0, floor=1e-12, perturb_scale=0.1)[source]¶
Return per-pair diagonal scales that equilibrate the comp block.
- Parameters:
problem (MPCCProblem) – Source problem. Must expose
comp_G,comp_H,x0, andn_comp.xl/xuare honoured when probing perturbations.threshold (float, optional) – A pair is rescaled only when
max(|G|, |H|) / min(|G|, |H|)— evaluated on per-pair medians across the probe set — exceeds this ratio. Default1e3.n_probes (int, optional) – Number of random perturbations of
x0evaluated in addition tox0itself. Default5(six samples total).seed (int, optional) – Seed for the perturbation RNG. Default
0.floor (float, optional) – Lower clip on per-pair median magnitudes before division. Default
1e-12.perturb_scale (float, optional) – Standard deviation of the random perturbation, expressed as a fraction of
max(|x0|, 1)per coordinate. Default0.1.
- Return type:
- Returns:
s_G (ndarray, shape (n_comp,))
s_H (ndarray, shape (n_comp,)) – Strictly positive scales.
1.0for well-conditioned pairs;1 / median(|·|)for imbalanced pairs (clipped atfloor).