Switch from sets of constraints to lists of constraints. This should have a positive performance impact, in that list insertion should be asymptotically faster than set insertion.