PHP Classes

File: example/example1.php

Recommend this page to a friend!
  Classes of ryan silalahi   Simple Genetic Algorithm   example/example1.php   Download  
File: example/example1.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple Genetic Algorithm
Implement genetic algorithm to optimize population
Author: By
Last change:
Date: 9 years ago
Size: 663 bytes
 

Contents

Class file image Download
<?php

/*
    this example show how we use SimpleGeneticAlgorithm
*/

require __DIR__ . '/../vendor/autoload.php'; // composer autoload

$ga = new \SimpleGeneticAlgorithm\SimpleGeneticAlgorithm(array(
   
   
//'population' => 20,
    //'selection' => 90, // 90%
   
'mutation' => 25, // 25%
   
    //'seed' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890\'.,',
   
'goal' => 'Astari Ghaniarti',
   
   
//'max_iteration' => 50000,
   
'delay' => 50, // ms, if debug is false, then delay forced to 0
   
'debug' => true,
   
//'fitness_in_percent' => false, // usefull if chromosome more than 10 chars
));


//var_dump($ga->run());
$ga->run(); // just run because debug is true