org.opt4j.core.common.logger
Class AbstractLogger

java.lang.Object
  extended by org.opt4j.core.common.logger.AbstractLogger
All Implemented Interfaces:
IndividualStateListener, OptimizerIterationListener, OptimizerStateListener
Direct Known Subclasses:
TsvLogger

public abstract class AbstractLogger
extends java.lang.Object
implements OptimizerStateListener, OptimizerIterationListener, IndividualStateListener

The AbstractLogger triggers its refinement on specific events dependent on the iteration and evaluation count. Each AbstractLogger has to listen to the be registered as listener of the Optimizer ( Opt4JModule.addOptimizerStateListener(Class) and Opt4JModule.addOptimizerIterationListener(Class)) and the state of the Individual (Opt4JModule.addIndividualStateListener(Class) .


Field Summary
protected  java.util.concurrent.atomic.AtomicInteger evaluationCount
           
protected  int evaluationCountLast
           
protected  int evaluationStep
           
protected  boolean isFirst
           
protected  int iterationStep
           
 
Constructor Summary
AbstractLogger(int iterationStep, int evaluationStep)
          Constructs an AbstractLogger.
 
Method Summary
 void inidividualStateChanged(Individual individual)
          Invoked if the Individual changes its state.
 void iterationComplete(int iteration)
          Invoked if the Optimizer completes an iteration.
abstract  void logEvent(int iteration, int evaluation)
          Callback method called if the specific number of iterations or evaluations is reached.
abstract  void logHeader(java.util.Collection<Objective> objectives)
          Writes the header.
abstract  void optimizationStarted()
          Callback method invoked once the optimization starts.
 void optimizationStarted(Optimizer optimizer)
          Invoked if the Optimizer starts the optimization process.
abstract  void optimizationStopped()
          Callback method invoked once the optimization stops.
 void optimizationStopped(Optimizer optimizer)
          Invoked if the Optimizer stops the optimization process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterationStep

protected final int iterationStep

evaluationStep

protected final int evaluationStep

evaluationCount

protected final java.util.concurrent.atomic.AtomicInteger evaluationCount

isFirst

protected boolean isFirst

evaluationCountLast

protected int evaluationCountLast
Constructor Detail

AbstractLogger

public AbstractLogger(int iterationStep,
                      int evaluationStep)
Constructs an AbstractLogger.

Parameters:
iterationStep - the number of iterations between two logging events
evaluationStep - the number of evaluations between two logging events
Method Detail

logEvent

public abstract void logEvent(int iteration,
                              int evaluation)
Callback method called if the specific number of iterations or evaluations is reached.

Parameters:
iteration - the current iteration number
evaluation - the current evaluation number

logHeader

public abstract void logHeader(java.util.Collection<Objective> objectives)
Writes the header.

Parameters:
objectives - a collection of objectives

optimizationStarted

public abstract void optimizationStarted()
Callback method invoked once the optimization starts.


optimizationStopped

public abstract void optimizationStopped()
Callback method invoked once the optimization stops.


iterationComplete

public void iterationComplete(int iteration)
Description copied from interface: OptimizerIterationListener
Invoked if the Optimizer completes an iteration.

Specified by:
iterationComplete in interface OptimizerIterationListener
Parameters:
iteration - the completed iteration

optimizationStarted

public void optimizationStarted(Optimizer optimizer)
Description copied from interface: OptimizerStateListener
Invoked if the Optimizer starts the optimization process.

Specified by:
optimizationStarted in interface OptimizerStateListener
Parameters:
optimizer - the optimizer

optimizationStopped

public void optimizationStopped(Optimizer optimizer)
Description copied from interface: OptimizerStateListener
Invoked if the Optimizer stops the optimization process.

Specified by:
optimizationStopped in interface OptimizerStateListener
Parameters:
optimizer - the optimizer

inidividualStateChanged

public void inidividualStateChanged(Individual individual)
Description copied from interface: IndividualStateListener
Invoked if the Individual changes its state.

Specified by:
inidividualStateChanged in interface IndividualStateListener
Parameters:
individual - the individual that changes the state