Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There may be a problem with DF11's _calc_pareto_front function #679

Open
Yulinjun-git opened this issue Jan 13, 2025 · 2 comments
Open

There may be a problem with DF11's _calc_pareto_front function #679

Yulinjun-git opened this issue Jan 13, 2025 · 2 comments
Assignees

Comments

@Yulinjun-git
Copy link

class DF11(DF):

def __init__(self, **kwargs):
    super().__init__(**kwargs)
    self.n_obj = 3

def _evaluate(self, x, out, *args, **kwargs):
    G = np.abs(np.sin(0.5 * np.pi * self.time))
    g = 1 + G + np.sum((x[:, 2:] - 0.5 * G * x[:, 0].reshape(len(x), 1)) ** 2, axis=1)
    y = [np.pi * G / 6.0 + (np.pi / 2 - np.pi * G / 3.0) * x[:, i] for i in [0, 1]]

    f1 = g * np.sin(y[0])
    f2 = g * np.sin(y[1]) * np.cos(y[0])
    f3 = g * np.cos(y[1]) * np.cos(y[0])

    out["F"] = np.column_stack([f1, f2, f3])

def _calc_pareto_front(self, *args, n_pareto_points=100, **kwargs):
    H = 20
    x1, x2 = np.meshgrid(np.linspace(0, 1, H), np.linspace(0, 1, H), indexing='xy')
    G = np.abs(np.sin(0.5 * np.pi * self.time))
    y1 = np.pi * G / 6 + (np.pi / 2 - np.pi * G / 3) * x1
    y2 = np.pi * G / 6 + (np.pi / 2 - np.pi * G / 3) * x2
    f1 = (1 + G) * np.sin(y1)
    f2 = (1 + G) * np.sin(y2) * np.cos(y1)
    f3 = (1 + G) * np.cos(y2) * np.cos(y1)
    # f2 = np.dot(np.multiply(1, np.sin(y2)), np.cos(y1))
    # f3 = np.dot(np.multiply(1, np.cos(y2)), np.cos(y1))

    return get_PF(np.array([f1, f2, f3]), False)

Hello, when I was referencing the DF11 testing problem on the Pymoo platform, I found that almost all algorithms were unable to effectively converge to the problem. Combined with the definition of DFs testing problem in CEC2018, I think it may be due to an issue with the function definition of your platform that approximates the true frontier. The commented code is the original code of the platform, and the new f1,f2,f3 is my modified code. When we ran the modified code, we found that the algorithm could achieve good convergence. Could you please review whether the question I raised is reasonable. I hope to receive your reply, thank you.

@blankjul
Copy link
Collaborator

blankjul commented Feb 1, 2025

The problems were added here: #270

@ahcheriet can you have a look how we can resolve this issue?

@blankjul blankjul self-assigned this Feb 1, 2025
@ahcheriet
Copy link
Contributor

ahcheriet commented Feb 1, 2025

Thank you @Yulinjun-git well spotted,
Yes, indeed there is a problem in the multiplication,

Element-wise operations with g scaling

f1 = (1+G) * np.sin(y1)
f2 = (1+G) * np.sin(y2) * np.cos(y1)  # Correct element-wise multiplication
f3 = (1+G) * np.cos(y2) * np.cos(y1)  # Correct element-wise multiplication

Also, we may check the DF12, DF13 and DF13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants