HiGHS Error: No invertible representation for getDualRay

I get an error when I try to solve a feasibility problem in JuMP using HiGHS. I use Julia v1.9.1 with the Julia packages JuMP v1.12.0 and HiGHS v1.5.2.

$ julia JuMP_solve.jl
Running HiGHS 1.5.3 [date: 1970-01-01, git hash: 45a127b78]
Copyright (c) 2023 HiGHS under MIT licence terms
Presolving model
270074 rows, 274684 cols, 1084700 nonzeros
269789 rows, 274399 cols, 1082726 nonzeros
Objective function is integral with scale 1

Solving MIP model with:
   269789 rows
   274399 cols (274398 binary, 1 integer, 0 implied int., 0 continuous)
   1082726 nonzeros

        Nodes      |    B&B Tree     |            Objective Bounds              |  Dynamic Constraints |       Work
     Proc. InQueue |  Leaves   Expl. | BestBound       BestSol              Gap |   Cuts   InLp Confl. | LpIters     Time

         0       0         0   0.00%   0               inf                  inf        0      0      0         0     2.2s

Solving report
  Status            Infeasible
  Primal bound      inf
  Dual bound        inf
  Gap               inf
  Solution status   -
  Timing            44.02 (total)
                    1.44 (presolve)
                    0.00 (postsolve)
  Nodes             1
  LP iterations     11798 (total)
                    0 (strong br.)
                    0 (separation)
                    0 (heuristics)
ERROR:   No invertible representation for getDualRay
 45.992959 seconds (3.86 M allocations: 492.087 MiB, 0.48% gc time, 0.52% compilation time: 27% of which was recompilation)

Does the Julia code error? I think you can just ignore the printed warning from HiGHS

The Julia code does not error.

Then just ignore the print from HiGHS. It just says that it can’t find a dual ray, which is a proof of infeasibility.

Should HiGHS’ infeasibility conclusion be trusted?

Should HiGHS’ infeasibility conclusion be trusted?

Yes. Otherwise that’s a bug. If you know a feasible solution and you have a reproducible example, please open an issue.

Hello everyone!
I also get this error related to getDualRay. And also my problem should be feasible.

When I set demand = false, the code works fine and find the optimal solution.
When I set demand =true, JuMP return the Error.
Matrix P is all positive and its been multiplied by x which is a bool vector to select one of its rows. So all itens in Mx vector should be greater than 0.

Any hint how could I solve this? Thanks in advance!!!

Here is the code:

Blockquote
function JuMP_MOA(L::BasicLoad; demand::Bool = false)

    model = Model()
    set_optimizer(model, () -> MOA.Optimizer(HiGHS.Optimizer))
    set_attribute(model, MOA.Algorithm(), MOA.Hierarchical())

    u = length(L.s)
    @variable(model, x[1:u], Bin)
    @constraint(model,sum(x)==1)

    if demand
        P = Generate_PowerMatrix(L)
        @expression(model, Mx, P*x)
        @constraint(model, [i = 1:288], Mx[i] >= 0)
    end

    @expression(model, Cost_expr, sum(Cost(L,i)*x[i] for i in 1:u) ) #MIN
    @expression(model, Comf_expr, sum(Comf(L,i)*x[i] for i in 1:u) ) #MAX

    @objective(model, Max, [-Cost_expr, Comf_expr])
    optimize!(model)
    if termination_status(model) != OPTIMAL
        @warn("The model was not solved correctly.")
        return
    end
    solution_summary(model)
    
    A = value.(x)
    ix = findfirst(x-> x>0.5 ,A)
    return L.s[ix]
end

Blockquote

ERROR: No invertible representation for getDualRay

This error is just printed by HiGHS. It does not mean that an actual error occurred in JuMP. (HiGHS will stop printing this line in the next release: HiGHS Error: No invertible representation for getDualRay · Issue #1350 · ERGO-Code/HiGHS · GitHub)

When I set demand =true, JuMP return the Error.

What is the full output? Does Julia throw an error?

Here a copy from terminal output. No errors in Julia at all. Line 145 is related to default Warning.
How can I ignore this error?

Blockquote
julia> tmo = SHC.JuMP_MOA(H[1]; demand = true)
Running HiGHS 1.5.1 [date: 1970-01-01, git hash: 93f1876e4]
Copyright (c) 2023 HiGHS under MIT licence terms
Presolving model
Presolve: Infeasible
Solving report
Status Infeasible
Primal bound -inf
Dual bound inf
Gap 0% (tolerance: 0.01%)
Solution status -
Timing 0.01 (total)
0.00 (presolve)
0.00 (postsolve)
Nodes 0
LP iterations 0 (total)
0 (strong br.)
0 (separation)
0 (heuristics)
ERROR: No invertible representation for getDualRay
┌ Warning: The model was not solved correctly.
└ @ SHC C:\PJL\SHC\src\SHC.jl:145

Can you provide a reproducible example?

Instead of optimize!(model), do write_to_file(model, "test.mof.json") and then attach the file.

Ok, here is the .mof.json file. I just had to add *.jl to include here.
I’ll do some cleanup in code and translate the comments to english.

test.mof.json.jl (292.2 KB)

I can reproduce. Something weird is going on. Let me take a look.

And here the clean code.
SHC_MAIN.jl (9.1 KB)

I’ve confirmed a bug in HiGHS.jl: Bug in copy_to · Issue #172 · jump-dev/HiGHS.jl · GitHub

It’s because you have a lot of rows like 0 >= 0. Drop all zero rows from your P matrix.

1 Like

Drop the zeros worked nice! I have also added a function that create an upper bound to this constraint. The working constraint code block is bellow:

if demand
  P = Generate_PowerMatrix(L)
  R = Generate_DemandPeakRef(L.Δt, 4, 1)
  @expression(model, Mx, P*x)
  #@constraint(model, [i in eachindex(Mx)], Mx[i] <= R[i])
  @expression(model, Mu, unique(Mx))
  @expression(model, Ix, uniqueinds(Mx))
  @constraint(model, [i in eachindex(Mu)], Mu[i] >= 0)
  @constraint(model, [i in eachindex(Mu)], Mu[i] <= R[Ix[i]])
end
uniqueinds(x) = unique(i -> x[i], eachindex(x))

The last function is from this discussion: Is there a function similar to numpy unique with inverse? - #6 by stevengj

1 Like

I haven’t tested this, but do instead something like

if demand
    P = Generate_PowerMatrix(L)
    R = Generate_DemandPeakRef(L.Δt, 4, 1)
    for i in 1:size(P, 1)
        if any(!iszero, P[i, :])
            @constraint(model, 0 <= P[i, :]' * x <= R[i])
        end
    end
end

I fixed the bug in HiGHS, so even the 0 >= 0 model will work once New version: HiGHS v1.6.1 by JuliaRegistrator · Pull Request #92216 · JuliaRegistries/General · GitHub is merged.

1 Like