Argument Exception
An unhandled exception of type 'ArgumentException' occurred in mscorlib.dll (Additional Information: An item with the same key has already been added.)
You are trying to create constraints for each node. Constraints are internally identified by their name. This name has to be unique.
To fix this problem:
- Let the string name contain the objects of your for-loop (e.g.
$"FlowBalance: {node}"
). - Or set the ModelScope.NameHandling to NameHandlingStyle.UniqueShortNames or NameHandlingStyle.UniqueLongNames.