balance_solver
BalanceSolver
BalanceSolver(
perturb=0.0001,
stop_condition=0.01,
relax_ratio=0.8,
relax_power=3,
max_iter=100,
)
Solver for balance models using a Newton-Raphson method. Takes a model implementing IModelForSolver as input, and solves it using.
The main difference with a classic Newton-Raphson method is that the correction of the state vector is using a custom formula, using a relaxation value that decreases with the number of iterations.
The jacobian matrix is computed using finite differences.
1 2 3 4 5 | |
Raises:
| Type | Description |
|---|---|
ConvergenceError
|
if the solver fails to converge within max_iter iterations. |
Source code in src/mechaphlowers/core/models/balance/solvers/balance_solver.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |