Author Topic: Metabolism v.1.0  (Read 6033 times)

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Metabolism v.1.0
« on: March 22, 2005, 10:37:19 PM »
OK, here is the description of first metabolism.
The goal of this post is not to iron out all the bugs, but to show you a system that is:
a) related to real chemistry and biology
B) backwards-compatible, allowing old bots to survive without too many changes
c) open-ended, allowing unlimited expansion (within reasonable limits)

So, let's start:

Look at the picture of catabolism.   You see different compounds linked by arrows.  Arrows are color-coded: green means ATP is produced, red means ATP is used up, black means no ATP is involved.  On this page high-energy compounds are destroyed to produce energy, untill all is left is CO2, NH4 and H2O (I don't keep track of H2O, it would be silly).  Each reaction is performed by its own enzyme.  For now we assume that bot has all enzymes necessary and they all work with equal efficiency.  Still, you say, how can an old bot use all that?  Well, destruction of any compound on this page can be activated by "break" command.  Just like this:

glucose
break

And old bots can just have a gene that constantly activates a bunch of such break commands.

This command will activate all enzymes that connect the compound in question (glucose) and final products of degradation (CO2) (in this case three enzymes are activated).  

Imagine that a bot just ate (and absorbed) a bunch of glucose.  Here is what happens next:

First cycle:  All enzymes in glucose-breaking pathway are activated.  They perform their actions simultaneously.  The last two enzymes don't do anything, because there is no substrate available.  The glucose-breaking enzyme takes a pre-determined amount of glucose (say 5) and converts it into 10 pyruvates, releasing 40 energy.  The pyruvates are not immediately converted to AcCoA, they just stay there till next cycle.  Total energy gain: 40.

Second cycle: 5 molecules of glucose are split again to get 10 pyruvates (releasing 40 energy) and the previous 10 pyruvates are converted into 10 AcCoA, releasing 60 energy.  Total energy gain in this cycle is 100.

Third cycle: 5 glucoses are converted to pyruvate (+40 energy), 10 pyruvates are converted to AcCoA (+60 energy) and 10 AcCoA are converted to CO2 (+ 120 energy).  Total energy gain in this cycle is 220.

After that the bot will receive 220 energy every cycle until all glucose is exosted.
All this is done with just one command: "glucose break".  So I hope I convinced you that digesting stuff will be very easy and straightforward.  Now, a smart bot might improve on this strategy in a number of ways, but we'll get to that later.

With me so far?

Now let's turn to anabolism.  All these reactions are performed by enzymes that are activated by make command.  It works just like break command in the sense that it activates all enzymes connecting the molecule in question and the most basic compound.  You were expecting CO2, wern't you?  Well, only plants can reduce CO2 to anything useful, so that reaction is hooked up to photosynthesis (we'll talk about it in a bit).

Another thing that is worth mentioning about anabolism is the huge arrow from am.acid to protein.  It takes 1200 energy to create a protein!  We need a system that would provide quite an advantage to protein-making bots...

We are getting close to the end.  Another graph that I want you to look at is this one.  It summarizes both catabolism and anabolism in one scheme.  Numbers next to arrows indicate how much ATP is produced or taken up.  Also here I added photosynthesis.

Now, photosynthesis does not actually involve creation of new molecules.  It is a series of proteins that transfer electrons to each other, generating H+ potential on a membrane.  That potential can be used two ways - directly to generate energy or to reduce CO2 and form carbohydrates (glucose).  To keep things simple we'll pretend that some molecules are being made during photosynthesis and that these reactions generate energy.  Notice that only the last step produces energy.  This is made so that only bots that have all of the photosynthetic enzymes are able to use light to generate energy.  In addition, photosynthesis is not regulated by break/make commands - it happens automatically (not to say that it cannot be regulated).

Fun fact: Some of you may have noticed on this last graph a cycle of "glucose-pyruvate-AcCoA-succinate-glucose", which seems to be generating energy for free.  Well, it is not.  At the end of this post I'll put all the stochiometry of reactions and those of you who are bright enough may figure out how this works...

OK, I hope I have shown you the biological relevance, ease of use and backward-compatability.  What about open-endedness?  Well, it is very easy to add reactions to this system.  For example we'll add something like "silicon -> silicon shell".  Just another two molecules and one more enzyme.  But it is even better - we can insert new reactions between existing ones!  Beacuse make/break system activates all intermediate enzymes, it will activate the new one as well (as long as bot has the enzyme).

The final part is about regulation:

Regulation is the bread and butter of metabolism.  Luckily, make/break system does not allow futile cycles (cycles where a molecule is made and broken down simultaneously is called futile, because it does not result in any molecule being created and just wastes energy).  But we need more.  And hopefully several different approaches, so that bots can mix and match.  Here are some of my ideas:

1. Consecutive break and make command over-write each other.  So if bot says

glucose make
glucose break

then the final result is the breaking.  We can also have "keep" command (from keep constant).  The command would cancel activations of all enzymes leading to formation or degradation of a molecule.

2. Making more enzyme increases the throughput of reactions.  I am not sure how to the enzymes are going to be created.  One possibility is to allow enzyme creation from DNA (mkenzyme command or something).  Another is to have counters of how often the existing enzyme is not enough to process all of available substrate and increase the amount automatically when the counter reaches 10.

3. Efficiency of enzymes (terminal three-bit idea from Nums).  The efficiency may be coded in the terminal three bits of enzyme activation system.

4. Bundling enzymes in complexes should increase efficiency and may allow passage of several steps in a single cycle.

5. Some enzymes may remain active for several consecutive cycles (could also be coded in terminal bits).

Well, this is it.  Thank you VERY MUCH for reading the whole post!  I am sure there will be tons of suggestions, questions and comments.  They are certainly welcome!

P.S:  Here are the promised stochiometries of reactions:

Catabolism:
CARBS
Glycogen = 15 glucose
starch = 8 glucose
glucose = 2 pyruvate + 8 ATP
pyruvate + 1.5 O2 = AcCoA + CO2 + 6 ATP
AcCoA + 2 O2 = 2 CO2 +12 ATP

FAT
fat + ATP = fatCoA
fatCoA +7 O2=8 AcCoA + 35 ATP

PROTEIN
protein = 8 am.acids
am.acid = pyruvate + NH4

Final summary of how much energy you get from each type of food:
1 fat = -1+35+8x12=130
1 protein = 8x6+8x12-4x3=116
1 carb = 8x36=288

Anabolism:

CARBS
2 pyruvate + 12 ATP = glucose
2 AcCoA = succinate + 3ATP  
2 succinate + 4 ATP = glucose + 2 CO2

FAT
8 AcCoA + 49 ATP = fat

PROTEIN
8 am.acid + 1200 ATP = protein
am.acid = pyruvate + NH4
NH4 + pyruvate + 3 ATP = am.acid
N2 + 16 ATP = 2 NH4

Photosynthesis:

12 H + 6 CO2 = glucose + 6 02
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Metabolism v.1.0
« Reply #1 on: March 23, 2005, 11:40:01 AM »
Good stuff.  Here are my comments:

Great graphs.  Did you make them yourself?

1.  When you say glucose break, how much glucose is broken down?  If I can break down 10 glucose, but I only want to do 5, how do I do that? There should be an extra command available to limit the number of the next make or break command.

2.  We can have things like 10 .strbody store be a shortcut to fat make, or something like that, so no conversion of old bots at all has to be done.

3.  I'm all for having related activation sites/enzymes on the same enzyme/complex be more efficient, but I'm entirely against having the pathways of the enzymes knowable from within the DNA.  The DNA just knows the direction it wants to head in.

4.  Protein should be hard to make.  Then it should be transferable from bot to bot via feeding.  That is, plants probably spend alot of energy making proteins (except the carniverous ones of course :P) then animals feed on plants to pick up the proteins.  Unfortunately, it takes alot of plant material to get alot of protein.  So herbivores spend alot of time doing nothing but feeding.   :D

5.  I have some comments on photosynthesis but I'm going to wait until I do some research so I odn't make a fool of myself.

6.  I think enzymes will be made automatically as demand arises.  The exact process is still something of a mystery, since if demand only spikes on rare occassion, you're probably all right just keeping food in the stomach for a few extra turns.

But the DNA can encourage or discourage enzyme production.

7.  Conflicting commands here remind of of the problems synchronous DNA has.  Check out the synchronous DNA thread where I considered possible solutions.

I think that's it.
« Last Edit: March 23, 2005, 11:40:49 AM by Numsgil »

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Metabolism v.1.0
« Reply #2 on: March 23, 2005, 12:55:56 PM »
0.  Yes, these are 100% my graphs :)  It's very easy to make them with Powerpoint.

1.  You break as much as you can.  By default only some small amount is broken down.  But you can increase it through regulation, such as through making more enzyme.  These changes should be relatively long-term.  So a sudden spike of glucose should not lead to increased amounts of enzyme.  Long-term abundance of glucose should.  And it should be automatic.  This actually raises interesting point that I did not have time to discuss: the best enzyme is not always an enzyme that does a lot of work quickly.  The best enzyme is an enzyme that best suits your needs.  So evolution may adjust "efficiency" of enzymes in both directions.

2. Yes, me and PY discussed something like that.  I just was not 100% sure if it was possible.

3. Not sure what you mean.  That only end-products can be addressed from DNA?  Then why have intermediate ones?  Say I am a plant and I want to efficiently convert excess of glucose to fat without affecting my immediate energy supply, wthout wasitng energy and without breaking AcCoA to CO2.  I am a very advanced bot and I I can say:

glucose break
fat make
AcCoA keep

this will convert glucose to AcCoA and AcCoA to fat without AcCoA being converted to CO2 or any funny stuff going on.

4. Proteins are very specific to their organisms.  When we eat protein, we break it down into basic components - aminoacid.  The huge amount of energy we spend is to arrange these aminoacids in a particular order, that is specific to our species.  So when proteins are digested all that invested energy is lost.

6. Look at #1.

7. Yeah, this is all open to discussion.  I am inclined to have simple "over-write" approach in this case.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Metabolism v.1.0
« Reply #3 on: March 23, 2005, 01:26:22 PM »
1.  There should be a difference between how much you can make or break, and what you want to make or break.  Olympic sprinters don't sprint everywhere.  They can walk.

Something like:

20 SetQTY
glucose make

would work I think.  If setQty is larger than throughput of the enzymes, it just does as much as it can.  Again the keyword should be something better.

3.  Pretend you have two paths:  A->B->C->D and A->E->D.  If you have A break then which path is chosen?  It should not be directly controllable from within the DNA since the DNA doesn't know how the enzymes are working.

I don't think we have this problem yet, but that's not to say we won't or can't have this problem pop up.

An easy way would be to have:
minAcCoA favor
A break

Then A will favor whichever reaction has the lowest AcCoA cost (or which one gives the most).  This allows the DNA to control the enzyme's path without knowing how the enzymes are doing what they do.

Why is this important?  Imagine you have a right hand and a left hand (a bit of a stretch, but bear with me).

In one instance, the left hand takes what the right hand gives and makes it into a final product.  The left foot also learns to make what the right hand makes.  The right hand is cut off.  The left hand still has a potential source in the left foot, but it has to relearn where to find it's raw materials.

Now imagine that the right hand places what it makes into a bowl, and the left hand picks up raw materials from the bowl.  Imagine that whenever anyone makes anything, it is automatically placed in the bowl.

Now, in the same thought experiment, the left foot figures out how to make what the right hand used to, and the right hand is cut off.  The lefthand doesn't have to relearn where to look for the stuff the right hand used to make because it never was aware where the stuff in the bowl was coming from anyway.  It just knows to look in the bowl.

Basically this makes mutations more likely to do something worthwhile.  A small change in one thing won't necessarily mess up everyone else if another part learns the same job.

4. Okay, here's what I'm thinking then:

We have one kind of amino acid.  It's the basic building block of all proteins.  This is a bit simplified, but I don't think it's horribly so.

Muscle, shell, or any other proteins are built from amino acids.  In your anabolism graph, basically the amino acid->protein-> stuff cycle is turned into amino acid -> stuff.

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Metabolism v.1.0
« Reply #4 on: March 23, 2005, 03:11:09 PM »
1.  Setting a quantity would solve some problems, but create others.  The "make/break" commands activate all enzymes in pathway and they work if they have a substrate.  Substrate amounts may differ (simply because one glucose makes 2 pyruvates).  Are you going to set all enzymes to "20"?  Also, this means that any break/make command has to have setQty in front of it, which complicates the language.  What happens if setQty is not there?  Nothing?

3.  This sounds complicated and will require some tricky algorithms to figure out this minAcCoA function...  What if we just come up with some basic rules, like: 50% of A goes to B and 50% goes to E.  
Or: the amount of A is split based on ratio of B/E.  If there is too much B, it goes to E and vice versa.  
Or: the proportions are determined by efficiency of enzymes A>B and A>E.

Something automatic and simple.

4. We sure can.  It would be even more true to nature.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Metabolism v.1.0
« Reply #5 on: March 23, 2005, 03:27:13 PM »
1.  If no setqty is present than you can just default to the maximum amount.  No problem there.  setqty is an optional keyword that effects the next make or break command that follows.

All it basically says is that, this turn, don't do more than X.  If I have 10 setqty and A break, then this turn I will break 10 or less of A.  After that, it follows exactly how you describe, with all the enzymes working max.

It also occurs to me that you'll need a way to define a start and stop state.  I think you have that with 'keep' as a keyword.  You don't always want to go all the way.  Sometimes you want to stop off at a funny place.

3.  Indeed some tricky algorithms are needed.  But I'm willing to look them up.  This is actually a kind of problem that is common in computer science.  I've seen the code for it before.  It's a min flow/max flow problem.

Standard stuff.

New Stuff
8.  Okay, I'm still working through the science of your system.  I did notice that you skip straight from Acetyl CoA to nrg.  In reality it is a large multi step process called the Krebs cycle.  Aren't we going to model it?  I don't see a problem in doing so.

More to follow as I work through my bio book.  :D
« Last Edit: March 23, 2005, 03:27:26 PM by Numsgil »

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Metabolism v.1.0
« Reply #6 on: March 23, 2005, 03:51:39 PM »
1. OK, agree on that.

3. OK, if you say so.  You'll be the one to explain that system to every newbie that comes around :)

8. Most of reactions in my metabolism are abbreviations of multiple-step processes.  If we can work out a system with these, then inserting extra-steps can be done later.  As for Krebs cycle - it is very complicated and cannot be abbreviated easily.  But with all it's complications, all it really does is to convert AcCoA to CO2.  Really, not much more :)
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
Metabolism v.1.0
« Reply #7 on: March 23, 2005, 03:55:57 PM »
Nice ideas here. You guys are doing so well that I am going to keep out of it unless things start going in a direction that I really don't like.

I think we have the idea pretty much down. It's just the dynamics that need to be sorted out now.

This side of the programming is not my strongest point so I will leave it up to Nums and get back to my messing with evolution and graphics. I might even have a look at that pesky pop-up window at the start.

One point is that is there any real benefit to modeling the Kreb cycle in detail? The DNA doesn't really need to get involved with chemical reactions to that degree.

Anyway, provided that people don't need a degree to program a DarwinBot then it is fine with me. Just don't go getting too carried away.

 :D  PY  :D
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Metabolism v.1.0
« Reply #8 on: March 23, 2005, 04:01:16 PM »
8.  Obiously some steps are too complicated to model piece wise.  Making proteins are probably one such thing.  But glycolisis, etc. are set processes universal to all organisms that use them, so we should probably spend the time to model them as accurately as we can.

edit: basically, the krebs cycle wasn't pooped out whole.  It was built piece by piece, with most of those pieces forming nrg along the way, encouraging evolution to keep plucking away at it.

I think it would be cool to see organisms evolve slowly, figuring out the Krebs cycle.  I think the details should and must be hidden from the DNA's point of view.  Still just a A-CoA break command that ends at however far the reaction got.  Then the bot spits out the byproduct it doesn't know what to do with, encouraging other bots to learn to tap this abundant energy source.

9.  I was looking up things un enzyme regulation, and came across allosteric regulation, which appears to be a primitive method.  Maybe we can model something like this, although I'm not entirely sure how.

edit: here's a wiki on it.
« Last Edit: March 23, 2005, 04:08:42 PM by Numsgil »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Metabolism v.1.0
« Reply #9 on: March 23, 2005, 04:07:33 PM »
Quote
3. OK, if you say so. You'll be the one to explain that system to every newbie that comes around

Yea , in the end , post it in the final virsion thread , great idea shvartz...

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Metabolism v.1.0
« Reply #10 on: March 23, 2005, 04:22:47 PM »
8.  It would be VERY easy for me to include all glycolisis steps.  Question is whether we actually want it.  Let's make a poll to find out.  One diffuclty that I see is that since glycolisis will consist of multiple steps, it will require multiple enzymes.  Therefore it will be more costly to keep glycolisis - we shift the balance to other pathways.  The level of detail and complexity should increase proportionally in all pathways.  

9.  Certainly can be one of ways to do that.  Among others.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Metabolism v.1.0
« Reply #11 on: March 23, 2005, 04:26:02 PM »
We need a better word than A-CoA for acetyl coenzyme A.  I vote CoASH, since that's another way to write CoA, it sounds cool, is actually pronouncable, and 0easy to remember.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Metabolism v.1.0
« Reply #12 on: March 23, 2005, 04:33:16 PM »
8.

I'd vote to make the pathways as realistic as possible.  Organisms should favor whichever pathways give the most nrg.  If we do it right, we should see a very realistic evolution of organisms into the groups they're in now.

If we keep the details entirely hidden from the DNA, no one has to know how complex all this stuff is.  The enzymes will deal with it all automatically, allowing complex evolution without making it hard on the DNA programmers.

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Metabolism v.1.0
« Reply #13 on: March 23, 2005, 05:03:41 PM »
CoASH - it is actually not accurate.  Look at structures more.  Coenzyme A is CoA-SH, then it joins to acetyl and becomes CoA-S-Ac.  Wanna call it CoASAC?  I don't really care....

8.  As realistic as possible...  What a concept....  This will need a whole new sim program, cause those are crazily complicated.  I don't have enough competence to design stuff like this - it would involve chemistry, physics, advanced biochemisty, etc..  We need to chose a level at which we stop.

BTW, when you are coding the metabolism, you should make it possible to run metabolism simulations separately from the complete sim.  Basically like having an indivdual bot under a microscope with a command line.  You say "give 20 glucose" and watch the bot to go through hooplas with it.  It will achieve at least two goals:
1. debugging metabolism will be much easier
2. understanding metabolism will be much easier
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Metabolism v.1.0
« Reply #14 on: March 23, 2005, 05:07:56 PM »
Quote
CoASH - it is actually not accurate.  Look at structures more.  Coenzyme A is CoA-SH, then it joins to acetyl and becomes CoA-S-Ac.  Wanna call it CoASAC?  I don't really care....

I no CoASH isn't entirely acurate, since it doesn't involve the acteyl group, but I don't think we have another instance of Coenzyme A except as A-CoA, so why not call it CoASH?

Quote
8.  As realistic as possible...  What a concept....  This will need a whole new sim program, cause those are crazily complicated.  I don't have enough competence to design stuff like this - it would involve chemistry, physics, advanced biochemisty, etc..  We need to chose a level at which we stop.

I just mean we have all the steps of the chemical reactions.  Basically just increasing the resoltuon of what you already have.  I think there are like 9 reactions in the Krebs Cycle.  We wouldn't need to go more in depth than that.

I don't imagine doing anything more than a freshman biologist would understand.

Quote
It will achieve at least two goals:
1. debugging metabolism will be much easier
2. understanding metabolism will be much easier

Great Idea, I love it.
« Last Edit: March 23, 2005, 05:08:43 PM by Numsgil »