Skip to content

Commit

Permalink
README updates
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianton3 committed Mar 29, 2015
1 parent 82ccbdb commit 960900c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Sample applications

+ [simple](http://adrianton3.github.io/pso.js/examples/simple/simple.html) A simple application that optimizes a one dimensional function
+ [simple-require](http://adrianton3.github.io/pso.js/examples/simple_require/simple_require.html) The same as *simple*, except using RequireJS
+ [simple-node](http://adrianton3.github.io/pso.js/examples/node/node.js) A simple node example
+ [automaton](http://adrianton3.github.io/pso.js/examples/automaton/automaton.html) A more sophisticated application that adapts a mechanism for a specified output path.
pso.js is launched in this case by web workers
+ [circles](http://adrianton3.github.io/pso.js/examples/circles/circles.html) A simple application that optimizes a two dimensional function
Expand All @@ -30,7 +31,7 @@ var optimizer = new pso.Optimizer();
// set the objective function
optimizer.setObjectiveFunction(function (x) { return -(x[0] * x[0] + x[1] * x[1]); });

// set an initial population of 20 particles spread across the search space *[-10, 10] x [-10, 10]*
// set an initial population of 20 particles spread across the search space *[-10, 10] x [-10, 10]*
optimizer.init(20, [{ start: -10, end: 10 }, { start: -10, end: 10 }]);

// run the optimizer 40 iterations
Expand All @@ -51,11 +52,14 @@ The `setOptions` method takes a single map-like object - here are its default va
{
inertiaWeight: 0.8,
social: 0.4,
personal: 0.4
personal: 0.4,
pressure: 0.5
}
```

The `social` parameter dictates how much a particle should be influenced by the best performing particle in the swarm.
The `personal` parameter dictates how much a particle should be influenced by the best position it has been in.

+ `inertiaWeight` is multiplied every frame with the previous velocity
+ `social` dictates how much a particle should be influenced by the best performing particle in the swarm
+ `personal` indicates how much a particle should be influenced by the best position it has been in
+ `pressure` is the bias in selecting the best performing particle in the swarm

For more details consult the [annotated source](http://adrianton3.github.io/pso.js/docs/pso.html).
2 changes: 1 addition & 1 deletion examples/node/node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var pso = require('../../src/pso.js');
var pso = require('pso');

// create the optimizer
var optimizer = new pso.Optimizer();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pso",
"description": "Particle Swarm Optimization library",
"author": "Adrian Toncean <[email protected]>",
"version": "0.1.0",
"version": "1.0.0",
"main": "src/pso.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit 960900c

Please sign in to comment.