marcodelmastro.bsky.social
@marcodelmastro.bsky.social
Ok, there was a trap! Damn @was.tl that was a neat puzzle... ;-)
So, no real need to actually solve the region present arrangements, but what if I did anyway? ;-)
December 12, 2025 at 2:38 PM
... to explore the full phase space in case it does not exist. My quick and dirty solution was to cut seaches that takes too long, and it worked! ;-) I'll work on possible optimisation and pruning options another time...
December 12, 2025 at 10:36 AM
Inputs, output, and intermediate nodes to be traced in part 2 are circled in red (and it is easy to see that the portion of the graph relevant to part 1, starting from "you," is considerably smaller than the portion for part 2)
December 11, 2025 at 4:55 PM
The color of the nodes shifts toward red proportionally to the number of incoming connections (and it is clearly visible that there are bottlenecks...).
December 11, 2025 at 4:55 PM
And now the compulsory graph visualisation;-)
December 11, 2025 at 4:53 PM
Definitely harder than yesterday, but in a different way (required more mathematical thinking and knowledge of specialized tools).
December 10, 2025 at 10:21 AM
Most of the complexity was in properly encoding the constraints (integer non-negative solutions, minimal sum). Part 2 result was initially wrong by 1 becouse of a @$%^& rounding error when casting result to int!
December 10, 2025 at 10:21 AM
... while it works for the example, even with pruning the solution space is still too large for the full input. Thinking more carefully I tried a mathematical approach (Part 2 is effectively a linear system with constraints) using scipy.optimize.milp to solve (MILP=Mixed-Integer Linear Programming)
December 10, 2025 at 10:20 AM
How “not on BS”?! I’m here! ;)
December 8, 2025 at 10:10 PM
And not the compulsory animation... ;-)
December 8, 2025 at 2:17 PM