Thrive Game Development
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Thrive Game Development

Development of the evolution game Thrive.
 
HomeHome  PortalPortal  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  
Welcome new and returning members!
If you're new, read around a bit before you post: the odds are we've already covered your suggestion.
If you want to join the development team, sign up and tell us why.
ADMIN is pleased to note that this marquee has finally been updated.
ADMIN reminds you that the Devblog is REQUIRED reading.
Currently: The Microbe Stage GUI is under heavy development
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Quick Links
Website
/r/thrive
GitHub
FAQs
Wiki
New Posts
Search
 
 

Display results as :
 
Rechercher Advanced Search
Statistics
We have 1675 registered users
The newest registered user is dejo123

Our users have posted a total of 30851 messages in 1411 subjects
Who is online?
In total there are 4 users online :: 0 Registered, 0 Hidden and 4 Guests

None

Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm
Latest topics
» THIS FORUM IS NOW OBSOLETE
population - Population dynamics Emptyby NickTheNick Sat Sep 26, 2015 10:26 pm

» To all the people who come here looking for thrive.
population - Population dynamics Emptyby NickTheNick Sat Sep 26, 2015 10:22 pm

» Build Error Code::Blocks / CMake
population - Population dynamics Emptyby crovea Tue Jul 28, 2015 5:28 pm

» Hello! I can translate in japanese
population - Population dynamics Emptyby tjwhale Thu Jul 02, 2015 7:23 pm

» On Leave (Offline thread)
population - Population dynamics Emptyby NickTheNick Wed Jul 01, 2015 12:20 am

» Devblog #14: A Brave New Forum
population - Population dynamics Emptyby NickTheNick Mon Jun 29, 2015 4:49 am

» Application for Programmer
population - Population dynamics Emptyby crovea Fri Jun 26, 2015 11:14 am

» Re-Reapplication
population - Population dynamics Emptyby The Creator Thu Jun 25, 2015 10:57 pm

» Application (programming)
population - Population dynamics Emptyby crovea Tue Jun 23, 2015 8:00 am

» Achieving Sapience
population - Population dynamics Emptyby MitochondriaBox Sun Jun 21, 2015 7:03 pm

» Microbe Stage GDD
population - Population dynamics Emptyby tjwhale Sat Jun 20, 2015 3:44 pm

» Application for Programmer/ Theorist
population - Population dynamics Emptyby tjwhale Wed Jun 17, 2015 9:56 am

» Application for a 3D Modeler.
population - Population dynamics Emptyby Kaiju4u Wed Jun 10, 2015 11:16 am

» Presentation
population - Population dynamics Emptyby Othithu Tue Jun 02, 2015 10:38 am

» Application of Sorts
population - Population dynamics Emptyby crovea Sun May 31, 2015 5:06 pm

» want to contribute
population - Population dynamics Emptyby Renzope Sun May 31, 2015 12:58 pm

» Music List Thread (Post New Themes Here)
population - Population dynamics Emptyby Oliveriver Thu May 28, 2015 1:06 pm

» Application: English-Spanish translator
population - Population dynamics Emptyby Renzope Tue May 26, 2015 1:53 pm

» Want to be promoter or project manager
population - Population dynamics Emptyby TheBudderBros Sun May 24, 2015 9:00 pm

» A new round of Forum Revamps!
population - Population dynamics Emptyby Oliveriver Wed May 20, 2015 11:32 am


 

 Population dynamics

Go down 
+10
untrustedlife
hypoxanthine
scorpion268
Daniferrito
gdt1320
Rorsten594
The Uteen
~sciocont
Mysterious_Calligrapher
Seregon
14 posters
Go to page : 1, 2, 3, 4  Next
AuthorMessage
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Population dynamics   population - Population dynamics EmptyWed Sep 05, 2012 6:21 pm

In this thread I've been explaining how the compound system will work (summarized here). I'm now going to take one step back and explain how the compound system fits into the simulation of a community of species which inhabit a biome.

Population Dynamics crash course
First though, I need to explain what I mean by population dynamics, as it's not something I expect many people will be familiar with. I'll try and give a crash course, but this sort of thing is taught in the final year of an ecology degree, if at all, so it's fairly advanced. The maths I'll use isn't quite as advanced, and you should have encountered most of it by the end of high school if you didn't drop maths. Note that units are very important in population dynamics, so I'll be paying a lot of attention to them. I'll give more reasons why when it's appropriate, but for now it's enough to say that the overall value for the rate of change of a population must be measured in individuals per unit time. I'm going to use years as the unit of time for now, but these equations can ussually be scaled to any time-scale easily enough.

The population dynamics of a particular species summarises all the influences on that species population level into a single rate of change, and we use this rate to calculate how that population changes at each point in time.

Exponential growth
At its most simple a population is influences by just two factors: birth and death. Birth (b) is measured in individuals per individual per year, that is, the number of babies each individual is expected to give birth to annually, its effective unit then is 'per year', or year^-1. Death (d) can also be measured in individuals per individual per year, which represents an individuals average yearly chance of dying (effective unit: year^-1).

Now we combine these rates. Our population at time t is x(t) (unit: individuals), and our rate of change is dx/dt (individuals per year). Our first equation is:

dx/dt = b x - d x
dx/dt = (b - d) x
rate of change = births per year - deaths per year

This is an ordinary differential equation (ODE), which describes the rate of change of a variable according to its current state. In effect, the rate of change of a population can be written as a function of the current popoulation and the current time, where birth and death are constant parameters. Note that in our equation we don't use the current time, this is something we'll introduce much later.

dx/dt = f(x,t)

We can integrate this function to find the population at any time t. Given a starting population of x(0)=1 at time t=0, we can calculate:

x(t) = t0 exp(t (b - d))

I'm not going to explain how you integrate an ODE, becuase doing so very quickly becomes impossible as the equation becomes more detailed, so that in reality you almost never actually do an integration (and we certainly won't be able to in Thrive).

Instead what we do is simulate the progress of the ODE, or system. This means that you iteratively calculate the population x(t+1) at a future time, based on the population at the current time x(t), until you get to the time your interested in. The most basic method of doing this is the Euler method:

x(t+1) = x(t) + f(x(t),t)
x(t+1) = x(t) + (b - d) x

What we can see from this last equation is that the population will increase or decrease depending on the ratio of births to deaths. If birth rate is higher than death rate, population will increase, if lower, population will decrease. What perhaps isn't so obvious is how the population will increase or decrease. Becuase the rate of change is multiplied by the current population, the rate of change will be higher if the population is higher, so that growth becomes exponential (as hinted by the equation for x(t)), growing ever faster all the way to infinity:

population - Population dynamics Exponential_growth

Similairly, if death rate is higher, the population will decrease, ever more slowly, until it goes extinct (x=0):

population - Population dynamics Exponential_decline

As can be seen in the above equations, birth rate and death rate combine to define the population growth rate (r, unit: individuals per individual per year, effectively: year^-1) in a very simple way:

r = b - d

We'll use this simplification below.

Carrying capacity
In reality, populations don't grow to infinity. That's becuase theres never enough resources to support an infinite population, in effect every population is limited to a particular carrying capacity (K, unit: individuals) within its environment. That is, the maximum number of that individuals which can be sustained indefinately. If the population rises above this capacity (which is possible), it will eventually fall again as individuals starve due to a lack of food or other resources. The equation for this is:

