Why are there constraint expressions that are not displayed when I output the .ilp file and look at the overview of the entire model?
AnsweredI have done the following programming, but it does not work, as if the constraint expressions are not incorporated into the model.
When I output the .ilp file and observe the overall appearance of the model, I cannot see the constraint expressions that I should have implemented.
What should I do?
When I output the .ilp file and observe the overall appearance of the model, I cannot see the constraint expressions that I should have implemented.
What should I do?
from gurobipy import *
def prodmix(f_num,j_num,i_num,mto_demand,mts_demand,I_mto,I_mts,k_num,y,cost_parameter):
if __name__ == "__main__":
f_num,j_num,i_num,mto_demand,mts_demand,I_mto,I_mts,k_num,y,cost_parameter = make_data()
model = prodmix(f_num,j_num,i_num,mto_demand,mts_demand,I_mto,I_mts,k_num,y,cost_parameter)
model.computeIIS ()
model.write ( "model.ilp" )
if model.status == GRB.INFEASIBLE:
vars= model.getVars()
ubpen = [1.0]*model.numVars
model.feasRelax(1, False, vars, None, ubpen, None, None)
model.optimize()
print ("obj:",model.ObjVal)
X,Y,num_sys_machine,demand_of_mto,demand_of_mts,cost_matrix,MTO_num,MTS_num = model.__data
[Ed. note: Code trimmed for readability].
0

Hi Ryusei,
When you write an ILP file, Gurobi writes the computed Irreducible Inconsistent Subsystem (IIS) of your infeasibly model to the named file. This is not the full model, but is instead a subset of constraints causing infeasibility.
If you wish to view the entire model as a text file, you should instead write an LP file. Gurobi determines which file type to write based on the extension you provide, so you should instead use
model.write("model.lp")
if you want to view all the constraints in the final model.
0 
Happy New Year!
Thanks for your prompt advice.
Sorry I couldn't spot a simple mistake.0
Please sign in to leave a comment.
Comments
2 comments