public abstract class IterativeProcess extends java.lang.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 IterativeContextprotected 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()
IterativeContextdone in interface IterativeContextprotected void initializeIterations()
public void reset()
public double relativePrecision(double epsilon,
double x)
epsilon - doublex - doublepublic void setDesiredPrecision(double prec)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void setMaximumIterations(int maxIter)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException