Approaching a Limit (Mathematically)

Approaching a Limit (Mathematically)

Opus Magnum is full of strange optimization corners. Our leaderboards track far more than just the cost, cycles, and area provided with the game. We measure instructions, rate, and even height and width and bounding hexagon. We evaluate solutions in two ways: how they get to the victory screen and what they do when left to run forever. With this many corners, some are bound to be weird. Today, I’m going to write about the infinite families in Opus Magnum. These are solutions that demonstrate what the community calls an “epsilon problem.” In every infinite family there is some limit, but to achieve it you must allow the solution to have infinitely many of some thing. Any actual solution that can be built has only an absurdly large number of that thing. Like this:

By the end of this post, this solution should make more sense.

Classic Example: Logistics

Starting on Halloween 2021, the player F43nd1r began running speedsolving competitions. He drummed up interest on discord from a few top players. He let them know when he would release his new puzzle. Then as soon as the puzzle was revealed, the first player to submit a solution won. The format evolved from there.

By 2022, speedsolves also had a second challenge: at the one hour mark, try to be the player with the most optimized solution.

On May 1 2022, the speedsolve puzzle was called Logistics.

It took place in a production cabinet, but the strangest one most of us had ever seen. It had 7 copies of the tiniest chamber. The 6 around the outside had one conduit each, connecting them to the central room. To get any atom from one exterior chamber to another involved first passing it to the center. Note a graphical limitation of the game – there are only labels on the first 3 conduits. The rest are still paired as expected, but without labels.

This puzzle is incredibly cool. The 7 tile chambers make you break the process down into tiny modules. The central room proves to be the bottleneck, as it can only hold one arm. But the arm can be a hex arm, doing as many as 6 transfers in parallel..

Rate

Beyond the time-to-solve metric (which rebix won), the goal was to have the best rate at the one hour mark. I made this, which produces an output every 23 cycles.

It was 3rd, beaten by rebix and Rolamni. Both of them had solutions that made an output every 18 cycles, with Rolamni winning on cost tiebreak. His solution:

But that was just the one hour mark. Since this puzzle was so unique, it kept top players’ attention. How low does rate actually go here?

Two hours later, rebix had lowered the rate to 14. The center arm was sometimes doing as many as 4 moves in parallel.

We oohed and ahhed, but we didn’t make any further improvements right away. The next action didn’t come for 3 days.

Rolamni’s 12 + ε

On May 4th, Rolamni found a solution to Logistics that was almost 12r. Almost. Here’s a gif showing the fast part of his solution:

First, this is a legendary solution.

Second, there is a big difference between the previous solutions and this one. This solution is not self-initializing. In other words, the arms are programmed do some setup work before they settle into this 12 cycle loop.

The arms in this particular solution have 182 cycles of setup, 72 cycles of steady state, and 89 cycles of teardown to recover an empty board. But that’s just this particular solution. The steady state is a repeating 12 cycle loop, and this solution chose to include 6 copies of the loop. For every natural number N, you could have N copies of the loop. Each N gives rise to a solution for Logistics with slightly different stats.

During setup and teardown Rolamni’s solution makes 8 outputs. During steady state, it makes 1 output every 12 cycles. Measuring rate, his particular solution, when run forever, only actually makes an output every 24.5 cycles on average, slower even than my 23. But because the steady state outputs every 12 cycles, a solution with N copies of the middle part achieves any rate of the form (182 + 12N + 89) / (N + 8). This simplifies to 12 + 175 / (N + 8). Rolamni shared this value with the remark “this is why production rate is a bad metric for a tournament.”

We have our first infinite family, and our first epsilon problem.

Calculus

Now, I’m a physicist by training, so I see a limit in N and think “plug in N = ∞.” But that is a shortcut. In proof based calculus, I did learn the proper way to do these limits involves an “epsilon N” proof. The short of it, if someone tells me any ε > 0, I can provide a value of N such that the output (in this case the rate), is within ε of the limit.

So if we take ε = 2, we can find the N such that this solution is better than rebix’s 12 + 2 = 14r solution. We solve 12 + 175 / (N + 8) < 14 for N, and it gives N > 79.5. So if you copy the middle part 80 times, this solution is the rate record.

With the middle part copied 17492 times, we achieve a rate of exactly 12.01. The leaderboard rounds up to the nearest hundredth, so if this puzzle were to be on the leaderboard, that would be the limit. Anything greater than 12 would round to at least 12.01. ε = 0.01 is the smallest practically useful epsilon for record hunting in Opus Magnum.

