Velocity Reviews > Ruby > Ruby (quiz?) simulation idea

# Ruby (quiz?) simulation idea

Hal Fulton
Guest
Posts: n/a

 12-07-2004
This is just off the top of my head. I thought I'd post it instead of
emailing, in case people want to discuss it and/or think about it.

This is "life" in a sense, but not John Horton Conway.

Imagine you have N lifeforms to start with, each with a certain
genotype. For simplicity, we could assume simple dominance, no
sex-linked traits, and panmictic mating (probability of mating is
random based on the population). Purists out there: Please don't
flame any slight misuse of terms unless it's really relevant.

Flashback to the first day of Genetics 101:

AA = homozygous dominant
Aa = heterozygous
aa = homozygous recessive

The population's genotype frequencies are obviously
pAA + pAa + paa = 1

A few seconds of thought should show that the gene frequencies
are
pA = pAA + 0.5pAa
pa = paa + 0.5paa
and also
pA + pa = 1

I imagine modeling each individual as an object running in a
thread. For the heck of it, give each individual a location in
a grid. Let them wander around. When a nature male bumps into a
mature female, a probability function determines whether they mate
and how many offspring they have.

Assume each individual has a known average lifespan and a typical
mating age. (I'd favor expressing these in millisec for purposes
of the simulation). Let the "children" have certain probabilities
of surviving to mating age: qAA, qAa, and qaa. Typically, these
are all near 1.0 -- in many situations, the heterozygote will be
a little less likely to survive, and the homozygote least of all.
(This is the trivial case in which "A" is good or healthy and "a"
is bad or unhealthy.)

All things being equal, such a population will eventually reach
what is called Hardy-Weinberg equilibrium, in which the genotype
frequencies reach a constant and stay there (for a suitable value
of epsilon).

Run the simulation with large numbers of individuals. Sample the
population once in awhile and check the numbers. Watch for
equilibrium.

Write a pure deterministic (algebraic) model that will predict when
equilibrium occurs. See how well it matches your simulation. An
iteration in the deterministic model is simply a "generation" -- I
think we can consider that equal to a lifespan (or perhaps, hmm, the
lifespan minus the mating age?).

Just a thought...

Hal

James Edward Gray II
Guest
Posts: n/a

 12-07-2004
On Dec 6, 2004, at 7:25 PM, Hal Fulton wrote:

> This is just off the top of my head. I thought I'd post it instead of
> emailing, in case people want to discuss it and/or think about it.

[snip description]

Silence means consent?

> Write a pure deterministic (algebraic) model that will predict when
> equilibrium occurs. See how well it matches your simulation. An
> iteration in the deterministic model is simply a "generation" -- I
> think we can consider that equal to a lifespan (or perhaps, hmm, the
> lifespan minus the mating age?).

I think this should be "extra credit". Some of us are easily pleased
and would be content watching little dots move around and multiply.

James Edward Gray II

Brian Schröder
Guest
Posts: n/a

 12-07-2004
On Tue, 7 Dec 2004 23:25:07 +0900
James Edward Gray II <(E-Mail Removed)> wrote:

> On Dec 6, 2004, at 7:25 PM, Hal Fulton wrote:
>
> > This is just off the top of my head. I thought I'd post it instead of
> > emailing, in case people want to discuss it and/or think about it.

>
> [snip description]
>
> Silence means consent?
>

I'd like to propose something a bit different that stresses the fact that
evolution is _not_ survival of the _strongest_ but survival of the _fittest
population_.

Maybe you have heard of this theme before, I also tried to simulate it once but
it didn't work out how I thought, so it should be an interesting problem.

The setting: (Directly from memory, so correct any misfacts)

