I am currently building a milp model previously done in GAMS and I’m converting it into JuMP (Julia).

I am particularly having trouble with constraints and the objective function that has more than one summation with conditions. It is returning the following error

syntax: function argument names not unique around C:\Users\glmab.julia\packages\JuMP\qhoVb\src\macros.jl:91

Stacktrace:

[1] top-level scope at In[194]:7

[2] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

```
@constraints example2_netprofit begin
mat1a[s in s, n in n, s = 1, n > 1],
ST[s,n] == ST[s,n-1] + sum(sum(rho[i,s]*bs[i,np,n-1] for np in 1:length(np) if np <= n-1) for i in 1:length(Ips1)) + sum(sum(rho[i,s]*bs[i,n,np] for np in 1:length(np) if n <= np) for i in 1:length(Ics1))
mat2a[s in s, n in n, s = 2, n > 1],
ST[s,n] == ST[s,n-1] + sum(sum(rho[i,s]*bs[i,np,n-1] for np in 1:length(np) if np <= n-1) for i in 1:length(Ips2)) + sum(sum(rho[i,s]*bs[i,n,np] for np in 1:length(np) if n <= np) for i in 1:length(Ics2))
mat3a[s in s, n in n, s = 3, n > 1],
ST[s,n] == ST[s,n-1] + sum(sum(rho[i,s]*bs[i,np,n-1] for np in 1:length(np) if np <= n-1) for i in 1:length(Ips3)) + sum(sum(rho[i,s]*bs[i,n,np] for np in 1:length(np) if n <= np) for i in 1:length(Ics3))
mat4a[s in s, n in n, s = 4, n > 1],
ST[s,n] == ST[s,n-1] + sum(sum(rho[i,s]*bs[i,np,n-1] for np in 1:length(np) if np <= n-1) for i in 1:length(Ips4)) + sum(sum(rho[i,s]*bs[i,n,np] for np in 1:length(np) if n <= np) for i in 1:length(Ics4))
end
```

However, I have other constraints that do not have summation in it but are returning the exact same error.

```
@constraints example2_netprofit begin
bv1[i in i, n in n],
Ts[i,n] <= H
bv2[i in i, n in n],
Tf[i,n] <= H
bv3[i in i, n in n, np in np, n <= np <= n],
bs[i,n,np] <= bmax[i]
bv4[s in s],
ST0[s] <= STin[s]
bv5[s in Sfis, s in Sp],
ST0[s] == 0
bv6[i in i, n in n, np in np, np < n],
w[i,n,np] == 0
bv7[i in i, n in n, np in np, np < n],
bs[i,n,np] == 0
end
```

Here are the predefined sets and parameters used for the above to run correctly

```
#Sets
# i 'tasks' /t1*t5/
# j 'units' /j1*j5/
# n 'events' /n0*n3/
# s 'states' /s1*s4/
i = ["t1","t2","t3","t4","t5"];
j = ["j1","j2","j3","j4","j5"];
n = range(1,N, step = 1);
s = ["s1","s2","s3","s4"]
#SubSets
#Ij1(i) 'tasks which can be performed in unit 1' /task1/
#Ij2(i) 'tasks which can be performed in unit 2' /task2/
#Ij3(i) 'tasks which can be performed in unit 3' /task3/
#Ij4(i) 'tasks which can be performed in unit 4' /task4/
#Ij5(i) 'tasks which can be performed in unit 5' /task5/
Ij1 = i[1];
Ij2 = i[2];
Ij3 = i[3];
Ij4 = i[4];
Ij5 = i[5];
#Is1(i)'tasks which process state 1 and either produce or consume' /task1,task2/
#Is2(i)'tasks which process state 2 and either produce or consume' /task1,task2,task3/
#Is3(i)'tasks which process state 3 and either produce or consume' /task3,task4,task5/
#Is4(i)'tasks which process state 4 and either produce or consume' /task4,task5/
Is1 = i[1:2];
Is2 = i[1:3];
Is3 = i[3:5];
Is4 = i[4:5];
#Ips1(i) 'tasks which produce state 2' //
#Ips2(i) 'tasks which produce state 2' /task1,task2/
#Ips3(i) 'tasks which produce state 3' /task3/
#Ips4(i) 'tasks which produce state 4' /task4,task5/
Ips1 = [];
Ips2 = i[1:2];
Ips3 = i[3];
Ips4 = i[4:5];
#Ics1(i) 'tasks which consume state 1' /task1,task2/
#Ics2(i) 'tasks which consume state 2' /task3/
#Ics3(i) 'tasks which consume state 3' /task4,task5/
#Ics4(i) 'tasks which consume state 4' //
Ics1 = i[1:2];
Ics2 = i[3];
Ics3 = i[4:5];
Ics4 = [];
Sr =s[1]
Sfis = s[2:3]
Sp = s[4]
#alias(i,ip)
#alias(j,jp)
#alias(n,np,npp)
ip = i;
jp = j;
np = n;
npp = n;
```

```
#PARAMETERS
#bmin = [0,0,0,0,0]
bmin = OrderedDict(
"t1" => 0,
"t2" => 0,
"t3" => 0,
"t4" => 0,
"t5" => 0
)
#bmax = [100,150,200,150,150]
bmax = OrderedDict(
"t1" => 100,
"t2" => 150,
"t3" => 200,
"t4" => 150,
"t5" => 150
)
#STin = [10000, 0, 0, 0]
STin = OrderedDict(
"s1" => 10000,
"s2" => 0,
"s3" => 0,
"s4" => 0)
#STmax = [+inf, 200, 250, +inf ]
STmax = OrderedDict(
"s1" => Inf,
"s2" => 200,
"s3" => 250,
"s4" => 0
)
#alpha = [1.333, 1.333, 1.000, 0.667, 0.667]
alpha = OrderedDict(
"t1" => 1.333,
"t2" => 1.333,
"t3" => 1.000,
"t4" => 0.667,
"t5" => 0.667
)
#beta = [0.01333, 0.01333, 0.00500, 0.00445, 0.00445]
beta = OrderedDict(
"t1" => 0.01333,
"t2" => 0.01333,
"t3" => 0.00500,
"t4" => 0.00445,
"t5" => 0.00445
)
price = OrderedDict(
"s1" => 0,
"s2" => 0,
"s3" => 0,
"s4" => 5
)
demand = OrderedDict(
"s1" => 0,
"s2" => 0,
"s3" => 0,
"s4" => 0
)
#rho_table = wsv"""
#i s1 s2 s3 s4
#t1 -1 +1 0 0
#t2 -1 +1 0 0
#t3 0 -1 +1 0
#t4 0 0 -1 +1
#t5 0 0 -1 +1
#"""
rho_table = DataFrame([(i = "t1", s1 = -1, s2 = +1, s3 = 0, s4 = 0 ),
(i = "t2", s1 = -1, s2 = +1, s3 = 0, s4 = 0 ),
(i = "t3", s1 = 0, s2 = -1, s3 = +1, s4 = 0 ),
(i = "t4", s1 = 0, s2 = 0, s3 = -1, s4 = +1 ),
(i = "t5", s1 = 0, s2 = 0, s3 = -1, s4 = +1 )]);
rho = OrderedDict( (r[:i],states) => r[Symbol(states)] for r in eachrow(rho_table), states in s);
```

The commented out sections are in GAMS format. Please only take note. The other packages used include datastructures and dataframes