JuliaSmoothOptimizers / JuliaSmoothOptimizers/SolverTools.jl

Add max_time stopping criterion to armijo_goldstein

Open
#246 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
24
Forks
18
PR merge metrics
No merged PRs in 30d

Description

### Description


Currently, the `armijo_goldstein` line search method accepts limits on backtracking iterations (e.g., `bk_max` and `bG_max`), but it does not accept a wall-clock time limit (`max_time`).

When implementing custom solvers (like second-order regularized Newton methods) that rely on `armijo_goldstein` for negative curvature handling, an expensive objective evaluation or a poorly scaled direction can cause the line search to run for an excessively long time. Because the line search is unaware of the parent solver's global clock, it can cause the overarching optimization algorithm to severely violate its user-defined `max_time` limit.


Add `max_time` (and potentially `start_time`) as keyword arguments to `armijo_goldstein` to allow it to abort if the wall-clock time is exceeded.

Ideally, the function signature would look something like this:

```julia
function armijo_goldstein(
h::AbstractLineModel,
f0::Real,
slope0::Real;
t::Real = 1.0,
# ... existing kwargs ...
bk_max::Int = 10,
bG_max::Int = 10,
start_time::Float64 = time(), # Syncs with parent solver's clock
max_time::Float64 = Inf # Stops line search if exceeded
)

```

Inside the line search loop, a simple check would break the loop and return the best step found so far (or a failure flag) if the time limit is passed:

### Validation and testing

_No response_

### Motivation

_No response_

### Target audience

_No response_

### Can you help?

_No response_

Contributor guide

Open the contributing guide

Research direction

Search for armijo_goldstein and read the existing bk_max/bG_max loop and return path. Trace how callers track solver time, then determine how start_time and max_time should interact with the loop and its failure behavior. Done means the line search can stop at the limit without breaking existing calls, with coverage for the timeout path.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.