-
-
Notifications
You must be signed in to change notification settings - Fork 114
Remove OptimizationBase.jl pieces #1146
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
Conversation
|
This PR seems to be breaking backwards compatibility for me. I can confirm that my package compiled with v2.120.0 and then errored on v2.121.0. Error message below. It looks like this function was removed and is the cause of the error: function init(prob::OptimizationProblem, alg, args...; kwargs...)::AbstractOptimizationCache
if prob.u0 !== nothing && !isconcretetype(eltype(prob.u0))
throw(NonConcreteEltypeError(eltype(prob.u0)))
end
_check_opt_alg(prob::OptimizationProblem, alg; kwargs...)
cache = __init(prob, alg, args...; prob.kwargs..., kwargs...)
return cache
endMy package uses (no SciMLBase here except in their deps) [compat]
...
Optimization = "4.1.0"
OptimizationOptimJL = "0.4.1"
...Any recommendations for how to get around this? In case it helps, here's the call I make to these Optimization packages: optf = OptimizationFunction(objfn, Optimization.AutoForwardDiff())
prob = OptimizationProblem(optf, [atan(y, x)], [x; y; a; b], lb=[-pi], ub=[pi])
sol = solve(prob, BFGS())Finally, here's the error output: ERROR: LoadError: MethodError: no method matching init(::SciMLBase.OptimizationProblem{true, SciMLBase.OptimizationFunction{true, ADTypes.AutoForwardDiff{nothing, Nothing}, OptimizationOptimJL.var"#obj_f#38", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, Tuple{Matrix{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Float64}, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}}, ::Optim.LBFGS{Nothing, LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Returns{Nothing}}; maxiters::Int64, maxtime::Int64)
Stacktrace:
[1] solve(::SciMLBase.OptimizationProblem{true, SciMLBase.OptimizationFunction{true, ADTypes.AutoForwardDiff{nothing, Nothing}, OptimizationOptimJL.var"#obj_f#38", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, Tuple{Matrix{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Float64}, Nothing, Nothing, Nothing, Nothing, @Kwargs{}}, ::Vararg{Any}; kwargs::@Kwargs{maxiters::Int64, maxtime::Int64})
@ CommonSolve ~/.julia/packages/CommonSolve/JfpfI/src/CommonSolve.jl:23
[2] (::OptimizationOptimJL.var"#solve_nonnegative_least_squares#39"{OptimizationOptimJL.var"#obj_f#38"})(A::Matrix{Float64}, b::Vector{Float64}, solver::Optim.LBFGS{Nothing, LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Returns{Nothing}})
@ OptimizationOptimJL ~/.julia/packages/OptimizationOptimJL/pe3SX/src/OptimizationOptimJL.jl:491
[3] macro expansion
@ ~/.julia/packages/OptimizationOptimJL/pe3SX/src/OptimizationOptimJL.jl:502 [inlined]
[4] macro expansion
@ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:78 [inlined]
[5] top-level scope
@ ~/.julia/packages/OptimizationOptimJL/pe3SX/src/OptimizationOptimJL.jl:480
[6] include
@ ./Base.jl:495 [inlined]
[7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base ./loading.jl:2292
[8] top-level scope
@ stdin:4
in expression starting at /home/runner/.julia/packages/OptimizationOptimJL/pe3SX/src/OptimizationOptimJL.jl:1
in expression starting at stdin:4 |
|
OK, it seems like |
|
Well, it now compiles but it doesn't run. The sample at the Optimization.jl docs errors: # Import the package and define the problem to optimize
using Optimization, Zygote
rosenbrock(u, p) = (p[1] - u[1])^2 + p[2] * (u[2] - u[1]^2)^2
u0 = zeros(2)
p = [1.0, 100.0]
optf = OptimizationFunction(rosenbrock, AutoZygote())
prob = OptimizationProblem(optf, u0, p)
sol = solve(prob, Optimization.LBFGS())ERROR: MethodError: no method matching init(::OptimizationProblem{…}, ::Optimization.LBFGS)
The function `init` exists, but no method is defined for this combination of argument types.
Stacktrace:
[1] solve(::OptimizationProblem{true, OptimizationFunction{…}, Vector{…}, Vector{…}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, @Kwargs{}}, ::Vararg{Any}; kwargs::@Kwargs{})
@ CommonSolve ~/.julia/packages/CommonSolve/JfpfI/src/CommonSolve.jl:23 |
|
OK, final comment on this: I have |
|
Okay, finally fixed this code movement. Sorry, this change has been a mess. |
|
All good now! To me, this is the exception that proves the rule: the julia ecosystem does a great job with version control and making updates smooth. And I include you in that. Thank you for all you do with SciML! |
No description provided.