Hi JuMP Community,

I am working on a problem with a linear objective and one nonlinear constraint. Let mvncdf(x1, x2, x3,…) be the multivariate normal distribution; then, the nonlinear constraint is given by mvncdf(x1, x2, x3, …)>=0.5.

I did not find any implementations in Julia to calculate the cdf of the multivariate normal distribution, but I found one in Python.I try using PyCall to define a user defined function. In the case of 3 variables, the function in Julia looks like

function mvncdf3(z1, z2, z3, rho)

using PyCall

@pyimport scipy.stats.mvn as mvn

@pyimport numpy as np

low = np.ones(3) * -10

mu = np.zeros(3)

p, i = mvn.mvnun(low, z, mu, rho)

return p

end

Then, I tried to register it to JuMP and use it in @NLconstraint

using JuMP, Ipopt

m = Model(solver = IpoptSolver())

@variable(m, z[1:3] >=0)

JuMP.register(m : mvncdf3, 4, mvncdf3, Dmvncdf3)

@NLconstraint(m, mvncdf3(z[1],z[2],z[3],rho) >= 0.5)

But, I get the following error: "PyError (:PyObject_Call) <type ‘exceptions.TypeError’> TyperError(‘float() argument must be a string or a number’,) "

I guess is because z is a JuMP variable that cannot be handled to by PyCall. Is there a workaround this?

Thank you,