powered by
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.
max(min_swaps, Binomial(n, p))
min_swaps
n
swap_mutation(ids, grid_ids, p, seed = NULL, min_swaps = NULL, visit = NULL)
Integer matrix of unique grid IDs, same dimension as ids
ids
Integer matrix with n rows (turbines) and one column per individual
All valid grid cell IDs
Mutation probability per turbine
Set a seed for comparability. Default is NULL
NULL
Minimum number of swaps per individual. Default is getOption("windfarmGA.min_swaps") (1)
getOption("windfarmGA.min_swaps")
Named visit counts per grid ID. Free cells with fewer visits are more likely to be chosen. Default is NULL (uniform)
Other Genetic Algorithm Functions: crossover(), fitness(), genetic_algorithm(), init_population(), mutation(), selection(), set_crossover(), trimton()
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)
Run the code above in your browser using DataLab