adventofcode

2025-12-10T05:26:27.666499Z

Day 10 - Solutions

narimiran 2025-12-16T08:23:59.466309Z

Updated my notebook with the Part 2 solution: https://narimiran.github.io/aoc2025/src/day10/ It uses the brilliant insight from Reddit on how to divide and conquer this, without using Z3 or similar: https://old.reddit.com/r/adventofcode/comments/1pk87hl/2025_day_10_part_2_bifurcate_your_way_to_victory/

🙏 1
jurjanpaul 2025-12-16T11:15:22.438579Z

I am very interested in this, but for the moment I will still stubbornly continue hoping to - slowly - finish my own simplex + branch & bound implementation, after trying a constraint propagation approach that left too many options open to be feasible for the larger target values. All the while I kept thinking that there should probably be a much simpler solution that I just did not yet see… 🙂

snyssfx 2025-12-17T12:11:58.410569Z

Solved it by using loco wrapper for Choco constraint programming Java library... It almost worked except for 1 line, there I had to get the best result from what the solver returned in 10 minutes 🤣 I will post the code later, first time I did such a thing

narimiran 2025-12-17T13:27:14.109089Z

Just rewrote my Part 2 solution - now it is 5x faster than the initial solution and calculates the result in ~500 ms on my machine. (The link to the notebook is the same one as already posted above)

Aleks 2025-12-11T17:48:32.506809Z

Finally solved it with Simplex method. I was surprised when it said my answer is too low. It turned out that some solutions with non-integers might give an integer sum. So my wrong answer was just off by 4 🫠

👍 1
benoit 2025-12-11T19:32:55.979019Z

alright i'm out 🙂

genmeblog 2025-12-10T15:15:28.490539Z

OMG... I've just made it. I used linear programming (`linear-optimization` from a fastmath) + branch-and-bound algorithm to convert it to ILP. Simplex + branch-and-bound is enough for part2 problem.

narimiran 2025-12-10T16:02:18.671099Z

Just Part 1 for me today: https://narimiran.github.io/aoc2025/src/day10/

jurjanpaul 2025-12-10T16:58:01.648989Z

Yes, realised rather late that this requires linear programming. Will take some time before I have that logic in place in my Scittle environment.

🙂 1
genmeblog 2025-12-10T16:59:08.350539Z

It's worse: integer linear programming...

rjray 2025-12-10T16:59:32.051509Z

Kind of disappointed. It's one thing for a problem to make us research algorithms, but to only be (realistically) solveable by reaching for a 3rd-party package seems kind of cheesy.

rjray 2025-12-10T16:59:55.755679Z

But, I guess it's time to read up on this LP package...

genmeblog 2025-12-10T17:06:20.200339Z

Regular LP (Simplex method) gives non-integer solution on some cases - so specific adjustment is needed (`branch-and-bound` works fortunately). Or you should use ILP (integer programming) which is harder to implement. There are external libs of course.

👏🏻 1
minikomi 2025-12-11T04:24:24.233499Z

Hah I used minizinc for part 2.. clojure for parsing and orchestrating (well..pmapping) calling out to the minizinc binary