DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.88k stars 1.13k forks source link

AttributeError: module 'deap.creator' has no attribute 'Particle' #679

Open codezart opened 1 year ago

codezart commented 1 year ago

I'm following this example: https://deap.readthedocs.io/en/master/examples/pso_basic.html

when I run it, it shows be the following error

AttributeError: module 'deap.creator' has no attribute 'Particle'

When I check the codebase, I only see it defined in examples.

fmder commented 1 year ago

You need to make sure this line gets called, it is the one that will create the class on the fly.

creator.create("Particle", list, fitness=creator.FitnessMax, speed=list, smin=None, smax=None, best=None)