islandev
Class IslandsEvolutionServer

java.lang.Object
  |
  +--islandev.IslandsEvolutionServer
All Implemented Interfaces:
distrit.InteractiveTaskServer, java.rmi.Remote

public class IslandsEvolutionServer
extends java.lang.Object
implements distrit.InteractiveTaskServer

Server that can be used with any GA application to make it distributed via the Island based Coevolution model. This is a large class and contains all the methods to go through a Queue of tasks one by one and load populations from disk when resuming a previous task, etc... It also provides code to log stuff to a database which can be switched on with the log2Database variable.

This class should be broken up into components and made neater.


Field Summary
protected  java.lang.String baseLogDir
           
protected  java.util.Vector bestIndividuals
           
protected  ClientGrid clients
           
protected  int currentRunID
           
protected  EvolutionaryInteractiveTask evoTask
           
protected  java.lang.String evoTaskName
           
protected  java.util.Vector evoTaskQ
           
protected  java.util.Vector evoTaskQBestHDIndID
           
protected  java.util.Iterator evoTaskQBestHDIndIDI
           
protected  java.util.Vector evoTaskQDescr
           
protected  java.util.Iterator evoTaskQDescrI
           
protected  java.util.Vector evoTaskQEffort
           
protected  java.util.Iterator evoTaskQEffortI
           
protected  java.util.Iterator evoTaskQI
           
protected  java.util.Vector evoTaskQNames
           
protected  java.util.Iterator evoTaskQNamesI
           
protected  IslandsEvoGUI GUITask
           
protected  IslandsJDBC jdbc
           
protected  boolean log2Database
           
protected  java.lang.String logFileName
           
protected static int MAIN_POP
           
protected  double migrationProb
           
protected  int nrPops
           
protected  int pop0Size
           
protected  boolean resuming
           
protected  Individual solutionTemplate
           
protected  java.lang.String taskLogFileName
           
protected  java.util.Vector updatedClientIDs
           
 
Constructor Summary
IslandsEvolutionServer(java.util.Vector evoTaskQ, java.util.Vector evoTaskQNames, java.lang.String baseLogDir, java.lang.String logFileName, double migrationProb)
           
IslandsEvolutionServer(java.util.Vector evoTaskQ, java.util.Vector evoTaskQNames, java.lang.String baseLogDir, java.lang.String logFileName, double migrationProb, boolean log2Database, java.util.Vector evoTaskQDescr, java.util.Vector evoTaskQBestHDIndID, java.util.Vector evoTaskQEffort)
          This method should be called every time an instance of this server is created.
 
Method Summary
protected  void finishedCurrentTask()
           
 java.lang.Object getID(java.lang.Object initialParameters)
          Called by clients the first time they connect
 distrit.InteractiveTask getTask(java.lang.Object id)
          This will provide the client with the InteractiveTask it should run.
 java.lang.Object interact(java.lang.Object id, java.lang.Object clientTaskOutput)
          Called by client when they wishes to interact.
protected  void logRegister(java.lang.Object object, java.lang.String fileName)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAIN_POP

protected static final int MAIN_POP

log2Database

protected boolean log2Database

clients

protected ClientGrid clients

bestIndividuals

protected java.util.Vector bestIndividuals

jdbc

protected IslandsJDBC jdbc

evoTaskQ

protected java.util.Vector evoTaskQ

evoTaskQNames

protected java.util.Vector evoTaskQNames

evoTaskQDescr

protected java.util.Vector evoTaskQDescr

evoTaskQBestHDIndID

protected java.util.Vector evoTaskQBestHDIndID

evoTaskQEffort

protected java.util.Vector evoTaskQEffort

evoTaskQI

protected java.util.Iterator evoTaskQI

evoTaskQNamesI

protected java.util.Iterator evoTaskQNamesI

evoTaskQDescrI

protected java.util.Iterator evoTaskQDescrI

evoTaskQBestHDIndIDI

protected java.util.Iterator evoTaskQBestHDIndIDI

evoTaskQEffortI

protected java.util.Iterator evoTaskQEffortI

baseLogDir

protected java.lang.String baseLogDir

logFileName

protected java.lang.String logFileName

resuming

protected boolean resuming

evoTask

protected EvolutionaryInteractiveTask evoTask

GUITask

protected IslandsEvoGUI GUITask

evoTaskName

protected java.lang.String evoTaskName

taskLogFileName

protected java.lang.String taskLogFileName

updatedClientIDs

protected java.util.Vector updatedClientIDs

solutionTemplate

protected Individual solutionTemplate

nrPops

protected int nrPops

migrationProb

protected double migrationProb

pop0Size

protected int pop0Size

currentRunID

protected int currentRunID
Constructor Detail

IslandsEvolutionServer

public IslandsEvolutionServer(java.util.Vector evoTaskQ,
                              java.util.Vector evoTaskQNames,
                              java.lang.String baseLogDir,
                              java.lang.String logFileName,
                              double migrationProb)

IslandsEvolutionServer

public IslandsEvolutionServer(java.util.Vector evoTaskQ,
                              java.util.Vector evoTaskQNames,
                              java.lang.String baseLogDir,
                              java.lang.String logFileName,
                              double migrationProb,
                              boolean log2Database,
                              java.util.Vector evoTaskQDescr,
                              java.util.Vector evoTaskQBestHDIndID,
                              java.util.Vector evoTaskQEffort)
This method should be called every time an instance of this server is created.
Parameters:
bindingName - is how the server will be named in the rmiregistry
evolutionTask - is an implementation of InteractiveTask that runs the whole
migrationProb - the probability of a migration process succeding. evolutionary process. However in order to perform migration between islands it must conform with the following: the Object get( Object params ) method must: 1. ignore params 2. create a vector and add these elements in this order (0) vector containing best individuals evolved so far as Individual objects (1) vector of current generation numbers as Integer objects (2) vector of average fitnesses of current generations as Double objects (3) vector of individuals selected for migration as Individual objects 3. return this vector the void set( Object params) method must: 1. cast params into a vector of Individuals 2. add these individuals to the populations somewhere (they are incoming migrators)
Method Detail

logRegister

protected void logRegister(java.lang.Object object,
                           java.lang.String fileName)

getID

public java.lang.Object getID(java.lang.Object initialParameters)
                       throws java.rmi.RemoteException
Called by clients the first time they connect
Specified by:
getID in interface distrit.InteractiveTaskServer
Parameters:
initialParameters - initial parameters from client local configuration
Returns:
the ID of this client will from now on used for interaction

getTask

public distrit.InteractiveTask getTask(java.lang.Object id)
                                throws java.rmi.RemoteException
Description copied from interface: distrit.InteractiveTaskServer
This will provide the client with the InteractiveTask it should run.
Specified by:
getTask in interface distrit.InteractiveTaskServer
Following copied from interface: distrit.InteractiveTaskServer
Parameters:
id - The ID provided by the getID method by which the client will always refer to itself.
Returns:
The task this client should run. This could be exactly the same as the one all other clients are running or tailored to this particular client.

interact

public java.lang.Object interact(java.lang.Object id,
                                 java.lang.Object clientTaskOutput)
                          throws java.rmi.RemoteException
Called by client when they wishes to interact. Called by clients during evolution and at the end of evolution to report on their progress and effect migration between islands.
Specified by:
interact in interface distrit.InteractiveTaskServer
Parameters:
ID - the client's ID
clientTaskOutput - the outputs of the client obtained by task.get( null ) on the client task
Returns:
whatever should be sent into the client through task.set( )

finishedCurrentTask

protected void finishedCurrentTask()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object