B-trees in Factorio
razberry.substack.com
B-trees in Factorio
1–10 of 65 posts
Re: B-trees in Factorio
#2Re: B-trees in Factorio
#3You could do this all with splitters, don’t need the boxes and filter inserters. Nice explanation!
They're not just trying to split an output into multiple lanes. The boxes represent the item stored in that "node" of the B-Tree (laid out here in 2D).
I haven't had time to watch the video, but the prose & screenshots indicates there is associated logic on the inserters to maintain the "sorted" nature of the tree, by sending stuff down the appropriate path to child nodes.
Given the OP's choice of values for keys … you could use splitters to do the splitting, but IIRC splitters only accept a single filter, and so you'd need many of them at each junction (as many as items at that junction). Filter-serters permit several filters, which is a bit nicer here. (You can see that in first screenshot.)
(Unless you just forgo the entire B-Tree design and just n-splitters to sort into n boxes … but that's boring and I think isn't what the OP is going for.)
Re: B-trees in Factorio
#4You could do this all with splitters, don’t need the boxes and filter inserters. Nice explanation!
How? They're not just trying to split an output into multiple lanes. The boxes represent the item stored in that "node" of the B-Tree (laid out here in 2D). I haven't had time to watch the video, but the prose & screenshots indicates there is associated logic on the inserters to maintain the "sorted" nature of the tree, by sending stuff down the appropriate path to child nodes. Given the OP's choice of values for key…
There's almost no reason to use inserters for belt-to-belt transfers for modern meta, aside from a few speed-running stats where you use red-inserters while skipping logistics2 or something.
But if you're trying to sort items on a belt by placing them onto another belt, the answer is a splitter. Item A splits off to another belt, while all other items loop back.
Re: B-trees in Factorio
#5You could do this all with splitters, don’t need the boxes and filter inserters. Nice explanation!
How? They're not just trying to split an output into multiple lanes. The boxes represent the item stored in that "node" of the B-Tree (laid out here in 2D). I haven't had time to watch the video, but the prose & screenshots indicates there is associated logic on the inserters to maintain the "sorted" nature of the tree, by sending stuff down the appropriate path to child nodes. Given the OP's choice of values for key…
Re: B-trees in Factorio
#6You could do this all with splitters, don’t need the boxes and filter inserters. Nice explanation!
Splitter filters only filter one thing to one side, and everything else to the other side. That's not what is happening in this example though, where several things are going one way, and several things are going the other way.
Re: B-trees in Factorio
#7------------
So I have to comments. #1 is about the Comp-Sci side, and #2 is about the optimization side. #3 combines both together for what I'd like to talk about.
1. Self-balancing trees (2-3 trees, Red-black Trees, and B-Trees) are about the self-balancing part. Not just the construction of a singular tree. You cannot recongfigure trees to rebuild themselves in Factorio, so the biggest feature is missing already.
2. From an optimization perspective: inserters are slower than belts. Even 4 inserters per belt only allows like 12-items per second, and blue-belts can push 45 items-per-second. You want to use splitters (which operate at full speed: 45 items per second) for the best belt-only design. (Bots obviously sort items fastest, but I am presuming this is some kind of belt-only challenge build).
3. The intersection of splitters + computer science is therefore: the Splitter (Factorio) and Benes Networks (creation of networks built off of only a 2-input to 2-output crossbar). If you really want to have a crazy good factory design, start studying this stuff: https://en.wikipedia.org/wiki/Clos_network (A Benes network is simply a Clos network of size 2-input and 2-outputs. Clos networks are of any size: like 5-to-7 and other such odd numbers)
--------
In Factorio, the meta you want to be searching for is "mixed belt" design, it seems.
Re: B-trees in Factorio
#8Earlier quoted context omitted.
How? They're not just trying to split an output into multiple lanes. The boxes represent the item stored in that "node" of the B-Tree (laid out here in 2D). I haven't had time to watch the video, but the prose & screenshots indicates there is associated logic on the inserters to maintain the "sorted" nature of the tree, by sending stuff down the appropriate path to child nodes. Given the OP's choice of values for key…
The fastest "filter inserter" in modern Factorio meta is the splitter, which operates at full speed of the belt. There's almost no reason to use inserters for belt-to-belt transfers for modern meta, aside from a few speed-running stats where you use red-inserters while skipping logistics2 or something. But if you're trying to sort items on a belt by placing them onto another belt, the answer is a splitter. Item A spl…
Re: B-trees in Factorio
#9Earlier quoted context omitted.
How? They're not just trying to split an output into multiple lanes. The boxes represent the item stored in that "node" of the B-Tree (laid out here in 2D). I haven't had time to watch the video, but the prose & screenshots indicates there is associated logic on the inserters to maintain the "sorted" nature of the tree, by sending stuff down the appropriate path to child nodes. Given the OP's choice of values for key…
The fastest "filter inserter" in modern Factorio meta is the splitter, which operates at full speed of the belt. There's almost no reason to use inserters for belt-to-belt transfers for modern meta, aside from a few speed-running stats where you use red-inserters while skipping logistics2 or something. But if you're trying to sort items on a belt by placing them onto another belt, the answer is a splitter. Item A spl…
This doesn't address the parent comment's concern:
> IIRC splitters only accept a single filter, and so you'd need many of them at each junction
I haven't played Factorio in years, but IIRC the splitter maintains state (direction for next item) per item type, so I guess it can be set up to filter as many types as you like? I remember you had to prime it for the desired item type, but I forgot the specifics of how it does the rest of the filtering "logic".
Re: B-trees in Factorio
#10An inefficient design, but computer-science theory in Factorio means playing suboptimally necessarily. (Factorio wasn't designed to show off B-Trees, all the tools were designed to ya know... play Factorio) ------------ So I have to comments. #1 is about the Comp-Sci side, and #2 is about the optimization side. #3 combines both together for what I'd like to talk about. 1. Self-balancing trees (2-3 trees, Red-black Tr…