Skip to content

Commit c6739f2

Browse files
committed
return max fitness
1 parent f55ac72 commit c6739f2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

GeneticAlgorithm.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public function calcFitness(){
8484
}
8585
}
8686

87+
public function maxFitness() {
88+
return $this->max_fitness;
89+
}
8790
public function calcProbability(){
8891
$sum = 0;
8992
for ($i=0;$i<5;$i++) {

index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111

1212
require_once "GeneticAlgorithm.php";
1313

14-
$ga = new GeneticAlgorithm();
14+
$ga = new GeneticAlgorithm();
15+
echo "<br>";
16+
$result = $ga->maxFitness();
17+
echo count($result);

0 commit comments

Comments
 (0)