From 85e8b60499a21599ccca5e7cef3d2bfdc93ea77c Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sun, 21 Feb 2021 14:04:57 -0500 Subject: [PATCH 1/2] Start the soft deprecation of minimizer This allows for using the new OptimizationSolution as the underbelly for DiffEqFlux.jl in a non-breaking way. This is going to be a very "soft" change, as in `.minimizer` will still work without throwing an error, and in about a year we can add a depwarn. But we will change the documentation and tests almost immediately. This will let users slowly phase out the use of `.minimizer`, and we can throw a depwarn on code about a year. Naturally it should all be moving from `sciml_train` to direct GalacticOptim use over that time. actual fix --- Project.toml | 2 +- src/solutions/optimization_solutions.jl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0ae3d9b14..6ebaa644e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SciMLBase" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" authors = ["Chris Rackauckas and contributors"] -version = "1.8.0" +version = "1.8.1" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/src/solutions/optimization_solutions.jl b/src/solutions/optimization_solutions.jl index 4d612efd6..688b85ef9 100644 --- a/src/solutions/optimization_solutions.jl +++ b/src/solutions/optimization_solutions.jl @@ -32,6 +32,13 @@ function Base.show(io::IO, A::AbstractOptimizationSolution) return end +Base.@propagate_inbounds function Base.getproperty(x::AbstractOptimizationSolution,s::Symbol) + if s == :minimizer + return getfield(x,:u) + end + return getfield(x,s) +end + Base.summary(A::AbstractOptimizationSolution) = string( TYPE_COLOR, nameof(typeof(A)), NO_COLOR, " with uType ", From 803642d69fe13110d66ce96ab1d6e3eb65df7b03 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sun, 21 Feb 2021 14:10:00 -0500 Subject: [PATCH 2/2] help constant prop --- src/solutions/optimization_solutions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solutions/optimization_solutions.jl b/src/solutions/optimization_solutions.jl index 688b85ef9..df4475c45 100644 --- a/src/solutions/optimization_solutions.jl +++ b/src/solutions/optimization_solutions.jl @@ -33,7 +33,7 @@ function Base.show(io::IO, A::AbstractOptimizationSolution) end Base.@propagate_inbounds function Base.getproperty(x::AbstractOptimizationSolution,s::Symbol) - if s == :minimizer + if s === :minimizer return getfield(x,:u) end return getfield(x,s)