I have some questions about good practice in Julia/JuMP to manipulate subset of elements in a model.
In my usage, I want to do a model using graph, so I have my graph G=(V, E).
All edges in E are a struct, containing the id of the edge and an other Tuple containing the id of the vertices who are connecting.
So E can look like this : [ (1,(1,3)), (2,(1,2)) , (3, (2,3)) ]
But in my model, I may have the use of a subset of E. For example all the edges connecting the destination vertex (here the edges connecting the vertex 3), so I have an Array A containing [1,3], the two edges who connect to the vertex 3, and this is the subset I want to work with.
Then I’m trying to create Variables in JuMP with the information of the edges which id is in A. So I want in this example , 2 variables x[(1,3)] and x[(2,3)].
I’m trying with something like :
@variable(model, x[ E[ e in A].ij], Bin]
But as you can expect the “e in A” doesn’t work, and I don’t know how to iterate on E with the ID stocked in the subset A to extract only the edges I want.
My question is : Is the separation I made between my Array with all the edges, and from the other side a subset containing the ID, a good way to represent subset in Julia? And how can I use my subset inside the @variable/@constraint in JuMP ?
I don’t know if I’m clear enough, feel free to ask more precision !
Thanks in advance for help
PS: Sorry for the fail post earlier, I delete it