This very simplified form also gives similar results.
julia> main() do n, N, model, x
@variable(model, z, Int)
@constraint(model, z == sum(x[1, :]) - N)
@constraint(model, !z --> {sum(x[2, :]) == 2})
end
Test Summary: | Pass Total Time
main | 4070 4070 0.8s
Is it just a coincidence? Or are the formulations(*) actually equivalent?
(*)I’m having trouble following the logic of the second script.
For example, regarding the statement
@constraint(model, z[3] == z[1] + z[2])
I understand that if z[3]==0 then z[1]==z[2]==0.
I don’t understand how it works in different cases.
For example, if it makes sense, since z is Bin, what happens in the case z[1]==z[2]==1?