How to turn off warning in JuMP

jump

#1

I made a helper function for constraints

"""
If x is Bin & y is Int, it simply means x = y % 2.
"""
function addParityConstraint(model::JuMP.Model, x, y)
    @variable(model, odd_dummy, Int)
    @constraint(model, x + y == 2 * odd_dummy)
end

But keeps getting

WARNING: A variable named odd_dummy is already attached to this model. 
If creating variables programmatically, consider using the anonymous variable syntax x = @variable(m, [1:N], ...).

How to avoid the warnings? I cannot get anonymous variable with types working, e.g. @variable(model, Int)


#2

You cannot disable the warnings. After issue #741 is fixed you’ll be able to set the variable category inside the macro, but for now you can use

odd_dummy = @variable(model)
setcategory(odd_dummy,:Int)