It looks like you're new here. If you want to get involved, click one of these buttons!

- All Categories 2.2K
- Applied Category Theory Course 354
- Applied Category Theory Seminar 4
- Exercises 149
- Discussion Groups 49
- How to Use MathJax 15
- Chat 480
- Azimuth Code Project 108
- News and Information 145
- Azimuth Blog 149
- Azimuth Forum 29
- Azimuth Project 189
- - Strategy 108
- - Conventions and Policies 21
- - Questions 43
- Azimuth Wiki 711
- - Latest Changes 701
- - - Action 14
- - - Biodiversity 8
- - - Books 2
- - - Carbon 9
- - - Computational methods 38
- - - Climate 53
- - - Earth science 23
- - - Ecology 43
- - - Energy 29
- - - Experiments 30
- - - Geoengineering 0
- - - Mathematical methods 69
- - - Meta 9
- - - Methodology 16
- - - Natural resources 7
- - - Oceans 4
- - - Organizations 34
- - - People 6
- - - Publishing 4
- - - Reports 3
- - - Software 21
- - - Statistical methods 2
- - - Sustainability 4
- - - Things to do 2
- - - Visualisation 1
- General 39

Options

For several weeks now, I've been thinking about the video game Factorio as a kind of extended puzzle for many of the ideas presented in this course. I thought others might appreciate this puzzle too, so I wanted to share.

If you are unaware of the game, here's a brief summary. Factorio is an open-ended game where you build factories to harvest raw resources and convert them into a manufactured goods. You do this by building structures which convert some resources to other resources (at a certain rate). For example, a stone furnace smelts iron ore to iron plates (and requires coal for power). $$\mathrm{StoneFurnace}: \ \mathrm{IronOre} + \mathrm{Coal} \rightarrow \mathrm{IronPlate} $$ The wiki page has explanations for all game mechanics. You can probably already see the similarities to resources theories (Chapter 2) and codesign diagrams (Chapter 4).

Like real factories, we want to design efficient/effective factories that produce an end product at a given rate (or produce a given amount, etc.). A simple version of this question is this: how many factories do we need to make iron plates from iron ore and coal if we want to produce iron plates at a given rate \(r\)? As you can find here, the furnace makes 0.28 plates/sec so we would need \(n = \lceil \frac{r}{0.28} \rceil\) furnaces, and supply them with iron ore at a rate \(r\) and coal at a rate \(0.0225 n\) at least. This question is easy to answer with a single building, but gets harder as the factory gets more complicated. So the goal is to come up with a way to describe a factory using category theory, where

- objects are resources/reagents/ingredients: iron ore, plates, etc.
- morphisms are processes which convert resources/combinations of resources to other resources.

But with that category, we also want to be able to ultimately answer questions such as "How many furnaces do I need?", "At what rate do I need to produce a certain raw material to produce an end resource?"

I think there's several routes to an answer (as is often in science/math). Initially, I thought about this problem using feasibility relations (Chapter 4), but found it tricky to keep track of the resources. After reading Tai-Danae Bradley's booklet, I realized that the theme of functorial semantics is useful here. Instead of creating one category to capture both how recipes can be combined and the corresponding rates, we can split the problem into two slightly separate problems:

- Construct a category, call it \(\mathbf{Fact}\), which describes how recipes can be combined to produce bigger recipes.
- Construct a second category, call it \(\mathbf{Rate}\), which describes production, consumption, supply and demand rates for the resources and processes. And along with it, a functor \(F\) which maps recipe diagrams in \(\mathbf{Fact}\) to \(\mathbf{Rate}\) which tells us what the rates of production/consumption are.

Hopefully, this is enough info to get started. While I have some results for both problems, I'd rather not spoil the fun of discovering them for anyone else (at least until others have a chance to try it).

## Comments

Thanks for sharing

`Thanks for sharing`

I think you also want a sort of syntax category, where the morphisms are actual blueprints.

Composition gets a little funky because you need to specify the location and rotation of the second blueprint relative to the first, and because of how inserters and robots work, inputs and outputs are not necessarily on the border.

Though maybe we can get around that by requiring that the only way goods transfer from one generator to another is by being put/ taken from a shared rectangular overlap that can't have inserters?

There's some pretty interesting structure to the graph of basic recipes too.

Like the only reversible recipes are the barreling and unbarreling ones.

And if you remove those the only goods with more then one basic recipes are the three factions, and solid fuel.

Though heat and motive power (like for trains) are good-like and can be extracted from lots and lots of things.

`I think you also want a sort of syntax category, where the morphisms are actual blueprints. Composition gets a little funky because you need to specify the location and rotation of the second blueprint relative to the first, and because of how inserters and robots work, inputs and outputs are not necessarily on the border. Though maybe we can get around that by requiring that the only way goods transfer from one generator to another is by being put/ taken from a shared rectangular overlap that can't have inserters? There's some pretty interesting structure to the graph of basic recipes too. Like the only reversible recipes are the barreling and unbarreling ones. And if you remove those the only goods with more then one basic recipes are the three factions, and solid fuel. Though heat and motive power (like for trains) are good-like and can be extracted from lots and lots of things.`

It sounds like Petri Nets may be of interest to you. Read this: http://www.azimuthproject.org/azimuth/show/Petri+net

From https://ncatlab.org/nlab/show/Petri+net:

Also, if you're looking at analyzing production-consumption rates, this is useful: http://doomeer.com/factorio

Source code: https://github.com/doomeer/factorio

`It sounds like Petri Nets may be of interest to you. Read this: http://www.azimuthproject.org/azimuth/show/Petri+net From https://ncatlab.org/nlab/show/Petri+net: > The idea of a simple Petri net is based on a simple manufacturing shop. You have various ‘transitions’ or manufacturing ‘events’ that form part of the various process occurring in the ‘shop’. These typically take parts (of the final object), do something to them, such as combining two or more different parts to make a more complicated one, (for instance, putting the wheels on a car). Also, if you're looking at analyzing production-consumption rates, this is useful: http://doomeer.com/factorio Source code: https://github.com/doomeer/factorio`