Skip to content

Commit

Permalink
Make RSSCostFunction directly compatible with Optimization.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
gerlero committed Dec 17, 2023
1 parent 5f6ff0b commit 0b07db7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ParamEstim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using ..Fronts: InverseProblem, Problem, Solution, ReturnCode, solve
import ..Fronts: sorptivity

using LsqFit: curve_fit
import OrdinaryDiffEq.SciMLBase: successful_retcode
import OrdinaryDiffEq.SciMLBase: successful_retcode, NullParameters

"""
ScaledSolution
Expand Down Expand Up @@ -135,7 +135,9 @@ function (cf::RSSCostFunction)(sol::Union{Solution, ScaledSolution})
end
end

(cf::RSSCostFunction)(params::AbstractVector) = cf(candidate(cf, params))
function (cf::RSSCostFunction)(params::AbstractVector, ::NullParameters = NullParameters())
cf(candidate(cf, params))
end

_solve(cf::RSSCostFunction, params::AbstractVector) = _solve(cf, cf._func(params))
_solve(::RSSCostFunction, prob::Problem) = solve(prob, verbose = false)
Expand Down

0 comments on commit 0b07db7

Please sign in to comment.