-
Notifications
You must be signed in to change notification settings - Fork 234
Add iterator interface #745
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
Open
tkf
wants to merge
18
commits into
JuliaNLSolvers:master
Choose a base branch
from
tkf:iterator
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b10f27e
Add iterator interface
tkf cc594a8
Don't use at-eval
tkf d6a6d75
Simplify OptimizationResults(istate)
tkf 2117364
Add accessor functions
tkf b7b63e8
Directly define accessor functions
tkf 8a64efb
Merge branch 'master' into iterator
tkf 0826be0
Merge branch 'master' into iterator
pkofod b0e5c30
Apply suggestions from code review
pkofod a22346a
Apply suggestions from code review
pkofod 2310160
Fix breaks and types in trace api
pkofod 15c8b62
Update optimize.jl
pkofod 75ece54
Update interface.jl
pkofod 54a8542
Fix trust region
pkofod bc42ad8
Use tkf advice on explicitly requiring iter
pkofod afaa7e9
Update optimize.jl
pkofod cc5ebfc
Update optimize.jl
pkofod 56e0795
Fix interface (though we may want to change it) and update an nmgres …
pkofod dc03af8
Get rid of after_while!
pkofod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +0,0 @@ | ||
Base.@deprecate method(x) summary(x) | ||
|
||
const has_deprecated_fminbox = Ref(false) | ||
function optimize( | ||
df::OnceDifferentiable, | ||
initial_x::Array{T}, | ||
l::Array{T}, | ||
u::Array{T}, | ||
::Type{Fminbox}; | ||
x_tol::T = eps(T), | ||
f_tol::T = sqrt(eps(T)), | ||
g_tol::T = sqrt(eps(T)), | ||
allow_f_increases::Bool = true, | ||
iterations::Integer = 1_000, | ||
store_trace::Bool = false, | ||
show_trace::Bool = false, | ||
extended_trace::Bool = false, | ||
show_warnings::Bool = true, | ||
callback = nothing, | ||
show_every::Integer = 1, | ||
linesearch = LineSearches.HagerZhang{T}(), | ||
eta::Real = convert(T, 0.4), | ||
mu0::T = convert(T, NaN), | ||
mufactor::T = convert(T, 0.001), | ||
precondprep = (P, x, l, u, mu) -> precondprepbox!(P, x, l, u, mu), | ||
optimizer = ConjugateGradient, | ||
optimizer_o = Options( | ||
store_trace = store_trace, | ||
show_trace = show_trace, | ||
extended_trace = extended_trace, | ||
show_warnings = show_warnings, | ||
), | ||
nargs..., | ||
) where {T<:AbstractFloat} | ||
if !has_deprecated_fminbox[] | ||
@warn( | ||
"Fminbox with the optimizer keyword is deprecated, construct Fminbox{optimizer}() and pass it to optimize(...) instead." | ||
) | ||
has_deprecated_fminbox[] = true | ||
end | ||
optimize( | ||
df, | ||
initial_x, | ||
l, | ||
u, | ||
Fminbox{optimizer}(); | ||
allow_f_increases = allow_f_increases, | ||
iterations = iterations, | ||
store_trace = store_trace, | ||
show_trace = show_trace, | ||
extended_trace = extended_trace, | ||
show_warnings = show_warnings, | ||
show_every = show_every, | ||
callback = callback, | ||
linesearch = linesearch, | ||
eta = eta, | ||
mu0 = mu0, | ||
mufactor = mufactor, | ||
precondprep = precondprep, | ||
optimizer_o = optimizer_o, | ||
) | ||
end | ||
|
||
function optimize(::AbstractObjective) | ||
throw( | ||
ErrorException( | ||
"Optimizing an objective `obj` without providing an initial `x` has been deprecated without backwards compatability. Please explicitly provide an `x`: `optimize(obj, x)``", | ||
), | ||
) | ||
end | ||
function optimize(::AbstractObjective, ::Method) | ||
throw( | ||
ErrorException( | ||
"Optimizing an objective `obj` without providing an initial `x` has been deprecated without backwards compatability. Please explicitly provide an `x`: `optimize(obj, x, method)``", | ||
), | ||
) | ||
end | ||
function optimize(::AbstractObjective, ::Method, ::Options) | ||
throw( | ||
ErrorException( | ||
"Optimizing an objective `obj` without providing an initial `x` has been deprecated without backwards compatability. Please explicitly provide an `x`: `optimize(obj, x, method, options)``", | ||
), | ||
) | ||
end | ||
function optimize(::AbstractObjective, ::Options) | ||
throw( | ||
ErrorException( | ||
"Optimizing an objective `obj` without providing an initial `x` has been deprecated without backwards compatability. Please explicitly provide an `x`: `optimize(obj, x, options)``", | ||
), | ||
) | ||
end | ||
|
||
function optimize( | ||
df::OnceDifferentiable, | ||
l::Array{T}, | ||
u::Array{T}, | ||
F::Fminbox{O}; | ||
kwargs..., | ||
) where {T<:AbstractFloat,O<:AbstractOptimizer} | ||
throw( | ||
ErrorException( | ||
"Optimizing an objective `obj` without providing an initial `x` has been deprecated without backwards compatability. Please explicitly provide an `x`: `optimize(obj, x, l, u, method, options)``", | ||
), | ||
) | ||
end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose
tr = trace(r)
should be added here? I think it'll throwUndefVarError
otherwise. There are two more places I did this change.I'm including these changes (adding
tr = trace(r)
) although they are not directly related to PR.