Build a JGAP Grid using your LAN

[JGAP Home]


What is a Grid?

In the case of JGAP, a grid is a distributed computing environment where as many independent computers as possible work on a set of problems. These computers are called workers. Each worker receives tasks from a server, the master. The master gets fed in problems by a client. After that, the master splits those problems into handy units where each single unit will be processed on a single worker. After a worker has done its work for one unit, the result is  sent back to the master. The master in turn uses the result to advance the solution, or in the best case stop because a satisfactory solution has been found. In the end, the client receives the solution(s). computed by the workers.

Getting started with your Grid

JGAP provides an example for a grid consisting of the components Server (=master), Worker, and Client. Please see package examples.grid.fitnessDistributed. Package examples.grid hosts a file readme.txt that provides instructions for setting up the grid. The example distributes fitness computations to workers and does the evolution (genetic operations such as mutation and selection) on the client. Other scenarios, such as distributing evolution, are possible as well. JGAP's grid architecture is very flexible because a lot of strategy classes offer a bunch of configuration possibilities. 

To use the grid, do the following in the given order:

1. Start the server on a machine of your choice (called SERVER):

java -cp ".;jgap-examples.jar;lib\log4j.jar;jgap.jar;lib\commons-cli-1.0.jar;lib\jcgrid.jar" org.jgap.distr.grid.JGAPServer

Ensure that the given jar-files reside in the directories you specify! Each required jar-file is shipped with JGAP!

Attention: For Linux and similar operating systems, you have to use the slash instead of the backslash (for Windows) --> Also is true for the following commands!

2. Start as many workers as you like on machines of your choice:

java -cp ".;jgap-examples.jar;lib\log4j.jar;jgap.jar;lib\commons-cli-1.0.jar;lib\jcgrid.jar" org.jgap.distr.grid.JGAPWorker -s SERVER -n myworker1


Ensure that the given jar-files reside in the directories you specify! Each required jar-file is shipped with JGAP!
Each worker must have a unique name --> specify it after the "-n" option.
Each worker must point to the SERVER's ip address --> specify it after the "-s" option instead of the above "SERVER".

3. Start a client on a machine of your choice:

java -cp ".;jgap-examples.jar;lib\log4j.jar;jgap.jar;lib\commons-cli-1.0.jar;lib\jcgrid.jar" org.jgap.distr.grid.JGAPClient examples.grid.fitnessDistributed.GridConfiguration -s SERVER

The client must point to the SERVER's ip address --> specify it after the "-s" option instead of the above "SERVER".

After starting the client the server receives a task from the client.
After that the work is split into tasks and the started workers are asked by the server to compute them.
After a worker has computed a task, the result is sent back to the server.
The server in turn returns each solution to the client.
The client can process the result.

To make your GA work with a JGAP grid, especially have a look at the classes ExampleClient and MyGAWorker provided in the example package examples.grid.fitnessDistributed. Most of the necessary stuff is done by JGAP for you.


[JGAP Home]
 
   
      SourceForge Logo