Skip to content

Add recipe for getting infeasible constraints #857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 14, 2024

Conversation

Joao-Dionisio
Copy link
Member

@Joao-Dionisio Joao-Dionisio commented May 28, 2024

Adds slack variables to the constraints and minimizes their sum. Non-zero slack variables correspond to infeasible constraints.

This is still far from Gurobi's Irreducible Inconsistent Subsystem. Take the following constraints:

x <= 3
x <= 4
x <= 5
x == 7

This function would return $4$ infeasible constraints, even though it is natural to take x == 7 as the constraint yielding the infeasibility.

Fix #855

@Opt-Mucca
Copy link
Collaborator

As I said in the meeting: My suggestion is to add an option to attach a binary variable to each slack variable. If the slack variable is non-zero then force the binary to 1 and minimise the sum of binaries. (This is going to be a behemoth of a model to solve, but would give a minimum amount of constraints that are forced to be invalid).

@Joao-Dionisio
Copy link
Member Author

Thanks for the review @Opt-Mucca, I think it's done now.

The logical constraint was a bit more complicated than I realized, so I turned to OR SE (https://or.stackexchange.com/q/12142/5352) and implemented Erwin Kalvelagen's answer (who gracefully allowed me to use it).

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.

Project coverage is 52.29%. Comparing base (19b3ec9) to head (23e00b3).
Report is 1 commits behind head on master.

Current head 23e00b3 differs from pull request most recent head 6b886e8

Please upload reports for the commit 6b886e8 to get more accurate results.

Files Patch % Lines
src/pyscipopt/recipes/infeasibilities.py 0.00% 30 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #857      +/-   ##
==========================================
- Coverage   52.53%   52.29%   -0.25%     
==========================================
  Files          19       20       +1     
  Lines        3961     3991      +30     
==========================================
+ Hits         2081     2087       +6     
- Misses       1880     1904      +24     

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

@Opt-Mucca
Copy link
Collaborator

Can you answer or resolve the older questions?

Two points for the current state:

  • Why do you need the binary variables? They are created but never used, only the aux_binaries are.
  • Make sure to remove the old objective function, otherwise you won't get an honest answer on the number of infeasible constraints.

@Joao-Dionisio
Copy link
Member Author

Joao-Dionisio commented Jun 6, 2024

@Opt-Mucca the binary variables are used in line 30. The formulation is not trivial, that's why I point to https://or.stackexchange.com/q/12142/5352. I need both binary and aux_binary in order to use SOS1 constraints.

Oops! Good catch on the objective function Mark.

@Joao-Dionisio
Copy link
Member Author

I think that's it @Opt-Mucca!

@Opt-Mucca
Copy link
Collaborator

Am happy after our discussion!

@Opt-Mucca Opt-Mucca merged commit f773230 into scipopt:master Jun 14, 2024
1 check passed
@Joao-Dionisio Joao-Dionisio deleted the get_infeasibilities branch June 15, 2024 10:46
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.

Add model reformulation to get infeasible constraints to the recipes
2 participants