API reference

The full docstring index, grouped by area. Each group links to the page where those docstrings are written and discussed; this page is the lookup table, not the tutorial.

TRParams is documented under Thresholds and factors, the three solvers under Problem classes, and the trace alignment convention under Diagnostics.

Entry point

TrustRegionRadius.TRResult — Type
TRResult

An alias of JSO's GenericExecutionStats. Useful fields: status, solution, objective, dual_feas, iter, elapsed_time. Evaluation counts live on the model — neval_obj(nlp), neval_grad(nlp), neval_hprod(nlp).

source
TrustRegionRadius.tr_solve — Function
tr_solve(nlp; rule, model, subsolver, params, x_ref, true_curvature,
         hessian_norm, kwargs...) -> TRResult

The declared keywords are rule, model, subsolver, params, x_ref, true_curvature and hessian_norm. Everything else, trace and callback above all, is forwarded through kwargs... to SolverCore.solve!, so trace = true is the supported spelling rather than a keyword of this function.

Solve nlp, choosing the solver from the problem class:

nlpsolver
any AbstractNLPModel, FullBatchNLPDeterministicTRSolver
ExpectationNLPExpectationTRSolver
FiniteSumNLPFiniteSumTRSolver

The sampling rule is not an argument here: it belongs to the oracle, because it decides what the oracle returns.

using TrustRegionRadius, ADNLPModels

# deterministic
nlp = ADNLPModel(x -> (1 - x[1])^2 + 100(x[2] - x[1]^2)^2, [-1.2, 1.0])
tr_solve(nlp; rule = RGrad(), model = SR1Model(mem = 5))

# finite sum: the cap is M, not a keyword
prob = LogisticRegression(K = 5, M = 2_000)
tr_solve(FiniteSumNLP(prob, RadiusProportional()); model = BHHHModel(ridge = 1e-8))

# expectation: the cap is the budget, because there is no M
exp_prob = PerturbedExpectation(base; σg = 1.0)
tr_solve(ExpectationNLP(exp_prob, RadiusProportional(); budget = 50_000))
source
TrustRegionRadius.model_grad_evals — Function
model_grad_evals(solver) -> Int

Gradient evaluations made from inside the model, which the algorithm did not request. Non-zero only for SPDTarget, which calls grad inside dense_hessian and phi_target. Subtract before reporting neval_grad as a cost:

algorithm_grads = neval_grad(nlp) - model_grad_evals(solver)

The fallback returns 0 because no other model evaluates the gradient itself.

source

Extension points

These are exported so that a rule, a model Hessian or a subproblem solver defined outside the package can hook into it. They are validators and traits rather than user-facing API: you call them when writing an extension, not when solving a problem.

Index by area

Problem classes and oracles

Radius mechanisms

Thresholds and factors

Model Hessians

Subproblem solvers

Sampling rules and stochastic oracles

Likelihood and least squares

Second-order variants

Diagnostics

Benchmarking

Entry point