Conditional NLconstraint, Couenne

Hi all,

I am trying to solve a MINLP problem with Couenne. I have difficulty implementing an NLconstraint of this form: if x[i,j] == 0, y[i,j] == 0 else y[i,j] = 1/x[i,j], I have checked the Syntax notes and I still cannot get it right. If I try to use isapprox(x[i,j], 0, atol=1e-8), I get an error:
LoadError: MethodError: no method matching isapprox(::VariableRef, ::Int64; atol=1.0e-8)

here is a simplified version of my code excluding many other parts that makes it a MINLP problem:

using JuMP
using AmplNLWriter

m = Model(with_optimizer(AmplNLWriter.Optimizer, "path to couenne.exe"))


    D_st = [0, 0.03, 0.06, 0.2, 0.3, 0.5]
    Q = [0.02; 0.05; 0.07]
    NP = size(Q,1)
    ND = size(D_st,1)
    min_velocity = 0.6
    max_velocity = 2

    @variable(m, D[1:NP, 1:NP] >= 0)
    @variable(m, D_idx[1:NP, 1:NP, 1:ND] >= 0, Bin)
    @variable(m, x[1:NP, 1:NP] >= 0)

    @constraint(m, 1 .>= sum(x, dims=2))

    @constraint(m, [i = 1:NP, j = 1:NP], D[i,j] == sum(D_st[n]*D_idx[i,j,n] for n = 1:ND))

    @NLexpression(m, v_aux[i = 1:NP, j = 1:NP], 4*x[i,j]*Q[i]/(pi*D[i,j]^2))
    @NLexpression(m, QF[i = 1:NP], Q[i] - sum(x[j,i]*Q[j] for j = 1:NP))

    @expression(m, v[i = 1:NP, j = 1:NP], ifelse(isapprox(D[i,j],0, atol=1e-8),0,1)*v_aux[i,j])

    @NLconstraint(m, [i = 1:NP, j = 1:NP], min_velocity <= v[i,j])
    @NLconstraint(m, [i = 1:NP, j = 1:NP], max_velocity >= v[i,j])

    @NLconstraint(m, sum(QF[i] for i =1:NP)/sum(Q[i] for  i = 1:NP) == 0.8)

    JuMP.optimize!(m)

    x = JuMP.value.(x);
    D = JuMP.value.(D)
    v = JuMP.value.(v)


    println("x = ", x)
    println("D = ", D)
    println("v = ", v)

A standard way to implement this kind of constraint is using a big-M formulation. Are you familiar with that?

No I am not, but I can look it up. Thanks for the tip!