Ask Your Question

MixedIntegerLinearProgram with non feasible problem

asked 2022-01-13 14:03:35 +0200

Cyrille gravatar image

updated 2023-05-19 21:53:09 +0200

FrédéricC gravatar image

This is a simple reflexion : when glpk diagnose that a Linear programming program has no solution this is not an error but a diagnose in MixedIntegerLinearProgram. So the result should be only a warning that there is not feasible solution not a list of errors

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2022-01-13 17:13:10 +0200

Max Alekseyev gravatar image

updated 2022-01-13 17:14:11 +0200

This is not specific to glpk solver, and absence of solutions is serious enough to raise an 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()
M.add_constraint(x[0] == 0)
M.add_constraint(x[0] == 1)
except MIPSolverException:
    print("No feasible solution")
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-01-13 14:03:35 +0200

Seen: 327 times

Last updated: Jan 13 '22