Learn R Programming

nlmixr2auto (version 1.0.0)

create.pop: Create an initial GA population

Description

Generates an initial population for a genetic algorithm (GA). Each individual is a binary chromosome represented by a numeric vector containing 0 and 1.

Usage

create.pop(npop, nbits)

Value

A numeric matrix with npop rows and nbits columns containing only 0 and 1. Each row corresponds to one chromosome.

Arguments

npop

Integer. Number of individuals (chromosomes) in the population.

nbits

Integer. Number of bits in each chromosome.

Author

Zhonghui Huang

Details

Bits are sampled independently. Each bit takes the value 0 or 1 with equal probability.

Examples

Run this code
create.pop(npop = 10, nbits = 12)

Run the code above in your browser using DataLab