Class AlgorithmWrapper<T extends Algorithm>
java.lang.Object
org.moeaframework.algorithm.extension.AlgorithmWrapper<T>
- Type Parameters:
- T- the type of the wrapped algorithm
- All Implemented Interfaces:
- Algorithm,- Extensible,- Configurable,- Named,- Stateful
- Direct Known Subclasses:
- InstrumentedAlgorithm
public class AlgorithmWrapper<T extends Algorithm>
extends Object
implements Algorithm, Configurable
Wrapper for an algorithm.  Unless overridden, all methods call the same method on the wrapped instance.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidEvaluates the specified solution for the problem being solved by this algorithm.Returns the wrapped instance.Returns the extensions associated with the algorithm.getName()Returns the name of this algorithm.intReturns the number of times theevaluatemethod was invoked.Returns the problem being solved by this algorithm.Returns the current best-known result.voidPerforms any initialization that is required by this algorithm.booleanReturnstrueif this algorithm has been initialized;falseotherwise.booleanReturnstrueif this algorithm has reached its termination condition;falseotherwise.voidloadState(ObjectInputStream stream) Loads the state of this object from the stream.voidsaveState(ObjectOutputStream stream) Writes the state of this object to the stream.voidstep()Performs one logical step of this algorithm.voidCalled when the termination condition is reached and the run is complete.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.moeaframework.algorithm.AlgorithmevaluateAll, evaluateAll, run, runMethods inherited from interface org.moeaframework.core.configuration.ConfigurableapplyConfiguration, getConfigurationMethods inherited from interface org.moeaframework.algorithm.extension.ExtensibleaddExtension, removeExtension
- 
Constructor Details- 
AlgorithmWrapperWraps the given algorithm.- Parameters:
- algorithm- the algorithm to wrap
 
 
- 
- 
Method Details- 
getAlgorithmReturns the wrapped instance.- Returns:
- the wrapped instance
 
- 
getNameDescription copied from interface:AlgorithmReturns the name of this algorithm. Whenever possible, this name should match the name recognized byAlgorithmFactory.
- 
evaluateDescription copied from interface:AlgorithmEvaluates the specified solution for the problem being solved by this algorithm.
- 
getNumberOfEvaluationspublic int getNumberOfEvaluations()Description copied from interface:AlgorithmReturns the number of times theevaluatemethod was invoked. This is the primary measure of runtime for optimization algorithms.- Specified by:
- getNumberOfEvaluationsin interface- Algorithm
- Returns:
- the number of times the evaluatemethod was invoked
 
- 
getProblemDescription copied from interface:AlgorithmReturns the problem being solved by this algorithm.- Specified by:
- getProblemin interface- Algorithm
- Returns:
- the problem being solved by this algorithm
 
- 
initializepublic void initialize()Description copied from interface:AlgorithmPerforms any initialization that is required by this algorithm. This method should only be called once, though the specific implementation may choose to no-op or throwAlgorithmInitializationExceptionif called multiple times.Implementations should always call super.initialize()to ensure the algorithm is initialized correctly.- Specified by:
- initializein interface- Algorithm
 
- 
isInitializedpublic boolean isInitialized()Description copied from interface:AlgorithmReturnstrueif this algorithm has been initialized;falseotherwise.- Specified by:
- isInitializedin interface- Algorithm
- Returns:
- trueif this algorithm has been initialized;- falseotherwise
- See Also:
 
- 
steppublic void step()Description copied from interface:AlgorithmPerforms one logical step of this algorithm. The amount of work performed depends on the implementation. One invocation of this method may produce one or many trial solutions.In general, calling this method after Algorithm.terminate()is permitted. When this happens,Algorithm.isTerminated()is reset. We recommend checkingAlgorithm.isTerminated()after each step to detect when termination conditions are reached. However, if the implementation is unable to continue, this method should throwAlgorithmTerminationException.
- 
isTerminatedpublic boolean isTerminated()Description copied from interface:AlgorithmReturnstrueif this algorithm has reached its termination condition;falseotherwise.- Specified by:
- isTerminatedin interface- Algorithm
- Returns:
- trueif this algorithm has reached its termination condition;- falseotherwise
- See Also:
 
- 
terminatepublic void terminate()Description copied from interface:AlgorithmCalled when the termination condition is reached and the run is complete. This method is automatically called when usingAlgorithm.run(TerminationCondition), but can also be invoked directly if executing the algorithm step-by-step withAlgorithm.step().Implementations should always call super.terminate()to ensure the algorithm is terminated correctly.
- 
getResultDescription copied from interface:AlgorithmReturns the current best-known result.
- 
getExtensionsDescription copied from interface:ExtensibleReturns the extensions associated with the algorithm.- Specified by:
- getExtensionsin interface- Extensible
- Returns:
- the extensions
 
- 
saveStateDescription copied from interface:StatefulWrites the state of this object to the stream. The order that objects are written to the stream is important. We recommend first callingsuper.saveState(stream)followed by writing each field.- Specified by:
- saveStatein interface- Stateful
- Parameters:
- stream- the stream
- Throws:
- IOException- if an I/O error occurred
 
- 
loadStateDescription copied from interface:StatefulLoads the state of this object from the stream. The order for reading objects from the stream must match the order they are written to the stream inStateful.saveState(ObjectOutputStream).- Specified by:
- loadStatein interface- Stateful
- Parameters:
- stream- the stream
- Throws:
- IOException- if an I/O error occurred
- ClassNotFoundException- if the stream referenced a class that is not defined
 
 
-