IslandGA: Island model based genetic algorithm

View source: R/IslandGA.R

IslandGAR Documentation

Island model based genetic algorithm

Description

Perform the modified island-based genetic algorithm (IslandGA) for multiple changepoint detection. Minimization of an objective function using genetic algorithm (GA). The algorithm can be run sequentially or in explicit parallelisation.

Usage

IslandGA(
  ObjFunc,
  N,
  IslandGA_param = .default.IslandGA_param,
  IslandGA_operators = .default.operators,
  p.range = NULL,
  ...
)

Arguments

ObjFunc

The fitness function to be minimized. Users can specify any R or Rcpp functions as the fitness function with setting input as potential solution to the optimization problem and returning a numerical value as the output/fitness.

N

The sample size of the time series.

IslandGA_param

A list contains the hyper-parameters for IslandGA. The default values for these hyper-parameters are included in .default.IslandGA_param. See IslandGA_param for the details.

IslandGA_operators

A list includes the functions for population initialization, new individual selection, and genetic operator of crossover and mutation. See operators for the details and default functions.

p.range

Default is NULL for only changepoint detection. If p.range is specified as a list object, which contains the range of each model order parameters for order selection (integers). The number of order parameters must be equal to the length of p.range.

...

additional arguments that will be passed to the fitness function.

Value

Returns a list that has the following components.

overbestfit

The obtained minimum value of the objective function after the final iteration.

overbestchrom

The locations of the detected changepoints associating with the overbestfit the after the final iteration.

bestfit

The minimized fitness function values at each iteration.

bestchrom

The detected changepoints at each iteration.

countMig

The number of migrations undertaken by the IslandGA.

count

The number of iterations (generations) undertaken by the island genetic algorithm model.

convg

An integer code.

  • 0 indicates the algorithm successful completion.

  • 1 indicates the the total number of generations exceeds the prespecified maxgen limit.

Examples

N = 1000
XMatT = matrix(1, nrow=N, ncol=1)
Xt = ts.sim(beta=0.5, XMat=XMatT, sigma=1, phi=0.5, theta=NULL,
            Delta=c(2, -2), CpLoc=c(250, 750), seed=1234)
TsPlotCheck(X=1:N, Xat=seq(from=1, to=N, length=10), Y=Xt, tau=c(250, 750))

IslandGA.res = IslandGA(ObjFunc=BinSearch.BIC, N=N, Xt=Xt)
IslandGA.res$overbestfit
IslandGA.res$overbestchrom


changepointGA documentation built on April 4, 2025, 4:39 a.m.