I’m trying to define a JuMP @NLexpression with embedded indexing and I need to use numerical indices instead of collections. I would have thought that the below would work but I’m getting an error saying that F was already defined… Might anyone know how to circumvent this problem?
arr_1 = [A,B,C,...] ## A,B,C are structs that have arr_2 as fields
for a = 1:length(arr_1)
arr_2_a = arr_1[a].arr_2 ## arr_1[a].arr_2 = [x_a, y_a, z_a, ...], each of which is another struct
for b = 1:length(arr_2_a)
@NLexpression(
model,
F[a,b] = some_function_of_arr_1[a]_and_arr_2_a[b]
)
end
end