class AlgebraicLoopDirector.SuccessiveSubstitution extends AlgebraicLoopDirector.AlgebraicLoopSolver
_converged, _iterationCount, _maxIterations, _tolerance, _variableNames
Constructor and Description |
---|
SuccessiveSubstitution(java.lang.String[] variableNames,
double[] tolerance,
int maxIterations)
Construct an algebraic loop solver.
|
Modifier and Type | Method and Description |
---|---|
void |
solve(double[] xIni)
Solve the algebraic loop using the specified array as the initial
guess for the variables being solved for and replace the contents
of the specified array with the solution that is found.
|
_didConverge, converged, getIterationCount
public SuccessiveSubstitution(java.lang.String[] variableNames, double[] tolerance, int maxIterations) throws IllegalActionException
variableNames
- Names of each break variable.tolerance
- Tolerance for each variable.maxIterations
- Maximum number of iterations.IllegalActionException
public void solve(double[] xIni) throws IllegalActionException
This method iterates until a solution is found. If it does not converge within the maximum number of iterations, it throws an IllegalActionException. A method that calls solve(double[] xInitial) can then call converged() to check whether the exception is thrown because of lack of convergence.
solve
in class AlgebraicLoopDirector.AlgebraicLoopSolver
xIni
- Array with the initial values of the variables, to be replaced
with the solution by this method.IllegalActionException
- If the prefire() method
returns false having previously returned true in the same
iteration, or if the prefire() or fire() method of the actor
throws it, or if evaluating the function yields a value that
is not a double, or if the solver fails to find a solution.