Skip to content

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

Merged
odow merged 2 commits intomasterfrom
od/use-nlp-block
Mar 11, 2025
Merged

[FileFormats.MOF] make use_nlp_block=false the default if SNF in model#2688
odow merged 2 commits intomasterfrom
od/use-nlp-block

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