# Revision history [back]

This is not specific to glpk solver, and absence of solutions is serious enough to raise an excepting rather than giving just a warning. Anyway, you can easily catch this exception by enclosing .solve() into try and except like in the example below:

from sage.numerical.mip import MIPSolverException

M = MixedIntegerLinearProgram()
x = M.new_variable()
try:
M.solve()
except MIPSolverException:
print("No feasible solution")


This is not specific to glpk solver, and absence of solutions is serious enough to raise an excepting exception rather than giving just a warning. Anyway, you can easily catch this exception by enclosing .solve() into try and except like in the example below:

from sage.numerical.mip import MIPSolverException

M = MixedIntegerLinearProgram()
x = M.new_variable()