dx/dt = r x (1 - (x / K))

The first part of this equation (r x) is equivelant to our previous system (r = b - d; r x = (b - d) x), the second part (1 - (x / K)) is new. To see how it behaves it's easiest to calculate the value of dx/dt (= f(x,t)) for a few values of x, we'll assume for now that K = 1:

x = 0:
dx/dt = r 0 (1 - (0/K)) = 0
Theres no population to grow, so the population stays steady at 0.

x = 0.1:
dx/dt = r 0.1 (1 - (0.1/K)) = 0.1 r - 0.1^2 r = 0.1r - 0.01r = 0.09r
So long as r > 1 (equivelant to: b > d) the population will grow, albeit fairly slowly.

x = 0.5:
dx/dt = r 0.5 (1 - (0.5/K)) = 0.5 r - 0.5^2 r = 0.5r - 0.25r = 0.25r
This is actually the fastest rate at which the population can grow or decline (except when the population is far above the carrying capacity, which rarely happens in reality).

x = 1:
dx/dt = r 1 (1 - (1/K)) = 1 r - 1^2 r = 1r - 1r = 0
The population is at the carrying capacity, and will not grow any further.

x = 1.5:
dx/dt = r 1.5 (1 - (1.5/K)) = 1.5 r - 1.5^2 r = 1.5r - 2.25r = -0.75r
The population is above the carrying capacity, and will fall until it reaches that carrying capacity.

population - Population dynamics Carrying_capacity

Now, it's also possible to see a few flaws with this model. For example, at x = K, f(x,t) = 0, no matter the value of r. In effect a population at it's carrying capacity cannot change, even if its death rate is far higher than its birth rate. This is becuase the model represents an over-simplification of reality. However, the model is still useful, and provides a few good insights:

r- vs. K- selection
r-selected species are those which have a very high reproductive rate, but relatively short lifespans. They are able to quickly increase their population, especially after a disaster or other event destroys part of it. Conversely, they tend to die off quickly as well, so that when resources are scarce, their population will quickly fall to a lower level. In a chaotic environment, their population levels tend to continually rise and fall, without ever really stabilising. They tend to produce huge numbers of offspring, but make little to no investment in their survival (e.g.: small eggs with very little energy reserves, no parenting), which therefore have a very low survival probability. Effective reproduction relies on the sheer number of offspring produced, not their quality.

K-selected species are those which have relatively long lifespans, generally with a relatively large body size, and a relatively lower reproductive rate. Their populations are very resilient to change, and tend to react very slowly. This means that when disaster wipes out part of the population, it can take a very long time to recover. However, it also means they can smooth over the oscillations of a chaotic environment, holding their population relatively steady, without booming or busting as much as an r-selected species. They tend to produce a relatively small number of offspring, but invest significant effort in their survival (e.g.: eggs with large energy supplies, or in the extreme case of mammals and sharks the offspring are actually carried within the parent until they 'hatch', extended parenting), so that each offspring has a much higher chance of survival. Effective reproduction relies on the quality of offspring, and each one is fairly precious.

Equilibria and stability
This model has two equilibrium points, extinction (x* = 0), and population saturation (x* = K), x* represents an equilibrium value of x. This means that for most parameters values (exception: r = 0), the population will approach one or other of these equilibria depending on the parameters, and initial conditions (x(0)), as time increases to infinity. Equilibria can be described as either stable or unstable (or occasionally semi-stable, or even neutral, but that's for a later lesson).

Crudely, stability is defined as: if, when simulated in forward time, a point near x* remains near x*, or converges to x*, then x* is considered stable, (also called an attractor). If the point diverges from x*, x* is considered unstable (also called a reppeller). Note that in more complex systems the point can travel a very long way away from x* before returning and eventually converging, but for most of the examples we'll use it'll be fairly obvious whether an equilibrium is stable or not.

If r > 1, extinction (x*=0) is unstable, and population saturation (x*=K), is stable. If you start with 0 population (x = 0 = x*), then you will always have 0 population, however, if you have even the tiniest fraction more than 0 (e.g.: x = 0.000001 > x*), then x will diverge from x*, the population will grow up to the carrying capacity, and therefore extinction is unstable. Similairly for population saturation (x*=K), an initial condition of x(0) = K = x* will neither grow nor decline, but any other value of x (> 0) will eventually converge on x* = K, so that x* = K is a stable solution, which attracts nearby trajectories.

Summary
That's enough math for one day, hopefully most of it made some sense. If not, let me know and I'll try and improve my explanations, also let me know if I'm going too slow. If anyone is especially interested let me know and I can tell you a lot more, as well as recommending a few good books. This (population dynamics), along with the math involved (nonlinear dynamics), is what I do for a living (for minimum wage, mind you :roll:), it can be absolutely fascinating, is an incredible tool for understanding nature and the world around you, and, sooner or later, will cause a complete brain-meltdown...

It can also be nicely summarised by one of my favourite quotes: "all models are wrong, but some are useful" (George E. P. Box)

Next lesson: I'll introduce a second species, and look at how predator and prey interact with eachother.

edit: replaced the figures with some of my own, for a more consistent style.


Last edited by Seregon on Wed Sep 05, 2012 7:51 pm; edited 1 time in total
Back to top Go down
Mysterious_Calligrapher
Biome Team Lead
Mysterious_Calligrapher


Posts : 1034
Reputation : 26
Join date : 2010-11-26
Age : 32
Location : Earth, the solar system, the milky way...

population - Population dynamics Empty
PostSubject: Thank you   population - Population dynamics EmptyWed Sep 05, 2012 6:29 pm

I have been meaning to get around to giving the forum a proper explanation of this for some time.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyWed Sep 05, 2012 6:51 pm

Ah, good to know someone else knows what I'm talking about. It's hard to know at what point what I've learnt stopped being common (atleast to scientists/biologists/ecologists) knowledge, so I may be starting too simple. There's a lot more to cover though, and things will get a lot more interesting, so I'll try and explain everything as best I can.

If you spot any errors, or think I've missed something, feel free to correct me.
Back to top Go down
Mysterious_Calligrapher
Biome Team Lead
Mysterious_Calligrapher


Posts : 1034
Reputation : 26
Join date : 2010-11-26
Age : 32
Location : Earth, the solar system, the milky way...

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyWed Sep 05, 2012 10:48 pm

Seregon wrote:
Ah, good to know someone else knows what I'm talking about. It's hard to know at what point what I've learnt stopped being common (atleast to scientists/biologists/ecologists) knowledge, so I may be starting too simple. There's a lot more to cover though, and things will get a lot more interesting, so I'll try and explain everything as best I can.

If you spot any errors, or think I've missed something, feel free to correct me.

I promise to go through the math very soon. I posted a simpler version some time ago, concentrating on trying to find an arbitrary limit of resources to determine the carrying capacities. Of course, that thread probably got eaten.

Speaking of which, what are your thoughts on determining the carrying capacity? I know how to do the math, but what size population do you think is feasible, programming-wise, considering that the majority of your species will exist only as a population count that occasionally has beneficial mutations?
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyThu Sep 06, 2012 7:15 am

I actually didn't plan on using a carrying capacity (not directly anyway). Rather than cap the population with an arbitrary capacity, I think we can limit it by using its dependance on the resources it needs. So, if we have a sunlight intensity (the original resource for most biomes, as discussed elsewhere we could equally use heat or certain chemicals) of x / m2 / year, and plants can only effectively capture and use that sunlight at a certain rate, then combined with a density dependant death rate there is a maximum number of plants that area can support... in turn, those plants can only support so many consumers, which can only support so many predators.

I suspect that wasn't a very good explanation, but I intend to develop pretty much exactly that system in the next post on predator-prey interactions (with a few modifications beyond the classical Lotka-Volterra model), so hopefully all will become clear.

As you say, considering that most of the population is just a number, there isn't really a limit (programming wise) to what we can do, except trying to be realistic. I tried to come up with some rough numbers just now as estimates, but it depends on too many factors (resource availability, biodiversity, competition, creature size, trophic level, succession stage, and more...). I hope that we'll be able to develop an equation, based on what I'll be posting next, which factors in all of these, without us having to come up with too many arbitrary parameters values.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyThu Sep 06, 2012 9:24 pm

Excellent post. I've only just begun studying calculus, so I'm not yet able to fully look through the differentials, but I do have a general understanding of how differential equations work. The really important concepts there are the simplest ones: birth rate and death rate. Both of these are going to be partially set in the editor, then modified through the auto-evo process. The player/ computer will set in the behavior editor the general population survivorship curve curve for the species.
population - Population dynamics Survivorship%20curve%20for%20the%20Tyrannosaurus%20rex(600x664)(c)
Remember that we measure time in generations: each generation, the computer takes each species and adds a constant number of offspring for each fertile female (or the offspring-bearing caste). This gives the actual number born that generation. Let's call it B for Births.
Then, at the end of generation 1, the computer cuts down that number of surviving members of that generation in accordance with the height of the survivorship curve at the end of the first generation. If the curve is at 90 percent of the original height, it multiplies B by .9. This would model regular exponential growth, by adding a number of births each generation, modeling birthrate.

To model deathrate, we simply track each generation until the survivorship curve reaches 0% and make sure that, by the end of each generation, the number of organisms from that species in that generation is in line with what the survivorship curve shows.

I'm making a few assumptions here:
1) The lifespan of any organism cannot be under two generations: this is to ensure that there is still a percentage left by the end of one generation, and that the organism reaches sexual maturity at least by mid-lifespan (because they only technically reproduce their population at the generation mark, regardless of when the player might see more being born). This minimum lifespan goes well with our minimum size of 10 cm.
2) Mutations (of the chosen organism or any in its biome that affect it) can only have two effects:
-To increase/decrease the birthrate (multiply B by a positive number)
-To increase/decrease the deathrate (multiply the percent remaining after each generation by a positive number)

3) A population consists of all of the organisms from all living generations in one species.

Hopefully that all makes sense. The only mutation that doesn't have either of the two described effects would be a modification of the survivorship curve itself.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyFri Sep 07, 2012 6:29 am

Thanks. I basically agree that birth and death rates are the important part, and that they are whats evolved by auto-evo, but thats still a vast oversimplification of what we actually need to do (I'll be covering this in the next two lessons). As we've seen in the auto-evo discussion before, it's not enough to say 'species a reproduces faster', we need to know why (higher fertility, better survivability of offspring, more succesful feeding?).

Using the birth and death rate, and a survivorship curve, is a very good way of summarising a species population dynamics, it's just doesn't provide enough detail to get interesting auto-evo'd species. It's probably a good way to represent a players species fitness to them though.

I also largely agree with the use of generations, but more for use with auto-evo (for timing mutations) than reproduction. One of the nice things about ODE's is that we can simulate them over a period of time, and find out whats happening in that entire period, without too much calculation. i.e.: while we might only update population numbers every generation, the changes is the result of individuals born thoughout the whole generation. I'd also like to see different species able to reproduce at different times, but I suspect your definition of generation isn't as strict as mine, so that works anyway.

In effect what you say is correct, but I'm more interested in working out how particular mutations affect birth/death/survivorship, and how the traits which are mutated affect the population dynamics. More on that in a few lessons time.

Next lesson below, note that I wrote this last night, before reading scio's post above:

Predator prey models
Right, now that we've covered some very basic examples, lets look at something more interesting. Rather than looking at one population, what happens when two interact?
The classic example is the Lotka Volterra Model, which deals with a predator (e.g.: fox) and a prey (e.g.: rabbit) species.

The equations are:
dx/dt = (a * x * y) - (b * x)
dy/dt = (-c * x * y) + (d * y)

Where a, b, c, d are parameters, x is the predator population, and y the prey population. I've chosen to name the variables x and y, but I could equally call them x(1) and x(2), which I will be using in future, but not for this example.

Theres actually a lot going on here, so I'll break it down into pieces:
(a * x * y)
This represents the increase in predator population as a result of it predating the prey. (x * y) is the encounter rate between the species, i.e.: how many times (per year) you can expect two individuals to meet. 'a' is the efficiency with which these predations are converted into more predator population (units: new individuals per encounter (individuals sqr) per year, effectively 1 per individual year).

- (b * x)
Loss of predator population via mortality, 'b' here is equivelant to 'd' in the exponential model in the last post (units: individual per individual per year)

(-c * x * y)
The loss of prey population due to predation, 'c' is the number of prey individuals lost per predation (units: 1 per individual per year). For readability, I would ussually define the ratio between c and a, rather than indivually defining them. So, rather than saying c = 0.8 prey individual dies per predation (not every hunt is succesful), and a = 0.1 predator individual is born (it takes a lot of food to feed a new infant), I would say c = 0.8, and A = a/c = 0.125 = 1/8 predator individuals are born per prey individual killed (A units: individual per individual). The above equations would then be:
dx/dt = (A * c * x * y) - (b * x)
dy/dt = (-c * x * y) + (d * y)

+ (d * y)
Gain of prey individuals from reproduction. In this model we assume that the preys reproduction is exponential, with no limitations.

The result looks something like this:
population - Population dynamics Lotka_Volterra

Whats immediately obvious is that the populations fluctuate. They don't increase to infinity, or decrease to extinction (though with different parameters, either of those are also possible - if the predators over-hunt the prey goes extinct, then the predators have nothing to eat and also go extinct. If the predators aren't able to eat enough they go extinct, and the prey is able to increase exponentially). Instead, the populations enter a stable cycle: when there are lots of prey, the predators have lots of food so their population increases; this increased predator population depletes the prey population, which crashes; the predators then don't have enough food, so their population also crashes, at which point the prey population can increase again. This cycle is stable, and will carry on for all time (given the assumptions we've made). Interestingly, the results of this very simple model can be observed in actual data for many predator-prey species interactions in reality.

I'd also like to introduce another way to look at this data, a phase plot, which plots the trajectory of a model against its variables, rather than time. This lets you see the population level of one species for a given population of another. It also shows you how the trajectory either approaches a stable equilibrium point, or as in this case, a stable cycle (other possibilities, such as chaos, also exist) depending on the the model, its parameters, and your starting variables (initial value).

population - Population dynamics Lotka_Volterra_Phase

Here we can see that, as expected, the phase plot is a cycle. Note that the trajectory here moves clockwise, which can be made clearer by adding flow arrows to show in which direction the phase trajectory will move at any point in phase space, and how fast:

population - Population dynamics Lotka_Volterra_Phase_Quiver

From this we can also see that the trajectory flows much faster in the bottom and right of the plot, where the populations are decreasing, than in the top left, where they are increasing.

