constrained_least_squares_solver Derived Type

type, public, extends(constrained_equation_solver) :: constrained_least_squares_solver

Defines a constrained least-squares solver using Powell's trust region method. The method seeks a correction that reduces the residual vector while remaining inside a trust region of size and the bounds . The trial step is formed from a Gauss-Newton step a steepest-descent step and a dogleg combination with chosen so that . If the trust-region step is rejected, a backtracking line search is used to improve the step acceptance.


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 => cls_get_factor

procedure, public :: get_trust_region_radius => cls_get_radius

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 => cls_set_factor

procedure, public :: set_trust_region_radius => cls_set_radius

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 => cls_solve

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

    Applies the constrained least-squares solver to solve the nonlinear least-squares problem.

    Arguments

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

    The constrained_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. If the iteration process does not converge, each element is returned as NaN, and, if supplied, ib will indicate a failure to converge.

    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.