Distributed evolution

Fra Robin

Gå til: navigasjon, søk

Optimizing a robot's morphology and controller using evolutionary computation can be a time-consuming task. When the fitness evaluation of a single individual takes on the order of seconds of computation employing physics simulation software on a single processor, an entire evolutionary run (e.g., even a modest 100 generations of a 100-individual population) can take around 3 hours. To get statistically significant data, 10-20 runs are necessary. Developing the algorithm (tuning the mutation rate; choosing selection, mutation, and recombination operators; experimenting with artificial development; ...) requires many such runs. Let's not even get into more computationally demanding soft-body simulations, yet. Your biological clock is ticking...

Enter distributed computing: Put to use our many idling CPUs; relieve these multi-core powerhouses of the tedium of running word-processing and interweb-surfing software.

Ingredients:

  • 1 Linux server (e.g., one of our login servers, e.g. diamant.ifi.uio.no)
  • 80-300+ (or as many as you can get) central processing unit cores, on a network with the server
  • 1 whole Python, fresh (which will include important packages like Threading, Sockets, and Pickle)
  • 1 C++ compiler, with optional IDE (Microsoft Visual Studio 2008 used here)
  • 1 installation of the Boost C++ libraries, in particular booost::asio for network communications (alternately, your favorite networking library)
  • 1 NVidia PhysX SDK v2.8.4 (this, the latest version, doesn't require installation of system software, making it simple to distribute)
  • + optionally a dash of PyQt4 and MatPlotLib (Python packages)

After whispering an incantation against silliness, set the Python aside to let it adjust to room temperature.

Prepare a RemoteFitnessEvaluator application by gently folding together C++, boost::asio, and PhysX. When run, this application will repeatedly try to make a connection to our server application (described later); when it does, it will wait to receive the genetic code, which it will use to construct a model of our robot in PhysX. It will the simulate the robot for some period of time and measure its fitness based on the task at hand (e.g., locomotion). Then it will return the fitness value to the server and wait for the next genome.

Prepare the Python by coding it into a server application to perform the core of the evolutionary algorithm: generating genomes, managing a population, applying selection, mutation, and combination operators. This application delegates the responsibility of fitness evaluation to the clients described above. In order to use the clients, it listens for and manages a collection of connections to clients, using a combination of sockets (for network communications) and threads (to do non-blocking IO). This collection is the worker pool. When the algorithm wants fitnesses evaluated, it takes workers from the pool and starts them working; they send genomes over the network to the clients and wait (each in a separate thread) for a response. The algorithm waits for all workers to complete, then continues on its merry way. After each generation of the algorithm, the genomes and fitnesses of the population are saved to disk (using Pickle) for later analysis.

A large amount of data can accumulate by this process, especially when many repetitions of many runs are performed using various parameter values and operators of evolutionary computation. It can be helpful to have a tool to browse this data. Using Python and PyQt4, a GUI for browsing the data sets can be created which allows to quickly identify which parameters and operators were used in a run or set of runs, and what results were obtained. Furthermore, selected datasets can be aggregated and processed, then plotted using MatPlotLib, which gives access to plotting facilities nearly identical to those of MATLAB.

Serve with mayonnaise.

Bon apetit!

Personlige verktøy