I've introduced these plots mainly out of interest, I'll be using them in future to illustrate more interesting points.

Three species interaction
The main problem with this two species model is that we don't know where the prey gets its energy from, so to expand on it we'll add a third population, the resource (e.g.: grass), as a food source for the prey. The equations are very similair to those above:

dx/dt = (a * x * y) - (b * x)
dy/dt = (-c * x * y) + (d * y * z)
dz/dt = (-e * y * z) + f - (g * z)

As before, we have predators (x) reproducing by predating on prey (y), and losing individuals to mortality. We have prey reproducing by consuming the resource (z), and losing individuals to mortality from predation. An finally, resources reproducing at a constant rate 'f' (individuals per year) due to the constant energy input from the sun, and losing population to consumption by prey. We no longer have the potential for infinite growth, as each species now ultimately depends on the constant energy available from the sun for its population, and this energy is effectively shared between the species according to the parameters used (i.e.: how efficiently each species gets and holds onto that energy).

population - Population dynamics Three_Species

We can see here that there are no longer any stable oscillations, but rather that ther trajectories follow a damped oscillation before stabilising. Not quite so interesting as the previous model, but we'll fix that next time. Note that here the prey population is higher than the resource population, this isn't so realistic for rabbits and grass, but if we were intead looking at squirrels and oak trees it'd be far more reasonable. The phase plot shows the same information, but illustrates the lessening cycles:

population - Population dynamics Three_Species_Phase

I've only plotted the trajectory in the predator and prey axes above. It is possible to plot in 3D with the resource, but this actually makes the graph less clear.

population - Population dynamics Three_Species_Phase_3D

Summary
This three species model is a *very* simple version of what I'm trying to develop for Thrive, but it includes a lot of important elements. The population of each species is now capped naturally (by the suns input energy), not by an arbitrary carrying capacity. Each consumer species is dependant on a lower trophic species for its energy, and suffers predation from higher trophic species. And most importantly, the stable population of each species is dependant on the values of the parameters which define how efficient each predation process is, and these parameters are what could effectively be evolved by auto-evo.

Now, the parameters we have now (a-f) are far too simple to be of any real use, it doesn't really mean anything if a fox becomes more efficient at hunting a rabbit, we need to know how (is it faster, sneakier, stronger, better camouflaged, more toxic...?), so there's still a lot more to build on top of this... all in good time.

Next lesson time I'll be looking at seasonal forcing, and what happens when sunlight is no longer constant (i.e.: stronger during the summer, weaker in the winter). I'm also going to be working on a *very* simple example of auto-evoing the parameters above to give you a better idea what I mean... no promises it'll work though.

Please let me know what you think of these... are they too long, too complicated, too slow? If you think anything needs a better explanation or more detail, please let me know. You've probably also noticed I did a lot less analysis of the examples this time, this is partially becuase as the models become more complex, the analysis becomes much harder to do, but also becuase I'm actually far more interested in developing the models than analysing them. I also didn't want to go too overboard on the graphs, even if they are relatively small files. If you want more analysis though, I'll happily add more.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyFri Sep 07, 2012 6:02 pm

You're doing brilliantly. These models are fascinating and you're explaining then extremely well.
as for our differences in generation:
The generation is simply a unit of time in which we allow evolution to occur. It doesn't mean that young are born only at the start of a generation, it just means that that's when we measure how many should have been born within that generation, whenever in actual time that they were born. We could have generations last an entire year on the planet, we could have them last a lunar cycle, etc. It's just an arbitrary unit of time that we give the computer to run through the Auto-evo process and decide who evolves what.

Remember that we add "mutations" to entire populations of a species when the species is chosen to evolve, so we're assuming every mutation was at some point beneficial, and spread to the entire population. We need to understand all of the effects of a mutation, both negative and positive.

I think, actually, that, since your population models are so intriguing, and seem to work so well, we can have it so mutations only directly affect the species mutated, and we don't have to estimate effects on other species arbitrarily, as I was planning to do.
So now, mutations can only increase the birthrate or decrease the deathrate of the chosen species, since a mutation spread to the entire species must be in some way beneficial.

Determining how they affect those two parameters is the hard part.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySat Sep 08, 2012 6:16 am

That's pretty much what I though you meant by generation, and actually works perfectly with what I had in mind. So, every generation, we update the population counts and run auto evo, based on information from the previous generation.

Using these models its actually very easy to see which mutations will be benificial, as well as by how much, so it should work very nicely for choosing benificial mutations and applying those (though there will be some randomness added). The models also *only* work with populations, they completely ignore the individual, which in our case is actually rather useful.

Actually, determining the effects on other species (within the same area/biome) is just as easy as determining the effects on the mutated species. However, as I remember the current auto-evo concept, species only react to mutations of other species in the previous time step, not the current one.

One thing I rather dislike about the models in the last post is how disconnected they are. Each species is affected only by its own parameters, whereas in reality they'd all be related. I think the easiest way I can explain the problem is that in the above model, energy isn't conserved. Taking just one interaction as an example:

dx/dt = b * x * y
dy/dt = -c * x * y

Which is the predation of y by x. If b is large and c is small, then we see a large rise in x's population for each y killed, whereas of b is smaller than c, we see a small rise in x's population for each y killed. The former is ok for something like a leafcutter ant predating a tree, the latter is more reasonable for most larger species (e,g,: for a lion, even a meal as large as a wildebeast will only partially feed a new cub). If we allow each species to evolve their parameter independantly, b will be maximized and c minimized, so that you get an unrealistically large increase in x for a very small decrease in y.

To make it more realistic, we have to make it a lot more complicated, by introducing a few new parameters:
s - the ratio of x's body size to y's body size (units: kg per kg, i.e.: none)
e - the efficiency with which x uses a kill (units: individual per individual, i.e.: none)
v - the proportion of hunts which are succesful (units: individual per hunt)
d - the proportion of encounters which lead to a hunt (units: hunts per encounter)

the equations now become:
dx/dt = ((e * v * d) / s) * x * y
dy/dt = -(v * d) * x * y

First, I should explain that this is still a simplification. 'v' encompasses many more parameters, such as relative speed, strength, stealth, toxicity etc. 'd' includes how sensitive creatures are, as well as how quietly they ussually move around, and perhaps how hungry they are. 'e' includes the proportion of y which can be digested by x, how effectively x defends its kill, how large a meal it can eat in one sitting, and how much of its own energy is used in feeding. 's' depends on a whole load of relatively obvious factors.

In effect, each of the above parameters is a compound parameter, itself depending on many more parameters. Both species have traits which affect all of these parameters. The prey species can, for example, evolve toxins to both reduce the success of hunts and make itself less digestable, reducing 'e', the predator can become more stealthy to increase 'v' and possible 'd'. Any changes to these traits will have effects on other areas of a species population dynamics, such as requiring more energy (or other resources), so every mutation has a trade off.

We've now also fixed the energy leak, though that's not immediately obvious. For a loss of 1 individual of y due to predation, x increases by 'e / s' individuals. 's' is easy to explain, as its the size ratio of of the two species, 'x' is 's' times bigger than 'y', so every individual of 'y' contains '1/s' times as much energy as an individual of 'x', so that the equations are ballanced in this sense. 'e' is actually an intentional leak (0 <= e <= 1), '1-e' of every kill is wasted, atleast by the predator, and lost, though we can add that waste into the environment for use by other species, such as detritivores.


... Now that I've written all that, I've forgotten what point I wanted to make with it. Something along the lines of the parameters for each species not being as nicely seperate as I showed above, but also that this doesn't actually matter, it's actually a good thing, as it makes the reactionary mutations we want in auto-evo automatic. If a predator increases its hunting effectiveness in one generation, the prey will be affected, and will be more likely to do something to reduce that hunting effectiveness in the next generation.

Finally, its not quite as clear cut as *only* being able to increase birth rate or decrease death rate, many mutations will change both, perhaps increasing birthrate and only slightly increasing deathrate. Looking back to the first post, remember that 'r = (b - d)', in effect, all mutations should increase r. This may also be a good point to say that r is one possible measure of fitness, something we've had a hard time calculating in the past, but may now be quite possible.

I've actually made some good progress writing a very naive auto-evo implementation using the three species model above. It's got a lot of flaws right now, but I know how to fix most of them, and will post some of the results, along with the next lesson, early next week.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySat Sep 08, 2012 11:10 am

This seems good, having 'r' be changed instead of b or d. The only problem i can see is r being an oversimplified measurement, since certain interactions only affect b or d directly: mating and fertility affect b, predation and affects d and so on.
With the extra variables you have, (s,e,v,d) we can start incorporating compounds. So for e, we take the masses of each tissue in the prey species and multiply it by the efficiency of the digestion of the predator for each tissue. Whatever mass isn't digested comes out as waste.
Back to top Go down
Mysterious_Calligrapher
Biome Team Lead
Mysterious_Calligrapher


Posts : 1034
Reputation : 26
Join date : 2010-11-26
Age : 32
Location : Earth, the solar system, the milky way...

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySun Sep 09, 2012 10:05 am

~sciocont wrote:
This seems good, having 'r' be changed instead of b or d. The only problem i can see is r being an oversimplified measurement, since certain interactions only affect b or d directly: mating and fertility affect b, predation and affects d and so on.
With the extra variables you have, (s,e,v,d) we can start incorporating compounds. So for e, we take the masses of each tissue in the prey species and multiply it by the efficiency of the digestion of the predator for each tissue. Whatever mass isn't digested comes out as waste.

Not all the tissues: most of the nutrition lies in the muscles, organs, and marrow, so cartilage and non-marrow bone is just extra mass to most predators.

In addition, I would think that some things (like suddenly being able to process a new resource) would be very easy with this model, because they'd increase the birthrate, just by taking the assumption that there was more total food available. And being able to outrun your predators decreases the deathrate. Very elegantly done, Seregon.

The second oscillating model <i>does</i> represent carrying capacity, it's just an adjustable one based on the total of the resources there are available at the time. Notice that when there is a situation in which a food web, not a food chain, is being taken into account, the variation decreases greatly, because if one population (we're going to say rabbits) decreases, foxes will prey more upon other species, such as squirrels and mice. This ties in with what I've been pushing since day one here: an increase in biodiversity is an increase in the stability of the whole ecosystem.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySun Sep 09, 2012 3:34 pm

If bone and cartilage cannot be digested by one creature, it may be by another. For instance, heyenas can digest bone. It just means that they can harvest some nutrients from bone, and in this model it simply means that their bone-digestion ability is somewhere beyond 0: maybe .6 or so (1.0 being completely digestible)
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySun Sep 09, 2012 7:14 pm

~sciocont wrote:
This seems good, having 'r' be changed instead of b or d. The only problem i can see is r being an oversimplified measurement, since certain interactions only affect b or d directly: mating and fertility affect b, predation and affects d and so on.

This is really a question of how much complexity we want to present to the player. Seperating the effects of a mutation into those on birth and death would be useful, all I meant to say is that a mutation is benificial if (and only if) it increases r.

~sciocont wrote:
With the extra variables you have, (s,e,v,d) we can start incorporating compounds. So for e, we take the masses of each tissue in the prey species and multiply it by the efficiency of the digestion of the predator for each tissue. Whatever mass isn't digested comes out as waste.

Mysterious_Calligrapher wrote:
In addition, I would think that some things (like suddenly being able to process a new resource) would be very easy with this model, because they'd increase the birthrate, just by taking the assumption that there was more total food available. And being able to outrun your predators decreases the deathrate. Very elegantly done, Seregon.

This is *exactly* where I was going with this, so nice work figuring that out. I had intended to spend a few more lessons building up to this, but I guess we can skip ahead a little. The basic idea is that every possible interaction between species can be described as a transaction of compounds, and that if we know a species' population/fitness is being limited by a lack of compound x, we can fairly easily find an interaction, and a relevant mutation, which can increase that supply.

Mysterious_Calligrapher wrote:
The second oscillating model <i>does</i> represent carrying capacity, it's just an adjustable one based on the total of the resources there are available at the time. Notice that when there is a situation in which a food web, not a food chain, is being taken into account, the variation decreases greatly, because if one population (we're going to say rabbits) decreases, foxes will prey more upon other species, such as squirrels and mice. This ties in with what I've been pushing since day one here: an increase in biodiversity is an increase in the stability of the whole ecosystem.

Your right, effectively the carrying capacity here is 'f', the amount of sunlight energy entering the system, it's just not as arbitrary as in the previous model. The second effect you mention is related to prey preference: when a predator has a choice of multiple prey, it will hunt whichever is most abundant/easiest to catch/provides the most food etc.

Regarding biodiversity -> stability, there is some evidence (which I now can't find) that suggests that complexity (which isn't biodiversity, but closely related) can actually decrease system stability. It does lead to increased resilience (the ecosystem is more easily able to adapt and recover after a disaster), but left to its own devices its more dynamic, and won't stay stationary for very long. There are a lot of arguments either way though, and conventional wisdom agrees with you, we'll just have to see what happens in our system.

~sciocont wrote:
If bone and cartilage cannot be digested by one creature, it may be by another. For instance, heyenas can digest bone. It just means that they can harvest some nutrients from bone, and in this model it simply means that their bone-digestion ability is somewhere beyond 0: maybe .6 or so (1.0 being completely digestible)

My suggested solution to this is that anything which can't be digested is put back into the environment. Bones would be left at the carcass and available to scavengers, fibre and connective tissue would pass through the gut and be left in the faeces. This distinction probably isn't worth making in code, all we need to know is that there is x amount of undigested bone in the environment, and y amount of partially digested connective tissue.

We could make this system a lot more complicated by protecting some parts of the body from being accessed by most creatures. An easy example is bone marrow, which is digestable to almost any creature, but accessible to very few. We would then need to keep track of the amount of free bone marrow, the amount of bone marrow contained within bones, and probably the amount of bones not containing bone marrow. Doing this may or may not be feasible, but would add several more possibilities for auto-evo to act upon.

That's all from me for tonight, thank you very much for the encouragement and discussion so far, and expect another lesson (though I'm not sure you two need one!) and that naive auto-evo prototype in the next day or two.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyMon Sep 10, 2012 5:44 pm

Your solution for non-digested material is what I was thinking of as well. This is why waste is so important.

I think differentiating between b and d is important in the mutation definition process. Pretty much all mutations are there to decrease d (stay alive). Only changes to the reproductive system should influence d directly. Since the d and b multipliers added by mutation multiply the values from the previous generation (values which have already been modified by environmental factors) we don't have the risk of generating increasingly higher values for them, as we would if b and d were based on some absolute scale.

I don't care to go all the way down into the bone marrow with this. What we've been discussing seems fine without introducing the restrictions on materials access. If we really need to do it, we should be able to implement it later. Let's just assume marrow is a part of the bone and thus can only be digested by those who can digest the bone in the first place.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyThu Oct 11, 2012 1:15 pm

I've left this topic for far longer than I meant to... I had promised another lesson, and a naive auto-evo prototype over a month ago, and they are finally included below. Partially I've been distracted with work, but also by trying to coordinate the programming effort, which has sapped some of my motivation for other aspects of Thrive. To make up for that, I'll be concetrating my effort on Thrive on the compound and population dynamics systems for the next few weeks, both of which I find far more enjoyable, so expect quite a few more posts here shortly.

From here on I'll be developing two things simultaneously. Firstly, I'll continue introducing and explaining population dynamics theory, as I have done in the previous two lessons. In part, this is becuase I think many of you will be interested, but understanding some of this will also greatly help you understand (and contribute to) how I'll be using this for auto-evo. Secondly, starting in this post, I will be developing and auto-evo implementation by applying this theory to what we know about how we want Thrive to work.

Seasonal Forcing
Continueing on from my previous lesson (about 7 posts above this one) we ended with a three species model, representing a resource, a consumer and a predator. This is starting to look a lot like an ecosystem (though as Calli pointed out this is a food chain, whereas we eventually want a food web, with multiple species at each trophic level) with multiple species interacting with eachother, all eventually dependent on the environment (sunlight intensity). In another lesson I will look at expanding the number of species and their relationships (predation, competition, symbioses etc.), although how we do that should actually be fairly easy to imagine from what you've seen already. For now though, we need to look at the other half of the ecosystem: the environment, which up till now has been static. (Note that what we've considered so far, the collection of all species within an ecosystem, is known as the 'community')

In reality the environment is dynamic, with constantly changing levels of sunlight, dissolved nutrients, temperature etc. Building on the three species model, to keep things simple, we have only one environmental variable: sunlight intensity. Me and Scio had a long discussion over PM last month about how to calculate sunlight intensity for different lattitudes, times of year, times of day etc, but for the purposes of this lesson we'll keep it really simple:

S(t) = (1 + sin(t * pi * 2))

where S(t) is sunlight intensity at time 't', where one year corresponds to a change in 't' of 1. Effecitvely, S(t) is smallest when 't' is near a whole number (t = 0, 1, 2. i.e.: the start or end of a year), and greatest in between (t = 0.5, 1.5, 2.5, i.e.: the middle of a year). The results aren't particularly realistic, in the middle of winter S(t) = 0, and in mid-summer S(t) = 2, but they'll do for now.

EDIT - I've just noticed I should've used cos for this, as here we have summer around 0.25 and winter around 0.75, with spring at 0 and autumn at 0.5. That's not very clear, but it works fine for the simulation so I won't change it now.

population - Population dynamics Forced_St

Plugging this in to our previous three species model, there's only a small change, highlighted below:

dx/dt = (a * x * y) - (b * x)
dy/dt = (-c * x * y) + (d * y * z)
dz/dt = (-e * y * z) + f * S(t) - (g * z)

where 'f' is now the efficiency with which species 'z' converts sunlight into new individuals. The units to this are a little nasty: Sunlight intnsity can be measured as energy per unit area, ussually megajoules per square meter. 'f' then has units: individuals per (megajoule per square meter) per year, or square meter individuals per megajoule year. That doesn't seem to make much sense, so here's an interpretation: 'f' must incorporate both the number of individuals born per sunlight recieved (individuals per megajoule per year), and the area in which those individuals are being borne: given that 'f' isn't density dependant, we'd expect many more cells born in 100m2 than in 1m2. 'f' can then be described as a compound variable: f = A * g, where A is the area of our ecosystem (the area over which sunlight is being captured), and g is the efficiency with which this sunlight is converted to new individuals (individuals per megajoule per year).

A note on notation
Remember from the first lesson that dx/dt is actually a function of x and t:

dx/dt = f(x,t)

where 't' the time at which we're calculating f, and it is this 't' that is used when calculating S(t). Additionally (I'm not sure if I've explained this before), it's worth mentioning that the 'X' in f(X,t) isn't just the population of species x, it's actually a vector containing the population of each species, such that the above equation becomes:

dx/dt = dX1/dt = f1(X,t) = (a * X1 * X2) - (b * X1)
dy/dt = dX2/dt = f2(X,t) = (c * X1 * X2) + (d * X2 * X3)
dz/dt = dX3/dt = f3(X,t) = (-e * X2 * X3) + f * S(t) - (g * X3)

The three functions (f1, f2, f3) can also be expressed as a single function:

dX/dt = G(X,t)

using matrix calculus rather than the scalar calculus above. That's not something I'm going to show below, and it's not really necessary. Whats important is that you understand that each population is part of a whole, and each equation has information about the whole community, not just its own population. I'll stick to the notation used previoulsy for readability, just remember the 'set' of equations we're developing can be expressed just as easily as a single equation.

Right... unintended detour over, what happens when we seasonally 'force' sunlight intensity? The three species model developed last time settled on a constant equilibrium state. We would expect that this model doesn't, as it's conditions are continually changing, so that the target equilibrium is also continually changing:

population - Population dynamics Three_Species_Forced

What we see is an initial period of stabilisation, as before, followed by a fixed oscillation. This oscillation is stable, and can be considered a cyclical equilibrium (technically a 'centre node' equilibrium, as opposed to the 'node' in the previous model).

population - Population dynamics Three_Species_Forced_Phase

What is interesting is just how chaotic the initial stabilisation period is. It looks rather unpredictable, with the prey population jumping from low oscillations to high oscillations. While the eventual stable oscillations are rather dull, this period of chaos before stabilisation could make things far more interesting. Importantly, this stabilisation process will happen any time the system is changed by an outside force, such as a disaster, or to a much lesser degree, a mutation.

Density dependance
Introducing density dependance to the sunlight intensity term:

dx/dt = (a * x * y) - (b * x)
dy/dt = (-c * x * y) + (d * y * z)
dz/dt = (-e * y * z) + (f * S(t) * z * (1-z)) - (g * z)

changes the behaviour somewhat, with stabilisation being a little more interesting again, and taking much, much longer (over 500 years in this case), but the specific effects aren't quite interesting enough for me to explore here (I have more interesting things in mind!):

population - Population dynamics Three_Species_Forced_DD

population - Population dynamics Three_Species_Forced_Phase_DD

That's all the lesson for now, let me know if anything needs more explanation (I expect some of it does).

Auto-evo
Now for the main event, my first, *very* naive auto-evo implementation. I'll make two disclaimers before you read much further: firstly, it doesn't really work, it has quite a few issues which I'm working on fixing, but it does show the basic idea. Secondly, I wrote the code for this, and produce the figures, over a month ago, so I'm a little fuzzy on how it actually works. Since then I've been working on a far more capable version, but as that's not quite done, and a lot more complex than this, I though I'd present the simple version for now.

Equations
The equations used are those from the non-forced three species model, except that I've changed the parameter names to be a little more descriptive:

dx/dt = (p_x * x * y) - (m_x * x)
dy/dt = (-m_y * x * y) + (p_y * y * z)
dz/dt = (-m_z * y * z) + e - (d_z * z)

p_x is the number of individuals gained by species x from predation, and m_x is the number of individuals lost to mortality (either natural, or from predation). 'e' is energy from sunlight. Note that the graphs below have an error, p_z should be m_z, and d_z is mortality of the resource due to natural causes.

Generations and parameter selection
The population levels are updated each generation, which in this case was 1 on the timescale, at each generation, each species also got to pick a mutation. The population dynamics you should be now be familiar with, so I won't say any more about it. To pick a mutation, each species looks at the fitness change which would result from changing each of its parameters. For example, species x can change p_x or m_x (for some reason, species z can also control e). To do this, it calculates the partial derivative of its own function (e.g.: dx/dt = f(x,t)) with respect to each parameter, e.g.: Df(x)/Dp_x. (note 'D' isn't the correct symbol here, but its the best i can do on a forum). I can't explain how partial differentials work here, but they're actually very simple, especially if you already understand ordinary differentials, so have a look at the wikipedia article for more information. In effect though, this partial differential tells you how changing a parameter will effect the rate of change of your population, or more simply, how a mutation to that parameter affects your fitness.

What happens next is fairly obvious, whichever mutation has the greatest effect on fitness is picked (if the effect is negative, the reverse mutation is applied). This is very simple, very crude, and exactly why this model is very naive, but it (sort of) works.

population - Population dynamics Naive_auto_evo_par

What you can see here (not very clearly) is that the predator increases p_x, the prey slightly increases p_y, then decreases m_y, and the resource decreases p_z (actually m_z) and then later d_z. As I said, this isn't clear, and it's been over a month since I produced it, so I can't explain it much more clearly. In short, each species does what it's expected to, but for the most part they only mutate one parameter, with only the resource switching to mutate a second parameter later on.

Problems
The problem, as explained in a previous post, is partially that theres no cost to any mutations, benifits from predation are maximised, and penalties from mortality are minimised, wheras in reality theres only so far you can do so. Moreover, while I prevent the parameters leaving the range 0.05 < p < 1, the program doesn't actually detect when a parameter is at that limit, so that it continues to try and change that parameter, when it would be more benificial changing another parameter. Finally, it isn't realistically possible for a species to continually mutate one trait, as it will quickly run out of genetic diversity in that area; there should therefore be a penalty to how much you can mutate each parameter, dependant on how much it has already been mutated recently. All of these are issues I'm addressing in the next prototype.

Results
These first two plots show the same thing, but at different scales. As you can see the predator population increases to a huge number, and oscillates around 200, whereas the resource appears relatively stable around 20, and the prey oscillates around 0.2. These are huge differences in population levels, and a direct consequence of having no costs associated with mutations. The prey is able to get a huge amount of energy from the small number of prey, keeping its own population high, and the prey population low. This low prey population doesn't do much to harm the resource population, which also stays relatively high. This is a neat (if very artificial) example of a trophic cascade where the abundance of predators indirectly increases the abundance of resources.
population - Population dynamics Naive_auto_evo_x

population - Population dynamics Naive_auto_evo_y

These two plots are again the same as above, but over much longer spans of time, showing that the system does eventually stabilise.

population - Population dynamics Naive_auto_evo_long_x

population - Population dynamics Naive_auto_evo_long_y

Summary
All in all, the behaviour isn't that dissimilair to the earlier models, mainly becuase auto-evo only actually does something for the first 10 generations, after which the population is allowed to stabilise with somewhat different parameters than before. In reality, these mutations would take place much more slowly, and there would also be many more parameters to choose from, so that auto-evo acted for a far longer time span. Additionally, seasonal forcing as shown above would mean that the environment the species are adapting to would be constantly changing, so that selection pressure would act in different directions at different times. Basically, this has a long way to go before it becomes interesting, but I'm working towards that in the next prototype, which I hope to post sometime in the next week or two.

As usual, I'd be very interested to hear any comments or suggestions!

edit - forgot to mention, next lesson will be on age structured populations.


Last edited by Seregon on Fri Oct 12, 2012 7:03 am; edited 1 time in total
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyThu Oct 11, 2012 6:21 pm

Excellent post. With only a month of calculus under my belt I'm able to understand quite well what you're putting forth.
I'd suggest that we simply make each generation equal to one year, since in game time, you'll be playing through a representative sample of yearly conditions, so disparity in the transit time of planets doesn't have a huge effect on the length of a year in real playtime.

For those checking up on this thread, essentially what auto-evo is supposed to do is create a chaotic ecosystem. seregon's plots show that over time theoretical populations settle into stable oscillation- the goal of each ingame population is to break the stable oscillation by adding to its members. Therefore, We won't be seeing portions of even oscillation. Also (seregon as well) remember that the procedure for choosing species who are mutated is included already in the Auto-Evo documentation, so we needn't worry too much about who is getting mutated when right now, but on what effects the mutations will have. The best way to represent mixed and rife effects of mutation is to include many different parameters in the descriptions of organisms, so it comes as no surprise that the auto-evo right now is imperfect.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyFri Oct 12, 2012 7:30 am

