NodEO, a Multi-Paradigm Distributed Evolutionary Algorithm Platform in JavaScript

Merelo, Castillo, Mora, Esparcia-Alcázar, Rivas

GECCO-EvoSoft 2014

cc-by-sa license; get it from http://goo.gl/U4fgHd

Oh, no!

Image found in my disk drive

Originally in Flickr 210884378_277f124084_b.jpg

Not another EA framework in another language!

Image found in my disk drive

Originally in Flickr 91562666_1408ed489e_o.jpg

But this one is in JavaScript!

Image found in my disk drive

Originally in Flickr 2603767663_cec10bcfb7_b.jpg

JavaScript is here and there and everywhere

Untitled by  Luke Wroblewski

Image by Luke Wroblewski at https://flic.kr/p/gS8e2R

In fact, let's use it

11111111000000001111111100000000

You can do this at home!

11111111000000001111111100000000
00000000111111110000000011111111

Let's see how all this plays together

Check it out at http://goo.gl/yXpcKG

But JavaScript is asynchronous!

Can

Originally in Flickr 2603767663_cec10bcfb7_b.jpg

What does that mean?

Representation of migration and other I/O events in JS

How this plays out on the browser

(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();
	}
    })();

And in the server...

generate_population();
do_evolution();

function do_evolution(){
  single_generation();
  if (time_to_migrate()) {
    migrate_out();
    migrate_in();
  }
  if ( !evolution_end() ) {
    do_after_callbacks( do_evolution);
  }
}

Let's get to the EvoSoft thingie

nodeo in npm

Available at http://github.com/JJ/nodeo (+ experimental data)

NodEO for distributed EAs

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();
    }

I want to be just a client

    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) {
                    else {
			if ( result.chromosome) {
			    eo.incorporate( result.chromosome );
			}
		    }
		});

The right population

Base-hit

Where should we run it?

VM comparison

Better a pool...

islands

Image by Sarah Ackerman https://flic.kr/p/fSPGrs

.. or peer to peer?

canine tug of war

Image by vanhookc https://flic.kr/p/9B61uF

Who arrives first?

peer of a client

And who's the best at getting there?

peer of a client

Where's the beef?

Javascript is great for computer science && distributed evolutionary computation && massively scalable browser-based volunteer computing stuff

But if you use it, a pool-based system is probably a better idea

That's all

Questions?

Check out MUSES, mobile corporate security- Follow our research at @geneura (or look us up for European H2020 projects) or buy my novels at Amazon

Download this presentation from git.io/uniajq

Use arrows for navigation