I have a working solution using Drools constraints streams with two kinds of tests:
- Constraint tests (both individual, as well as a combined one using
ConstraintVerifier) - Integration-style test which actually uses the solver to solve a set of golden problems (solutions are known and asserted on).
I'm using a step-based termination to have a fully reproducible setup (random seed=0, local-search=SA). I can see that it's reproducible, because multiple runs of those tests produce the same results in the same number of steps.
In the interested of performance optimization (and subsequently solution optimization) I tried to switch constraint streams from Drools (default?!) to Bavet. The result for my two kinds of tests is as follows:
- Still green, significant speed increase of ~20x.
- Some tests are failing because they no longer find the optimal solution (but they are way faster). What's especially interesting, is that the non-optimal solution that they find differs from one test run to the next.
Is there something inherit in the Bavet implementation that is non-reproducible, e.g. does it use its own Random instance or does it rely on System.identityHashCode() or something like that?
I'd very much like to have a faster score calculation, but I favor reproducibility over speed.
EDIT
I forgot to mention that in order to make my constraints work with Bavet I had to rewrite them using groupBy a lot (instead of map which was failing with UnsupportedOperationException).
Could it be a combination of that, i.e. groupBy + Bavet?