diff --git a/js/genetic-0.1.14.js b/js/genetic-0.1.15.js similarity index 87% rename from js/genetic-0.1.14.js rename to js/genetic-0.1.15.js index b40a230..054b536 100644 --- a/js/genetic-0.1.14.js +++ b/js/genetic-0.1.15.js @@ -5,9 +5,9 @@ window.Genetic = require('./genetic'); },{"./genetic":2}],2:[function(require,module,exports){ var Genetic = Genetic || (function(){ - + 'use strict'; - + // facilitates communcation between web workers var Serialization = { "stringify": function (obj) { @@ -25,19 +25,19 @@ var Genetic = Genetic || (function(){ }); } }; - + var Clone = function(obj) { if (obj == null || typeof obj != "object") return obj; - + return JSON.parse(JSON.stringify(obj)); }; - + var Optimize = { "Maximize": function (a, b) { return a >= b; } , "Minimize": function (a, b) { return a < b; } }; - + var Select1 = { "Tournament2": function(pop) { var n = pop.length; @@ -64,7 +64,7 @@ var Genetic = Genetic || (function(){ return pop[(this.internalGenState["seq"]++)%pop.length].entity; } }; - + var Select2 = { "Tournament2": function(pop) { return [Select1.Tournament2.call(this, pop), Select1.Tournament2.call(this, pop)]; @@ -80,9 +80,9 @@ var Genetic = Genetic || (function(){ return [Select1.Fittest.call(this, pop), Select1.Random.call(this, pop)]; } }; - + function Genetic() { - + // population this.fitness = null; this.seed = null; @@ -93,7 +93,7 @@ var Genetic = Genetic || (function(){ this.optimize = null; this.generation = null; this.notification = null; - + this.configuration = { "size": 250 , "crossover": 0.9 @@ -104,33 +104,33 @@ var Genetic = Genetic || (function(){ , "webWorkers": true , "skip": 0 }; - + this.userData = {}; this.internalGenState = {}; - + this.entities = []; - + this.usingWebWorker = false; - + this.start = function() { - + var i; var self = this; - + function mutateOrNot(entity) { // applies mutation based on mutation probability return Math.random() <= self.configuration.mutation && self.mutate ? self.mutate(Clone(entity)) : entity; } - + // seed the population for (i=0;i=b},Minimize:function(a,b){return a=b},Minimize:function(a,b){return a= b; } , "Minimize": function (a, b) { return a < b; } }; - + var Select1 = { "Tournament2": function(pop) { var n = pop.length; @@ -59,7 +59,7 @@ var Genetic = Genetic || (function(){ return pop[(this.internalGenState["seq"]++)%pop.length].entity; } }; - + var Select2 = { "Tournament2": function(pop) { return [Select1.Tournament2.call(this, pop), Select1.Tournament2.call(this, pop)]; @@ -75,9 +75,9 @@ var Genetic = Genetic || (function(){ return [Select1.Fittest.call(this, pop), Select1.Random.call(this, pop)]; } }; - + function Genetic() { - + // population this.fitness = null; this.seed = null; @@ -88,7 +88,7 @@ var Genetic = Genetic || (function(){ this.optimize = null; this.generation = null; this.notification = null; - + this.configuration = { "size": 250 , "crossover": 0.9 @@ -99,33 +99,33 @@ var Genetic = Genetic || (function(){ , "webWorkers": true , "skip": 0 }; - + this.userData = {}; this.internalGenState = {}; - + this.entities = []; - + this.usingWebWorker = false; - + this.start = function() { - + var i; var self = this; - + function mutateOrNot(entity) { // applies mutation based on mutation probability return Math.random() <= self.configuration.mutation && self.mutate ? self.mutate(Clone(entity)) : entity; } - + // seed the population for (i=0;i