osier.utils.check_if_interior#

osier.utils.check_if_interior(points, par_front, slack_front)[source]#

Checks if a point or set of points is inside the N-polytope created by the Pareto front and the slack front (a.k.a the near-optimal front).

Warning

If the Pareto front has only a few points there may false negatives.

Parameters:
  • points (numpy.ndarray) – A point or set of points to test.

  • par_front (numpy.ndarray) – The set of points on the Pareto front.

  • slack_front (numpy.ndarray) – The set of points on the near-optimal front. Equal to par_front*(1+slack).

Returns:

interior_idxs – The set of indices that are between the Pareto front and slack front.

Return type:

numpy.ndarray

Examples

>>> import itertools as it
>>> x = np.arange(3)
>>> grid = np.array(list(it.product(x,x)))
>>> pf = np.array([[0,0]])
>>> sf = np.array([[2,0], [1,1], [0,2]])
>>> rng = np.random.default_rng(seed=1234)
>>> test_points = rng.uniform(low=0, high=2, size=(10,2))
>>> int_idx = check_if_interior(test_points, pf, sf)
>>> int_points = test_points[int_idx]
>>> import matplotlib.pyplot as plt
>>> plt.scatter(grid[:,0],grid[:,1])
>>> plt.scatter(test_points[:,0],test_points[:,1])
>>> plt.scatter(int_points[:,0],int_points[:,1])
>>> plt.show()