# levMarMethods¶

Extended_rate_function(opt, varargin)[source]

Usage

[hxk, ghxk] = Extended_rate_function(opt, varargin)

Inputs

• xk – current point;
• opt – structure includes required parameters:
• .FR - concatenation of forward and reverse stoichiometric matrix
• .A - Reduced forward stoichiometric matrix
• .B - Reduced reverse stoichiometric matrix
• .L - left null space of R-F
• .l0 - positive initial concentration
• .k - initial kinetic

Outputs

• hxk – the vector h(xk)
• ghxk – gradient of h at xk
GLM_FY(mapp, lin_sym_solver, x0, options)[source]

GLM_FY is a Levenberg-Marquardt algorithm for solving systems of nonlinear equations $$h(x) = 0$$, x in $$R^m$$ using the nonlinear unconstrained minimization $$\textrm{min} \psi(x) = 1/2 ||h(x)||^2$$ s.t. x in $$R^m$$.

Usage

[x_best, psi_best, out] = GLM_FY(mapp, lin_sym_solver, x0, options)

Inputs

• mapp – function handle provides h(x) and gradient h(x)
• lin_sym_solver – function handle for solving the linear system
• x0 – initial point
• options – structure including the parameteres of scheme
• .eta - parameter of the scheme
• .MaxNumIter - maximum number of iterations
• .MaxNumMapEval - maximum number of function evaluations
• .MaxNumGmapEval - maximum number of subgradient evaluations
• .TimeLimit - maximum running time
• .epsilon - accuracy parameter
• .x_opt - optimizer
• .psi_opt - optimum
• .flag_x_error - 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• .flag_psi_error - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .flag_time - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .Stopping_Crit - stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• x_best – the best approximation of the optimizer
• psi_best – the best approximation of the optimum
• out – structure including more output information
• .T - running time
• .Niter - total number of iterations
• .Nmap - total number of mapping evaluations
• .Ngmap - total number of mapping gradient evaluations
• .merit_func - array including all merit function values
• .x_error - relative error $$\textrm{norm}(x_k(:)-x_{opt}(:))/\textrm{norm}(x_{opt})$$
• .psi_error - relative error $$(\psi_k-\psi_{opt})/(\psi_0-\psi_{opt}))$$
• .Status - reason of termination
GLM_YF(mapp, lin_sym_solver, x0, options)[source]

GLM_YF is a Levenberg-Marquardt algorithm for solving systems of nonlinear equations $$h(x) = 0$$, x in $$R^m$$ using the nonlinear unconstrained minimization $$\textrm{min} \psi(x) = 1/2 ||h(x)||^2$$ s.t. x in $$R^m$$.

Usage

[x_best, psi_best, out]=GLM_YF(mapp, lin_sym_solver, x0, options)

Inputs

• mapp – function handle provides h(x) and gradient h(x)
• lin_sym_solver – function handle for solving the linear system
• x0 – initial point
• options – structure including the parameteres of scheme
• .eta - parameter of the scheme
• .MaxNumIter - maximum number of iterations
• .MaxNumMapEval - maximum number of function evaluations
• .MaxNumGmapEval - maximum number of subgradient evaluations
• .TimeLimit - maximum running time
• .epsilon - accuracy parameter
• .x_opt - optimizer
• .psi_opt - optimum
• .flag_x_error - 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• .flag_psi_error - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .flag_time - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .Stopping_Crit - stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• x_best – the best approximation of the optimizer
• psi_best – the best approximation of the optimum
• out – structure including more output information
• .T - running time
• .Niter - total number of iterations
• .Nmap - total number of mapping evaluations
• .Ngmap - total number of mapping gradient evaluations
• .merit_func - array including all merit function values
• .x_error - relative error $$\textrm{norm}(x_k(:)-x_{opt}(:))/\textrm{norm}(x_{opt})$$
• .psi_error - relative error $$(\psi_k-\psi_{opt})/(\psi_0-\psi_{opt}))$$
• .Status - reason of termination
Initialization(options)[source]

Initialization is a function for initializing the parameters of LLM and GLM. If some parameters specified by the user Initialization uses these parameters. Otherwise, the default values will be employed.

Usage

[eta, epsilon, MaxNumIter, MaxNumMapEval, MaxNumGmapEval, adaptive, TimeLimit, flag_x_error, flag_psi_error, flag_time, Stopping_Crit] = Initialization(options)

Input

