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() |
void |
evaluate()
Performs the iterative process.
|
protected void |
finalizeIterations()
Perform eventual clean-up operations
(must be implement by subclass when needed).
|
double |
getDesiredPrecision() |
int |
getIterations() |
int |
getMaximumIterations() |
double |
getPrecision() |
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) |
void |
setMaximumIterations(int maxIter) |
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()
done
in interface IterativeContext
true
if this iterative process is finished, and false
otherwise.protected void initializeIterations()
public void reset()
public double relativePrecision(double epsilon, double x)
epsilon
- doublex
- doublepublic void setDesiredPrecision(double prec) throws IllegalArgumentException
prec
- the desired precision.IllegalArgumentException
public void setMaximumIterations(int maxIter) throws IllegalArgumentException
maxIter
- the maximum allowed number of iterationsIllegalArgumentException
Copyright © 2015. All rights reserved.