We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2db23b commit 38d7bb8Copy full SHA for 38d7bb8
GeneticAlgorithm.php
@@ -86,10 +86,15 @@ public function crossOver() {
86
}
87
88
public function mutation(){
89
+
90
$mutation_count = round((3 * 5) * $this->mutation_rate, 0, PHP_ROUND_HALF_DOWN);
91
92
for ($i=0;$i<$mutation_count;$i++){
93
$position = rand(1,(3 * 5));
- $chossed_chrom = round($position / 3 , 0 , PHP_ROUND_HALF_UP) - 1;
94
+ $chosen_chromosome = round($position / 3 , 0 , PHP_ROUND_HALF_UP) - 1;
95
+ $chosen_gen = (3 * 5) - ($chosen_chromosome * 3);
96
97
+ $this->chromosome[$chosen_chromosome][$chosen_gen] = rand(0,10);
98
99
100
0 commit comments