public abstract class IterativeProcess extends Object implements IterativeContext
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 |
---|---|
boolean |
done()
Returns true if this iterative process is finished, and false otherwise.
|
void |
evaluate()
Performs the iterative process.
|
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.
|
double |
relativePrecision(double epsilon,
double x) |
void |
reset() |
void |
setDesiredPrecision(double prec)
Defines the desired precision.
|
void |
setMaximumIterations(int maxIter)
Defines the maximum allowed number of iterations.
|
void |
setPrecision(double precision) |
abstract void |
step()
Evaluate the result of the current iteration.
|
public void evaluate()
public abstract void step()
step
in interface IterativeContext
protected void finalizeIterations()
public double getDesiredPrecision()
public int getIterations()
public int getMaximumIterations()
public double getPrecision()
public void setPrecision(double precision)
precision
- the precision to setpublic boolean hasConverged()
public boolean done()
IterativeContext
done
in interface IterativeContext
protected void initializeIterations()
public void reset()
public double relativePrecision(double epsilon, double x)
epsilon
- doublex
- doublepublic void setDesiredPrecision(double prec) throws IllegalArgumentException
IllegalArgumentException
public void setMaximumIterations(int maxIter) throws IllegalArgumentException
IllegalArgumentException
Copyright © 2014. All rights reserved.