Hi guys, i am new in julia and i need to write this constraint

@FOR(pilotos(i): @for(vuelos(j): @for(vuelos(k) j#ne#k #and# dia(j)#eq#dia(k) #and#

inicio(j)#le#inicio(k) #and# fin(j)#gt#inicio(k) : x(i,j)+x(i,k)<=1)));

I appreciate your help!!

Hi guys, i am new in julia and i need to write this constraint

@FOR(pilotos(i): @for(vuelos(j): @for(vuelos(k) j#ne#k #and# dia(j)#eq#dia(k) #and#

inicio(j)#le#inicio(k) #and# fin(j)#gt#inicio(k) : x(i,j)+x(i,k)<=1)));

I appreciate your help!!

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

Thank you so much!

1 Like