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

Switch default NL writer to nlv2 #2676

Merged
merged 26 commits into from Jan 27, 2023
Merged

Switch default NL writer to nlv2 #2676

merged 26 commits into from Jan 27, 2023

Conversation

jsiirola
Copy link
Member

@jsiirola jsiirola commented Dec 20, 2022

Fixes # .

Summary/Motivation:

This switches the default NL writer to the new "NLv2" writer.

Changes proposed in this PR:

  • Change default NL writer
  • Update pyomo.mpec.complementarity to suppress deprecation warnings
  • Testing
    • Add explicit NL v1 and v2 tests for complementarity and suffixes
    • Skip a test on old versions of CPLEX where changing variable ordering could cause CPLEX to calculate incorrect duals
  • Fix handling of the default file_determinism flag int eh NLv1 writer
  • NLv2 writer updates
    • NL writer will by default write files using Unix-style (not universal) newlines. This is due to a bug in how the ASL handles string arguments (it cannot correctly parse string arguments terminated with windows-style newlines)
    • map inf/-inf bounds on Constraints/Vars to None
    • Add warnings for writing NL files containing string arguments using \r\n line terminators
    • Add processing of complementarity constraints (not the preferred solution, but this replicated the functionality in the NLv1 writer)

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@michaelbynum
Copy link
Contributor

We should add an issue to eventually remove the old nl writer.

@mrmundt mrmundt self-requested a review January 10, 2023 19:59
@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Base: 87.04% // Head: 87.09% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (50d518a) compared to base (517060e).
Patch coverage: 96.07% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2676      +/-   ##
==========================================
+ Coverage   87.04%   87.09%   +0.05%     
==========================================
  Files         757      757              
  Lines       84596    84898     +302     
==========================================
+ Hits        73638    73945     +307     
+ Misses      10958    10953       -5     
Flag Coverage Δ
linux 84.55% <94.11%> (+0.10%) ⬆️
osx 74.58% <88.23%> (+0.07%) ⬆️
other 84.73% <96.07%> (+0.09%) ⬆️
win 81.89% <90.19%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyomo/repn/plugins/__init__.py 100.00% <ø> (ø)
pyomo/scripting/solve_config.py 98.66% <ø> (ø)
pyomo/repn/plugins/nl_writer.py 93.25% <95.74%> (+7.36%) ⬆️
pyomo/mpec/complementarity.py 95.90% <100.00%> (ø)
pyomo/scripting/util.py 59.01% <100.00%> (ø)
pyomo/contrib/pyros/master_problem_methods.py 79.28% <0.00%> (-8.80%) ⬇️
pyomo/util/components.py 96.42% <0.00%> (-3.58%) ⬇️
pyomo/repn/plugins/ampl/ampl_.py 83.26% <0.00%> (-2.94%) ⬇️
pyomo/common/deprecation.py 96.58% <0.00%> (-1.47%) ⬇️
pyomo/util/calc_var_value.py 100.00% <0.00%> (ø)
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@michaelbynum michaelbynum left a comment

Choose a reason for hiding this comment

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

One minor comment below.

pyomo/scripting/solve_config.py Show resolved Hide resolved
Copy link
Contributor

@mrmundt mrmundt left a comment

Choose a reason for hiding this comment

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

Looks really good, @jsiirola . I didn't even see any typos.

@mrmundt mrmundt merged commit 7edd5f0 into Pyomo:main Jan 27, 2023
@jsiirola jsiirola deleted the activate-nlv2 branch January 30, 2023 20:52
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.

None yet

3 participants