Gurobi / gurobi-modelanalyzer

Tools to analyze models for numerical issues and check solutions for feasibility
https://gurobi-modelanalyzer.readthedocs.io/
Apache License 2.0
20 stars 6 forks source link

Handle Gurobi Environments #3

Open peno64 opened 1 year ago

peno64 commented 1 year ago

With following python file:

import sys
import gurobipy as gp
import gurobi_modelanalyzer as ma
m=gp.read(sys.argv[1])
m.optimize()
print('kappa_explain1')
ma.kappa_explain(m)
print('kappa_explain2')
ma.kappa_explain(m, expltype="COLS")
print('angle_explain')
ma.angle_explain(m)

With attached file: oops1.mps.txt

I get the following error:

...
Solved in 0 iterations and 0.00 seconds (0.00 work units)
Optimal objective  1.000000000e+00
Vector matrix product of certificate of ill conditioning and basis:
ZTHREE
Traceback (most recent call last):
  File "D:\brol\modelanalyzer.py", line 7, in <module>
    ma.kappa_explain(m)
  File "C:\Users\peno\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\gurobi_modelanalyzer\results_analyzer.py", line 421, in kappa_explain
    refine_output(resmodel, yvaldict, expltype, submatrix)
  File "C:\Users\peno\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\gurobi_modelanalyzer\results_analyzer.py", line 1640, in refine_output
    contoadd = condict[conname]
               ~~~~~~~^^^^^^^^^
KeyError: '(mult=1.0)MYEQN'
...

Note that I run this on a windows 11 computer with the latest version of this tool (I did a pip install today) The gurobi version is 10.0.3 (running on a compute server) The python version is: 3.11.6

I get this error for almost all my models I test.

mattmilten commented 1 year ago

This is an issue with model handling in Compute Server environments. The code is not yet compatible with Gurobi Compute Server.

Thanks for bringing this up!