When someone in the Opus Magnum community finds a “12 + ε” rate solution, it’s now generally understood that they found a family of solutions, each closer to 12r than the previous, and the limit of 12.01 would be the best the leaderboard could recognize.

The Price

In Logistics, and many similar examples, the price being paid to get closer to the limit is instruction count. Even the ε = 0.01 examples tend to have absurdly high instruction counts. To curb this, the leaderboard organizer set an instruction limit of 16384i on submissions stored in the database.

Not many solutions actually want that many instructions. The game runs terribly when the solution file has that many instructions. But in many cases, this cap also does prevent us reaching the lowest values of epsilon. With 852 + 77N instructions, this Logistics family caps out at N = 201 and 12.84r.

An Alternative Format

One of the complications with these solution families is trying to figure out which ones are worth keeping around. We keep an entire pareto frontier in the database. Nothing really stops someone from making all of the separate solutions and submitting to the leaderboard. If the Rate / Instruction tradeoffs all happen to be pareto optimal, then every solution is accepted. In some cases, like overlapped Face Powder where the setup, work loop, and teardown are each just 2 instructions, people have bothered to do this. But it is not the done thing, and even the Face Powder example got a lot of people mad to have the database polluted by dozens of the same solution.

Instead of putting a solution on the leaderboard, we can imagine putting a solution generator on the leaderboard, which is some script that takes in a value N and builds that solution of the relevant family. When someone runs a command on the leaderboard bot to get an actual solution out, they supply their own N and the script assembles the solution for them to download. This is theoretically possible, although nobody has done it.

Part of the reason nobody has done it is the challenge of determining what is pareto optimal. If there is only one infinite family, then the Rate / Instruction tradeoffs each have a pareto spot. But while writing this blog post, I built my own 12 + ε rate Logistics solve.

How would you compare them? If there are two separate infinite families, it can end up being the case that one is better for some N and the other better for others. Extend to as many as exist in the mathematically complete pareto frontier, and it’s a headache for any code to keep up.

Many have decried the lack of a “loop from here” command in the game. If there were such a thing, the arms could enter their steady state directly in the instruction tray and the epsilon problem would be solved, right?

Not entirely. Logistics would be 12r, yes. But we have examples of epsilon problems in other metrics too!

Height and Width and Bestagon Too

The community decided that area was not the only important measurement of size for a solution. We now track four size-like metrics in the leaderboard. Area counts the number of tiles. Height counts the number of rows used, without caring about the width. Width counts the number of columns used, without caring about the height. Finally, bounding hexagon (often called Bestagon) counts the smallest regular hexagon that contains the solution.

An example well-behaved height optimized solution, Sword Alloy in 3 height:

An example well-behaved width solution, Rocket Propellant in 2.5 width:

A few caveats about width. Most width solutions are displayed diagonally instead of vertically, because the gif will show the action better. Width also can take half-integer values like 2.5. This is because columns in a hexagonal grid are zig-zag shaped. This graphic (from the leaderboard website help page) shows where the measurement comes from.

Finally a well behaved Bestagon solution, Airship Fuel in 3b:

All of these metrics bring the “production chamber” experience to any puzzle. As a result, the leaderboards have to deal with the problems inherent to a production chamber, on every puzzle. That includes epsilon problems. However, height and width both have the additional feature of infinite space. So what if you could improve rate ever so slightly, by using more of that space?

The 2 Width Problem

In July 2024, a player called “Psi looks away” had been establishing himself as a HR and WR main. These categories have you optimize rate under the constraint of minimum height or width, respectively. The previous WR WR (width rate world record) for the tutorial puzzle Stabilized Water looked like this:

An output every 6 cycles, quite simple machinery. But he broke that record, with a solution outputting on average every 5.63 cycles..

This was not itself part of an infinite family, it just built 8 outputs every 45 cycles as 5 from the bottom pipeline and 3 from the top. But it showed how you could go faster than 6r. This was the beginning of what grimmy ultimately termed “width snakes”. One day later, Psi looks away had found the limit of this approach, and the tutorial puzzle had an epsilon record.

Extra Work

Here’s a screenshot in game using a mod by mr_puzzel to show the width constraint. In order for the stabilized water molecule to make it to the product tray, it must slide, rotate, slide, rotate, slide, rotate, slide. That’s 4 slides and 3 rotates. There is room on the track for 3 arms. At period 10, each one can do one slide and one rotate, but that’s not enough. Someone has to do a little extra work.

