JuliaNLSolvers / Optim.jl

Optimization functions for Julia
Other
1.11k stars 213 forks source link

Problem with optimization with Optim.GradientDescent #1018

Closed STaherpour closed 5 months ago

STaherpour commented 1 year ago

Hi, I'm trying to use Optim.jl in Optimization of a State-to-State Transfer in a Two-Level-System.

Actually I want to learn working with Optim.jl and my main issue is working with Optim.GradientDescent.

When I use `opt_result_OptimGD = QuantumControlBase.optimize(

problem,
method = :grape,
info_hook = chain_infohooks(
    QuantumControl.GRAPE.print_table,
    store_pulses
),
optimizer = Optim.GradientDescent(;
    #alphaguess=LineSearches.InitialStatic(alpha=0.2),
    alphaguess = LineSearches.InitialPrevious(alphamin=0.2),
    linesearch = LineSearches.HagerZhang(alphamax=2.0)
)

);`

I face with this error: type GradientDescentState has no field g_previous, and I don't know why it happens. There is no g_previous in the Optim.GradientDescent.

Would you please help me in this regard?

pkofod commented 1 year ago

could you show the full stack trace? I think that maybe QuantumControl tries to access a field that does not exist.