Thanks Scio. Good to know it's not too difficult to understand, I don't think the math gets much more complicated unless I start doing more in-depth analysis (which are nasty even for me, so I'll avoid doing so if possible). The only thing I may have to do at some point is use vector/matrix calculus instead, but I can give a very quick intro on that when needed.

I've been giving a lot of thought to how long generations should be, or more specifically, how often we should allow mutations. The major problem is this: if we have a generation be one year (for simplicity, lets say that year lines up perfectly with the year of the planet in quetion), then we'll always have a new generation at the same time of year. If that time of year is winter, we'll end up with a lot of species very well adapted to the cold, but not the rest of the year. That's not to say they won't suffer for it, the population dynamics are still calculated for the whole year, but the fitness benifit of mutations is (currently) only calculated at the end of each generation.

There are various solutions to this. The simplest is to have generations be much shorter (in earth terms, about a week would work nicely), and tweak down the mutation rates to be much lower. This has some pretty poor consequences in terms of computation, so isn't ideal. Its something we'll have to think about anyway at some point, when we decide what time scale the player will be experiencing, but this is something we don't need to figure out just yet.

The second option is to try and summarise the fitness benifit of a mutation across the whole generation. That's not exactly trivial, and I've spent a lot of time thinking about how it could be done. I'm not there yet, but I'm fairly sure it is possible, and I'm hoping to use it in the 3rd prototype in a few weeks time.

In terms of *who* gets mutated, I know we have a pretty good concept for working that out. For the time being, I'm assuming (for simplicity) that everyone gets to mutate every generation, and I'm only worrying about what they mutate.

As you say, they more parameters we have, the more complex the mutations can be, and the more diverse our species can be. I expect theres a limit to this idea, and an optimum number of parameters to use (especially when we consider computation). I am, however, certain that the 7 I'm using right now are no where near enough.

Regarding chaos and oscillations, it would actually be nice to see some oscillations, as that's exactly what we see in the real world. Those oscillations will tend to drift as species adapt, and some mutations may break them (sudden things like disasters could easily do so), but we shouldn't expect to see complete chaos. Given Thrive's much faster timeline for evolution, its possible that some timespans will be dominated more by chaos than oscillations, especially after a major disturbance, and that would also be nice to see. I should probably also point out that chaos and oscillations are not mutually exclusive, in fact the Lorenz equations, perhaps the most famous chaotic system, is a chaotic oscillator (better known as a strange attractor).
Back to top Go down
The Uteen
Sandbox Team Lead
The Uteen


Posts : 1476
Reputation : 70
Join date : 2010-07-06
Age : 27
Location : England, Virgo Supercluster

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyFri Oct 12, 2012 4:16 pm

Nice work. I don't understand the technical stuff (too many variables), but it's interesting nevertheless. Thanks for the updates.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySat Oct 13, 2012 11:19 am

I am fairly familiar with the lorentz attractor, at least in general what it does.
The problem with generations lasting only a week is that the definiton for fitness changes seasonally, which means organisms will be constantly evolving to match the changes in the seasons, not evolving in order to outcompete each other. In another thread, we said that a year would equal about 30-120 minutes of playtime, and would probably include around 4-12 discrete "days" (or equivalents) that you'd play through. This means we have plenty of time for the computer to do all of the auto-evo calculations for your biome, and we could make mutations slightly larger. If we make generations equal to the length of a year in playtime, this will make gameplay slow down a little, but you won't be constantly dealing with changing and new information about your environment.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySat Oct 13, 2012 3:26 pm

I can see what your saying, in that we want interspecies competition to be a major factor in driving adaptation, but that shouldn't be at the cost of not allowing species to adapt to their environment (and that includes the different seasons). Species interactions also won't be constant throughout the year, e.g.: competition for food will be far greater during the winter (which is why avoiding it by hibernating is a brilliant adaptation).

The timing you describe for generations (1 year, 30-120 minutes, 4-12 days) sound absolutely fine to me. Presumably, within that time you would be experiencing several different seasons (in our case, 3 days each of winter, spring, summer and autumn).

I think what we need is a way of having generations be long (i.e.: 1 year), but have the mutations which take place take account of conditions during the entire generation, not just the point at which the generation ends. It could be we need to tweak how things work to get a good ballance of environmental vs interaction factors for determining mutations.
Back to top Go down
Rorsten594
Newcomer
Rorsten594


Posts : 82
Reputation : 1
Join date : 2012-09-13
Age : 24
Location : Earth,Canada

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySat Oct 13, 2012 3:55 pm

~sciocont wrote:
I am fairly familiar with the lorentz attractor, at least in general what it does.
The problem with generations lasting only a week is that the definiton for fitness changes seasonally, which means organisms will be constantly evolving to match the changes in the seasons, not evolving in order to outcompete each other. In another thread, we said that a year would equal about 30-120 minutes of playtime, and would probably include around 4-12 discrete "days" (or equivalents) that you'd play through. This means we have plenty of time for the computer to do all of the auto-evo calculations for your biome, and we could make mutations slightly larger. If we make generations equal to the length of a year in playtime, this will make gameplay slow down a little, but you won't be constantly dealing with changing and new information about your environment.

about the seasons thing wouldn't you just be able to have adaptation for all the seasons? (rabbit have longer hair and white hair in winter than gray or brown in summer less hair)
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptySun Oct 14, 2012 9:37 am

Rorsten594 wrote:
~sciocont wrote:
I am fairly familiar with the lorentz attractor, at least in general what it does.
The problem with generations lasting only a week is that the definiton for fitness changes seasonally, which means organisms will be constantly evolving to match the changes in the seasons, not evolving in order to outcompete each other. In another thread, we said that a year would equal about 30-120 minutes of playtime, and would probably include around 4-12 discrete "days" (or equivalents) that you'd play through. This means we have plenty of time for the computer to do all of the auto-evo calculations for your biome, and we could make mutations slightly larger. If we make generations equal to the length of a year in playtime, this will make gameplay slow down a little, but you won't be constantly dealing with changing and new information about your environment.
about the seasons thing wouldn't you just be able to have adaptation for all the seasons? (rabbit have longer hair and white hair in winter than gray or brown in summer less hair)
Ideally, but that gets very complex. We'll have to see what we can do.
Back to top Go down
gdt1320
Newcomer



Posts : 24
Reputation : 3
Join date : 2012-09-23

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyMon Oct 15, 2012 3:45 pm

Ok so contributing more ideas to develop a more chaotic auto-evo

So we need to decide what parameters the auto-evo can change,
the list from the wiki is
Quote :

size, mass, speed, type of movement, toxicity, toxic resistance, stamina, armor, specialized defensive organs, specialized offensive organs, camouflage.

(side-note: can we just have mass? size and mass are pretty similar)
and how they affect the growth and death rates.

I'd also like to introduce a food level that is a numerical value for how high up a species is on the food web. (again probably needs to be changed, but just for this idea I'll keep it)

Thoughts for modeling equations
Spoiler:

Expanding on the (Probability) term
Spoiler:

Auto-Evo
Spoiler:

Anyways, just more thoughts, and perhaps a different way to look at things.


MAJOR EDIT: I'm an idiot. I just read your (seregon's) post in the other thread. I'll see what I can do since mass and energy balances are sort of my thing.









Back to top Go down
gdt1320
Newcomer



Posts : 24
Reputation : 3
Join date : 2012-09-23

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyMon Nov 26, 2012 4:12 pm


Determining cost/benefits of evolutionary adaptions

So i think evolutionary adaptations can be sorted into two categories, mechanistic and behavioral. Mechanistic would cover the species interactions with compounds. I.E. what it can eat, what it is toxic too, what it is resistant against, etc. behavioral would be how it interacts with members of its own species, and other species.

Mechanistic adaptations can be divided into two subgroups, direct and indirect.

Direct adaptations would be altering enzymes, and proteins to be more resistance at something (possibly through changes in amino acid sequences, or glycosylation steps), at the cost of efficiency.

Indirect adaptations would be the development of new compounds within the system to balance out some negative effect. I.E. developing an antidote that neutralizes a toxin or parasite. These would come at the cost of requiring more compounds, or energy. (Developing new limbs, or body parts could probably fit under this description as well)

I'm still looking into behavioral, because I don't know much about AI. But maybe parameters such as aggressiveness, awareness, socialization, would be a good key few.

Back to top Go down
Daniferrito
Experienced
Daniferrito


Posts : 726
Reputation : 70
Join date : 2012-10-10
Age : 29
Location : Spain

population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics EmptyWed Nov 28, 2012 6:52 am

gdt1320 wrote:
I'm still looking into behavioral, because I don't know much about AI. But maybe parameters such as aggressiveness, awareness, socialization, would be a good key few.

I've been thinking on this, and as i see it, a well programmed learning AI can be considered like a behavorial auto-evo. It will try to adapt, learning about new dangers and food sources. Of course, it it sees a new animal that it has never seen before, it will not know anything about him, probably dyeing the first times. But that happens in real life too. A newly introduced species usually has a good starting time because other species don know how to counteract him.

If you are concerned about letting the player choose the behavior, we could allow the player to modify the weights, and in turn allowing him to lower the learning rate in order to allow the artificial changes to stay.
Back to top Go down
Sponsored content





population - Population dynamics Empty
PostSubject: Re: Population dynamics   population - Population dynamics Empty

Back to top Go down
 
Population dynamics
Back to top 
Page 1 of 4Go to page : 1, 2, 3, 4  Next
 Similar topics
-
» Population dynamics prototype
» Natural Population Growth Simulation/Prototype

Permissions in this forum:You cannot reply to topics in this forum
Thrive Game Development :: Development :: Design :: Evolution-
Jump to: