Wilfried ifeherva Anita Thomas D

Short video on installing and running FREVO

Installation Instructions

FREVO requires the Java environment (version min. 1.6) to be installed. Type java -version in the console to see if you have the compatible version installed.

Running FREVO

To simply start FREVO with its GUI, follow these steps:

  1. Start a console window and type

    java -jar createscripts.jar

    This will create the script files used to start FREVO.
  2. Based on your operating system, run the following file:

Windows: launch_Frevo.bat

Unix/Linux/Mac OSX: ./launch_Frevo.sh

Developing with FREVO:

FREVO is primarily developed using Eclipse.

The Eclipse project file can be found in the root directory. Use "import existing project into workspace" to import FREVO into your Eclipse workspace.

Getting around with FREVO

Composing a new simulation session and run them

To set up a new session, start FREVO with the graphical user interface. The first thing that should be selected is the Problem Implementation. To do this, click the “problem” label, outlined in red. Select “Problem”. The “Select Problem Component” window will then pop up.

  • Select a problem component. Here, “Cellular automaton morphogenesis” (Cam) is selected.
  • Define parameters in the table. Here, the “simulation steps” parameter is selected in yellow. To define a parameter, double click and enter a value.
  • When you are finished, click “Confirm” at the bottom of the screen.
  • Repeat this step for the Method, Candidate Representation and Ranking, selecting the required parameters.

Now you should have defined your parameters. To run the simulation, click the “Play” button and the simulation shall start.

One can use the “Reset” button to clear all ongoing simulations.
The bottom half of the screen shows information and the progress bar (again outlined in red).
When the simulation is finished, results will be saved in the “FREVO” folder, under “Results”.

Saving and loading a session

Evaluate results

Creating a new Problem

In this tutorial we will implement a problem definition. In particular, it will be a simulation where agents try to find an emergency exit. As a prerequisite, you should have installed Java, eclipse, downloaded Frevo and imported it as an eclipse project.

Let's start:

  • Run FREVO and open the Component Creator

  • A window opens. Here you have to select the type of the component you want to create (Problem, Method, Representation, Ranking). We will select Problem. Then you have to enter a name and a short description.

  • Click on "Create" and follow the instructions that are shown. A new folder, containing your .java file, and an .xml file will be generated. (in this case "EmergencyExit.java" and "EmergencyExit.xml")
  • The generated *.java file looks like this:

public class EmergencyExit extends AbstractSingleProblem {

  protected double evaluateCandidate(AbstractRepresentation candidate) {
    return 0;

  public void replayWithVisualization(AbstractRepresentation candidate) {

  public double getMaximumFitness() {
    return Double.MAX_VALUE;

    • evaluateCandidate() is called to simulate without visualization, it should return a fitness value.
    • replayWithVisualization() is (as the name says) called to replay the simulation with a (possible graphical) visualization.
    • getMaximumFitness() should return the maximum Fitness that can be reached. If this Value is not known Double.Max_Value should be returned. This Value can be used by the optimization algorithm to stop optimization if this value has been reached
  • Implement your simulation. (it is useful to extract it in an own function. So you can call it from getResult() and replayWithVisualization).
    For this tutorial I started with a very simple simulation:

  int steps;
  int xpositionofEmergencyExit = 0;
  int ypositionofEmergencyExit = 0;
  int width;
  int height;
  int xpositionofAgent;
  int ypositionofAgent;
  AbstractRepresentation c;

  void calcSim(){

    xpositionofEmergencyExit = Integer.parseInt(getProperties().get("xpositionofEmergencyExit").getValue());
    ypositionofEmergencyExit = Integer.parseInt(getProperties().get("ypositionofEmergencyExit").getValue());
    xpositionofAgent = Integer.parseInt(getProperties().get("xpositionofAgent").getValue());
    ypositionofAgent = Integer.parseInt(getProperties().get("ypositionofAgent").getValue());

    for (int step = 0; step < steps; step++) {
      ArrayList<Float> input = new ArrayList<Float>();
      input.add((float) (xpositionofEmergencyExit - xpositionofAgent));
      input.add((float) (ypositionofEmergencyExit - ypositionofAgent));

      ArrayList<Float> output = c.getOutput(input);

      float xVelocity = output.get(0).floatValue()*2.0f-1.0f;
      float yVelocity = output.get(1).floatValue()*2.0f-1.0f;

      if (xVelocity >= 1.0 && xpositionofAgent < width - 1) xpositionofAgent += 1;
      else if (xVelocity <= -1.0 && xpositionofAgent > 0 ) xpositionofAgent -= 1;
      if (yVelocity >= 1.0 && ypositionofAgent < height - 1) ypositionofAgent += 1;
      else if (yVelocity <= -1.0 && ypositionofAgent > 0) ypositionofAgent -= 1;

The position of the emergency exit and the agent are read from the .xml file which is accessed getProperties().get(name).getValue(). name represents the name of the value in the .xml file. The value of "steps", "width" and "height" are written in the functions evaluateCandidate() and replayWithVisualization(). The main function of FREVO is to find the best function between input and the output automatically. So you just have to collect all the inputs and the representation (here it is c) will return the output. It is important that all the inputs and all the outputs are always in the same order. The output is always a float value between 0.0 and 1.0. You have to decide how to handle these outputs. In this simulation the output defines how the agent moves.

  • Now the code of the simulation is finished but it needs to be called by evaluateCandidate().

protected double evaluateCandidate(AbstractRepresentation candidate) {
  steps = Integer.parseInt(getProperties().get("steps").getValue());
  width = Integer.parseInt(getProperties().get("width").getValue());
  height = Integer.parseInt(getProperties().get("height").getValue());
  c = candidate;


  return -FastMath.hypot(xpositionofEmergencyExit - xpositionofAgent, ypositionofEmergencyExit - ypositionofAgent);

As we said before the values of “steps”, “width” and “height” have to be written in this function. They are read from the *.xml file. The return value of this function says how good this representation was. It says if this value is high, the connection of input and output is good. For the emergencyExit simulation this value is the negative distance between the agent and the emergency exit. So if the agent reaches the emergency exit within the amount of steps, the distance will be 0 and so it says it is a good way of connecting input and output.

So, we have to edit EmergencyExit.xml in order to add the component-specific properties:

  <propentry key="xpositionofEmergencyExit" type="INT" value="99"/>
  <propentry key="ypositionofEmergencyExit" type="INT" value="99"/>
  <propentry key="width" type="INT" value="100"/>
  <propentry key="height" type="INT" value="100"/>
  <propentry key="xpositionofAgent" type="INT" value="50"/>
  <propentry key="ypositionofAgent" type="INT" value="50"/>
  <propentry key="steps" type="INT" value="50"/>

and to configure the number of inputs and outputs for the agent:

    <reqentry key="inputnumber" type="INT" value="2"/>
    <reqentry key="outputnumber" type="INT" value="2"/>

  • Finally, we have to implement a visualization for your simulation:

  public void replayWithVisualization(AbstractRepresentation candidate) {
    steps = 0;
    c = candidate;
    width = Integer.parseInt(getProperties().get("width").getValue());
    height = Integer.parseInt(getProperties().get("height").getValue());
    display = new Display(440, 495, "SimplifiedEmergencyExit");
    whiteboard = new WhiteBoard(400, 400, width, height, 1);
    whiteboard.addColorToScale(0, Color.WHITE);
    whiteboard.addColorToScale(1, Color.BLACK);
    whiteboard.addColorToScale(2, Color.GREEN);
    JButton minusbutton = new JButton("-");
    JButton plusbutton = new JButton("+");
    minusbutton.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        if (steps > 0) steps--;
        display.setTitle("Simplified Emergency Exit    Step: " + steps);
    plusbutton.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        display.setTitle("Simplified Emergency Exit    Step: " + steps);
    display.setTitle("Simplified Emergency Exit    Step: " + steps);

  private void displayResult() {
    int[][] data = new int[width][height];
    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        if /* */(x == xpositionofEmergencyExit && y == ypositionofEmergencyExit) data[x][y] = 2;
        else if (x == xpositionofAgent /*    */&& y == ypositionofAgent) /*    */data[x][y] = 1;
        else /*                                                                */data[x][y] = 0;

Therefore the class WhiteBoard can be used. It is an extension of JPanel which represents a two- or three-dimensional grid of data in form of colors or pictures in a grid. It only has to be initialized and added to a JFrame or an extension of JFrame. Here the class Display is used. It is an extension of JFrame with a new constructor and a few settings that have already been done. The window of this visualization contains the WhiteBoard and two buttons, which are used to go through the simulation step by step. The simulation always does as much steps as the value of “steps” says. The simulation with visualization always works with the same representation and the same starting conditions. So it is possible to increase the value of “steps” and start a simulation from the beginning by clicking on plusbutton without having any differences in the agent’s behaviour. You will just see the next step of the simulation. For displaying the result the position of the agent and the emergency exit have to be converted into a two-dimensional array. Also the color-scale of the WhiteBoard has to be set. The conversion is done by displayResult(). The setting of the colorscale is done in replayWithVisualization by the function addColorToScale(int lowerLimit, Color c). All values within lowerLimit and the next lowerLimit or, if there is no next lowerLimit, the top, have the color c. As soon as this has been done you have to set the data which should be shown by the WhiteBoard. The data is set with the function setData(int[][] data). The call of repaint() will force the WhiteBoard to visualize the data which will look like this:

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks