Hi everybody,
I’m currently using Pulp and the Gurobi solver and I would like to use some of gurobi method such as GUROBI.computeIIS() in order to catch the source of infeasibility in my optimization problem.
I didn’t find any way to do it…
Maybe you can give me some insight how to achieve that.
What I would like to achieve:
#problem is
then solved with the default solver
whiskas_model.solve(pulp.GUROBI(mip=True, msg=True, timeLimit=None, epgap=None))
if whiskas_model.status
== pulp.constants.LpStatusInfeasible:
# part not working!!
whiskas_model.computeIIS() #WHAT DO I HAVE TO WRITE HERE IN ORDER TO USE gurobi.COMPUTEIIS() ?
print('\nConstraints:')
for c in whiskas_model.constraints():
if c.IISConstr:
print('%s' % c.constrName)
print('\nBounds:')
for v in whiskas_model.variables():
if v.IISLB
> 0 :
print('Lower bound: %s' % v.VarName)
elif v.IISUB
> 0:
print('Upper bound: %s' % v.VarName)
Thanks a lot for you answer,
Baptiste
.ilp
format file. It will attempt to solve the model, and if the model is found to be infeasible, it will automatically compute an IIS and write it to the requested file name. --
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pulp-or-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/pulp-or-discuss.
For more options, visit https://groups.google.com/d/optout.
import os, glob, pulp
status = whiskas_model.solve(pulp.GUROBI(mip=True, msg=True, timeLimit=None, epgap=None))
if whiskas_model.status == pulp.constants.LpStatusInfeasible:
print 'Model Infeasible catched'
'remove all the existing .mps in your directory'
os.system('"del '+str('*.mps')+'"')
'create the .mps using the default pulp solver in order to get the .mps'
whiskas_model.solve(pulp.PULP_CBC_CMD())
MPS_file_created = glob.glob("*.mps")
'transform the .mps into a .ilp'
os.system('"C:\gurobi600\gurobi600\win64'+str(r'\bin')+'\gurobi_cl.exe ResultFile=IISresults.ilp '+MPS_file_created[0]+'"')