Skip to content

Commit 4802481

Browse files
authored
Fix optimizer verbosity in fixedpoint algorithm selector (#175)
* Make `fixedpoint` verbosities consistent with MPSKit and KrylovKit: 1. warnings 2. info at init and convergence 3. iteration info 4. debug output including CTMRG and AD infos
1 parent 115089f commit 4802481

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/algorithms/optimization/peps_optimization.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ The optimization parameters can be supplied via the keyword arguments or directl
112112
* `tol::Real=$(Defaults.optimizer_tol)` : Overall tolerance for gradient norm convergence of the optimizer. Sets related tolerance such as the boundary and boundary-gradient tolerances to sensible defaults unless they are explictly specified.
113113
* `verbosity::Int=1` : Overall output information verbosity level, should be one of the following:
114114
0. Suppress all output
115-
1. Optimizer output and warnings
116-
2. Additionally print boundary information
117-
3. All information including AD debug outputs
115+
1. Only print warnings
116+
2. Initialization and convergence info
117+
3. Iteration info
118+
4. Debug info including AD outputs
118119
* `reuse_env::Bool=$(Defaults.reuse_env)` : If `true`, the current optimization step is initialized on the previous environment, otherwise a random environment is used.
119120
* `symmetrization::Union{Nothing,SymmetrizationStyle}=nothing` : Accepts `nothing` or a `SymmetrizationStyle`, in which case the PEPS and PEPS gradient are symmetrized after each optimization iteration.
120121
* `(finalize!)=OptimKit._finalize!` : Inserts a `finalize!` function call after each optimization step by utilizing the `finalize!` kwarg of `OptimKit.optimize`. The function maps `(peps, env), f, g = finalize!((peps, env), f, g, numiter)`.

src/algorithms/select_algorithm.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ function select_algorithm(
2121
::typeof(fixedpoint),
2222
env₀::CTMRGEnv;
2323
tol=Defaults.optimizer_tol, # top-level tolerance
24-
verbosity=2, # top-level verbosity
24+
verbosity=3, # top-level verbosity
2525
boundary_alg=(;),
2626
gradient_alg=(;),
2727
optimizer_alg=(;),
2828
kwargs...,
2929
)
3030
# adjust CTMRG tols and verbosity
3131
if boundary_alg isa NamedTuple
32-
defaults = (; verbosity=verbosity 1 ? -1 : verbosity, tol=1e-4tol)
32+
defaults = (; verbosity=verbosity 3 ? -1 : 3, tol=1e-4tol)
3333
boundary_kwargs = merge(defaults, boundary_alg)
3434
boundary_alg = select_algorithm(leading_boundary, env₀; boundary_kwargs...)
3535
end
3636

3737
# adjust gradient verbosity
3838
if gradient_alg isa NamedTuple
3939
# TODO: check this:
40-
defaults = (; verbosity=verbosity 2 ? -1 : 3, tol=1e-2tol)
40+
defaults = (; verbosity=verbosity 3 ? -1 : 3, tol=1e-2tol)
4141
gradient_alg = merge(defaults, gradient_alg)
4242
end
4343

4444
# adjust optimizer tol and verbosity
4545
if optimizer_alg isa NamedTuple
46-
defaults = (; tol, verbosity=verbosity < 1 ? -1 : 3)
46+
defaults = (; tol, verbosity)
4747
optimizer_alg = merge(defaults, optimizer_alg)
4848
end
4949

0 commit comments

Comments
 (0)