A certain kind of blood sucking bats (Vampires can survive only one day
without finding food. They live in big groups in their caves, but
hunt/gather[1] alone.

These bats are a standard example for how altruism develops in evolution.

A bat may share the blood it has gathered through the night with another bat
that had no success. But why should it? If it shares, it needs to gather
successfully the next night, otherwise it will starve. So it diminusishes its
strength and helps a rival, whose genes will have a better chance to spread.
Wouldn't it be better off being egoistic and increasing its survival
possibility?

In practice, the bats developed some kind of "tit for tat" algorithm. So it is
_for the population with this trait_ an evolutionary positive trait to be
altruistic.

So obviously what is the goal of the quiz. Write a "bat simulator" and feed it
with a population of bats with different survival strategies. Equip the bats
live with whatever detail you deem neccessary (Hunting, Mating, Breeding,
Genetic Exchange, Mutation, ...) and see if the populations with different
traits come to an equilibrium.

Try to adjust the factors such that altruistic bats survive, if this didn't
happen on the first run.

Drawback of this proposal: No sensible nice graphics possible. Only graphs. But
maybe _why can draw us a bat that looks like an elephant with a duck on its
back

Best Regards,

Brian

[1] they don't kill their prey, so maybe I should say gather

--
Brian Schröder
http://www.brian-schroeder.de/

James Edward Gray II
Guest
Posts: n/a

 12-07-2004
On Dec 7, 2004, at 9:28 AM, Brian Schröder wrote:

> I'd like to propose something a bit different that stresses the fact
> that
> evolution is _not_ survival of the _strongest_ but survival of the
> _fittest
> population_.

War of the simulators? I say we unleash Brian's vampire bats on the
pregnant sims from Hal's idea and...

Seriously. It doesn't have to be an either or thing. It's possible
we'll do many simulators over time.

My queued quiz directory is currently empty, so the more the merrier.
(If you have a good quiz idea, submit now and be first in line!)

I'm watching this discussion and archiving the ideas presented.

The only thing I'll add is that I'll tend to favor more fleshed out
ideas (read: low work for James). Ready-to-run quizzes sent to
http://www.velocityreviews.com/forums/(E-Mail Removed) will be given the highest priority and
attention, as always.

James Edward Gray II

James Britt
Guest
Posts: n/a

 12-07-2004
Brian Schröder wrote:
> On Tue, 7 Dec 2004 23:25:07 +0900
> James Edward Gray II <(E-Mail Removed)> wrote:
>
>
>>On Dec 6, 2004, at 7:25 PM, Hal Fulton wrote:
>>
>>
>>>This is just off the top of my head. I thought I'd post it instead of
>>>emailing, in case people want to discuss it and/or think about it.

>>
>>[snip description]
>>
>>Silence means consent?
>>

>
>
> I'd like to propose something a bit different that stresses the fact that
> evolution is _not_ survival of the _strongest_ but survival of the _fittest
> population_.
>
> Maybe you have heard of this theme before, I also tried to simulate it once but
> it didn't work out how I thought, so it should be an interesting problem.

Sounds like something from A.K. Dewdney's Computer Recreations column
that ran in Scientific American. He also wrote a book,
The (New) Turing Omnibus: 66 Excursions in Computer Science, that is
full of good explanations of assorted CompSci principles and concepts.

http://isbn.nu/0805071660

And he created Core Wars. If there isn't already a good Ruby version of
that, it might make for a nice quiz.

http://www.koth.org/info/akdewdney/index.html

James

Brian Schröder
Guest
Posts: n/a

 12-07-2004
On Wed, 8 Dec 2004 00:51:46 +0900
James Edward Gray II <(E-Mail Removed)> wrote:

> On Dec 7, 2004, at 9:28 AM, Brian Schröder wrote:
>
> > I'd like to propose something a bit different that stresses the fact
> > that
> > evolution is _not_ survival of the _strongest_ but survival of the
> > _fittest
> > population_.

>
> War of the simulators? I say we unleash Brian's vampire bats on the
> pregnant sims from Hal's idea and...
>
> Seriously. It doesn't have to be an either or thing. It's possible
> we'll do many simulators over time.
>
> My queued quiz directory is currently empty, so the more the merrier.
> (If you have a good quiz idea, submit now and be first in line!)
>
> I'm watching this discussion and archiving the ideas presented.
>
> The only thing I'll add is that I'll tend to favor more fleshed out
> ideas (read: low work for James). Ready-to-run quizzes sent to
> (E-Mail Removed) will be given the highest priority and
> attention, as always.
>
> James Edward Gray II
>
>

Oh, oh, oh. I wanted to stress cooperation and altruism, and now we have
already arrived at a war My forecastings for mankind are red as a vampire
bats blood stained teeth

Regards,

Brian

--
Brian Schröder
http://www.brian-schroeder.de/

Brian Schröder
Guest
Posts: n/a

 12-07-2004
On Wed, 8 Dec 2004 00:55:17 +0900
James Britt <(E-Mail Removed)> wrote:

> Brian Schröder wrote:
> > On Tue, 7 Dec 2004 23:25:07 +0900
> > James Edward Gray II <(E-Mail Removed)> wrote:
> >
> >
> >>On Dec 6, 2004, at 7:25 PM, Hal Fulton wrote:
> >>
> >>
> >>>This is just off the top of my head. I thought I'd post it instead of
> >>>emailing, in case people want to discuss it and/or think about it.
> >>
> >>[snip description]
> >>
> >>Silence means consent?
> >>

> >
> >
> > I'd like to propose something a bit different that stresses the fact that
> > evolution is _not_ survival of the _strongest_ but survival of the _fittest
> > population_.
> >
> > Maybe you have heard of this theme before, I also tried to simulate it once
> > but it didn't work out how I thought, so it should be an interesting
> > problem.

>
> Sounds like something from A.K. Dewdney's Computer Recreations column
> that ran in Scientific American.

This is not my source, as I don't read scientific american. But it is a very
popular example that can be found in a lot of textbooks about evolution. I also
think it was one of the first theories whose plausiblity was tested by
simulation. In fact I was introduced to the problem in my cognitive science
courses at university.

The interesting thing I found out when trying to simulate it myself, is that it
is not so easy to make a simulation that has the same outcome as nature. As
always in the paper it all sounded a lot clearer.

Regards,

Brian

--
Brian Schröder
http://www.brian-schroeder.de/

James Edward Gray II
Guest
Posts: n/a

 12-07-2004

On Dec 7, 2004, at 9:55 AM, James Britt wrote:

> And he created Core Wars. If there isn't already a good Ruby version
> of that, it might make for a nice quiz.
>
> http://www.koth.org/info/akdewdney/index.html

I've been reading some of the information in these links and this looks
promising. Thanks for exposing me to this.

Don't suppose your interested in creating the quiz?

James Edward Gray II

James Edward Gray II
Guest
Posts: n/a

 12-07-2004
On Dec 7, 2004, at 3:18 PM, James Edward Gray II wrote:

Or not. Sorry.

James Edward Gray II