Reference

Contents

Index

Gawain.TRBSolverType
TRBSolver(model)

A structure that contains all required storage to run solver TRB. A TRBSolver instance can be used to perform efficient re-solves of a problem (e.g., with a different initial guess or different parameter).

Arguments

  • model::AbstractNLPModel: an NLPModel representing an unconstrained or bound-constrained problem.
source
Gawain.trbMethod
trb(model; kwargs...)

Solve the unconstrained or bound-constrained problem model with GALAHAD solver TRB.

Arguments

  • model::AbstractNLPModel: an NLPModel representing an unconstrained or bound-constrained problem.

Keyword arguments

  • callback: a function called at each iteration allowing the user to access intermediate solver information. See below for more details.
  • x0::AbstractVector: an initial guess of the same type as model.meta.x0. Default: model.meta.x0.
  • prec: a function or callable of (x, u, v) that overwrites u with a preconditioner applied to v at the current iterate x. prec(x, u, v) should return 0 on success. Default: u = v, i.e., no preconditioner.
  • print_level::Int: verbosity level (see the TRB documentation). Default: 1.
  • maxit::Int: maximum number of iterations. Default: max(50, n), where n is the number of variables.

Callback

The callback is called at each iteration. The expected signature of the callback is callback(model, solver, stats), and its output is ignored. Changing any of the input arguments will affect the subsequent iterations. In particular, setting stats.status to anything else than :unknown will stop the algorithm, and setting it :user will signal that user-requested termination was requested. All relevant information should be available in model, solver and stats. Notably, you can access, and modify, the following:

  • solver.x: current iterate;
  • solver.gx: current gradient;
  • stats: structure holding the output of the algorithm (GenericExecutionStats), which contains, among other things:
    • stats.dual_feas: norm of the residual, for instance, the norm of the gradient for unconstrained problems;
    • stats.iter: current iteration counter;
    • stats.objective: current objective function value;
    • stats.status: current status of the algorithm. Should be :unknown unless the algorithm attained a stopping criterion. Changing this to anything will stop the algorithm, but you should use :user to properly indicate the intention.
    • stats.elapsed_time: elapsed time in seconds.

If re-solves are of interest, it is more efficient to first instantiate a solver object and call solve!() repeatedly:

solver = TRBSolver(model1)
stats = GenericExecutionStats(model, solver_specific = Dict{Symbol, TRB_STATUS}())
solve!(solver, model2, stats; kwargs...)

where the kwargs... are the same as above. In this scenario, model1 and model2 need not be the same model, but they must have the same number of variables, and the same Hessian sparsity pattern.

source