Fix/elite set mutation#717
Conversation
| self.crossover_operator = crossover_method | ||
| self.mutation_method = mutation_method | ||
|
|
||
| # TODO: do this only if initial_population is provided. |
There was a problem hiding this comment.
If you look at the function, it immediately returns if there is no initial population, so this is probably already ok
| self.evaluator.evaluate_population(self.population) | ||
| ).collect() | ||
|
|
||
| # TODO: if no initial population, generate initial population here |
There was a problem hiding this comment.
We at some point purposefully started lazy initializing it
| :param new_population: The new population to perform crossover on. | ||
| :param unique_hashes: The set of unique hashes of the individuals in the new population. | ||
| """ | ||
| # TODO: crossover should choose from non-elite set only |
| :param unique_hashes: The set of unique hashes of the individuals in the new population. | ||
| """ | ||
| # TODO: crossover should choose from non-elite set only | ||
| # TODO: crossover % should mean: if %, cross a single individual, and remove both parents. else, copy random individual from previous gen. remove said individual from selection pool. |
There was a problem hiding this comment.
You need to be very careful with this approach with your probabilities, as you don't always remove the same number of individuals from the population. It can work for sure, just keep this in mind so the param setting this probability still behaves intuitively.
| """ | ||
| # TODO: crossover should choose from non-elite set only | ||
| # TODO: crossover % should mean: if %, cross a single individual, and remove both parents. else, copy random individual from previous gen. remove said individual from selection pool. | ||
| # TODO: since we produce 1 input per 2 parents, we fill the population until we reach the target size. (NOT DONE HERE, BUT IN generate_simple) |
There was a problem hiding this comment.
Huh, so we suddenly generate from scratch again? No? Didn't we talk about how this isn't typical?
|
|
||
| :param new_population: The new population to perform mutation on. | ||
| """ | ||
| # TODO: remove mutation pool, does not make sense. all population is subject to mutation based on %. |
There was a problem hiding this comment.
This is an example of a significant change to the current behavior. We may want to release a new at least minor version after this.
| :param new_population: The new population to perform destruction on. | ||
| :return: The new population after destruction. | ||
| """ | ||
| # TODO: find most efficient way to destroy % of population at random. |
There was a problem hiding this comment.
How about we remove destruction for now?
| :param max_generations: The maximum number of generations to generate. If None, the generation will run indefinitely. | ||
| :return: A generator of DerivationTree objects, all of which are valid solutions to the grammar (or satisify the minimum fitness threshold). | ||
| """ | ||
| # TODO: since initial population was produced during init, we can remove this check. |
| generation = 0 | ||
|
|
||
| while True: | ||
| # TODO: check the stop condition. if fitness is 1.0? |
There was a problem hiding this comment.
Why would we stop generating then? Maybe I want more solutions?
| self.population_size, | ||
| ) | ||
|
|
||
| # TODO: are we double evaluating here? |
There was a problem hiding this comment.
We are. All over the place, sometimes nested. Check all the functions when evaluate_individual is passed. Maybe create a wrapper around a tree that contains the eval? This would make it a bit cleaner and would make it easier to reuse previous evals.
…ulation-wide task)
…ner`). No functionality at the moment.
…bring them back with better tests soonTM
DRAFT