Abstract the DependenciesList and ConstraintsList into separate classes.

Use persistent data-structures on the back-end of these classes to reduce the
time spent on copy-on-write operations.

After this change the performance decreased on smaller tests, increased
drastically on bigger tests (up to 50% improvement on the largest test) but
increased the memory consumption by a negligible amount.
Adjust tests for the constraint-solver resolver: the order of choices doesn't
matter as long as they are correct.
Add stubs to the test data.

This is a bit of cheating but the easiest way to get these tests working.