On Thursday, 29 October 2015 17:03:26 UTC-7, Dillon wrote:
>
>
> Hi all,
>
> I thought I would start by asking the matroid group this non-matroidal 
> sage question, just in case I am missing something obvious.
>
> I set up a linear program:
>
> lp=MixedIntegerLinearProgram(maximization=True)
>
> Now I want to test whether lp has a feasible solution. Can I do this 
> without throwing an error? If there is no feasible solution, then
>
> lp.solve()
>
> produces an error:
>
> Traceback (click to the left of this block for traceback)
>
>
sure, but there is Python's try: except: construction that makes it easy to 
deal with. 
And it is quite quick, too.

HTH,
Dima


> ...
> sage.numerical.mip.MIPSolverException: 'GLPK : Solution is undefined'
>
>
> I would like a command along the lines of lp.is_feasible(), but I can find no 
> trace of such a thing. lp.polyhedron() will return an empty polyhedron if the 
> lp is not feasible, but this is far too slow. I can get the error message 
> from lp.solve() in a fraction of second, but it takes minutes/hours for 
> lp.polyhedron() to tell me that the polyhedron is empty.
>
>
> Does anyone know how to do this? Surely I am not the first person who wants 
> to run multiple linear programs in a row without knowing in advance that they 
> are feasible and without wanting to stop if they are not.
>
>
> Thanks,
>
>
> Dillon
>
>

-- 

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

Reply via email to