Abstract

Nonlinear parameter fitting using the Levenberg-Marquardt-algorithm (sort of a genetic algorithm).

The mk_lmdif module is the entry point, which must be given a representation of scalars (which also doubles as the type of parameters) and a way to produce random numbers.

Synopsis

module type lmdif = {
type real
type range = {initial_value: real, lower_bound: real, upper_bound: real}
type calibration_result [num_vars] = {error: real, num_feval: i32, parameters: [num_vars]real}
type optimization_variable
val fixed_value: real -> optimization_variable
val optimize_value: range -> optimization_variable
val lmdif [num_vars]: [num_vars]optimization_variable -> (objective: ([num_vars]real -> real)) -> (max_global: i32) -> (np: i32) -> calibration_result [num_vars]
}
module mk_lmdif: (real: real) -> (rand: rng_engine) -> lmdif with real = real.t

Description

module type lmdif

The type of an instantiated mk_lmdif module.

type real

The representation of real numbers.

type range = {initial_value: real, lower_bound: real, upper_bound: real}

A range for an optimizable varible. Inclusive lower and upper bounds, as well as an initial value.

type calibration_result [num_vars] = {error: real, num_feval: i32, parameters: [num_vars]real}

The result of calibration, which includes the best observed parameter assignment, its error, and the number of evaluations of the objective function that was carried out before finding this result. The error is simply the value returned by the objective function for the parameters, and produced here only for convenience.

type optimization_variable

An input variable to the objective function. It can be either fixed or subject to optimization.

val fixed_value: real -> optimization_variable
val optimize_value: range -> optimization_variable
val lmdif [num_vars]: [num_vars]optimization_variable -> (objective: ([num_vars]real -> real)) -> (max_global: i32) -> (np: i32) -> calibration_result [num_vars]

Perform parameter fitting. objective is the objective function, max_global is the maximum number of calls to the objective function before termination. np is the number of mutations to attempt per iteration.