gov.sandia.cognition.algorithm
Class AbstractAnytimeAlgorithm<ResultType>
java.lang.Object
gov.sandia.cognition.util.AbstractCloneableSerializable
gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm<ResultType>
- Type Parameters:
ResultType - The type of object produced by the algorithm.
- All Implemented Interfaces:
- AnytimeAlgorithm<ResultType>, IterativeAlgorithm, StoppableAlgorithm, CloneableSerializable, Serializable, Cloneable
- Direct Known Subclasses:
- AbstractAnytimeBatchLearner, LentzMethod
@CodeReview(reviewer="Justin Basilico",
date="2008-07-17",
changesNeeded=false,
comments="Abstract class looks fine.")
public abstract class AbstractAnytimeAlgorithm<ResultType>- extends AbstractIterativeAlgorithm
- implements AnytimeAlgorithm<ResultType>
A partial implementation of the common functionality of an
AnytimeAlgorithm.
- Since:
- 2.1
- Author:
- Kevin R. Dixon, Justin Basilico
- See Also:
- Serialized Form
|
Field Summary |
protected int |
maxIterations
Maximum number of iterations before stopping |
|
Method Summary |
int |
getMaxIterations()
Gets the maximum number of total iterations before stopping. |
boolean |
isResultValid()
Indicates whether or not the algorithm results are in a consistent state
or not. |
void |
setMaxIterations(int maxIterations)
Sets the maximum number of total iterations before stopping. |
| Methods inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm |
addIterativeAlgorithmListener, clone, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners |
maxIterations
protected int maxIterations
- Maximum number of iterations before stopping
AbstractAnytimeAlgorithm
public AbstractAnytimeAlgorithm(int maxIterations)
- Creates a new instance of
AbstractAnytimeAlgorithm.
- Parameters:
maxIterations - Maximum number of iterations before stopping
isResultValid
public boolean isResultValid()
- Description copied from interface:
StoppableAlgorithm
- Indicates whether or not the algorithm results are in a consistent state
or not. A
StoppableAlgorithm may not always be able to stop in a
manner that makes its results valid. This method is used to check whether
the results are in a consistent state or not.
- Specified by:
isResultValid in interface StoppableAlgorithm
- Returns:
- True if the results of the algorithm are in valid state and
false if they are not valid.
getMaxIterations
public int getMaxIterations()
- Description copied from interface:
AnytimeAlgorithm
- Gets the maximum number of total iterations before stopping.
- Specified by:
getMaxIterations in interface AnytimeAlgorithm<ResultType>
- Returns:
- Maximum number of total iterations before stopping. Must be greater
than zero.
setMaxIterations
public void setMaxIterations(int maxIterations)
- Description copied from interface:
AnytimeAlgorithm
- Sets the maximum number of total iterations before stopping.
- Specified by:
setMaxIterations in interface AnytimeAlgorithm<ResultType>
- Parameters:
maxIterations - Maximum number of iterations before stopping. Must be greater
than zero.