Skip to content

Commit

Permalink
Updated Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
aprowe committed Mar 4, 2015
1 parent 13125c2 commit 0de8367
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ evoJS is a genetic algorithm 'calculator', making it easy to incoporate evolutio
Wrapped in the library are simple ANN (Artificial Neural Network) and CPPN (Compositional Pattern Producing Network)
classes that work easily with the genetic algorithm.

Installation
-------------
evoJS is compatible with both require.js and node.


Usage
---------
Expand Down Expand Up @@ -33,6 +37,9 @@ Getting started is easy:
Gradually, the gene pool will evolve to maxmize the score.
The magic happens in `pool.next` and `pool.report`. `pool.next()` will retrieve the next set of genes,
and when the pool is empty, it will breed all of the specimens you have reported back to the pool via `pool.report`.

###### Triggers
----------
We can monitor for when a generation is computed with the 'breed' trigger.

```javascript
Expand All @@ -41,21 +48,21 @@ We can monitor for when a generation is computed with the 'breed' trigger.
});
```

For easy creation of objects using the genes, we can use the 'spawn' trigger. This lets you define a function
to shortcut the creation of your genetic object.
###### Spawn Objects
For easy creation of objects using the genes, we can use the 'spawn' trigger. This lets you define a function to shortcut the creation of your genetic object.

```javascript
pool.on('spawn', function(genes){
var net = evo.network('cppn', genes);
return net
return net;
});
```

The return value of this function will be returned when `pool.spawn` is called.
Now, we can do this:

```javascript
var net = pool.spawn()
var net = pool.spawn();

// Evaluate the network
var output = net.calc([0,1,2]);
Expand All @@ -64,10 +71,9 @@ Now, we can do this:
net.score = output[0] - output[1];

// pool reference is now stored in net.
net.report()
net.report();
```

More to Come
----------
evoJS is a baby.
It will remain simple and general, but more usage and example are to be posted.
evoJS is a just baby!

0 comments on commit 0de8367

Please sign in to comment.