DEAP / deap

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

CMA-ES population type #301

Open chielk opened 6 years ago

chielk commented 6 years ago

The population in cma.py -> update is assumed to be an iterable of objects that contain a .fitness attribute (line 130), but on line 158 .T is called on it, suggesting it is a numpy matrix. This causes errors under most (but not all) conditions, like when mu is not equal to the dimensionality of the search space.

A possible way to remedy this is to transform it to an array after sorting: population = numpy.array([ind[:] for ind in population]) This seems to work on my code, but may not be compatible with how other people have represented the population.

fmder commented 5 years ago

On line 154 the result of list of lists - numpy.array is a numpy.array.

What error do you get?

chielk commented 5 years ago

I currently don't have time to work on this, maybe later, but IIRC I would get something like "operands could not be broadcast together" unless I chose a mu equal to the dimensionality of the solution space. When I did do that, it would strangely give the same error, but only after multiple generations.