• options – structure including the parameteres of schemes
• .eta - parameter of the scheme
• .MaxNumIter - maximum number of iterations
• .MaxNumMapEval - maximum number of function evaluations
• .MaxNumGmapEval - maximum number of subgradient evaluations
• .TimeLimit - maximum running time
• .epsilon - accuracy parameter
• .x_opt - optimizer
• .psi_opt - optimum
• .flag_x_error - 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• .flag_psi_error - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .flag_time - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .Stopping_Crit - stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• eta – parameter of the scheme
• MaxNumIter – maximum number of iterations
• MaxNumMapEval – maximum number of function evaluations
• MaxNumGmapEval – maximum number of subgradient evaluations
• TimeLimit – maximum running time
• epsilon – accuracy parameter
• x_opt – optimizer
• psi_opt – optimum
• flag_x_error – 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• flag_psi_error – 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• flag_time – 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• Stopping_Crit – stopping criterion
LLM(mapp, lin_sym_solver, x0, options)[source]

LLM is a Levenberg-Marquardt algorithm for solving systems of nonlinear equations $$h(x) = 0$$, x in $$R^m$$ using the nonlinear unconstrained minimization $$\textrm{min} \psi(x) = 1/2 ||h(x)||^2$$ s.t. x in $$R^m$$.

Usage

[x_best, psi_best, out] = LLM(mapp, lin_sym_solver, x0, options)

Inputs

• mapp – function handle provides h(x) and gradient h(x)
• lin_sym_solver – function handle for solving the linear system
• x0 – initial point
• options – structure including the parameteres of scheme
• .eta - parameter of the scheme
• .MaxNumIter - maximum number of iterations
• .MaxNumMapEval - maximum number of function evaluations
• .MaxNumGmapEval - maximum number of subgradient evaluations
• .TimeLimit - maximum running time
• .epsilon - accuracy parameter
• .x_opt - optimizer
• .psi_opt - optimum
• .flag_x_error - 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• .flag_psi_error - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .flag_time - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .Stopping_Crit - stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• x_best – the best approximation of the optimizer
• psi_best – the best approximation of the optimum
• out – structure including more output information
• .T - running time
• .Niter - total number of iterations
• .Nmap - total number of mapping evaluations
• .Ngmap - total number of mapping gradient evaluations
• .merit_func - array including all merit function values
• .x_error - relative error $$\textrm{norm}(x_k(:)-x_{opt}(:))/\textrm{norm}(x_{opt})$$
• .psi_error - relative error $$(\psi_k-\psi_{opt})/(\psi_0-\psi_{opt}))$$
• .Status - reason of termination
LMLS(mapp, lin_sym_solver, x0, options)[source]

LMLS is a Levenberg-Marquardt algorithm for solving systems of nonlinear equations $$h(x) = 0$$, x in $$R^m$$ using the nonlinear unconstrained minimization $$\textrm{min} \psi(x) = 1/2 ||h(x)||^2$$ s.t. x in $$R^m$$.

Usage

[x_best, psi_best, out] = LMLS(mapp, lin_sym_solver, x0, options)

Inputs

• mapp – function handle provides h(x) and gradient h(x)
• lin_sym_solver – function handle for solving the linear system
• x0 – initial point
• options – structure including the parameteres of scheme
• .eta - parameter of the scheme
• .MaxNumIter - maximum number of iterations
• .MaxNumMapEval - maximum number of function evaluations
• .MaxNumGmapEval - maximum number of subgradient evaluations
• .TimeLimit - maximum running time
• .epsilon - accuracy parameter
• .x_opt - optimizer
• .psi_opt - optimum
• .flag_x_error - 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• .flag_psi_error - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .flag_time - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .Stopping_Crit - stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• x_best – the best approximation of the optimizer
• psi_best – the best approximation of the optimum
• out – structure including more output information
• .T - running time
• .Niter - total number of iterations
• .Nmap - total number of mapping evaluations
• .Ngmap - total number of mapping gradient evaluations
• .merit_func - array including all merit function values
• .x_error - relative error $$\textrm{norm}(x_k(:)-x_{opt}(:))/\textrm{norm}(x_{opt})$$
• .psi_error - relative error $$(\psi_k-\psi_{opt})/(\psi_0-\psi_{opt}))$$
• .Status - reason of termination
LMTR(mapp, lin_sym_solver, x0, options)[source]

LMTR is a Levenberg-Marquardt algorithm for solving systems of nonlinear equations $$h(x) = 0$$, x in $$R^m$$ using the nonlinear unconstrained minimization $$\textrm{min} \psi(x) = 1/2 ||h(x)||^2$$ s.t. x in $$R^m$$.

Usage

[x_best, psi_best, out] = LMTR(mapp, lin_sym_solver, x0, options)

Inputs

