JGAP

examples.grid.mathProblemDistributed
Class ClientEvolveStrategy

java.lang.Object
  extended by org.jgap.gp.GPProblem
      extended by examples.grid.mathProblemDistributed.ClientEvolveStrategy
All Implemented Interfaces:
java.io.Serializable, IClientEvolveStrategyGP

public class ClientEvolveStrategy
extends GPProblem
implements IClientEvolveStrategyGP

Sample implementation of a strategy for evolving a generation on the client.

Since:
3.2
See Also:
Serialized Form

Field Summary
static java.lang.String CVS_REVISION
          String containing the CVS revision.
 
Constructor Summary
ClientEvolveStrategy(GridConfiguration a_gridConfig)
          Default constructor is necessary here as it will be called dynamically!
 
Method Summary
 void afterWorkRequestsSent()
           
 GPGenotype create()
           
 Variable createVariable(GPConfiguration a_conf)
           
 void evolve()
           
 JGAPRequestGP[] generateWorkRequests(JGAPRequestGP m_workReq, IRequestSplitStrategyGP m_splitStrategy, java.lang.Object data)
           
 CommandGene[][] getNodeSets(GPConfiguration conf)
           
 void initialize(IGridClientMediator a_gc, GPConfiguration a_config, IClientFeedbackGP a_clientFeedback)
          Called at the very beginning and only once before distributed evolution starts.
 boolean isEvolutionFinished(int a_evolutionsDone)
           
 void onFinished()
          Called after evolution has finished.
 void resultReceived(JGAPResultGP a_result)
          Merge the received results as a basis for the next evolution.
 
Methods inherited from class org.jgap.gp.GPProblem
createTree, getGPConfiguration, setGPConfiguration, showTree, showTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVS_REVISION

public static final java.lang.String CVS_REVISION
String containing the CVS revision. Read out via reflection!

See Also:
Constant Field Values
Constructor Detail

ClientEvolveStrategy

public ClientEvolveStrategy(GridConfiguration a_gridConfig)
Default constructor is necessary here as it will be called dynamically! Don't declare any other constructor as it will not be called!

Parameters:
a_gridConfig - the grid configuration to use
Method Detail

initialize

public void initialize(IGridClientMediator a_gc,
                       GPConfiguration a_config,
                       IClientFeedbackGP a_clientFeedback)
                throws java.lang.Exception
Called at the very beginning and only once before distributed evolution starts.

Specified by:
initialize in interface IClientEvolveStrategyGP
Parameters:
a_gc - GridClient mediator
a_config - Configuration
a_clientFeedback - IClientFeedback
Throws:
java.lang.Exception
Since:
3.2

afterWorkRequestsSent

public void afterWorkRequestsSent()
                           throws java.lang.Exception
Specified by:
afterWorkRequestsSent in interface IClientEvolveStrategyGP
Throws:
java.lang.Exception

isEvolutionFinished

public boolean isEvolutionFinished(int a_evolutionsDone)
Specified by:
isEvolutionFinished in interface IClientEvolveStrategyGP

onFinished

public void onFinished()
Called after evolution has finished.

Specified by:
onFinished in interface IClientEvolveStrategyGP

evolve

public void evolve()
            throws java.lang.Exception
Specified by:
evolve in interface IClientEvolveStrategyGP
Throws:
java.lang.Exception

generateWorkRequests

public JGAPRequestGP[] generateWorkRequests(JGAPRequestGP m_workReq,
                                            IRequestSplitStrategyGP m_splitStrategy,
                                            java.lang.Object data)
                                     throws java.lang.Exception
Specified by:
generateWorkRequests in interface IClientEvolveStrategyGP
Throws:
java.lang.Exception

resultReceived

public void resultReceived(JGAPResultGP a_result)
                    throws java.lang.Exception
Merge the received results as a basis for the next evolution.

Specified by:
resultReceived in interface IClientEvolveStrategyGP
Parameters:
a_result - JGAPResult
Throws:
java.lang.Exception
Since:
3.2

createVariable

public Variable createVariable(GPConfiguration a_conf)
                        throws InvalidConfigurationException
Throws:
InvalidConfigurationException

getNodeSets

public CommandGene[][] getNodeSets(GPConfiguration conf)
                            throws InvalidConfigurationException
Throws:
InvalidConfigurationException

create

public GPGenotype create()
                  throws InvalidConfigurationException
Specified by:
create in class GPProblem
Returns:
newly created GPGenotype
Throws:
InvalidConfigurationException

JGAP