1. Go to this page and download the library: Download petercoles/gao library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
petercoles / gao example snippets
php
use PeterColes\GAO\Solution;
class MySolution extends Solution
{
public function genome()
{
return [
['char', 'ABC'],
['float', 0, 1],
['integer', -100, 100],
];
}
public function evaluate($data = null)
{
$this->fitness = (ord($this->chromosomes[0]) + $this->chromosomes[2]) / $this->chromosomes[1];
}
}
php
$optimiser = new Optimiser(new Population(MySolution::class, 100));
$optimiser->run();
foreach ($optimiser->results as $solution) {
print_r($solution->summary());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.