In one version of the programming, we can give all the extra work to arm 4. It has to do 3 actions totaling 14 cycles, and that 14 cycle loop forces the entire machine to period 14.

But better would be to have the programming cover more products. That way, each arm can do the extra work for one product. This width snake is perfectly designed to operate arms to operate at period 10 whether they are upstream or downstream from the one currently doing extra work.

Spreading it out across more arms makes the result even closer to period 10, but the instruction count increases quadratically. Every new arm adds another product that needs to be scripted, so you pay the instruction price on every arm and have to write instructions for the new one.

By doing this though, you approach the WR limit. Put a 10 + ε pipeline on each side of the output, and your two constructions become a single 5 + ε construction.

Psi looks away and grimmy came to a sort of agreement to optimize the solution at 5.42r without submitting anything faster. That rate corresponds to 12 products per 65 cycles, and an implementation of it has over a thousand instructions. Here’s where the WR WR stood at the end of that day.

However, for fun, grimmy did write a script that would assemble the stabilized water width snakes out to any limit. Using it, they created a solution with stats 5.01r/22635g/1508502i. 1.5 million instructions. About 30 times longer than the one shown here, and programmed for 30 times as many products. This was immediately followed by calls for an instruction limit, and led to the 16384i limit we have today. Within that limit, the solution shown in the introduction to this post is the record, at 5.1r.

Similar Puzzles

Only a small number of puzzles in the game admit a 2w solution. Those that do often end up with width snakes in their WR solutions. As the tutorial level, Stabilized Water has been pushed the furthest into the insane, but the record for Airship Fuel is beatable today by simply extending a snake:

Precision Machine Oil

For an example of a Height epsilon, we look at Precision Machine Oil. 2 height has a lot more opportunity for speed than 2 width, so this record approaches the true minimum rate for the puzzle of 4r. With 3 height, 4r looks like this:


But the puzzle is solvable in 2 height, and so the HR record attempts to do it in 2 height. What it actually achieves is 4 + ε.

We can grab arbitrarily many pairs of tin atoms with pistons as shown in the left half of the solution below. In this particular solution, the count is 5.

In the middle of the track loop, all pistons have to drop, spin around, grab their neighbor’s tin, and then push it to the end of the loop. Much like the width snakes, the challenge is going from “atoms behind the arms” to “atoms in front of the arms”. The turn around is choreographed so that any arm in between two pairs of tins has exactly the right amount of time to make the 4r schedule. But two arms are not in between two pairs of tins – the ones in the front and the back. Front goes from escorting tin to shuffling along empty. Back does the opposite. These arms still need a space on the track loop, and a piece of the machinery waits for them to pass.

On the right side of the machine there is another source of delay. That track is full of bi arms, which grab on their left. They mean to drop on their right. Somewhere in the middle of the track, each arm has to let go of what they are holding and pick up what their neighbor in front dropped.

Psi looks away perfectly synchronized all of these delays to add 2 cycles to the overall loop. That number remains at 2 no matter how many products are made in one batch. So while this 5 product solution takes 22 cycles for 4.4r, a 10 product solution would take 42 cycles for 4.2r. The limit is 4r, and has two infinitely long track loops with infinitely many pistons on the left and infinitely many bi-arms on the right.

When I brought up I was writing this blog post, he also remarked that Fireworks Powder, Reactive Gold, and Metal Division all have epsilon problems for their HR records. In those cases he hasn’t bothered to even make an example solution because it sounds tedious.

Alcohol Separation

Let’s look at a Bestagon puzzle. This won’t be too different from a production chamber, but it has a fun story so I’ll tell it.

Before September 2025, the BR record for Alcohol Separation looked like this:

You have to squint to even make out the bounding hexagon here, since it looks to just be a vaguely compact solution that works. rebix noticed this, and declared it should be possible to get to 3r within this bounding hexagon. It gives you a lot of room. He followed that statement up with this solution, scoring 3.99r. Use the video scrubber to see the teardown and setup at the end of the gif.

3.99r was chosen to be the largest rate (and thus smallest number of repetitions) that would dethrone the 4r.

When tinkering, jinyou decided to push it to 3.49r just for safety against a possible 3.5. Then CooCoo52 went ahead and made a 3.02r by maxing out the instruction count. Despite rebix saying “I still believe 3 proper exists,” it went unfound.

