HiGHS Error: No invertible representation for getDualRay

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