Age | Commit message (Collapse) | Author |
|
By realising that the first time we hit the need to skip, the items to
be skipped will be in sorted order; to change them to reverse-sorted
order just requires reversing the items, not re-sorting them backwards.
(On part 1 of the puzzle with a 40 minute limit, the timing goes from
6.6s to 4.3s, average of 5 runs.)
|
|
Even though we change from 3 small memcpy()s per 2 items, to 1 small
memcpy() per item plus 1 big memcpy(), it goes slower?
(On part 1 of the puzzle with a 40 minute limit, the timing goes from
6.6s to 6.8s, average of 5 runs.)
Leave commented out for now.
|
|
|
|
This solves the actual the puzzle, in the case where two plumbers (you
and the elephant) can't reach all the valves in time. But it doesn't
work for the test case, where you can, and it has to look for the most
efficient split of resources.
So, I got the gold star, but I wanted to create a full solution before
committing it. Obviously that didn't happen at the time. Might as well
commit what I have now, and look at improving it with a later fix.
|
|
|
|
|
|
Only tried it with test data before, where we don't need the permutation
pruning system. If you enable it with live data, it prevents any
permutations from being skipped, so it takes forever.
|
|
|
|
That was a tough one. Still takes 2.5s on my hardware. Should be able to
multithread the permuation search at some point, if I want to.
|