Search code examples
optimizationjuliajulia-jump

How to define a set in JuMP (JuliaOpt)


It should be easy, but it's almost 3 days that I'm trying to define a set in JuMP. Then, I need to set my variable y for each pair (i', i) belonging to the set O.

O={(i,j): t[j] - t[i] + 30 < d[i,j]; i in D, j in K, i !=j }

y[i,j]=0, for each (i,j) in O

Any help?


Solution

  • I should have found the solution for the problem. This is the code to write the constraint for the set O:

    for i=1:n, j=1:m
        if (i != j && t[i] - t[j] + 30 < d[i,j])
            @constraint(model, y[i,j] == 0)
        end
    end