public abstract class IterativeProcess
extends java.lang.Object
Algorithms that subclass this class are typically used in the following way:
FooAlgorithm foo = new FooAlgorithm(...) foo.setMaximumIterations(100); //set up conditions ... foo.evaluate(); //key method which initiates iterative process foo.getSomeResult();
Constructor and Description |
---|
IterativeProcess()
Generic constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
evaluate()
Performs the iterative process.
|
protected abstract double |
evaluateIteration()
Evaluate the result of the current interation.
|
protected void |
finalizeIterations()
Perform eventual clean-up operations
(must be implement by subclass when needed).
|
double |
getDesiredPrecision()
Returns the desired precision.
|
int |
getIterations()
Returns the number of iterations performed.
|
int |
getMaximumIterations()
Returns the maximum allowed number of iterations.
|
double |
getPrecision()
Returns the attained precision.
|
boolean |
hasConverged()
Check to see if the result has been attained.
|
protected void |
initializeIterations()
Initializes internal parameters to start the iterative process.
|
protected void |
reinitialize() |
double |
relativePrecision(double epsilon,
double x) |
void |
setDesiredPrecision(double prec)
Defines the desired precision.
|
void |
setMaximumIterations(int maxIter)
Defines the maximum allowed number of iterations.
|
public void evaluate()
protected abstract double evaluateIteration()
protected void finalizeIterations()
public double getDesiredPrecision()
public int getIterations()
public int getMaximumIterations()
public double getPrecision()
public boolean hasConverged()
protected void initializeIterations()
protected void reinitialize()
public double relativePrecision(double epsilon, double x)
epsilon
- doublex
- doublepublic void setDesiredPrecision(double prec) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void setMaximumIterations(int maxIter) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException