pathsim.optim.newton module

class pathsim.optim.newton.NewtonRaphsonAD[source]

Bases: object

This class implements the newton raphson method using pathsims automatic differentiation framework to compute anlytical jacobians.

solve(func, x0, iterations_max=100, tolerance=1e-06)[source]

Solve the function ‘func’ with initial value ‘x0’ up to a certain tolerance.

Parameters:
  • func (callable) – function to solve

  • x0 (numeric) – starting value for solution

  • iterations_max (int) – maximum number of solver iterations

  • tolerance (float) – convergence condition

Returns:

  • x (numeric) – solution

  • res (float) – residual

  • i (int) – iteration count

reset()[source]
step(x, g, *args, **kwargs)[source]

Perform one newton-raphson step

Parameters:
  • x (float, array) – current solution

  • g (float, array) – current evaluation of g(x)

Returns:

  • x (float, array) – new solution

  • res (float) – residual norm, fixed point error

class pathsim.optim.newton.GaussNewtonAD[source]

Bases: NewtonRaphsonAD

This class implements the gauss newton method using pathsims automatic differentiation framework to compute anlytical jacobians.

step(x, g, *args, **kwargs)[source]

Perform one gauss-newton step

Parameters:
  • x (float, array) – current solution

  • g (float, array) – current evaluation of g(x)

Returns:

  • x (float, array) – new solution

  • res (float) – residual norm, fixed point error

class pathsim.optim.newton.LevenbergMarquardtAD[source]

Bases: NewtonRaphsonAD

This class implements the levenberg marquardt algorithm using pathsims automatic differentiation framework to compute anlytical jacobians.

reset()[source]
step(x, g, *args, **kwargs)[source]

Perform one LM step

Parameters:
  • x (float, array) – current solution

  • g (float, array) – current evaluation of g(x)

Returns:

  • x (float, array) – new solution

  • res (float) – residual norm, fixed point error