public class InstrumentedAlgorithm extends PeriodicAction
NFE
field is automatically recorded by this class.PeriodicAction.FrequencyType
algorithm, frequency, frequencyType, iteration, lastInvocation
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
addCollector(Collector collector)
Adds a collector to this instrumented algorithm.
|
void |
doAction()
Invoked periodically by this class to perform some function.
|
Observations |
getObservations()
Returns the observations collected from this algorithm.
|
void |
loadState(java.io.ObjectInputStream stream)
Loads the state of this object from the stream.
|
void |
saveState(java.io.ObjectOutputStream stream)
Writes the state of this object to the stream.
|
evaluate, getNumberOfEvaluations, getProblem, getResult, isTerminated, step, terminate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkTypeSafety, getState, setState, writeTypeSafety
public InstrumentedAlgorithm(Algorithm algorithm, int frequency)
algorithm
- the algorithm to decoratefrequency
- the frequency, in evaluations, that data is collectedpublic InstrumentedAlgorithm(Algorithm algorithm, int frequency, PeriodicAction.FrequencyType frequencyType)
algorithm
- the algorithm to decoratefrequency
- the frequency that data is collectedfrequencyType
- if frequency is defined by EVALUATIONS or STEPSpublic void addCollector(Collector collector)
collector
- the collectorpublic Observations getObservations()
public void doAction()
PeriodicAction
doAction
in class PeriodicAction
public void saveState(java.io.ObjectOutputStream stream) throws java.io.IOException
Stateful
super.saveState(stream)
followed by writing each
field.saveState
in interface Stateful
saveState
in class PeriodicAction
stream
- the streamjava.io.IOException
- if an I/O error occurredpublic void loadState(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Stateful
Stateful.saveState(ObjectOutputStream)
.loadState
in interface Stateful
loadState
in class PeriodicAction
stream
- the streamjava.io.IOException
- if an I/O error occurredjava.lang.ClassNotFoundException
- if the stream referenced a class that is not definedCopyright 2009-2024 David Hadka and other contributors. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage.