constrained_equation_solver Derived Type

type, public, abstract, extends(least_squares_solver) :: constrained_equation_solver

A least-squares solver that implements limits (constraints) on the solution variables.


Contents


Type-Bound Procedures

procedure, public :: apply_limits => ces_apply_limits

  • private subroutine ces_apply_limits(this, x)

    Applies the limits to the solution vector.

    Arguments

    Type IntentOptional Attributes Name
    class(constrained_equation_solver), intent(in) :: this

    The constrained_equation_solver object.

    real(kind=real64), intent(inout), dimension(:) :: x

    On input, the solution vector. On output, the clamped solution vector.

procedure, public :: get_fcn_tolerance => es_get_fcn_tol

  • private pure function es_get_fcn_tol(this) result(x)

    Gets the convergence on function value tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value real(kind=real64)

    The tolerance value.

procedure, public :: get_gradient_tolerance => es_get_grad_tol

  • private pure function es_get_grad_tol(this) result(x)

    Gets the convergence on slope of the gradient vector tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value real(kind=real64)

    The tolerance value.

procedure, public :: get_lower_limits => ces_get_lower_bounds

  • private pure function ces_get_lower_bounds(this) result(rst)

    Gets the array of lower bounds constraints.

    Arguments

    Type IntentOptional Attributes Name
    class(constrained_equation_solver), intent(in) :: this

    The constrained_equation_solver object.

    Return Value real(kind=real64), allocatable, dimension(:)

    The limit array.

procedure, public :: get_max_fcn_evals => es_get_max_eval

  • private pure function es_get_max_eval(this) result(n)

    Gets the maximum number of function evaluations allowed during a single solve.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value integer(kind=int32)

    The maximum number of function evaluations.

procedure, public :: get_print_status => es_get_print_status

  • private pure function es_get_print_status(this) result(x)

    Gets a logical value determining if iteration status should be printed.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value logical

    True if the iteration status should be printed; else, false.

procedure, public :: get_step_scaling_factor => lss_get_factor

  • private pure function lss_get_factor(this) result(x)

    Gets a factor used to scale the bounds on the initial step.

    This factor is used to set the bounds on the initial step such that the initial step is bounded as the product of the factor with the Euclidean norm of the vector resulting from multiplication of the diagonal scaling matrix and the solution estimate. If zero, the factor itself is used.

    Arguments

    Type IntentOptional Attributes Name
    class(least_squares_solver), intent(in) :: this

    The least_squares_solver object.

    Return Value real(kind=real64)

    The factor.

procedure, public :: get_upper_limits => ces_get_upper_bounds

  • private pure function ces_get_upper_bounds(this) result(rst)

    Gets the array of upper bounds constraints.

    Arguments

    Type IntentOptional Attributes Name
    class(constrained_equation_solver), intent(in) :: this

    The constrained_equation_solver object.

    Return Value real(kind=real64), allocatable, dimension(:)

    The limit array.

procedure, public :: get_var_tolerance => es_get_var_tol

  • private pure function es_get_var_tol(this) result(x)

    Gets the convergence on change in variable tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value real(kind=real64)

    The tolerance value.

procedure, public :: set_fcn_tolerance => es_set_fcn_tol

  • private subroutine es_set_fcn_tol(this, x)

    Sets the convergence on function value tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    real(kind=real64), intent(in) :: x

    The tolerance value.

procedure, public :: set_gradient_tolerance => es_set_grad_tol

  • private subroutine es_set_grad_tol(this, x)

    Sets the convergence on slope of the gradient vector tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    real(kind=real64), intent(in) :: x

    The tolerance value.

procedure, public :: set_lower_limits => ces_set_lower_bounds

  • private subroutine ces_set_lower_bounds(this, x)

    Sets the array of lower bounds constraints.

    Arguments

    Type IntentOptional Attributes Name
    class(constrained_equation_solver), intent(inout) :: this

    The constrained_equation_solver object.

    real(kind=real64), intent(in), dimension(:) :: x

    The limit array.

procedure, public :: set_max_fcn_evals => es_set_max_eval

  • private subroutine es_set_max_eval(this, n)

    Sets the maximum number of function evaluations allowed during a single solve.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    integer(kind=int32), intent(in) :: n

    The maximum number of function evaluations.

procedure, public :: set_print_status => es_set_print_status

  • private subroutine es_set_print_status(this, x)

    Sets a logical value determining if iteration status should be printed.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    logical, intent(in) :: x

    True if the iteration status should be printed; else, false.

procedure, public :: set_step_scaling_factor => lss_set_factor

  • private subroutine lss_set_factor(this, x)

    Sets a factor used to scale the bounds on the initial step.

    This factor is used to set the bounds on the initial step such that the initial step is bounded as the product of the factor with the Euclidean norm of the vector resulting from multiplication of the diagonal scaling matrix and the solution estimate. If zero, the factor itself is used.

    Arguments

    Type IntentOptional Attributes Name
    class(least_squares_solver), intent(inout) :: this

    The least_squares_solver object.

    real(kind=real64), intent(in) :: x

    The factor.

procedure, public :: set_upper_limits => ces_set_upper_bounds

  • private subroutine ces_set_upper_bounds(this, x)

    Sets the array of upper bounds constraints.

    Arguments

    Type IntentOptional Attributes Name
    class(constrained_equation_solver), intent(inout) :: this

    The constrained_equation_solver object.

    real(kind=real64), intent(in), dimension(:) :: x

    The limit array.

procedure, public :: set_var_tolerance => es_set_var_tol

  • private subroutine es_set_var_tol(this, x)

    Sets the convergence on change in variable tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    real(kind=real64), intent(in) :: x

    The tolerance value.

procedure, public :: solve => lss_solve

  • private subroutine lss_solve(this, fcn, x, fvec, ib, args, err)

    Applies the Levenberg-Marquardt method to solve the nonlinear least-squares problem. This routines is based upon the MINPACK routine LMDIF.

    Arguments

    Type IntentOptional Attributes Name
    class(least_squares_solver), intent(inout) :: this

    The least_squares_solver object.

    class(vecfcn_helper), intent(in) :: fcn

    The vecfcn_helper object containing the equations to solve.

    real(kind=real64), intent(inout), dimension(:) :: x

    On input, an N-element array containing an initial estimate to the solution. On output, the updated solution estimate. N is the number of variables.

    real(kind=real64), intent(out), dimension(:) :: fvec

    An M-element array that, on output, will contain the values of each equation as evaluated at the variable values given in x.

    type(iteration_behavior), optional :: ib

    An optional output, that if provided, allows the caller to obtain iteration performance statistics.

    class(*), intent(inout), optional :: args

    An optional argument to allow the user to communicate with the routine.

    class(errors), intent(inout), optional, target :: err

    An error handling object.