PHP Classes

PHP Genetic Algorithm Methods: Implements crossover, mutation and inversion

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (14)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 133 This week: 1All time: 9,298 This week: 560Up
Version License PHP version Categories
genetic_algorithm 1.0.0Freeware5Algorithms, PHP 5, Biology, Artificia...
Description 

Author

This class implements crossover, mutation and inversion genetic algorithm methods.

It takes several parameters to configure values that define how the execution of the genetic algorithm methods are implemented to optimize the order of a set of entities known as population.

Each method uses several techniques in order to produce their offsprings. Theses techniques are:

1. Crossover

1.1 Single Point Crossover
1.2 Two Points Crossover
1.3 Uniform Crossover
1.4 Ring Crossover

2. Mutation

2.1 Bit Flip Mutation
2.2 Random Resetting
2.3 Swap Mutation
2.4 Scramble Mutation
2.5 Inversion Mutation
2.6 Insertion Mutation

3. Inversion

3.1 Inversion all chromosome

The class produces new population generations and returns the results as a binary encoded string.

Picture of Sasan Nobakht
  Performance   Level  
Name: Sasan Nobakht <contact>
Classes: 1 package by
Country: United States United States
Age: 34
All time rank: 4315547 in United States United States
Week rank: 411 Up48 in United States United States Up

Example

<?php
set_time_limit
(0);
ini_set('memory_limit', '1024M'); // or you could use 1G

require_once 'Genetic.class.php';
$Genetic = new GeneticAlgorithm (
    array(
       
'Goal' => 'AI',

       
'PopulationSize' => 200, // Size of Population In Each Generation
       
'MaxIteration' => 400,
       
'GenerationGap' => 100, // Percent of Checking Fitness Function on Population
       
'Age' => 6,
       
'Strategy' => 'M,L',
       
'Elitism' => true,

       
'MinAcceptableFitness' => 0,
       
'CodingType' => 'Binary',

       
'CrossOverRate' => 100, // Percent
       
'MutationRate' => 100, // Percent
       
'InversionRate' => 100, // Percent

       
'CrossOverTechnique' => 1,
       
'MutationTechnique' => 1,

       
'SingleCrossOverPoint' => 3,
       
'TwoCrossOverPoint1' => 2,
       
'TwoCrossOverPoint2' => 4,
       
'UniformCrossOverRatio' => 50, // Percent
       
'RingCrossOverCuttingPoint' => 3,
       
'RingCrossOverCuttingByRandom' => false
   
)
);

$Genetic->Run();

echo
"<pre>";
print_r(array_reverse($Genetic->Generations));
echo
"</pre>";


Screenshots  
  • Standalone
  • Chromosome.png
  • GenerationTable.png
  • Result
  • Form.png
  • Intro.png
  Files folder image Files  
File Role Description
Files folder imageImages (1 file)
Files folder imageJavascripts (6 files)
Files folder imageStyles (3 files)
Accessible without login Plain text file Ajax.php Example Load Ajax Result
Accessible without login Plain text file Genetic.class.php Class Main Genetic Algorithm Class
Accessible without login Plain text file index.php Aux. Demo Mainpage
Accessible without login Plain text file StandaloneExample.php Example Standalone Example

  Files folder image Files  /  Images  
File Role Description
  Accessible without login Image file ex2_bg.png Photo Background

  Files folder image Files  /  Javascripts  
File Role Description
  Accessible without login Plain text file Bootstrap.Bundle.js Class Bootstrap Bundle
  Accessible without login Plain text file Bootstrap.js Class Bootstrap Library
  Accessible without login Plain text file Javascript.js Class Main Javascript
  Accessible without login Plain text file JQuery.Easing.js Class JQuery Easing Plugin
  Accessible without login Plain text file JQuery.js Class JQuery Library
  Accessible without login Plain text file Popper.js Class Popper JS

  Files folder image Files  /  Styles  
File Role Description
  Accessible without login Plain text file Bootstrap.css Class Bootstrap Library
  Accessible without login Plain text file Normalize.css Class Normalize HTML Pages
  Accessible without login Plain text file Style.css Class Demo Style

 Version Control Unique User Downloads Download Rankings  
 0%
Total:133
This week:1
All time:9,298
This week:560Up