Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix check for undefined pop fitness when using parallel processing #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ahmedfgad merged 1 commit into ahmedfgad:master from MBradbury:undefined-fitness-check
Nov 2, 2023

Conversation

Copy link
Contributor

@MBradbury MBradbury commented Oct 18, 2023
edited
Loading

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'

ahmedfgad reacted with heart emoji Takshan reacted with rocket emoji
@ahmedfgad ahmedfgad merged commit 263cb49 into ahmedfgad:master Nov 2, 2023
@ahmedfgad ahmedfgad added the bug Something isn't working label Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
bug Something isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Multi-Objective Optimization and parallel_processing

AltStyle によって変換されたページ (->オリジナル) /