Thank you very much for the answer. It works perfectly.

在 2019年4月28日星期日 UTC+2下午7:18:39,Peter Mueller写道:
>
> You can use an exception, something as follows:
>
> def is_lp_solvable(P):
>     try:
>         P.solve()
>         return True
>     except:
>         return False
>
> Am Sonntag, 28. April 2019 14:31:31 UTC+2 schrieb [email protected]:
>>
>> Hello everyone! I would like to ask a question about the solvability of a 
>> linear programming problem.
>> I use sagemath to check whether my LP problem has any feasible solution 
>> or not.
>> The program is similar to the following one without details
>> sage: p = MixedIntegerLinearProgram(maximization=False, solver = "PPL")
>> sage: w = p.new_variable(integer=True, nonnegative=True)
>> sage: p.set_objective(w[0])
>>
>> Then I use p.solve() to solve this problem, and when there is no feasible 
>> solution, the program will
>> print out quite a few sentences with the last one like this:
>> MIPSolverException: PPL : There is no feasible solution
>>
>> My question is whether I can define a True/False function such that when 
>> the LP porble p has any feasible solution,
>> then it returens True; otherwise it returns False?
>>
>> Thank you very much for your kind help!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to