| swap_mutation | R Documentation |
Replace occupied grid cells with unused ones. The number of
swaps is max(min_swaps, Binomial(n, p)), so each individual explores at
least min_swaps new cells (default 1). The number of turbines stays n.
swap_mutation(ids, grid_ids, p, seed = NULL, min_swaps = NULL, visit = NULL)
ids |
Integer matrix with |
grid_ids |
All valid grid cell IDs |
p |
Mutation probability per turbine |
seed |
Set a seed for comparability. Default is |
min_swaps |
Minimum number of swaps per individual. Default is
|
visit |
Named visit counts per grid ID. Free cells with fewer visits
are more likely to be chosen. Default is |
Integer matrix of unique grid IDs, same dimension as ids
Other Genetic Algorithm Functions:
crossover(),
fitness(),
genetic_algorithm(),
init_population(),
mutation(),
selection(),
set_crossover(),
trimton()
ids <- cbind(c(1, 3, 5, 7), c(2, 4, 6, 8))
swap_mutation(ids, grid_ids = 1:20, p = 0.5, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.