cc-by-sa
license; get it from http://goo.gl/lJ0909
Image by Johannes Bader, from his PhD Thesis
Image by Matt Kowal
Unfit for JavaScript. Will not survive even if the Red Bull dose is increased.
(function do_ea() {
eo.generation();
generation_count++;
if ( (generation_count % 100 === 0) ) {
do_periodic_stuff()
}
if( (eo.fitness_of[eo.population[0]] < traps*conf.fitness.b )
&& ( generation_count*conf.population_size < conf.max_evaluations)) {
setTimeout(do_ea, 5);
} else {
we_are_done();
}
})();
Jorge González, Juan J. Merelo Guervós, Pedro A. Castillo Valdivieso, Víctor Manuel Rivas Santos, Gustavo Romero: Optimizing Web Newspaper Layout Using Simulated Annealing. IWANN (2) 1999: 759-768
Merelo-Guervós, J. J., Castillo, et al. Asynchronous distributed genetic algorithms with Javascript and JSON. In IEEE Congress on Evolutionary Computation, 2008 pp. 1372-1379. IEEE.
Further versions using FluidDB and CouchDB. Not bad, but not excellent. Main problem, dealing with latency
Available at http://github.com/JJ/nodeo (+ experimental data)
var jsEOGA = new Class({
Extends: jsEOAlgorithm, /** more stuff after this **/
privateRun: function(_fitFn, _numGenerations, _showing) {
var popSize = this.population.length();
this.population.sort();
for (var j = 0; (j < _numGenerations); ++j) {
var newPop = this.indivSelector.operate(this.population);
for (var i = 0; i < newPop.length(); ++i) {
var tmpPop = new jsEOPopulation();
tmpPop.add(newPop.getAt(i)).join(newPop);
tmpPop = this.operSelector.
operate().
operate(tmpPop).
evaluate(_fitFn);
newPop.setAt(i, tmpPop.getAt(0));
}
this.population.join(newPop).sort().crop(popSize);
if (typeof this.opSend != 'undefined' && this.opSend != null) {
this.opSend.operate(this.population);
}
} //for numGenerations
},
run: function() {
this.privateRun();
}
});
Code @http://git.io/jseo by @vrivas.
do {
eo.generation();
generation_count++;
} while ( eo.not_finished() && eo.current_run());
if ( conf.peers ) {
var peer_url = conf.peers[ Math.floor(Math.random()*conf.peers.length )];
rest.get( peer_url+"/best" ).on('success', function(result) {
eo.incorporate( result.chromosome );
});
}
total_generations += generation_count;
if ( eo.way_to_go() ) {
setImmediate( generations );
} else {
eo.we_re_done();
process.exit();
}
generation_count++;
eo.generation();
if ( generation_count % conf.generation_run === 0 ) {
rest.put( pool_url+"/one/" + eo.population[0])
.on('complete', function(result) {
if ( result instanceof Error ) {log_errer(); }
});
rest.get( pool_url+"/random" )
.on('complete', function(result) {
if ( result instanceof Error ) { log_error(); }
else {
if ( result.chromosome) {
eo.incorporate( result.chromosome );
}
}
});
>Submitted to GECCO'2014 conference; and Open Science in GitHub .
sockets.io
.nodeo
.Use arrows for navigation