Skip to content

More flexible LinearStandardFormCompiler#3949

Open
bknueven wants to merge 12 commits into
Pyomo:mainfrom
bknueven:flexible-linear-standard-repn
Open

More flexible LinearStandardFormCompiler#3949
bknueven wants to merge 12 commits into
Pyomo:mainfrom
bknueven:flexible-linear-standard-repn

Conversation

@bknueven
Copy link
Copy Markdown
Contributor

@bknueven bknueven commented May 12, 2026

Fixes # N/A

Summary/Motivation:

LinearStandardFormCompiler is a great tool for rapidly expanding a Pyomo model into the form need for (mixed-integer) linear programming solvers. Many of these solvers also handle ranged (linear) constraints, quadratic constraints, SOS constraints, quadratic objectives, and even sometimes general nonlinear constraints and objectives. This PR would augment the LinearStandardFormCompiler two significant ways:

  1. Functional forms it cannot compile directly are either passed on or ignored and do not raise an error (new option allow_nonlinear and extra_valid_ctypes).
  2. Ranged linear constraints are directly returned as part of the LinearStandardFormInfo when the new option keep_range_constraints=True.

See the usage proof of concept on #3879, which includes these changes.

Changes proposed in this PR:

  • Add keep_range_constraints to LinearStandardFormCompiler and compile range constraints appropriately (84afd9a, e330102, efc1c74)
  • Add option for LinearStandardFormCompiler to return non-linear constraints / objectives it encounters instead of raising an error (option allow_nonlinear aa9ce77)
  • Add option for additional valid ctypes, to be handled by the caller. Useful for SOS constraints (36953d1).
  • Bugfix for constraints with +/-inf (a13c2e0, c0741a8)
  • Bugfix: allow TemplateVarRecorder to correctly handle pyomo.kernel variables (6a2c69a)

This PR was created with the help of GitHub Copilot CLI.

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.

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.

1 participant