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

Make nlp a concretely typed field in MadNLPSolver #220

Merged
merged 2 commits into from
Sep 8, 2022

Conversation

baggepinnen
Copy link
Contributor

Before this PR, all accesses to fields on ips.nlp were type unstable and caused allocations.

Before this PR, all accesses to fields on `ips.nlp` were type unstable and caused allocations.
@codecov-commenter
Copy link

codecov-commenter commented Sep 1, 2022

Codecov Report

Merging #220 (bb93607) into master (ff28e44) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #220   +/-   ##
=======================================
  Coverage   74.33%   74.33%           
=======================================
  Files          37       37           
  Lines        3674     3674           
=======================================
  Hits         2731     2731           
  Misses        943      943           
Impacted Files Coverage Δ
src/IPM/IPM.jl 98.75% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@frapac frapac left a comment

Choose a reason for hiding this comment

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

This overall looks good to me. It was something on our todo list, but haven't found the time to fix this. The question is about whether we should allow MadNLP to support very corner cases, as changing entirely the model between two consecutive solves. I guess the answer is not.

Medium-term, it would be nice to update the structure to be immutable as well.

src/IPM/IPM.jl Outdated
@@ -5,8 +5,8 @@ abstract type AbstractMadNLPSolver{T} end

include("restoration.jl")

mutable struct MadNLPSolver{T,KKTSystem <: AbstractKKTSystem{T}} <: AbstractMadNLPSolver{T}
nlp::AbstractNLPModel
mutable struct MadNLPSolver{T,KKTSystem <: AbstractKKTSystem{T}, N <: AbstractNLPModel} <: AbstractMadNLPSolver{T}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest renaming the type N as Model

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been done in
bb93607

src/IPM/IPM.jl Outdated Show resolved Hide resolved
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.

Looks good to me! Thanks for the PR @baggepinnen

@sshin23 sshin23 merged commit 7c42a2f into MadNLP:master Sep 8, 2022
@baggepinnen baggepinnen deleted the patch-1 branch September 8, 2022 14:59
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.

4 participants