| random_population | R Documentation |
Randomly generate the individuals' chromosomes (changepoint confirgurations) to construct the first generation population.
random_population(popSize, prange, N, minDist, pchangepoint, mmax, lmax)
popSize |
An integer represents the number of individual in each population for GA (or subpopulation for IslandGA). |
prange |
Default is |
N |
The length of time series. |
minDist |
The minimum length between two adjacent changepoints. |
pchangepoint |
Same as |
mmax |
The maximum possible number of changepoints in the data set. |
lmax |
The maximum possible length of the chromosome representation. |
Each population can be stored in a matrix with lmax rows and
popSize columns, where each column represents an individual chromosome
in the format of
C = (m, \boldsymbol{s}, \boldsymbol{\tau}, N+1)',
in cptga or cptgaisl. This function can randomly
initialize the population matrix with some imposed constraints, such as
ensuring the number of time points between two adjacent changepoints is
greater than or equal to minDist. This prevents unrealistic scenario
of two changepoints being too close to each other and helps reduce the total
number of admissible solutions in the search space. Users can adjust the
level of searching space reduction by setting an appropriate value for
minDist. During population initialization, each changepoint location
in \boldsymbol{\tau} can be selected sequentially. With a specified
probability pchangepoint denoting the probability of a time point
being selected as a changepoint, the first changepoint \tau_{1} is
randomly picked between t=1+minDist and t=N. Then \tau_{2}
is randomly selected from a smaller range between t=\tau_{1}+minDist
and t=N. The process is continued until the last admissible changepoint
t=N-minDist is exceeded, and the number of changepoints m is
obtained automatically. For added flexibility, users can specify their own
population initialization function. The default population initialization uses
selectTau to select the chromosome for the first generation
population.
A matrix that contains each individual's chromosome.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.