- or download this
$population = regenrate_population();
...
...
}
return $new_population;
}
- or download this
my $crossover_point = int( rand($chromosome_size) );
for my $i ( 0 .. ( $chromosome_size - 1 ) ) {
...
push( @$new_chromosome, @$chromosome2[$i] );
}
}
- or download this
my $crossover_point = int( rand($chromosome_size) );
$new_chromosome = [
@{$chromosome1}[ 0 .. $crossover_point-1],
@{$chromosome2}[ $crossover_point .. $#{$chromosome2} ]
];