initval | R Documentation |
Initialize the population with integer or real numbers
initval(n, m, prevpop, lb, ub, nmode="real", type, ...)
n |
Population size |
m |
Chromosome length (number of variables) |
prevpop |
Matrix of solutions used in heuristic and hybrid initialization |
lb |
Lower bound of each variables |
ub |
Upper bound of each variables |
nmode |
Type of variables (“integer” or “real”) |
type |
Type of output matrix |
... |
Further arguments passed to or from other methods. |
With this function, populations are initialized with integer and/or real numbers depending on the GA problem. In this case, the value type must be known. Furthermore, the lower and upper bound values for each variable must be known. If desired, heuristic or mixed initialization can be done with the prevpop
argument.
The output matrix includes only chromosomes of initial population when type=2
, otherwise The output matrix includes
chromosomes of initial population and additional two empty columns for generation number and fitness values.
Zeynel Cebeci & Erkut Tekeli
initbin
,
initperm
,
initnorm
,
initialize
n = 15 #Population size (number of chromosemes) m = 4 #number of Variables population = initval(n, m) head(population, 3) tail(population, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.