Yustina Ivanova
Yustina Ivanova

Reputation: 150

Python: how to get 2D points on the Pareto front

Given a set of points calculated after optimization with Optuna, where minimization - maximization problem was solved, I would like to plot these points lying on the pareto front. How to estimate them with python?

Example of input: Scatter plot of input set

What should be Pareto front line for this case? Thank you!

I tried solution provided by ChatGPT:

# Function to check if a point is dominated by any other point
def is_dominated(point, points):
    for other in points:
        # Objective1 (minimize), Objective2 (maximize)
        if other[0] <= point[0] and other[1] >= point[1] and any(other != point):
            return True
    return False

# Find Pareto front points (non-dominated points)
pareto_front_points = np.array([point for point in points if not is_dominated(point, points)])

# Print Pareto front points
print("Pareto front points:")
print(pareto_front_points)

The results were not fulfilling (only four points were found): Pareto points red

Upvotes: 0

Views: 36

Answers (0)

Related Questions