I am trying to implement an arc-flow problem where I have a set of arcs in an array. Each arc is a custom data structure composed of from/to nodes. I want to add a constraint where I only include the arcs that go from a specific node (1), something like:
@constraint(m, sum(x[a] for a in arcs; a.from==1) == 1)
This does not work. What is the best approach to deal with this? Is there a way to do it without precomputing all outgoing arcs from each node first? If so, is there a way to add additional conditions? Thanks in advance
Bernardo