Python error: ImportError: cannot import name 'NSGAII' from 'platypus'

272 views Asked by At

I am trying to use platypus. I did all the required steps, install with pip, then uninstall and install again and I still get the error "ImportError: cannot import name 'NSGAII' from 'platypus'"

Anyone knows how to fix it ? thanks

here is the code

from platypus import NSGAII, Problem, Real


def schaffer(x):
    return [x[0] ** 2, (x[0] - 2) ** 2]


problem = Problem(1, 2)
problem.types[:] = Real(-10, 10)
problem.function = schaffer

algorithm = NSGAII(problem)
algorithm.run(10000)



1

There are 1 answers

7
Tanveer On

create

__init__.py

file in your current directory to resolve the import issue