[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Oct 17 15:43:13 2002 
Subject:Copying Lists 
From:msc37ack 
Volume-ID:1021017.03 


Hi everyone, I've got a problem.

I'm writing a genetic algorithm.  My population is a list of chromosomes 
in the variable 'population'.  I'm trying to overwrite one choromosome 
with a copy of another:

population(20) -> population(19);

However I find that anything do to population(20) is automatically done to 
population(19).  This means that I'm ending up with most of the population 
becoming the same, but not because its found a good solution. 

I'd be very greatful for any suggestions,

Thanks

Adam Knowles
MSc Natural Computation
 
P.S. A copy of the mutation function I'm using is below (the chromosomes 
are binary 0s and 1s)


define mutate(chom);
lvars pos;
    1 + random0( chom_length) -> pos;

    if population(chom)(pos) == 1 then
        0 -> population(chom)(pos);
    else
        1 -> population(chom)(pos);
    endif;
enddefine;