Skip to content

Review tolerance for determining whether or not bounds are fixed. #261

@nbelakovski

Description

@nbelakovski

At the moment we use the following code to determine whether or not a lower bound is equal to a given upper bound:

tol = get_arrays_tol(lb, ub)
_fixed_idx = (
    (lb <= ub)
    & (np.abs(lb - ub) < tol)
)

In this case get_arrays_tol provides a tolerance that is scaled based on the length of the provided arrays and the largest number in the array, but this can lead to a pathological case like the following two arrays

lb: (1, 2)
ub: (very large number, 3)

If the large number is large enough, the tolerance will be large and we would consider the number bound by 2 and 3 to be fixed.

One alternative approach is to just always use machine epsilon. Another is to use an array of tolerances. This latter approach would work better for a case like the following:

lb: (very large number)
ub: (very large number) + 1

Where the difference is larger than eps but where we might want to consider the bounds to effectively be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions