Skip to content

NL writer: resolve model scaling bug writing Expression objects#3673

Merged
blnicho merged 2 commits intoPyomo:mainfrom
jsiirola:nl-scaling-named-expr
Aug 4, 2025
Merged

NL writer: resolve model scaling bug writing Expression objects#3673
blnicho merged 2 commits intoPyomo:mainfrom
jsiirola:nl-scaling-named-expr

Conversation

@jsiirola
Copy link
Copy Markdown
Member

@jsiirola jsiirola commented Aug 1, 2025

Fixes # .

Summary/Motivation:

@dallan-keylogic found a particularly nefarious bug where turning on the handling of scaling in the NLv2 writer would fail to scale the linear coefficients of named expressions (Expression components) used in nonlinear contexts. This PR resolves the bug and adds a test for scaling named Expression objects in nonlinear contexts (slightly modified from @dallan-keylogic's MWE).

Changes proposed in this PR:

  • update _write_v_line to scale the linear term coefficients.
  • add a test covering this error

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.

@blnicho blnicho moved this from Todo to Review In Progress in August 2025 Release Aug 1, 2025
@blnicho blnicho merged commit 4e4a90f into Pyomo:main Aug 4, 2025
90 of 93 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer Approved to Done in August 2025 Release Aug 4, 2025
@jsiirola jsiirola deleted the nl-scaling-named-expr branch August 4, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

3 participants