JGAP

org.jgap.distr.grid
Class JGAPClient

java.lang.Object
  extended by java.lang.Thread
      extended by org.jgap.distr.grid.JGAPClient
All Implemented Interfaces:
java.lang.Runnable

public class JGAPClient
extends java.lang.Thread

A client defines work for the grid and sends it to the JGAPServer. Use this class to get an idea for your grid client implementation or see the samples under package examples.grid to have templates for a) fitness computation and b) evolution on the worker side.

Since:
3.01

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  GridNodeClientConfig m_gridconfig
           
protected  JGAPRequest m_workReq
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JGAPClient(GridNodeClientConfig a_gridconfig, java.lang.String a_clientClassName)
           
 
Method Summary
protected  void evolve(GridClient gc)
          If necessary: override to implement your evolution cycle individually.
 Configuration getConfiguration()
           
static void main(java.lang.String[] args)
          Starts a client (first parameter: name of specific setup class).
protected  void receiveWorkResults(JGAPRequest[] workList)
           
 void run()
          Threaded: Splits work, sends it to workers and receives computed solutions.
protected  void sendWorkRequests(JGAPRequest[] a_workList)
           
 void setWorkRequest(JGAPRequest a_request)
           
 void start()
           
protected  GridClient startClient()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_gridconfig

protected GridNodeClientConfig m_gridconfig

m_workReq

protected JGAPRequest m_workReq
Constructor Detail

JGAPClient

public JGAPClient(GridNodeClientConfig a_gridconfig,
                  java.lang.String a_clientClassName)
           throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

setWorkRequest

public void setWorkRequest(JGAPRequest a_request)

startClient

protected GridClient startClient()
                          throws java.lang.Exception
Throws:
java.lang.Exception

run

public void run()
Threaded: Splits work, sends it to workers and receives computed solutions.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
Since:
3.01

sendWorkRequests

protected void sendWorkRequests(JGAPRequest[] a_workList)
                         throws java.lang.Exception
Throws:
java.lang.Exception

receiveWorkResults

protected void receiveWorkResults(JGAPRequest[] workList)
                           throws java.lang.Exception
Throws:
java.lang.Exception

evolve

protected void evolve(GridClient gc)
               throws java.lang.Exception
If necessary: override to implement your evolution cycle individually.

Parameters:
gc - GridClient
Throws:
java.lang.Exception

start

public void start()
Overrides:
start in class java.lang.Thread

getConfiguration

public Configuration getConfiguration()

main

public static void main(java.lang.String[] args)
Starts a client (first parameter: name of specific setup class).

Parameters:
args - String[]
Since:
3.01

JGAP