Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues affecting changes in line search methods #1104

Open
1 of 2 tasks
timholy opened this issue Oct 24, 2024 · 3 comments
Open
1 of 2 tasks

Issues affecting changes in line search methods #1104

timholy opened this issue Oct 24, 2024 · 3 comments

Comments

@timholy
Copy link
Contributor

timholy commented Oct 24, 2024

In an attempt to fix JuliaNLSolvers/LineSearches.jl#173 and JuliaNLSolvers/LineSearches.jl#175 (see JuliaNLSolvers/LineSearches.jl#180), I've concluded that the best option is to rewrite HagerZhang from scratch. I've actually done this, and the new implementation passes all the tests in LineSearches.jl.

However, many tests in Optim fail. Here's a to-be-updated list of issues that need discussion and/or resolution:

  • some tests depend on every minor detail of the algorithms. In this case where we deliberately limit the number of iterations, the new implementation gets to a lower minimum with fewer function calls, and yet because of how that test is written it's counted as a failure. I've already addressed this one (it's easy).
  • there are a ton of tests that have bespoke exceptions granted with no obvious rhyme or reason. One example:
    # TODO: Check why skip problems fail
    skip = ("Trigonometric", "Large Polynomial", "Parabola", "Paraboloid Random Matrix",
    "Paraboloid Diagonal", "Extended Rosenbrock", "Penalty Function I", "Beale",
    "Extended Powell",
    )
    run_optim_tests(AcceleratedGradientDescent();
    skip = skip,
    convergence_exceptions = (("Rosenbrock", 1),("Rosenbrock", 2)),
    minimum_exceptions = (("Rosenbrock", 2),),
    minimizer_exceptions = (("Rosenbrock", 2),),
    iteration_exceptions = (("Powell", 1100),
    ("Rosenbrock", 10000),
    ("Polynomial", 1500),
    ("Fletcher-Powell", 10000),
    ("Extended Powell", 8000)),
    f_increase_exceptions = ("Hosaki", "Polynomial", "Powell", "Himmelblau",
    "Extended Powell", "Fletcher-Powell",
    "Quadratic Diagonal", "Rosenbrock"),
    show_name=debug_printing)#,
    The test/multivariate directory is full of examples like these. Since HagerZhang is the default line search algorithm, any subtle change can cause shifts in the things that require exceptions. I will wager that something things that previously failed will pass, and I know that some things that previously passed will fail. In the one case I've looked at in detail, it actually does reach the minimum, but it bounces around without triggering the convergence criterion. Somehow the old implementation happened to trigger it, but given the hand-granted exceptions I'm guessing that's more random than systematic.
    Proposed solutions:
    • echoing warn people that g_tol often needs to be set #1102, one option is that the convergence criteria should be part of the problem formulation, stored as a field in OptimizationProblem. Or at least, something that would allow you to compute problem-specific convergence criteria.
    • alternatively, perhaps we could compute the criteria from the Hessian evaluated at the minimum, if all the problems are in fact second-order differentiable. This doesn't adequately incorporate roundoff error (which can have a big impact), so it may not actually work in practice. Perhaps we could do something clever with IntervalArithmetic to estimate the impact of roundoff error, though again there are caveats.

I'd absolutely love some help with some of these. I could easily imagine spending a week just rationalizing the existing test suite, and that may stand in the way of actually fixing outstanding issues.

CC @mateuszbaran @kbarros @stevengj

@pkofod
Copy link
Member

pkofod commented Oct 25, 2024

Yeah, that test setup is far from optimal. It basically only measures if given some options the solution found is no worse (or something close to that, cannot remember the exact setup).

timholy added a commit that referenced this issue Oct 25, 2024
A global flag, test_broken (default false), determines whether
this runs during CI. Locally it's useful to be able to tally the
failures, e.g., #1104

Also:
- Fix one failure in L-BFGS that causes CI to fail
- Remove several tests from the exclusions lists that now pass
@pkofod
Copy link
Member

pkofod commented Oct 29, 2024

Is the re-implementation present anywhere?

@timholy
Copy link
Contributor Author

timholy commented Oct 29, 2024

avik-pal pushed a commit to avik-pal/Optim.jl that referenced this issue Nov 19, 2024
A global flag, test_broken (default false), determines whether
this runs during CI. Locally it's useful to be able to tally the
failures, e.g., JuliaNLSolvers#1104

Also:
- Fix one failure in L-BFGS that causes CI to fail
- Remove several tests from the exclusions lists that now pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants