# HiGHS Error: No invertible representation for getDualRay

**URL:** <https://discourse.julialang.org/t/highs-error-no-invertible-representation-for-getdualray/101372>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [July 8, 2023, 10:29pm UTC](https://discourse.julialang.org/t/highs-error-no-invertible-representation-for-getdualray/101372 "2023-07-08T22:29:23Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![rodolforbcoutinho](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rodolforbcoutinho/32/27067_2.png) [@rodolforbcoutinho](https://discourse.julialang.org/u/rodolforbcoutinho)\
**Post date:** [September 26, 2023, 1:55am UTC](https://discourse.julialang.org/t/highs-error-no-invertible-representation-for-getdualray/101372/15 "2023-09-26T01:55:50Z")

</div>

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:

```julia
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

```

```julia
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](https://discourse.julialang.org/t/is-there-a-function-similar-to-numpy-unique-with-inverse/80949/6)

---

_[View the full topic](https://discourse.julialang.org/t/highs-error-no-invertible-representation-for-getdualray/101372)._
