Skip to content

More Optimization removal #28

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

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OptimizationBase"
uuid = "bca83a33-5cc9-4baa-983d-23429ab6bcbb"
authors = ["Vaibhav Dixit <[email protected]> and contributors"]
version = "0.0.3"
version = "0.0.4"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
11 changes: 10 additions & 1 deletion src/OptimizationBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ import SciMLBase: OptimizationProblem,
MaxSense, MinSense, OptimizationStats
export ObjSense, MaxSense, MinSense

struct NullCallback end
(x::NullCallback)(args...) = false;
const DEFAULT_CALLBACK = NullCallback()

struct NullData end
const DEFAULT_DATA = Iterators.cycle((NullData(),))
Base.iterate(::NullData, i = 1) = nothing
Base.length(::NullData) = 0

include("adtypes.jl")
include("cache.jl")
include("function.jl")

export solve, OptimizationCache
export solve, OptimizationCache, DEFAULT_CALLBACK, DEFAULT_DATA

end
6 changes: 3 additions & 3 deletions src/cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct OptimizationCache{F, RC, LB, UB, LC, UC, S, O, D, P, C} <:
end

function OptimizationCache(prob::SciMLBase.OptimizationProblem, opt, data;
callback = Optimization.DEFAULT_CALLBACK,
callback = DEFAULT_CALLBACK,
maxiters::Union{Number, Nothing} = nothing,
maxtime::Union{Number, Nothing} = nothing,
abstol::Union{Number, Nothing} = nothing,
Expand All @@ -33,8 +33,8 @@ function OptimizationCache(prob::SciMLBase.OptimizationProblem, opt, data;
end

function SciMLBase.__init(prob::SciMLBase.OptimizationProblem, opt,
data = Optimization.DEFAULT_DATA;
callback = Optimization.DEFAULT_CALLBACK,
data = DEFAULT_DATA;
callback = DEFAULT_CALLBACK,
maxiters::Union{Number, Nothing} = nothing,
maxtime::Union{Number, Nothing} = nothing,
abstol::Union{Number, Nothing} = nothing,
Expand Down