Hi,
In my Genetic Algorithm program, I have a class called Genome. Another
class called GA has a class variable called 'population' which is an array
of type Genome.
One of the methods in GA, called CreateNextGener ation(), creates a local
array of class Genome called 'nextGeneration ', and at the end of that
method I want the class variable 'population' to hold the array
'nextGeneration '.
Is it as simple as?
population = nextGeneration;
At the moment class Genome contains a copy method, and I have a loop which
copies all the Genomes in 'nextGeneration ' to 'population' (the 2 arrays
are always the same size). This is obviously ineffecient, but I was
worried about what memory and garbage collection overheads there would be
it I used the line:
population = nextGeneration;
Should using this line be ok?
Many thanks,
MS
In my Genetic Algorithm program, I have a class called Genome. Another
class called GA has a class variable called 'population' which is an array
of type Genome.
One of the methods in GA, called CreateNextGener ation(), creates a local
array of class Genome called 'nextGeneration ', and at the end of that
method I want the class variable 'population' to hold the array
'nextGeneration '.
Is it as simple as?
population = nextGeneration;
At the moment class Genome contains a copy method, and I have a loop which
copies all the Genomes in 'nextGeneration ' to 'population' (the 2 arrays
are always the same size). This is obviously ineffecient, but I was
worried about what memory and garbage collection overheads there would be
it I used the line:
population = nextGeneration;
Should using this line be ok?
Many thanks,
MS
Comment