Skip to content

Fix simulator bug#3692

Merged
jsiirola merged 1 commit intoPyomo:mainfrom
blnicho:fix-dae-bug
Aug 12, 2025
Merged

Fix simulator bug#3692
jsiirola merged 1 commit intoPyomo:mainfrom
blnicho:fix-dae-bug

Conversation

@blnicho
Copy link
Copy Markdown
Member

@blnicho blnicho commented Aug 12, 2025

Fixes #3690

Summary/Motivation:

#3690 reported a bug in the simulator where if you had a differential equation of the form A*dxdt + B == RHS it would be handled differently than dxdt*A + B == RHS. Pyomo.DAE checks for certain forms that a differential equation may have been written in and tries to permute those forms to a standard separable format expected by the integrators. At one point I think product expressions would have been rearranged such that if A was not potentially variable it would have ALWAYS been moved to arg[0] in the ProductExpression so the Simulator only ever checked for A*dxdt. When we stopped doing automatic expression mangling in core Pyomo the assumption that the simulator didn't have to check for dxdt*A was no longer valid and the bug was introduced. This PR fixes it by ensuring the Simulator is checking for both cases.

Changes proposed in this PR:

  • Fix bug in simulator code for identifying separable differential equations.

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
Copy Markdown
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.

Thanks for fixing this so quickly!

@github-project-automation github-project-automation bot moved this from Todo to Reviewer Approved in Pyomo 6.9.4 Release Aug 12, 2025
@jsiirola jsiirola merged commit 58b0a43 into Pyomo:main Aug 12, 2025
35 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer Approved to Done in Pyomo 6.9.4 Release Aug 12, 2025
@blnicho blnicho deleted the fix-dae-bug branch December 1, 2025 17:52
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.

Changing multiplicand order causes exception

3 participants