Skip to content

[FileFormats.MOF] make use_nlp_block=false the default if SNF in model #2688

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 2 commits into from
Mar 11, 2025

Conversation

odow
Copy link
Member

@odow odow commented Mar 10, 2025

Closes #2687

The underlying issue is that we supported nonlinear file formats before the introduction of ScalarNonlinearFunction. Thus, .mof.json and .nl that contain nonlinear get parsed into a MOI.NLPBlock. This is the "old" nonlinear interface, and it means that Ipopt etc run into problems if the user wants to read in a file and then do some "new" stuff with it.

The current work-around is to use read_from_file(model; use_nlp_block = false).

But we could add a tag to the file on write if we detect MOI.ScalarNonlinearFunction. This would all "new" stuff to round-trip as new, and "old" stuff to round-trip as old.

The alternative would be to change the default to use_nlp_block = false, but this is technically breaking. Although this is also breaking, but arguably a bug-fix, because currently "new" models get written and then read back in as "old".

Once we agree on what to do, we should make a similar fix to the .nl file module. It probably means adding a header comment about whether we had ScalarNonlinearFunctions.

@odow odow merged commit 6988d69 into master Mar 11, 2025
31 checks passed
@odow odow deleted the od/use-nlp-block branch March 11, 2025 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[FileFormats.MOF] add a flag to the file when use_nlp_block=false
1 participant