Skip to content

robations/php-pso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Experimental Particle Swarm Optimisation component

More information TBC.

If you have any suggestions on improvements to this project they would be gratefully received.

Basic usage

use Contrebis\Pso\Swarm;
use Contrebis\Pso\WeightVector;

$constants = array(
    'phi1' => 0.15,
    'phi2' => 0.15,
    'vMax' => 0.5,
    'inertia' => 0.97,
);
$fitnessFunc = function (WeightVector $x) {
    // insert your fitness function here
    // too lazy to think of a good example now!
    // high values are good, low values are bad
    return 0;
};
$swarm = new Swarm($constants, 10, 2, $fitnessFunc);

for ($i = 0; $i < $iterations; $i++) {
    $swarm->go();
}

echo "$swarm";

TODO

  • Add tests
  • Refactor out responsibility for creating initial positions and velocities
  • Pick and add a license

About

Experimental Particle Swarm Optimisation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages