Skip to content
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

Compute IIS if problem is infeasible for solver COPT #358

Open
PeterKlein11 opened this issue Oct 10, 2024 · 0 comments
Open

Compute IIS if problem is infeasible for solver COPT #358

PeterKlein11 opened this issue Oct 10, 2024 · 0 comments

Comments

@PeterKlein11
Copy link

COPT has a python example of how to calculate the IIS to help debug infeasible solutions. It would be great to add this functionality to linopy.

Compute IIS if problem is infeasible

if model.status == COPT.INFEASIBLE:

Compute IIS

model.computeIIS()

Check if IIS is available

if model.hasIIS:
# Print variables and constraints in IIS
cons = model.getConstrs()
vars = model.getVars()

print("\n======================== IIS result ========================")
for con in cons:
  if con.iislb or con.iisub:
    print('  {0}: {1}'.format(con.name, "lower" if con.iislb else "upper"))

print("")
for var in vars:
  if var.iislb or var.iisub:
    print('  {0}: {1}'.format(var.name, "lower" if var.iislb else "upper"))

# Write IIS to file
print("")
model.writeIIS('iis_ex1.iis')
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

No branches or pull requests

1 participant