Skip to content

Conversation

@jsiirola
Copy link
Member

Fixes #3131 .

Summary/Motivation:

This updates the NLv2 writer to only raise an exception for empty models (no variables in either objectives or constraints) when it is called using the legacy "call" interface. The new recommended interface will not raise an exception and instead rely on the caller (the solver interface) to inspect the returned list of variables and do the correct thing when that list is empty.

Changes proposed in this PR:

  • Move the exception for an empty model from the core writer method and into the logacy __call__ interface.

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.

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.

Thanks, @jsiirola!

@michaelbynum michaelbynum merged commit 7e9da37 into Pyomo:main Feb 14, 2024
@jsiirola jsiirola deleted the nl-error-empty-model branch February 20, 2024 23:58
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.

NL Writer Errors when presolve removes all variables

2 participants