The mutation rate increases linearly with the generation index. Real-coded mode applies Gaussian perturbation; binary mode flips selection bits. When a gene network is supplied, the perturbation of each gene is damped by its relative connectivity (degree), so network hubs change less.
Usage
mutation_cpp(
offspring,
mutation_rate,
iteration,
max_iterations,
network = NULL,
representation = "real"
)Examples
genomic_data <- matrix(rnorm(100), nrow = 10, ncol = 10)
population <- BioGA::initialize_population_cpp(genomic_data, population_size = 5)
fitness <- BioGA::evaluate_fitness_cpp(genomic_data, population, c(1.0, 0.5))
parents <- BioGA::selection_cpp(population, fitness, num_parents = 2)
offspring <- BioGA::crossover_cpp(parents, offspring_size = 2)
BioGA::mutation_cpp(offspring, mutation_rate = 0.1, iteration = 1,
max_iterations = 100)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] -0.6002596 0.5539177 0.5846137 0.7799651 1.253815 0.3796395 -0.2950715
#> [2,] -0.6002596 0.5539177 0.5846137 0.7799651 1.253815 0.3796395 -0.3186994
#> [,8] [,9] [,10]
#> [1,] -0.04287046 0.8781335 1.360652
#> [2,] -0.04287046 0.8781335 1.360652
