Using fitness ranks of parent chromosomes, this function will select parents based upon their fitness rank, generate two children from each mate pair and mutate those child chromosomes. Function uses select_parents
, crossover_parents
, and mutate_child
to generate children.
1 2 | create_next_generation(generation_t0, obj_fun_output, select_parents,
crossover_method, crossover_parents, pCrossover, mutate_child, mutation_rate)
|
generation_t0 |
a matrix of parent chromosomes to be evaluated. Columns correspond to predictors/genes and rows correspond to parents/chromosomes. |
obj_fun_output |
a numeric vector containg the objective function output for each parent chromosome. |
select_parents |
function for selection of parents for |
crossover_method |
a character string indicating which crossover method to use: c("method1", "method2", "method3"). Default is "method1". See |
crossover_parents |
a function for crossover between two parents. See |
pCrossover |
a number between 0 and 1 indicating the probability of crossover between two parents. |
mutate_child |
a function for mutagenesis of child genes. See |
mutation_rate |
a number between 0 and 1 indicating the probability of mutation. See |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.