How to write a constraint Julia-jump

Hi there,

It seems like you might want to start with some JuMP tutorials:

You should also read

It has some suggestions on writing a good question. It’s easier to help if you provide some reproducible code.

Broadly speaking though, you have two options:

Write a for-loop:

for i in I, j in J, k in K
    if j != k && i <= j
        @constraint(model, x[i,j] + x[i,k] <= 1)
    end
end

Use the container syntax (Constraints · JuMP):

@constraint(model, [i=I, j=J, k=K; j != k && i <= j], x[i,j] + x[i,k] <= 1)
1 Like