CPA Prototype


#1

Ok here’s the beginning of a CPA prototype, The system is hugely complicated. You can have a look at the code in the prototypes repo. I’ve split it into two pieces, the first, cpa1, has all the actual cpa logic in it and the second, viewer1, is just a load of pygame stuff to plot the graphs and isn’t really required.

So far I’ve only done “a species is made of organelles and they can do processes, species live in patches and have permeable membranes” there are also bacteria that live in the patches that break down proteins and agents that spill into the water. As you can see the graphs are crazy complicated (and also hard to read because the colours are so similar - not sure what to do about that). I’m going to keep working on it. I want to get this part really well balanced and sort out issues of storage and permeability being related to population number (a more populous species has a larger surface area), I haven’t even done compounds locked or blueprints yet.

Then there’s predation and then all the auto evo and inter-patch stuff on top of that. It’s a super super complex system. It’s got kind of ridiculous (and may need stripping down a bit because balancing something this complicated is going to be hard, but not impossible).

The graphs show the amount of compounds in a species (in relative terms, unlabelled axis, I might sort that out later). Species “-1” is the amount of compounds floating around in the patch. You can actually see some nice dynamics in the video. So every cell has a nucleus and that makes protein so that usually spikes at the beginning. But then the cell runs out of glucose and so the protein enzymes start to break down the protein again.

Oh and if you are going to run this thing yourself you will need to increase the run_time parameter, these graphs are for run_time = 10000, I set it to 100 because that way it’s easy to run it to check it works. Longer run times require more computation.

Before anyone tries to build this for real we need to have an iron tight, totally 100% nailed down list of compounds and organelles. Don’t even try without that as it very quickly becomes a nightmare.


Future Release Plans
#2

Done a bit more work on this, definitely having problems.

So this is a graph of the population in a patch, it looks very nice, the population of each species grows until it is in equilibrium (birth rate = death rate).

But then you look at the compounds free of that species and it’s BELGIUM. Loads of them are negative? WTB

I’ll keep working on it. ha ha :smile:


#3

Nice. This is great work @tjwhale. If there is any way I can help out, please do ask. I have a question about the species, are you currently only looking at the compounds, or do you already have predator-prey relations? I though it was the latter, but the top graph threw me off a bit. Also, if you are doing predator-prey, shouldn’t it be more of a sinusoidal graph rather than logistic?

Again, this is really fantastic!


#4

I haven’t got to predator prey relationships yet. All that’s happening is the microbe is absorbing compounds form it’s environment, processing them, locking them away in it’s locked bin and then spilling them from there back into the environment. What should happen (I think) is that everything should settle into an equilibrium where the rates of these processes are balanced (like the species is growing as fast as it is dying so it’s population is stable etc).

I think I’ll try making a prototype with just one compound. I think that will make things easier, no processes. Just growth and death in a patch. I’ll let you know how that goes. Once that’s done it’ll be easier to see how to extend it to many compounds.

Thanks for the offer of help! I’ll let you know.


#5

The first rule of problem solving is “If you can’t solve the problem solve an easier one”. In light of that I wrote a quick program to do the CPA with just 1 compound. Here’s the results. You can see that the population stabilises to a constant where it’s absorbtion = it’s death rate. Next I’ll try adding predation.


#6

With predation it’s still shockingly stable. That’s kind of bizarre. I guess I was imagining there might be more limit cycles (where the populations fluctuated over time). Still pretty cool I guess, a good basis for building on. Code in the repo.

In this top image you can see the species that starts with the least compound locked (they all start with a random amount) just munches his way through the others and ends up on top.


#7

Bit of progress today. I managed to get the multi-compound sim to work. Which is nice. Bad news all the species just die out exponentially.

However if you artificially stabilise them with fat and protein (which currently are the only things they are made of) they do fine.


#8

If you can take a look at total compounds (locked + free), what’s happening? are compounds disappearing, effectively starving the ecosystem?

What list of processes are you using (if you aren’t already, I suggest this one)?


#9

Yes that’s a good idea. I’ll make some kind of accounting function which checks there isn’t a leak. I’ve been using my old compounds and processes list from the old forum.

I think we should bite the bullet and fix a final compounds and processes list. Is there any reason we can’t do this now? I think it will be important to actually balance the equations to avoid accountancy problems with creation or destruction of compounds.


CPA Master List
#10

The accounting is actually quite complicated. The reason being that because compounds are transformed it’s not trivial to work out if stuff is disappearing. The results are a little better though.

Huh you can ctrl v a screenshot straight into a post. That’s kind of cool.

Anyway I think I want to start again with a proper compounds and processes list. It gets complicated really fast. It needs more accounting built in. I’ll make a new thread.


#11

