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

exit criteria #44

Closed
rengel8 started this conversation in Ideas
May 20, 2021 · 1 comments · 2 replies
Discussion options

I read about the on_generation parameter, which allows to write a user defined function. This is a very useful method and underlines conceptual aspects of pygad. Stopping based on a rule, skipping remaining generations, is possible through this.

But I would think of two ways to implement exit criteria. A) Some examples in the documentation or B) maybe beyond some presented logic some internal criteria.

exit_criteria=None
All generations are executed (default), the user might want to exit on his own desire using on_generation (function)

exit_criteria="seen_20"
The execution would stop after 20% of all combinatorical (precision) gene variations have been seen/tested

exit_criteria="stale_10"
The execution would stop after 10 generations with no new best solution found

exit_criteria="flatmox_1_5"
The execution would stop if the increase in fitness is below 1% for the last 5 generations (flattening approximation max)

Just some thoughts. But I think that some criteria better describe where one is aiming for. Sometimes it is very hard to estimate needed generations. Would be neat to have. Otherwise it might direct others on their search for something like this.

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

That is another good feature from your side. Thanks Rainer! Such feature will be supported in the next release.

For exit_criteria="seen_20", do you mean:

  1. Exit when the same group of genes is selected for a given number of times (e.g. 20)?
  2. Or you mean exit when the same group of genes is selected + identical mutation changes are applied for such genes for a given number of times?

I think it would be the first option but just to get your idea clearly.

You must be logged in to vote
2 replies
Comment options

Here I was referring to given gene spaces (user defined), where all possible solutions are quantized (known). Then it would be possible to know how much different solutions have been "seen", i.e. for which the corresponding fitness-value is known.

i.e.
gene_space = [{'low': 1, 'high': 181}, {'low': 7, 'high': 251}, {'low': 1, 'high': 21}]
3 genes (possible variations: 180, 244, 20 -> 878.400) seen_20 would than mean that 175.680 unique solutions had been seen.

If the gene space is not user defined, your option 1 may be suitable but diferent from what I had in mind. So it is - as allways, not that trivial diving into the details..

Comment options

I got it. Thanks Rainer!

I will consider supporting this feature but the challenge is that the unique visited solutions across all generations must be memorized and checked after each generation to measure the exact percent of visited solutions. I think this would take some space besides the time.

A warning will be printed to the user when this option would generate thousands of combinations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
enhancement New feature or request

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