Skip to main content

Error in computing IIS

Answered

Comments

7 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Tobias Achterberg
    Gurobi Staff Gurobi Staff

    What is d.status? If it is GRB.INF_OR_UNBD or GRB.UNBOUNDED, then you won't be able to compute an IIS. You will only get an IIS for a provably infeasible model.

    If the status is GRB.INF_OR_UNBD, then you can check whether the model is infeasible by discarding the objective function and calling optimize() again.

    Regards,

    Tobias

    0
  • Jose Vindel
    Gurobi-versary
    Thought Leader
    Investigator

    Hello Tobias,

    Thank you for your response,

    I discarded the objective function and the optimal objective reported in the log is equal to zero

    Gurobi Optimizer version 9.1.0 build v9.1.0rc0 (win64)
    Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
    Optimize a model with 49 rows, 34 columns and 82 nonzeros
    Model fingerprint: 0xb5f532da
    Coefficient statistics:
    Matrix range [1e+00, 1e+00]
    Objective range [0e+00, 0e+00]
    Bounds range [0e+00, 0e+00]
    RHS range [1e+00, 1e+01]
    Presolve removed 49 rows and 34 columns
    Presolve time: 0.01s
    Presolve: All rows and columns removed
    Iteration Objective Primal Inf. Dual Inf. Time
    0 0.0000000e+00 0.000000e+00 6.000000e-0 60s
    Extra simplex iterations after uncrush: 5
    5 0.0000000e+00 0.000000e+00 0.000000e+00 0s
    Solved in 5 iterations and 0.01 seconds
    Optimal objective 0.000000000e+00
    0
  • Jose Vindel
    Gurobi-versary
    Thought Leader
    Investigator

    Sorry to keep bothering you, on a different model I got a key error = 1805, but I can't find that code in the documentation, could you help me?

    Using license file C:\Users\alexa\gurobi.lic
    Academic license - for non-commercial use only - expires 2021-09-12
     
     
    ---------------------------------------------------------------------------

    KeyError
    Traceback (most recent call last)
    <ipython-input-5-7e5ab484b266>
    in <module>
    31
    # Stoichiometry Constraints
    32

    ---> 33
    x.addConstrs((gp.quicksum(S[i,j] * v[j] for j in M) == 0 for i in N), name='St') #Stoichimetry
    34

    35

    src\gurobipy\model.pxi
    in gurobipy.gurobipy.Model.addConstrs()
    <ipython-input-5-7e5ab484b266>
    in <genexpr>(.0)
    31
    # Stoichiometry Constraints
    32

    ---> 33
    x.addConstrs((gp.quicksum(S[i,j] * v[j] for j in M) == 0 for i in N), name='St') #Stoichimetry
    34

    35

    src\gurobipy\gurobi.pxi
    in gurobipy.gurobipy.quicksum()
    <ipython-input-5-7e5ab484b266>
    in <genexpr>(.0)
    31
    # Stoichiometry Constraints
    32

    ---> 33
    x.addConstrs((gp.quicksum(S[i,j] * v[j] for j in M) == 0 for i in N), name='St') #Stoichimetry
    34

    35

    KeyError: 1805
    0
  • Tobias Achterberg
    Gurobi Staff Gurobi Staff

    The KeyError is not from Gurobi. I guess this comes directly from Python and is triggered in the gurobipy module. Could it be that there is some j in M and i in N for which S[i,j] or v[j] does not exist?

    0
  • Jose Vindel
    Gurobi-versary
    Thought Leader
    Investigator

    Sorry, such a mistake I typed wrong when defining v in \(addVars\) it had the wrong length. Now I managed to create the lp file that I wanted. Coming back to the first question, after I dropped the objective function and the solution is zero, does it mean that the model is not infeasible but might be unbounded?

    Thank you! 

    0
  • Tobias Achterberg
    Gurobi Staff Gurobi Staff

    Yes. You really should take a look at the optimization status code in d.status. If it is GRB.INFEASIBLE, then the model is infeasible. If it is GRB.UNBOUNDED, then the model has an unbounded ray (but can still be either feasible or infeasible). It if is GRB.INF_OR_UNBD, then presolve has concluded that there is an unbounded direction without knowing whether the model is infeasible or not. So, if the status is either GRB.UNBOUNDED or GRB.INF_OR_UNBD, you can discard the objective function and try again to find out whether the model is infeasible or not.

    0

Post is closed for comments.