x3cflux.compute_closest_interior_point

class x3cflux.compute_closest_interior_point(point: ndarray, inequality_matrix: ndarray, inequality_bound: ndarray, margin: float | ndarray = 0.1)

Computes an interior point of the polytope that is closest in 2-norm to the given one.

This method relies on least squares optimization to compute the closest point. A margin is added to the polytope bounds to not ensure that the interior point is not exactly on the boundary. This margin is decreased iteratively if the solution fails, starting from 0.1.

Parameters:
  • point – a point with shape (N,)

  • inequality_matrix – inequality matrix (M, N) of the polytope

  • inequality_bound – inequality bound (M,) of the polytope

  • margin – absolute distance to each respective bound. Might also be given as a vector of distances for each bound. Default: 0.1

Returns:

interior point

Raises:

Exception if constraints could not be fulfilled even after many attempts