Skip to content

Add adaptive tolerance scaling for boundary and gradient algorithms in variational optimization - #410

Open
leburgel wants to merge 3 commits into
mainfrom
lb/dynamic_tols
Open

Add adaptive tolerance scaling for boundary and gradient algorithms in variational optimization#410
leburgel wants to merge 3 commits into
mainfrom
lb/dynamic_tols

Conversation

@leburgel

@leburgel leburgel commented Aug 4, 2026

Copy link
Copy Markdown
Member

Adds adaptive tolerance scaling, where the tolerance of the contraction algorithm is set based on the current norm of the gradient (default scaling factor of 1.0e-3). The tolerance of the gradient algorithm in turn is set based on the contraction tolerance (default scaling factor 1.0e1).

On the README example, these default settings give a 1.5x speedup in walltime needed to reach a given energy value starting from the same initial guess. I'll see what the tests say for now, and do some more trials in the meantime.

At the same time, this reworks the way the per-iteration info metrics are stored and added. Previously, the contraction_metrics and gradnorms_unitcell got a new entry every time cost function was called. These function evaluations don't necessarily match the iterations of the optimization loop. In particular, entries were added for every rejected step during the line search, which just seemed needlessly confusing. I changed to workflow to record the current values in the cost function, but only add entries in the finalize! routine, which is actually called after every iteration (i.e. every accepted step).

This is also in anticipation of adding preconditioning, which naturally requires access to the current gradient norm.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/algorithms/optimization/peps_optimization.jl 95.65% 1 Missing ⚠️
src/algorithms/select_algorithm.jl 94.11% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/Defaults.jl 85.71% <ø> (ø)
...rithms/optimization/fixed_point_differentiation.jl 85.47% <100.00%> (-3.33%) ⬇️
src/algorithms/optimization/peps_optimization.jl 95.65% <95.65%> (+0.91%) ⬆️
src/algorithms/select_algorithm.jl 82.05% <94.11%> (+5.12%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Successfully merging this pull request may close these issues.

1 participant