Skip to content

Commit b2e8765

Browse files
committed
q
1 parent b7edee8 commit b2e8765

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

2025/Day10/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ It’s clearly a linear algebra problem as follows:
1616

1717
This is a textbook integer linear programming problem, trivially solved by an ILP solver, or in [my case z3](solve.py). But this is not how Advent of Code has worked in the last 10+ years, so I was hoping for some shortcut, maybe a special structure of the input... But no luck, ILP really seems to be the intended way.
1818

19+
## The Gaussian way
20+
1921
I'm a purist in the sense that I don't use external dependencies in my C# solutions, so something like _OR-tools_ is out of scope. I did find another path, though, which is not that good-looking, but workable....
2022

2123
One can notice that `A` is almost always full (column) rank, and the kernel space has at most 2–3 dimensions. This means we can solve the equation using Gaussian elimination, which will give us a solution with the columns in the kernel set to 0. There is no guarantee that the solution is integer, or that all `xᵢ` are non-negative, though.
@@ -28,7 +30,7 @@ This way we eventually get a feasible solution for the original problem, say wit
2830

2931
I prototyped [this idea](gauss.py) in Python with ChatGPT. I think, if anything, this could be ported to C#, but I don’t feel the urge. Although it uses first principles that one could potentially implement, it’s a much slower solution than the one using z3.
3032

31-
## Update
33+
## A recursive solution
3234

3335
Based on the ingenious idea of [tenthmascot](https://www.reddit.com/r/adventofcode/comments/1pk87hl/2025_day_10_part_2_bifurcate_your_way_to_victory/), I could create a plain C# implementation for the problem.
3436

0 commit comments

Comments
 (0)