Hello
If your version of sage is older than 5.0, then I'm afraid you need to
upgrade. :-( Otherwise, the documentation does actually suggest a fix,
though since I wrote the documentation based on my experience of the error,
it might not be clear. After reading the rest of this reply, please type
sage: p.solve?
and see if it explains it adequately for your situation.
Since I don't trust myself, though, here's what you should do. Set a
parameter to solve using the simplex algorithm, rather than the default
integer optimizer which performs some preprocessing which wrecks things.
That is, add
sage: p.solver_parameter("simplex_or_intopt", "simplex_then_intopt")
If I do that on sage v5.0, your second (unbounded) system gives me
MIPSolverException: 'GLPK : Solution is undefined'
while your first (infeasible) system gives me
MIPSolverException: 'GLPK : Simplex cannot find a feasible solution'
That should allow you to distinguish the two situations.
You could also try the cbc solver; I don't believe it suffers from this
problem. That said, neither Nathann have had other troubles with Cbc, so
YMMV.
john perry
On Tuesday, August 28, 2012 1:01:50 PM UTC-5, Robert Samal wrote:
>
>
> Hi,
>
> I am trying to solve some linear programs in sage.
> From the tutorial it seems that the right way to do this is nowadays
> the MixedIntegerLinearProgram() class. However, using the default
> glpk solver I can't find a way to distinguish between unbounded and
> unfeasible programs. That is
> p = MixedIntegerLinearProgram()
> t = p.new_variable()
> p.add_constraint(t[0]<=-1)
> p.set_objective(t[0])
> p.solve()
>
> (no solution) gives the same answer as
>
> p = MixedIntegerLinearProgram()
> t = p.new_variable()
> p.set_objective(t[0])
> p.solve()
>
> (unbounded problem).
> Is there some official way how to distinguish these two cases?
>
> I suppose I could use cvxopt, but I fear it would be too slow for the real
> program I want to use it for.
>
> Thanks in advance,
>
> Robert Samal
>
>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.