Polyhedra.jl icon indicating copy to clipboard operation
Polyhedra.jl copied to clipboard

Inconsistent error message for `chebyshevcenter` with different solvers

Open schillic opened this issue 10 months ago • 1 comments

The following code throws an informative error message:

function foo(N, solver)
    A, b = Matrix{N}(undef, 0, 1), N[]
    backend = Polyhedra.IntervalLibrary{N}()
    Q = Polyhedra.polyhedron(Polyhedra.hrep(A, b), backend)
    Polyhedra.chebyshevcenter(Q, solver)
end

julia> solver = LazySets.default_lp_solver_polyhedra(eltype(P); presolve=true);
julia> foo(Float64, solver)

ERROR: The polyhedron contains euclidean ball of arbitrary large radius.

For an exact solver, the analogous code throws a different error message:

julia> solver = JuMP.optimizer_with_attributes(() -> GLPK.Optimizer(; method=GLPK.EXACT));
julia> foo(Rational{Int}, solver)

glp_exact: problem has no rows/columns
ERROR: Solver returned `INVALID_MODEL` when computing the H-Chebyshev center. Solver specific status: The problem instance has no rows/columns.

The reason for this difference is that the first example results in the solver status MOI.DUAL_INFEASIBLE, while the second example results in the solver status INVALID_MODEL.

https://github.com/JuliaPolyhedra/Polyhedra.jl/blob/d38979cf82dcc818a2391fb3775cc8782c990c85/src/center.jl#L92-L99

This is really a minor issue, but I thought I should still report it.

schillic avatar Feb 11 '25 20:02 schillic

GLPK is not the only solver that would struggle when there are no constraints, we might want to do a special case for this in Polyhedra.jl

blegat avatar Feb 12 '25 07:02 blegat