Ejemplo n.º 1
0
Archivo: ga.php Proyecto: piiskop/pstk
require_once 'individual.php';
//supporting individual
require_once 'population.php';
//supporting population
require_once 'fitnesscalc.php';
//supporting fitnesscalc
require_once 'algorithm.php';
//supporting fitnesscalc
$solution_phrase = "A genetic algorithm found!";
algorithm::$uniformRate = 0.5;
algorithm::$mutationRate = 0.05;
algorithm::$poolSize = 15;
/* crossover how many to select in each pool to breed from */
$initial_population_size = 45;
//how many random individuals are in initial population (generation 0)
algorithm::$max_generation_stagnant = 400;
//maximum number of unchanged generations terminate loop
algorithm::$elitism = true;
//keep fittest individual  for next gen
$lowest_time_s = 100.0;
//keeps track of lowest time in seconds
$generationCount = 0;
$generation_stagnant = 0;
$most_fit = 0;
$most_fit_last = 400;
echo "\n ________                      __  .__        ";
echo "\n/  _____/  ____   ____   _____/  |_|__| ____  ";
echo "\n/   \\  ____/ __ \\ /    \\_/ __ \\   __\\  |/ ___\\ ";
echo "\n\\    \\_\\  \\  ___/|   |  \\  ___/|  | |  \\  \\___ ";
echo "\n\\______  /\\___  >___|  /\\___  >__| |__|\\___  >";
echo "\n       \\/     \\/     \\/     \\/             \\/ ";