# Islands Genetic Algorithms

### Description

Maximization of a fitness function using islands genetic algorithms (ISLGAs). This is a distributed multiple-population GA, where the population is partitioned into several subpopulations and assigned to separated islands. Independent GAs are executed in each island, and only occasionally sparse exchanges of individuals are performed among the islands. In principle islands can evolve sequentially, but increased computational efficiency is obtained by running GAs in parallel on each island. The latter is called island parallel GAs (ISLPGAs) and it is used by default.

### Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ```
gaisl(type = c("binary", "real-valued", "permutation"),
fitness, ...,
min, max, nBits,
population = gaControl(type)$population,
selection = gaControl(type)$selection,
crossover = gaControl(type)$crossover,
mutation = gaControl(type)$mutation,
popSize = 100,
numIslands = 4,
migrationRate = 0.1,
migrationInterval = 10,
pcrossover = 0.8,
pmutation = 0.1,
elitism = base::max(1, round(popSize/numIslands*0.05)),
updatePop = FALSE,
postFitness = NULL,
maxiter = 1000,
run = maxiter,
maxFitness = Inf,
names = NULL,
suggestions = NULL,
optim = FALSE,
optimArgs = list(method = "L-BFGS-B",
poptim = 0.05,
pressel = 0.5,
control = list(fnscale = -1, maxit = 100)),
parallel = TRUE,
monitor = if(interactive())
{ if(is.RStudio()) gaislMonitor else gaislMonitor2 }
else FALSE,
seed = NULL)
``` |

### Arguments

`type` |
the type of genetic algorithm to be run depending on the nature of decision variables. Possible values are:
| ||||||

`fitness` |
the fitness function, any allowable R function which takes as input an individual | ||||||

`...` |
additional arguments to be passed to the fitness function. This allows to write fitness functions that keep some variables fixed during the search. | ||||||

`min` |
a vector of length equal to the decision variables providing the minimum of the search space in case of real-valued or permutation encoded optimizations. | ||||||

`max` |
a vector of length equal to the decision variables providing the maximum of the search space in case of real-valued or permutation encoded optimizations. | ||||||

`nBits` |
a value specifying the number of bits to be used in binary encoded optimizations. | ||||||

`population` |
an R function for randomly generating an initial population. See | ||||||

`numIslands` |
an integer value specifying the number of islands to be used in a | ||||||

`migrationRate` |
a value in the range $[0,1]$ providing the proportion of individuals that should migrate between the islands. | ||||||

`migrationInterval` |
an integer value specifying the number of iterations at which exchange of individuals takes place. | ||||||

`selection` |
an R function performing selection, i.e. a function which generates a new population of individuals from the current population probabilistically according to individual fitness. See | ||||||

`crossover` |
an R function performing crossover, i.e. a function which forms offsprings by combining part of the genetic information from their parents. See | ||||||

`mutation` |
an R function performing mutation, i.e. a function which randomly alters the values of some genes in a parent chromosome. See | ||||||

`popSize` |
the population size. | ||||||

`updatePop` |
a logical defaulting to | ||||||

`postFitness` |
a user-defined function which, if provided, receives the current | ||||||

`pcrossover` |
the probability of crossover between pairs of chromosomes. Typically this is a large value and by default is set to 0.8. | ||||||

`pmutation` |
the probability of mutation in a parent chromosome. Usually mutation occurs with a small probability, and by default is set to 0.1. | ||||||

`elitism` |
the number of best fitness individuals to survive at each generation. By default the top 5% individuals in each island will survive at each iteration. | ||||||

`maxiter` |
the maximum number of iterations to run before the GA search is halted. | ||||||

`run` |
the number of consecutive generations without any improvement in the best fitness value before the GA is stopped. | ||||||

`maxFitness` |
the upper bound on the fitness function after that the GA search is interrupted. | ||||||

`names` |
a vector of character strings providing the names of decision variables. | ||||||

`suggestions` |
a matrix of solutions strings to be included in the initial population. If provided the number of columns must match the number of decision variables. | ||||||

`optim` |
a logical defaulting to | ||||||

`optimArgs` |
a list controlling the local search algorithm with the following components: `method` a string specifying the general-purpose optimisation method to be used, by default is set to `"L-BFGS-B"` . Other possible methods are those reported in`optim` .`poptim` a value in the range [0,1] specifying the probability of performing a local search at each iteration of GA (default 0.1). `pressel` a value in the range [0,1] specifying the pressure selection (default 0.5). The local search is started from a random solution selected with probability proportional to fitness. High values of `pressel` tend to select the solutions with the largest fitness, whereas low values of`pressel` assign quasi-uniform probabilities to any solution.`control` a list of control parameters. See 'Details' section in `optim` .
| ||||||

`parallel` |
a logical argument specifying if GAs evolution should be performed in parallel ( | ||||||

`monitor` |
a logical or an R function which takes as input the current state of the | ||||||

`seed` |
an integer value containing the random number generator state. This argument can be used to replicate the results of a ISLGA search. Note that if parallel computing is required, the doRNG package must be installed. |

### Details

Genetic algorithms (GAs) are stochastic search algorithms inspired by the basic principles of biological evolution and natural selection. GAs simulate the evolution of living organisms, where the fittest individuals dominate over the weaker ones, by mimicking the biological mechanisms of evolution, such as selection, crossover and mutation.

The `gaisl`

function implements the islands GAs approach, where the population is partitioned into several subpopulations and assigned to separated islands. Independent GAs are executed in each island, and only occasionally sparse exchanges of individuals are performed among the islands. The algorithm can be run in parallel or sequentially.
For more information on GAs see `ga`

.

### Value

Returns an object of class `gaisl-class`

. See `gaisl-class`

for a description of available slots information.

### Author(s)

Luca Scrucca luca.scrucca@unipg.it

### References

Luque G., Alba E. (2011) *Parallel Genetic Algorithms: Theory and Real World Applications*. Springer.

Luke S. (2013) *Essentials of Metaheuristics*, 2nd edition. Lulu. Freely available at http://cs.gmu.edu/~sean/book/metaheuristics/.

Scrucca L. (2016). On some extensions to GA package: hybrid optimisation, parallelisation and islands evolution. Submitted to *R Journal*.

### See Also

`summary,gaisl-method`

,
`plot,gaisl-method`

,
`gaisl-class`

,
`ga`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
## Not run:
# two-dimensional Rastrigin function
Rastrigin <- function(x1, x2)
{
20 + x1^2 + x2^2 - 10*(cos(2*pi*x1) + cos(2*pi*x2))
}
x1 <- x2 <- seq(-5.12, 5.12, by = 0.1)
f <- outer(x1, x2, Rastrigin)
persp3D(x1, x2, f, theta = 50, phi = 20)
filled.contour(x1, x2, f, color.palette = jet.colors)
GA <- gaisl(type = "real-valued",
fitness = function(x) -Rastrigin(x[1], x[2]),
min = c(-5.12, -5.12), max = c(5.12, 5.12),
popSize = 80, maxiter = 500,
numIslands = 4, migrationInterval = 50)
summary(GA)
plot(GA)
## End(Not run)
``` |