When using parallel processing and multiple objectives are returned from the fitness function, then the following exception will be raised. This PR fixes the issue by avoiding comparisons between the undefined string and a numpy array. This would fix #236.
ERROR: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Traceback (most recent call last):
File ".venv/lib/python3.10/site-packages/pygad/pygad.py", line 1790, in cal_pop_fitness
if pop_fitness[sol_idx] == "undefined":
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Version information:
$ python
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygad
>>> pygad.__version__
'3.2.0'
When using parallel processing and multiple objectives are returned from the fitness function, then the following exception will be raised. This PR fixes the issue by avoiding comparisons between the
undefined
string and a numpy array. This would fix #236.Version information: