Function performs a compact genetic algorithm search for a given evaluation function.
cga(chsize, popsize, evalFunc)
Number of bits
Number of population. By default it is 20
Function to minimize
Returns the best chromosome with size of chsize.
CGA (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] than [0,0,0,1,1] when the probability vector is [0.9,0.9,0.9,0.1,0.1].