Re: [OT] Re: model implementation
From: Pieter Provoost (pieterprovoost_at_tiscali.be)
Date: 06/02/04
- Next message: Kench: "Re: copy constructor of parent clas"
- Previous message: Mark A. Gibbs: "Re: ~traits::eof()?"
- In reply to: Howard: "[OT] Re: model implementation"
- Next in thread: Howard: "Re: [OT] Re: model implementation"
- Reply: Howard: "Re: [OT] Re: model implementation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 2 Jun 2004 22:38:01 +0200
"Howard" <alicebt@hotmail.com> schreef in bericht
news:4Mqvc.116823$hH.2045892@bgtnsc04-news.ops.worldnet.att.net...
>
> "Pieter Provoost" <pieterprovoost@tiscali.be> wrote in message
> news:40bd1b63$0$9527$a0ced6e1@news.skynet.be...
> > Hi,
> >
> > I am looking for c++ implementations of very simple ecosystem or
> > (meta)population models. I want to know the very basics of model
> > implementation.
> >
> > For example, if my model consists of a number of units that hold a
certain
> > amount of nutrients, and there are flows between the units that depend
on
> > the contents of the units (dU1 = U1 - 5*U2 for example) - how do I
> implement
> > this?
> >
> > Is it correct that I should represent these units by objects of the same
> > class, which has properties such as "contents", "how much is the flow to
> U1
> > dependent on the contents of this unit", "how much is the flow to U1
> > dependent on the contents of U1"...? If that is correct, how do I start
a
> > simulation or calculate the change in the units over time?
> >
> > I have just started with c++ so please keep it very basic :)
> >
> > Thanks in advance,
> > Pieter
> >
>
> This is rather off-topic for this newsgroup, but I actually wrote this
exact
> program for the Ecology classes at my university once, intended as a
> training device for students, so I thought I'd pass my thoughts along.
>
> What I did was create a two-dimensional array of double values, with one
> index representing the different levels (indexed 0..4, if I recall, from
> producers to top consumers), and the other index representing time (in
> days). The values stored in this array were the "contents" for the given
> level on the given day.
>
> The total length of the simulation was a value I let the user decide, but
I
> limited it to 10 years I think (since this was on a Apple IIe, and didn't
> have much memory). You could make a longer maximum, or dynamically
allocate
> the array after asking for the simulation length in days.
>
> Then I had another two-dimensional square array, also of double values,
> indexed in both directions by the biotic (?) level. This array was used
to
> indicate the amount of the content of each of the levels to be added (or
> subtracted) from this level's "content" when calculating the next day's
> "content". These values are constants given by formulas in a book I used
to
> model the ecosystem. (But I had some fun playing with them, so I decided
to
> put them into a configuration file that the user could modify if desired,
> and read the file into the array at startup.)
>
> I allowed the user to "seed" the initial starting content values, and then
> simply started the simulation by stepping forward in time (and thus in the
> array), calculating each level's new content based entirely on the values
> for the previous day and the values in the square array. Changing the
> initial values allowed the user to see how well the system recovered from
> things like over-predation of a given level (such as by humans killing
half
> the top consumers by hunting, for example).
>
> The basic calculation was something like this (leaving out some neat
> features I added):
>
> // 0 index is the "seed" and is already set
> for (int t = 1; t < max_time; ++t)
> {
> for (int b = 0; b < num_levels; ++b)
> {
> double new_content = 0;
> for (int i = 0; i < num_levels; ++i)
> // here's the caluclation(s):
> // add amount of given level's content,
> // multiplied by appropriate factor
> // (note: factor could be negative,
> // if preyed upon by other level!)
> new_content += factor[b,i] * content[b,t-1];
> content[b,t] = new_content;
> }
> display_content(t);
> }
>
> As added complexity and flexibility, I also included things like modifying
> the producer content based on solar input, and let the user specify the
day
> in the year that the smulation was to start, and the amount (and timing)
of
> the solar fluctuation (to account for latitude, for example). I also
added
> other features, such as varying the "constants" according to annual
changes
> (such as hibernation periods), but this is the basic idea of the system.
>
> Good luck!
>
> -Howard
>
Thank you very much, I'm going to experiment a bit with your concept!
Pieter
- Next message: Kench: "Re: copy constructor of parent clas"
- Previous message: Mark A. Gibbs: "Re: ~traits::eof()?"
- In reply to: Howard: "[OT] Re: model implementation"
- Next in thread: Howard: "Re: [OT] Re: model implementation"
- Reply: Howard: "Re: [OT] Re: model implementation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|