Learn R Programming

eive (version 3.1.3)

cga_generate_chromosome: Generate Chromosome

Description

Generate a binary vector using a probability vector This function is not directly called by user. CGAs (Compact genetic algorithms) sample chromosomes using this probability vector. A probability vector contains[P1, P2, ..., PN] and the function generates and returns a chromosome[B1, B2, ..., BN]. The probability of BK having the value of 1 is PK. So, it has more chance to have [1, 1, 1, 0, 0] rather than [0, 0, 0, 1, 1] when the probability vector is [0.9, 0.9, 0.9, 0.1, 0.1].

Usage

cga_generate_chromosome(prob_vec, vect)

Value

Mutates the vect. Returns null.

Arguments

prob_vec

Vector of probabilities

vect

Vector of bits.