Skip to content
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

[Breaking change] Refactor the way we pass options to MadNLP #191

Merged
merged 4 commits into from
Aug 18, 2022

Conversation

frapac
Copy link
Member

@frapac frapac commented Jul 8, 2022

This PR merges the option_dict and kwargs arguments, so now we pass all options as kwargs...:

ips = MadNLP.InteriorPointSolver(nlp; max_iter=10)

No need to pass the options in a separate Dict anymore.

In addition, we add a new function default_options to return the default options associated to a given linear solver.

MadNLP.default_options(LapackCPUSolver)

@frapac frapac requested a review from sshin23 July 8, 2022 15:20
@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2022

Codecov Report

Merging #191 (2933de6) into master (59aa6e5) will decrease coverage by 0.03%.
The diff coverage is 94.59%.

@@            Coverage Diff             @@
##           master     #191      +/-   ##
==========================================
- Coverage   73.00%   72.96%   -0.04%     
==========================================
  Files          38       38              
  Lines        3456     3459       +3     
==========================================
+ Hits         2523     2524       +1     
- Misses        933      935       +2     
Impacted Files Coverage Δ
lib/MadNLPHSL/src/MadNLPHSL.jl 90.00% <ø> (ø)
lib/MadNLPKrylov/src/MadNLPKrylov.jl 0.00% <0.00%> (ø)
lib/MadNLPPardiso/src/MadNLPPardiso.jl 100.00% <ø> (ø)
lib/MadNLPPardiso/src/pardiso.jl 0.00% <0.00%> (ø)
src/IPM/utils.jl 89.83% <ø> (-2.24%) ⬇️
lib/MadNLPHSL/src/ma27.jl 85.29% <100.00%> (ø)
lib/MadNLPHSL/src/ma57.jl 85.07% <100.00%> (ø)
lib/MadNLPHSL/src/ma77.jl 96.20% <100.00%> (ø)
lib/MadNLPHSL/src/ma86.jl 94.73% <100.00%> (ø)
lib/MadNLPHSL/src/ma97.jl 94.44% <100.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59aa6e5...2933de6. Read the comment docs.

Copy link
Member

@sshin23 sshin23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @frapac

Since we introduce a breaking change, maybe it's an excellent time to change some function names. But we can do it in a separate PR.

src/IPM/IPM.jl Outdated

@assert is_supported(opt.linear_solver,T)

# Initiate linear-solver options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing this here makes it much cleaner! Great idea

setproperty!(opt,key,parse_option(T,val))
pop!(option_dict,key)
function set_options!(opt::AbstractOptions, options)
other_options = Dict{Symbol, Any}()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

MadNLP.check_option_sanity(opt)

# Initiate linear-solver options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 10-26 seems to be redundant to line 104-120 of IPM.jl. Can we create an internal function for setting options?

@frapac
Copy link
Member Author

frapac commented Jul 8, 2022

@sshin23 thanks for the review! I am all in to change the names of the functions in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants