public abstract class AbstractLogger extends java.lang.Object implements OptimizerStateListener, OptimizerIterationListener, IndividualStateListener
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)
.Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicInteger |
evaluationCount |
protected int |
evaluationCountLast |
protected int |
evaluationStep |
protected boolean |
isFirst |
protected int |
iterationStep |
Constructor and Description |
---|
AbstractLogger(int iterationStep,
int evaluationStep)
Constructs an
AbstractLogger . |
Modifier and Type | Method and Description |
---|---|
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. |
protected final int iterationStep
protected final int evaluationStep
protected final java.util.concurrent.atomic.AtomicInteger evaluationCount
protected boolean isFirst
protected int evaluationCountLast
public AbstractLogger(int iterationStep, int evaluationStep)
AbstractLogger
.iterationStep
- the number of iterations between two logging eventsevaluationStep
- the number of evaluations between two logging eventspublic abstract void logEvent(int iteration, int evaluation)
iteration
- the current iteration numberevaluation
- the current evaluation numberpublic abstract void logHeader(java.util.Collection<Objective> objectives)
objectives
- a collection of objectivespublic abstract void optimizationStarted()
public abstract void optimizationStopped()
public void iterationComplete(int iteration)
OptimizerIterationListener
Optimizer
completes an iteration.iterationComplete
in interface OptimizerIterationListener
iteration
- the completed iterationpublic void optimizationStarted(Optimizer optimizer)
OptimizerStateListener
Optimizer
starts the optimization process.optimizationStarted
in interface OptimizerStateListener
optimizer
- the optimizerpublic void optimizationStopped(Optimizer optimizer)
OptimizerStateListener
Optimizer
stops the optimization process.optimizationStopped
in interface OptimizerStateListener
optimizer
- the optimizerpublic void inidividualStateChanged(Individual individual)
IndividualStateListener
Individual
changes its state.inidividualStateChanged
in interface IndividualStateListener
individual
- the individual that changes the state