MOEA Framework 2.12
API Specification

org.moeaframework.analysis.collector
Class InstrumentedAlgorithm

java.lang.Object
  extended by org.moeaframework.algorithm.PeriodicAction
      extended by org.moeaframework.analysis.collector.InstrumentedAlgorithm
All Implemented Interfaces:
Algorithm

public class InstrumentedAlgorithm
extends PeriodicAction

Decorates an algorithm to periodically collect information about its runtime behavior. The NFE field is automatically recorded by this class.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.moeaframework.algorithm.PeriodicAction
PeriodicAction.FrequencyType
 
Field Summary
 
Fields inherited from class org.moeaframework.algorithm.PeriodicAction
algorithm, frequency, frequencyType, iteration, lastInvocation
 
Constructor Summary
InstrumentedAlgorithm(Algorithm algorithm, int frequency)
          Decorates the specified algorithm to periodically collect information about its runtime behavior.
InstrumentedAlgorithm(Algorithm algorithm, int frequency, PeriodicAction.FrequencyType frequencyType)
          Decorates the specified algorithm to periodically collect information about its runtime behavior.
 
Method Summary
 void addCollector(Collector collector)
          Adds a collector to this instrumented algorithm.
 void doAction()
          Invoked periodically by this class to perform some function.
 Accumulator getAccumulator()
          Returns the accumulator to which all recorded information is stored.
 Serializable getState()
          Returns a Serializable object representing the internal state of this algorithm.
 void setState(Object objState)
          Sets the internal state of of this algorithm.
 
Methods inherited from class org.moeaframework.algorithm.PeriodicAction
evaluate, getNumberOfEvaluations, getProblem, getResult, isTerminated, step, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstrumentedAlgorithm

public InstrumentedAlgorithm(Algorithm algorithm,
                             int frequency)
Decorates the specified algorithm to periodically collect information about its runtime behavior. Frequency is given in number of evaluations.

Parameters:
algorithm - the algorithm to decorate
frequency - the frequency, in evaluations, that data is collected

InstrumentedAlgorithm

public InstrumentedAlgorithm(Algorithm algorithm,
                             int frequency,
                             PeriodicAction.FrequencyType frequencyType)
Decorates the specified algorithm to periodically collect information about its runtime behavior.

Parameters:
algorithm - the algorithm to decorate
frequency - the frequency that data is collected
frequencyType - if frequency is defined by EVALUATIONS or STEPS
Method Detail

addCollector

public void addCollector(Collector collector)
Adds a collector to this instrumented algorithm. The collector should have already been attached to the algorithm.

Parameters:
collector - the collector

getAccumulator

public Accumulator getAccumulator()
Returns the accumulator to which all recorded information is stored.

Returns:
the accumulator to which all recorded information is stored

doAction

public void doAction()
Description copied from class: PeriodicAction
Invoked periodically by this class to perform some function. This function should not depend on the frequency that it is invoked, since it is not guaranteed that this method is invoked at any specific frequency and, in some cases, may not be invoked at all.

Specified by:
doAction in class PeriodicAction

getState

public Serializable getState()
                      throws NotSerializableException
Description copied from interface: Algorithm
Returns a Serializable object representing the internal state of this algorithm.

Specified by:
getState in interface Algorithm
Overrides:
getState in class PeriodicAction
Returns:
a Serializable object representing the internal state of this algorithm
Throws:
NotSerializableException - if this algorithm does not support serialization

setState

public void setState(Object objState)
              throws NotSerializableException
Description copied from interface: Algorithm
Sets the internal state of of this algorithm.

Specified by:
setState in interface Algorithm
Overrides:
setState in class PeriodicAction
Parameters:
objState - the internal state of this algorithm
Throws:
NotSerializableException - if this algorithm does not support serialization

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!