I am trying to insert user cuts and lazy constraints in a mixed-integer linear programming model. I am putting the functions in separate files from the main model. An illustrative example:

function valid_inequality(cb_data)

con = @constraint([i in 1:m,j in 1:n, k in 1:n], sum(X[i,j,k,l] for l in 1:s)<=1)

MOI.submit(model, MOI.UserCutCallback(), con)

end

in the main file:

MOI.set(model, MOI.UserCutCallback(), valid_inequality)

And Julia is returning:

UndefVarError: i not defined

The examples of user cuts and lazy constraints in the JuMP documentation does not present decision variables with several indices.

Thanks in advance,

Bruno