Day 10: Factory

Megathread guidelines

  • Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
  • You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL

FAQ

  • EnEnCode@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    7 hours ago

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    (/relieving)

    I would never have solved this if it weren’t for AoC being only 12 days. I don’t know if that was a good thing with how much this took out of me.

    • Written in the Really Ultimate Simplex Tableau (Rust) programming language
    • Over 600 lines (so long it didn’t fit without using paste)
    • Two-phase simplex fully implemented, refactored to handle inequalities as well as equalities (you need inequalities during branch-and-cut)
    • Custom Fraction struct because floating-point made me sad (just like every other time I try to use it)
    • The hackiest branch-and-cut implementation ever (really, you had to add inputs with non-integer optima just to make life harder?)
    • Hideously unreadable use of iterators
    • Probably still filled with lingering bugs
    • All of the comments telling the story of my deteriorating mental state intact
    • Part 1 included as a bonus
    • Somehow, actually reasonably performant (37.1 +/- 0.3 ms)

    Solution