darwin-js
A simple genetic algorithm framework for Node. Allows you to implement the genetic operators (selection, crossover and mutation), and fitness function, and it handles the rest. The "chromosomes" can be any datatype whatsoever, and the fitness function can either be synchronous or a Promise.
Install
npm install --save darwin-js
Usage
var ga = // Implement on your ownvar options = // Always copy over best individual without modification // to the next generation. elitism: true { // You have the option of returning a Promise here, if // G.A. needs to asynchronously reach out to the user, say, for a // subjective rating. return fitness } { // Return an individual population[k].individual based on // population[k].fitness. var k = ... return populationkindividual } { // Combine parent1 and parent2 somehow return child1 child2 } { // Mutate individual (or return unchanged) ... return mutant } iterations: 10000 { // Return true if fitness is high enough. Will // terminate G.A. even if it hasn't iterated 10000 times. return ... } { console console } // Run genetic algorithmga
API
TODO. See tests for a complete example for now.