summaryrefslogtreecommitdiff
path: root/19.c
AgeCommit message (Collapse)Author
2022-12-31Puzzle 19: Only build at most one robot per round!Adam Spragg
After reading the rules more carefully, I see we can only build one robot per round! (Not just one robot per material type, one robot!) Doh! This reduces the combinatorial explosion a lot. The exhaustive search has become a lot more feasible, with Blueprint 2 of the test input able to cover 22 rounds in a minute and a half. I shouldn't only need to find some small wins from here to get the 24-round runtime to something sensible.
2022-12-30Puzzle 19: Add an "exhaustive" build strategy.Adam Spragg
As expected, the explosion in permutations makes this prohibitive. With this stragegy, on Blueprint 2 of the test input, for: 10 rounds it takes 0.018s/59,979 iterations 11 rounds it takes 0.070s/1,257,483 iterations 12 rounds it takes 1.292s/59,156,010 iterations 13 rounds it takes 3m2.770s/8,395,942,157 iterations Getting to 24 rounds just isn't feasible with that growth. And I can't figure out how to cull unwanted permutations easily. Going to have to try something else.
2022-12-30Puzzle 19: Allow user to specify build strategyAdam Spragg
2022-12-30Puzzle 19: Allow user to specify number of roundsAdam Spragg
2022-12-30Puzzle 19: Fix debug info for geodesAdam Spragg
2022-12-29Puzzle 19: Move the timing loop into the build functionAdam Spragg
2022-12-29Puzzle 19: Move blueprint id into the blueprintAdam Spragg
2022-12-20First attempt at puzzle 19 part 1 (buggy)Adam Spragg
It produces *a* result for each blueprint, but not the best result. I feel like that's a hard problem. The number of decisions about what to build when over 24 iterations explodes so much that you can't brute-force the optimal geode count. Either there's a way of pruning possibilities that I've not thought of, or there's a pretty good heuristic you can get from the blueprint about the proportions of how many of each type of material you want to be producing, that you can pick what to build and get a geode count that doesn't deviate from optimal in only 24 iterations. One other possibility is transforming this puzzle into a SAT format and letting a SAT solver attack it, with its ability to prune decision trees effectively. But I don't have any actual experience with those, and I'm not sure I have time to figure that out for AoC. https://en.wikipedia.org/wiki/SAT_solver