Skip to content
rmorenoga edited this page Aug 19, 2016 · 10 revisions

#Setting Up

To set up the evolutionary system the simulation in V-REP and the Java Evolutionary framework (JEAF) should be downloaded and set up. This guide will concentrate on setting up the evolution on an Ubuntu 14.04 64 Bit computer.

For this project to work, a Java Runtime Environment (JRE) or a Java Development Kit (JDK) version 1.7 or newer should be installed. A guide on how to install a JRE or JDK on Ubuntu can be found here

The source code is set up as an Eclipse project. It can be cloned and then imported into the workspace of Eclipse, or it can be cloned directly to Eclipse by using Egit

This page is divided in two parts, how to set up an evolutionary process running in only one CPU and how to set up the process to evaluate individuals in more than one simulator.

##Simulator

The V-REP simulator can be downloaded here, for this project the Linux 64 bit Pro edu version is used.

The simulator comes in a compressed file that can be put anywhere on the file system, we recommend to uncompress it under the /home/username/V-REP/ folder. Starting from version 3.3.0 V-REP can be compiled to work without GUI, this is specially important when running simulations on clusters or workstations with only text based terminals; a short guide on how to compile V-REP without a GUI can be found here

For JEAF to be able to communicate with the V-REP simulator the continuous remoteApi server should be activated (V-REP manual). The server should be activated by default but it is always better to check the "remoteApiConnections.txt" file inside the V-REP folder, also in this file the value of the port used to connect to the simulator server is set.

##Simulation

The simulation scene files can be found in the Maze folder (/Simulation/Maze/).

The file MazeBuilder01.ttt contains all that is needed for the evolution of a robot with no sensors to take place. This file receives the parameters from the main evolutionary algorithms in java, builds a maze for the robot, runs the simulation and returns a fitness to the main algorithm, for it to work properly, the file should be opened with V-REP and the script associated with the InitControl object should be modified.

Inside the InitControl object script are four lines that load the basic parts of the maze like this:

shandle = simLoadModel("/home/.../V-REP/corridors/StraigthCorr.ttm")

and should be modified to reflect the location of the model files in the file system, the model files can be found inside the corridors folder under the Maze folder (/Simulation/Maze/).

More information about the simulation can be found in the Simulation section of this wiki.

JEAF and Java

The Java language was chosen for this project since there already are evolutionary frameworks that can be used with some minor modifications or just configuring parameters, being JEAF one example. The JEAF libraries and classes must be included in the path when building the Java code in order for it to work properly. The JEAF jar files and other libraries that it depends on are included in the /VREPControl/lib/ folder.

Also, for communicating with the simulator, the file "libremoteApiJava.so", that can be found in the folder /programming/remoteApiBindings/java/lib/64Bit inside V-REP files, must be also on the java path; the coppelia package, which can be found in /programming/remoteApiBindings/java, should be included in the path too.

To simplify the process of building java programs and setting all path variables the Eclipse IDE is used and all the java code in this repository is configured and can be imported as an Eclipse project.

An evolutionary run example can be found here.

###Parallel Execution

Several copies of the simulator can be created; to copy the simulator just copy all the files contained in the compressed file and put them on a different folder, for example copy them to /home/../V-REP/Vrep0/ and /home/../V-REP/Vrep1/. The numbering makes them easier to call later from the main evolutionary algorithms in java.

Three files should be modified inside the simulators files in order for them to run properly with this project, for example for the simulator in .../V-REP/Vrep0/ the files "vrep" and "vrep.sh" should be changed to "vrep0" and "vrep0.sh" respectively, also the field's "portIndex1_port" value inside the "remoteApiConnections.txt" file should be changed depending on the number of the simulator; for the simulator on ../Vrep0/ the value should be 19997, for ../Vrep1/ it should be 19996 (which is 19997-1) and so forth.

##MPJ

In order for the JEAF framework to work the mpj library should be installed, to do this first download it from the mpj-express project page http://mpj-express.org/download.php the mpj library comes in a compressed folder and can be put anywhere on the file system, we recommend to uncompress it in a folder under the /home/ folder (for example /home/username/MPJ/). The following lines should be added to the .bashrc file (for version 0.43 of mpj):

export MPJ_HOME=/home/username/MPJ/mpj-v0_43
export PATH=$MPJ_HOME/bin:$PATH

and they should go before the line that says:

\#If not running interactively, don't do anything

After restarting the user session in Ubuntu MPJ should be ready to work.

Clone this wiki locally