You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix two bugs around pinned states in the Solver and SolutionCache. (#1409)
Fix two bugs around pinned states in the Solver and SolutionCache.
I was working on an unrelated bug fix and I stumbled into a couple of
incorrect formats in some complex examples. After poking around, I found
two bugs:
- In SolutionCache, it always used the given state of the root Piece
even if that state wasn't explicitly bound in the parent Solution.
This causes incorrect output if we are separately formatting a child,
the parent Solution doesn't bind the child's root, and the best state
for the child is *not* the unsplit state.
That's a rare enough combination of events that none of the existing
tests hit it, but I'll have some new tests for the unrelated bug fix
that do.
- In Solution, when applying constraints between pieces, it doesn't
take into account conflicts from pinned pieces. This bug was
introduced by #1407. It wasn't caught because the one test that
happens to tickle this doesn't tickle it when a certain child piece
is formatted separately, but does if you disable that optimization.
The fix to SolutionCache also means we no longer use the root piece's
state as part of the cache key. Somewhat surprisingly, it doesn't seem
to be necessary. Taking the state out of the cache key is good because
it means we're able to reuse more cached Solutions in different
contexts. This PR makes the large benchmark about 5% faster.
0 commit comments