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.
At the moment we use the following code to determine whether or not a lower bound is equal to a given upper bound:
In this case
get_arrays_tolprovides 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 arrayslb: (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.