Skip to content

New options and mappings in the core.add_slack_variables Transformation#3869

Open
emma58 wants to merge 3 commits intoPyomo:mainfrom
emma58:add_slacks_additions
Open

New options and mappings in the core.add_slack_variables Transformation#3869
emma58 wants to merge 3 commits intoPyomo:mainfrom
emma58:add_slacks_additions

Conversation

@emma58
Copy link
Contributor

@emma58 emma58 commented Mar 6, 2026

Fixes # .

Summary/Motivation:

We've always used the core.add_slack_variables transformation as purely a debugging tool for infeasible models. However, there are other reasons one could want to add slack variables, such as relaxing certain constraints of a model by bounded amounts. This PR adds a couple features to the add slack variables transformation to make that easier, specifically an API so that a user can get the slack variables from the constraints and adding an option to not change the objective.

Changes proposed in this PR:

  • Adds a config option to not touch the objective
  • Adds public methods for getting relaxed constraints corresponding to given slack variables and vice versa on the transformation

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.

emma58 added 3 commits March 6, 2026 09:30
…rmation, as well as an API to retrieve slack variables and relaxed constraints from each other
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.60%. Comparing base (7ad143c) to head (155815b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3869      +/-   ##
==========================================
- Coverage   89.67%   89.60%   -0.07%     
==========================================
  Files         908      908              
  Lines      106735   106761      +26     
==========================================
- Hits        95717    95666      -51     
- Misses      11018    11095      +77     
Flag Coverage Δ
builders 29.08% <38.70%> (+<0.01%) ⬆️
default 85.96% <100.00%> (?)
expensive 35.51% <38.70%> (?)
linux 86.71% <100.00%> (-2.46%) ⬇️
linux_other 86.71% <100.00%> (-0.43%) ⬇️
oldsolvers 28.00% <38.70%> (+<0.01%) ⬆️
osx 82.04% <100.00%> (+<0.01%) ⬆️
win 85.14% <100.00%> (-0.42%) ⬇️
win_other 85.14% <100.00%> (-0.42%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants