Skip to main content

same_answer_allowance

Function same_answer_allowance 

Source
pub fn same_answer_allowance(
    f_a: Number,
    f_b: Number,
    slack: Number,
    gap: Number,
) -> Number
Expand description

How far two minimized objectives may differ and still be one answer: SAME_ANSWER_REL_TOL·max(|f_a|, |f_b|) + CORNER_SLACK_FACTOR·slack + gap, slack the relaxation_slack of the points compared (their sum when both are relaxed) and gap the sum of their complementarity_gaps. Every term scales with the objective, so neither test that uses it changes its verdict when f is multiplied by a constant (gh#1128: an absolute 1e-4 floor near zero, and an allowance proportional to max(1, |f|) rather than to the multipliers, both did). The gap is the floor near f = 0: what the two solves’ own tolerance leaves.