Skip to content
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

Crash when all individuals are invalid #33

Closed
jmmcd opened this issue Nov 30, 2016 · 11 comments
Closed

Crash when all individuals are invalid #33

jmmcd opened this issue Nov 30, 2016 · 11 comments
Assignees

Comments

@jmmcd
Copy link
Collaborator

jmmcd commented Nov 30, 2016

In stats.py, we have lines like:

        available = [i for i in individuals if not i.invalid]

        # Genome Stats
        genome_lengths = [len(i.genome) for i in available]
        stats['max_genome_length'] = max(genome_lengths)

(Also min, and ave.) These will throw an error if all individuals in a population are invalid. I've seen this a few times in the hill-climbing search loop, but not in the default search loop. Maybe there's some protection against all becoming invalid when running the default search loop?

@mikefenton
Copy link
Collaborator

mikefenton commented Nov 30, 2016

Hmm, an interesting one. Crossover currently doesn't allow invalids to be created (i.e. crossover will continue until all children in the population are valid), but there's no such catch for mutation. Should we implement something like that for mutation?

@dvpfagan
Copy link
Collaborator

dvpfagan commented Nov 30, 2016 via email

@jmmcd
Copy link
Collaborator Author

jmmcd commented Feb 8, 2017

Probably the default should be to allow crossover to create invalids since that is the published algorithm. Maybe add switches --no-crossover-invalids and --no-mutation-invalids.

@mikefenton
Copy link
Collaborator

Switch added for --no_crossover_invalids. However, mutation is not quite so easy to put various checks in place (e.g. limitations on max depth/nodes/invalids) as the current mutation is done with a list(map()) function, necessitating a bit more thought to sort out.

@mikefenton
Copy link
Collaborator

Mutation now has the same checks as crossover. All checks have been moved to utilities.representation.check_methods.check_inds. Checks can be extended to suit.

@mikefenton
Copy link
Collaborator

Setting the default fitness is now the responsibility of each individual fitness function. By default, we have set the default_fitness value of each fitness function to numpy.NaN. This allows us to calculate population statistics over the entire population by filtering out these np.NaN values using numpy's np.nanmax(), np.nanmin(), and np.nanmean() functions. PonyGE will no longer crash if all individuals are invalid.

@dvpfagan
Copy link
Collaborator

dvpfagan commented Feb 15, 2017 via email

@mikefenton
Copy link
Collaborator

All this info should be in the README I presume. RTFM issue...

@dvpfagan
Copy link
Collaborator

dvpfagan commented Feb 15, 2017 via email

@mikefenton
Copy link
Collaborator

Agreed. It's gonna take a fair while to ensure everything is in the README. When the code review is being done it might be an idea to check that every aspect is documented in the README somehow...

@dvpfagan
Copy link
Collaborator

dvpfagan commented Feb 15, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants