in src/hull_to_pareto.py [0:0]
def determine_pareto_curve(ccw_points):
"""
Converts a convex hull given by scipy into the points along a pareto curve where the south west quadrant is
considered to be more optimal. This gives us a way to efficiently trace pareto curve described by linear
combininations of any mixtures we find.
"""
# Determine the point with the lowest x value, break ties by lower y
ccw_points = ccw_points.tolist() # Convrt to python list
min_index = ccw_points.index(min(ccw_points)) # Get index of min tuple
ccw_points = ccw_points[min_index:] + (ccw_points[:min_index]) # concatenate the lists
# Now we have the points in CCW order, starting with the left most point on the pareto curve.
# We simply iterate over until the x values decreses, and keep all points before that.
curr_index = 0
broken = False
last_x = ccw_points[0][0]
last_y = ccw_points[0][1]
for x, y in ccw_points:
if x < last_x or y > last_y: # if at any point we start going back in x or up in y we terminate
stop_index = curr_index # exclusive stopping index
broken = True
break
last_x = x
last_y = y
curr_index += 1
# If we never decrease x, we don't want to eliminate any points
if not broken:
stop_index = len(ccw_points)
# Now, we just keep the pareto part from left to right
return np.array(ccw_points[:stop_index])