anyoptimization / pymoo

NSGA2, NSGA3, R-NSGA3, MOEAD, Genetic Algorithms (GA), Differential Evolution (DE), CMAES, PSO
https://pymoo.org
Apache License 2.0
2.3k stars 396 forks source link

Issues with Numba in AGE-MOEA #661

Closed oliverweissl closed 2 days ago

oliverweissl commented 6 days ago

I get the following error when using AGE-MOEA:

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of type(CPUDispatcher(<function point_2_line_distance at 0x735c3d5b7a60>)) with parameters (array(float64, 2d, C), array(float64, 1d, C), array(float64, 1d, C))

During: resolving callee type: type(CPUDispatcher(<function point_2_line_distance at 0x735c3d5b7a60>))
During: typing of call at /../../miniconda3/envs/***/lib/python3.9/site-packages/pymoo/algorithms/moo/age.py (249)

File "../../../miniconda3/envs/***/lib/python3.9/site-packages/pymoo/algorithms/moo/age.py", line 249:
def find_corner_solutions(front):
    <source elided>
    for i in range(r):
        dists = point_2_line_distance(front, np.zeros(n, dtype=np.float64), W[i, :])
        ^

My package versions:

Im using the optimizer for a NxG sized array of floats ranging [0,1]. As feedback we get a Nx2 sized fitness array also ranging [0,1]. The approach works for all Pymoo MOO algorithms without numba.

If you need any further information LMK!

oliverweissl commented 6 days ago

Made a fix that works for my case in #662. Seems to be general enough to be useful for all.

blankjul commented 2 days ago

Just merged your PR! Thanks!

blankjul commented 2 days ago

In case that should not fix it please re-open this issue. Note for testing it you will have to use the most recent main branch.