• mapp – function handle provides h(x) and gradient h(x)
• lin_sym_solver – function handle for solving the linear system
• x0 – initial point
• options – structure including the parameteres of scheme
• .eta - parameter of the scheme
• .MaxNumIter - maximum number of iterations
• .MaxNumMapEval - maximum number of function evaluations
• .MaxNumGmapEval - maximum number of subgradient evaluations
• .TimeLimit - maximum running time
• .epsilon - accuracy parameter
• .x_opt - optimizer
• .psi_opt - optimum
• .flag_x_error - 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• .flag_psi_error - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .flag_time - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .Stopping_Crit - stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• x_best – the best approximation of the optimizer
• psi_best – the best approximation of the optimum
• out – structure including more output information
• .T - running time
• .Niter - total number of iterations
• .Nmap - total number of mapping evaluations
• .Ngmap - total number of mapping gradient evaluations
• .merit_func - array including all merit function values
• .x_error - relative error $$\textrm{norm}(x_k(:)-x_{opt}(:))/\textrm{norm}(x_{opt})$$
• .psi_error - relative error $$(\psi_k-\psi_{opt})/(\psi_0-\psi_{opt}))$$
• .Status - reason of termination
LevMar(mapp, lin_sym_solver, x0, options)[source]

LevMar is a Levenberg-Marquardt trust-region algorithm for solving systems of nonlinear equations $$h(x) = 0$$, x in $$R^m$$ using the nonlinear unconstrained minimization $$\textrm{min}\ \psi(x) = 1/2 ||h(x)||^2$$ s.t. x in $$R^m$$.

Usage

[x_best, psi_best, out] = LevMar(mapp, lin_sym_solver, x0, options)

Inputs

• mapp – function handle provides h(x) and gradient h(x)
• lin_sym_solver – function handle for solving the linear system
• x0 – initial point
• options – structure including the parameteres of scheme
• .eta - parameter of the scheme
• .MaxNumIter - maximum number of iterations
• .MaxNumMapEval - maximum number of function evaluations
• .MaxNumGmapEval - maximum number of subgradient evaluations
• .TimeLimit - maximum running time
• .epsilon - accuracy parameter
• .x_opt - optimizer
• .psi_opt - optimum
• .flag_x_error - 1: saves $$x_{error}$$, 0: do not saves $$x_{error}$$ (default)
• .flag_psi_error - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .flag_time - 1: saves $$\psi_{error}$$, 0: do not saves $$\psi_{error}$$ (default)
• .Stopping_Crit - stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• x_best – the best approximation of the optimizer
• psi_best – the best approximation of the optimum
• out – structure including more output information
• .T - running time
• .Niter - total number of iterations
• .Nmap - total number of mapping evaluations
• .Ngmap - total number of mapping gradient evaluations
• .merit_func - array including all merit function values
• .x_error - relative error $$\textrm{norm}(x_k(:)-x_{opt}(:))/\textrm{norm}(x_{opt})$$
• .psi_error - relative error $$(\psi_k-\psi_{opt})/(\psi_0-\psi_{opt}))$$
• .Status - reason of termination
Rate_function1(opt, varargin)[source]

Usage

[fxk, gfxk] = Rate_function1(opt, varargin)

Inputs

• xk – current point;
• opt – structure includes required parameters;
• .FR - concatenation of forward and reverse stoichiometric matrix
• .A - Reduced forward stoichiometric matrix
• .B - Reduced reverse stoichiometric matrix
• .k - initial kinetic

Outputs

• hxk – the vector h(xk)
• ghxk – gradient of h at xk
StopCriterion(grad, nhxk, Niter, Nmap, Ngmap, MaxNumIter, MaxNumMapEval, MaxNumGmapEval, T, TimeLimit, epsilon, nhx0, ngradx0, Stopping_Crit)[source]

StopCriterion is a function checking that one of the stopping criteria holds to terminate LLM and GLM. It perepare the status determining why the algorithm is stopped.

Usage

[StopFlag, Status] = StopCriterion(grad, nhxk, Niter, Nmap, Ngmap, MaxNumIter, MaxNumMapEval, MaxNumGmapEval, T, TimeLimit, epsilon, nhx0, ngradx0, Stopping_Crit)

Inputs

• nhxk – the norm 2 of h(xk)
• MaxNumIter – maximum number of iterations
• MaxNumMapEval – maximum number of function evaluations
• MaxNumGmapEval – maximum number of subgradient evaluations
• TimeLimit – maximum running time
• epsilon – accuracy parameter
• Stopping_Crit – stopping criterion
1. stop if $$||grad|| \leq \epsilon$$
2. stop if $$||nhxk|| \leq \epsilon$$
3. stop if MaxNumIter is reached
4. stop if MaxNumMapEval is reached
5. stop if MaxNumGmapEval is reached
6. stop if TimeLimit is reached
7. stop if $$||grad|| \leq \textrm{max}(\epsilon, \epsilon^2 * ngradx0)$$
8. stop if $$||nhxk|| \leq \textrm{max}(\epsilon, \epsilon^2 * nhx0)$$
9. stop if (default) $$||hxk|| \leq \epsilon$$ or MaxNumIter is reached

Outputs

• StopFlag – 1: if one of the stopping criteria holds, 0: if none of the stopping criteria holds
• Status – the reason of the scheme termination
lin_sym_solver_mldivide(Hk, grad)[source]

Solves the linear system $$Hkdk = -grad$$.

Usage