New Instruction Just Dropped

Then the DLC came out, and with it a new instruction. The Halt command is not quite a loop-from-here, but it provides the ability for any arm to stop looping and deactivate entirely. All other arms disregard stopped arms and continue their loops unbothered. If we have enough room to do setup using halt arms, and the steady state using other arms, we can fix this.

Dark_Brick took a look at the BR for Alcohol Separation with halts in mind, but came up short. It was difficult to find a way to set it up even with halts. The steady state forced arms in many useful positions to remain unhelpful until an air and an earth were called into existence in the right places.

But I got curious, and tried for myself. And I succeeded! I saved the remaining 0.02 rate, and it used about 16000 fewer instructions.

The two pistons 1 and 2 are able to set it up in about 70 cycles. My original version took more like 100 cycles, but BrotherMojo took a look and streamlined it. Watching the video, the instruction tray turns dark gray for arms after they halt.

Notice that arm 4 does start moving while the initialization is still running. We need to get a water out of the way, and neither of the halt pistons are able to reach the water output to dispose it properly. Arm 4 can, since that is its job in steady state too! Since arm 4 doesn’t have a halt instruction, it just keeps looping its action. The rest of setup has to dodge it, but that’s not too difficult.

With that, we had eliminated one epsilon from the leaderboard.

The Hierarchy

Introducing the Halt instruction got rid of a few epsilons. However, it is not enough to make Logistics self initializing. It has extremely small chambers, and there are no spare hexes in any of them to place a halting arm. Work loop arms cannot halt, since that disables action in steady state.

I included the puzzle Balanced Gold in the same category as Logistics. This was added to the journal a couple weeks ago by mr_puzzel, and the current rate record is 2.6 + ε. And because it is on the leaderboard, we see enough solutions with 16k instructions to meaningfully tick up the histogram bar there.

Rate epsilons are almost an inevitability with production puzzles that use the new Glyph of Proliferation though. That glyph wants you to build a template atom one time, and then copy it, which is the perfect use case for setup + work loop. If someone can prove me wrong, and solve Balanced Gold at true 2.6r, or its theory limit of true 2.4r, I will give that person a special shout out in a future blog post.

Honorable Mention: LexC

Rate gets most of the focus for epsilon issues because it is the only value our leaderboards track that comes from a continuous space of real numbers. In order to be able to approach a limit, you need there to be infinitely many possible steps between where you are and where you are going. But we have had a few tournament metrics that also behave in this way. I included the LexC metric in the hierarchy. You can read more about that metric in the 2023 tournament post. It cares about the cycle count for every single output the puzzle ever makes, which means there are infinitely many ways to slightly improve a solution without passing a limit.

I’ve never seen a LexC puzzle where the theory limit has an epsilon problem. But in the 2023 tournament, SpiritualShampoo built a machine that had an epsilon problem anyway. It was good enough for 8th place, as 7 people found a way to beat even the limit of his approach.

His solution, titled “TOURNAMENT BURNOUT SPEEDRUN (WORLD RECORD) (144P)” wrote enough instructions for 144 outputs before looping. It was one of the most unwieldy creations shown on stream. You can watch its debut here:

If there was a “loop from here” instruction, this would have not happened.

Conclusions?

As evident from the outer layer of the hierarchy, some epsilons are here to stay. They are the nastiest ones, taking up unbounded space and growing their instruction count quadratically. They are so unwieldy that even the expert of HR and WR, Psi looks away, is content to remark that they exist and doesn’t want to build them.

The DLC Halt command was a huge improvement to quality of life. But it only takes care of a small amount of the issue. So we prepare for what remains. Instruction limits and rounding to the nearest 0.01 place an upper limit on the amount of solutions a bad actor can submit to our leaderboard. Maybe someone can come up with a solution generator that works nicely with all of the leaderboard infrastructure. Maybe we rely on the honor code to prevent people submitting everything that could be submitted (though with AI agents beginning to trawl the leaderboard to make automated improvements, the idea of an honor code quickly is evaporating).

I think Logistics is a cool puzzle, and I would like it to be added to the leaderboard, now that we already have Balanced Gold and friends. 12 + ε is not the theory limit, I still wonder if 10 + ε exists. Rolamni and rebix and I are going to take another look.

Leave a Reply

Your email address will not be published. Required fields are marked *