-
-
Notifications
You must be signed in to change notification settings - Fork 489
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
Replies: 1 comment 2 replies
-
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:
- Exit when the same group of genes is selected for a given number of times (e.g. 20)?
- 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.
Beta Was this translation helpful? Give feedback.
All reactions
-
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..
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
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.
Beta Was this translation helpful? Give feedback.