That’s the logic that led me to produce the list I linked :stuck_out_tongue:. In these equations I made sure to keep carbon balanced, ignored the production and incorporation of water since the amount of water turned over through chemical reactions is always very small compared to the amount of water a cell requires for all sorts of other reasons (ie, a scenario where water is a limiting factor in a reaction is a scenario where the cell has a whole lot of other problems), and used ATP not so much as a chemical compound, but as a unit of energy accounting, to quantify the number of ATP-equivalent units of energy usably produced, or required, by each reaction.

So, for example, you will note that the fat reactions don’t preserve pyruvate, but that’s ok since carbon is preserved, and excluding photosynthesis, ATP is generally lost in reaction cycles, as it should be, since the Gibbs potentials are what drive these reactions in a certain direction in the first place.

How are you driving reaction rates? I imagine you are doing a simple rate law thing. This is a problem with the current game too, since reaction rates in living cells are controlled heavily by gene expression, ligands, etc, and are thus not simply driven by the quantities of each reactant and product. The question is, how do we quantify those regulating factors?


#12

Stable populations whooop. This is with birth and death so they are able to absorb compounds from the environment, process them into protein and fat, make more of themselves with protein and fat and then have those members die (spilling the protein and fat back into the patch).


#13

This is what it looks like with bacteria processing spilled compounds !!! HYPE!


#14

It seems over a long time the populations become very stable. There is the initial transient period and then they stabilise so fixed values, just like in the one compound example.

I guess part of this is they just burned through all the Hydrogen Sulphide and then once that was gone they relied on photosynthesis alone.


#15

Ok so I put in an Ocean Stabilisation routine which basically sets an ocean wide value for a compound and over time moves the amount in the patch towards that value. For example it will mix sulphur made by the microbes away to nothing and replenish the hydrogen sulfide (assuming they live near an ocean vent). What this means is that if the microbes are net producers of something (like fat) then they can’t just build it up and sort of store it in the patch. Here are the results.


#16

That looks fantastic! Amazing job. I particularly love how it’s a periodic function. So population goes up and uses up all the compounds, and then everyone starts to die, releasing more compounds. Awesome.

If I may ask, are the reaction rate dependent on concentrations as you and moopli were talking about, or are they constant? Or have you not gotten to that point yet?


#17

Thanks. The reaction rates are based on the thresholds idea we were discussing. So if a compound is below it’s lower threshold the process that produces it will start going. If it’s above it’s high threshold any process that uses it as an input will start working and if it’s above it’s vent threshold then it gets vented. I made a typo, I typed a1 - b rather than a(1 - b) and I think it’s probably the best thing I’ve done on this project. If a compound is low then it will try to start the process that produces more but if the inputs to that process are also low that process will slow down. So if you’re low on everything the cell will do nothing rather than running all processes trying to correct all the deficiencies. It works beautifully and was a complete accident.

Code is in the repo if you want to have a look. The “step_function” function determines the response to being above or below the thresholds which is stored as compounds_free_action. Then “run_organelles” just searches for the largest of these.


#18

Nice. Now, if I were to implement this, how exactly does the interface work? I mean, what information do I need to supply (if any) to the CPA system and what data does it output? You mentioned that there are bacteria processing spilled compounds, are these just “internal” bacteria (a vague species being that process a certain amount of X into Y every second), or actual discrete entities?

The reason I’m asking is that I believe it was decided that the CPA system dictates how often we see each microbe and bacteria species. This, in turn, tells us what compound clouds are being produced and in what amount.

I understand if you’re not at this point yet—you’ve done a huge amount already—I was just curious.


#19

Interesting questions.

Basically the interface is all output. We’ll need a really clear way of representing what species are in your patch and how well they are doing relative to each other. This is a really good data visualisation challenge, you can see from the prototype there is so much information it’s easy for the graphs to be unreadable.

The input is choosing what organelles your species has in the editor. This is the only control you have over your species in the CPA system. The hope is the models will be good enough that you will choose what works for you swimming around and that will translate into doing well in CPA. I guess if the processes are the same in the CPA and swimming around then you should get a good feel for that part of it.

The bacteria were a cleanup mechanism, so if you spill protein they chew it up to prevent species living as scroungers. However that’s not really necessary anymore. The Ocean Stabilisation will handle that just fine so actually bacteria probably need a rethink. They could just live alongside you in your patch, they could have a specific role, we’ll have to think it through.


#20

Bacteria, in the game stage, are for more than just preventing things from accumulating in the environment – they add more stuff to interact with and swim between, what with the plans to have myriad types of large bacterial colonies that form particles you have to swim around, or webs of cyanobacteria-like filaments you can swim between.

Also, if you’re planning on keeping the ocean stabilization mechanism, how will we handle, say, mass oxygenation events, or other things where the biosphere should drastically change levels of some compound, when we’re putting our thumbs on the scales to artificially stabilize things? I don’t think we can keep the ocean stabilization as more than just a stopgap :confused: