Reusing an optimization problem

In Optimization.jl, we make an OptimizationProblem and solve it using an optimizer – is there any way to reuse the OptimizationProblem, like remake! in DifferentialEquations.jl? The idea would be to seamlessly chain multiple optimizers together without manually rebuilding the OptimizationProblem each time.

For what it’s worth, it’s possible with JuMP.jl. A quick look at the docs for Optimization.jl didn’t yield anything on this topic, but I might have missed something

remake works. Note it’s an immutable struct so you can just prob.p .= to modify the values, or just remake the struct and let Julia elide the problem construction (with immutables it usually just deletes the wrapper construction if it’s a good idea)

Might also be possible with @set from Setfield.jl which might be a lighter weight dependency.