Constraints using a matrix built from external function

Hi,
To build a constraint from a NxM matrix variable (denoted by h), I need to build another NxM matrix so I wrote an external function convexity(h). I tried this syntax (partial code):

    function convexity(h)
        #...
       return output
    end
    #... 
    @variables(
        model,
        begin
        h[1:N,1:M]<=b/2.0
        end
    )
    @NLobjective( # max perimeter
        model,
        Max,
        aireSurface(h)
    )
    @constraint(
        # convexity
        model,
        convexity(h) .> 0
    )

Unfortunately, I get the error: @constraint(model, convexity(h) .> 0): Unrecognized sense >`. What did I do wrong?

replace .> with .>=

1 Like

Thank you but I want every term of the matrix to be >0 and not >=0 (sorry Iā€™m new with both julia and juMP).

You cannot use strict inequalities in JuMP because of floating point. If you want it non-zero, use .>= 0.0001 or similar.

1 Like