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

[BUG]: cec2021 F2 has abnormal optimal value. #21

Closed
SkyLull opened this issue Dec 15, 2023 · 1 comment · Fixed by #30
Closed

[BUG]: cec2021 F2 has abnormal optimal value. #21

SkyLull opened this issue Dec 15, 2023 · 1 comment · Fixed by #30
Assignees
Labels
bug Something isn't working

Comments

@SkyLull
Copy link
Contributor

SkyLull commented Dec 15, 2023

Description of the bug

In short:

F22021 should have a global optimal value = 1100.0, but I found much more space that has even lower values.


In detail:

The plotted function of F22021 looked like this:
螢幕擷取畫面 2023-12-15 155906
The very little red dot near the middle (located at (2.0990197e+01, -2.3188216e+01), right as provided) should have the global optimal value of 1100.0 (equals bias), but as the plot clearly showed, much more space has a value lower than 1100.0.
For example, the red dot located at (94.14767894, 2.33460048) near the right side solved for a value of 23.98, there even exists a point (99.31320785, -0.51136206) that solved for a value of -32.35

I suppose this is not the intended outcome?

In case I did something wrong that I couldn't find myself due to the lack of domain knowledge, here is the same plot from other angles:
圖片
螢幕擷取畫面 2023-12-15 160801
螢幕擷取畫面 2023-12-15 163427

Steps To Reproduce

I use this code to draw the plot:

import numpy as np
import matplotlib.pyplot as plt
import opfunu.cec_based


if __name__ == '__main__':
    dim = 2
    eval_func = opfunu.cec_based.F22021(ndim=2)
    bound = {"upper": 100.0,
             "lower": -100.0}

    # Create a meshgrid for visualization
    x = np.linspace(bound["lower"], bound["upper"], 300)
    y = np.linspace(bound["lower"], bound["upper"], 300)
    X, Y = np.meshgrid(x, y)

    Z = np.zeros_like(X)
    for i in range(len(x)):
        for j in range(len(y)):
            Z[i, j] = eval_func.evaluate([X[i, j], Y[i, j]])

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.plot_surface(X, Y, Z, cmap='viridis')
    ax.set_xlabel('x')
    ax.set_ylabel('y')
    ax.set_zlabel('z')

    print("f_global = ", eval_func.f_global)

    ax.scatter(2.0990197e+01, -2.3188216e+01, 1100., color='red')

    plt.show()

Additional Information

The version of main packages:
Python 3.9.13
Cython 3.0.6
matplotlib 3.8.2
numpy 1.26.2
opfunu 1.0.1

using Windows 11 22H2

@SkyLull SkyLull added the bug Something isn't working label Dec 15, 2023
@thieu1995
Copy link
Owner

Hi @SkyLull,

Please install the previous version 1.0.0. This bug will be gone. This latest version has this bug but I haven't had time to fix it.

thieu1995 added a commit that referenced this issue Mar 22, 2024
fix: align `modified_schwefel_func()` in `operator.py`, close #21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants