Displaying 1 result from an estimated 1 matches for "create_population".
2009 Apr 26
3
3 questions regarding matrix copy/shuffle/compares
...n equivalent R code segment?
Thanks,
Esmail
--------------- the code called above -------------
####################################################
# create a binary vector of size "len"
#
create_bin_Chromosome <- function(len)
{
sample(0:1, len, replace=T)
}
############## create_population ###################
# create population of chromosomes of length len
# the matrix contains twice as much space as popsize
#
create_pop_2 <- function(popsize, len)
{
datasize=len*popsize
print(datasize)
npop <- matrix(0, popsize*2, len, byrow=T)
for(i in 1:popsize)
npop[i,] =...