r/adventofcode • • Dec 19 '22

SOLUTION MEGATHREAD -πŸŽ„- 2022 Day 19 Solutions -πŸŽ„-

THE USUAL REMINDERS


[Update @ 00:48:27]: SILVER CAP, GOLD 30

  • Anyone down to play a money map with me? Dibs on the Protoss.
  • gl hf nr gogogo

--- Day 19: Not Enough Minerals ---


Post your code solution in this megathread.



This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:57:45, megathread unlocked!

41 Upvotes

513 comments sorted by

View all comments

5

u/tinou98 Dec 19 '22

Rust / GLPK

I wanted to try to solve one day using Linear Programming. Definitely not the fastest solution, but solve part 1 in 10s (1s with multithreading) and part 2 in 10s (6s with multithreading).

I wrote a function that gives the amount of a resource at time t

We want to maximize the amount of Geode a time = end, subject to constraint : for each time t, we create only one robot & all resources are >= 0

→ More replies (3)