• Gurobi Staff

Can you try upgrading to v11.0.0 and re-running this test?

Cheers,
David

David Torres Sanchez We do have v11.0 lic I will do. In general just want to understand below points

Model contains large matrix coefficient range what is this meaning. How to know which one are large?

It also tells max constraint violation and max general constraint violation, how to know which constraints are violating.

The model log tells, Consider reformulating model. Here how to find which part of the constraint I need to reformulate. Is there any way to see which constraints are causing this issue?

• Gurobi Staff

Hi Sudheer,

This is the code snippet I use (which uses Python and pandas)

import pandas as pdimport numpy as np# assumes your model is "m"A = np.abs(m.getA()).tocoo() # absolute-value coefficent matrix in scipy sparse coo_matrix formcons = np.array(m.getConstrs())df = pd.DataFrame({    "abscoeff":A.data,    "constr":cons[A.row],})# try to find family of constraints with highest magnitude of coefficients#  (you obviously need to tailor this to the coefficients in your model)df["name"] = df["constr"].map(lambda c: c.constrname) # add namesdf["family"] = df["name"].map(lambda n: n.split("_")[0]) # assuming name is of the form myconstr_0_1df.query("abscoeff > 8e6")["family"].value_counts()# try to find family of constraints with smallest magnitude of coefficientsdf.query("abscoeff < 1e-3")["family"].value_counts()# investigate violated constraints# note this is only looking at linear constraintsslacks = m.getAttr("Slack", cons)df2 = pd.DataFrame({    "violation":-slacks[slacks < 0],    "constr":cons[slacks < 0],})# can sort df2, add names, count family etc

For guidance on reducing the coefficient range please see the subsections of Tolerances and User Scaling (a section in our Guidelines for Numerical Issues chapter of our reference manual).

- Riley