Hey people,

I am new here, any help is much appreciated!!

```
@variable( bilap, X[1:2,u=1:4,1:3], Bin)
```

I want to use the sum of all 1s per each u in X as an Input (Index) for the matrix shown above.

```
@constraint( bilap , workers_allocated[u=1:4],w[u]=sum(X[i,u,j] for i in 1:2, j in 1:3)
@constraint( bilap , duration[i=1:4], duration[i]=Duration_per_task[i][w[u])
```

I know, it`s not possible like this, but I am struggeling with alternative workarrounds tbh.

First I introduced a binary variable:

```
@variable( bilap, D[1:3,1:4], Bin)
@constraint( bilap , Da[i=1:4],Duration[i]==sum(D[j,i]*Duration_per_task[i][j] for j in 1:3))
@constraint( bilap , Da2[i=1:4],sum(D[:,i])==1)
```

My problem is how to link the binary variable D to the sum of the 1s in X (necessary, cause there are several other constraints for X)

This Approach:

```
@constraint( bilap , Da3[i=1:4],sum(x[a,i,p] for a in 1:2, p in 1:3)==sum(D[j,i])*j for j in 1:3)
```

leads to following Error:

```
Unsupported constraint expression: we don't know how to parse constraints containing expressions of type :generator
```

Also I tried ConditionalJuMP to use @implies, but without any success.

Many thanks!!