My question is about writing down a constraint in IBM CPLEX or in any solver.
Imagine you have a graph with N nodes and E edges. Imagine for connecting one node (source node) to another specific node (destination node), you have a set of paths. Each path is a list of nodes that start from the source node and end with the destination node. The paths in the set can share nodes. For each path, I have a binary decision variable x_p that indicates if you have decided to use that path (x_p=1) or not (x_p=0). The objective function for my optimization problem is a function of the paths. I want to have a constraint that checks if the paths that have been decided to be used (their binary decision variable is 1) are using at most K nodes which means the summation of the unique nodes on those paths is less than equal to K. Is it possible to write a constraint for this?