Skip to content

Instantly share code, notes, and snippets.

View MatthiasKrijgsman's full-sized avatar

Matthias Krijgsman MatthiasKrijgsman

View GitHub Profile
var DNA;
DNA = function(min, max, length){
// Gene's min and max value
this.minValue = parseFloat(min);
this.maxValue = parseFloat(max);
// Gene's array length
this.dnaLength = length
var Population;
Population = function(size, mutationRate, eliminationRate){
this.size = size;
this.mutationRate = mutationRate;
this.eliminationRate = eliminationRate;
this.pool = []
for(var x = 0; x < size; x++){
// Set Custom DNA Options
@MatthiasKrijgsman
MatthiasKrijgsman / Genetic.js
Created January 11, 2016 07:48
Simple but powerful Genetic Algorithm
/**
* Author: Matthias Krijgsman
*
* Genetic Operator: One-point crossover
*
* Options input json:
* size - Population Size
* elimination - Elimination Rate
* mutation - Mutation Rate
* geneSize - DNA Size