Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: individual trajectories

New Message Reply Date view Thread view Subject view Author view

Subject: Re: individual trajectories
From: Geraldine Abrami (Geraldine.Abrami@cirad.fr)
Date: Wed Dec 21 2005 - 11:04:41 CET

Dear Florent

I'm not sure I understand exactly what you ask for but I can give you a
few elements of code.
You can access the spatial location of an individual (AgentLocation)
with the method center that returns the coordinates of teh individual in
the spatial grid.
Then you can draw lines from one point to the other in the spatial rid
using the method displayLineFrom:to: of GraphicsContext
You can see exemple of drawing lines on the spatial grid in the
evolveFriends: method of the model SugarScape (for each SugarAgent, red
lines is drown from its center to the centers of all its friends).
self theSugarAgents do:
[:a |
gc := self spaceModel vue graphicsContext.
gc paint: (ColorValue perform: #red).
a friends do: [:b | gc displayLineFrom: a center to: b last center]].
So I guess if you have an attribute named trajectory that stores the
different spatial locations of your entity you could have something like
gc := self spaceModel vue graphicsContext.
start := myAgent trajectory first.
myAgent trajectory do: [:next |
gc displayLineFrom: start to: next.
start := next].
I've used the SugarScape code basis to develop a bit more complex
methods to display different types of relations between the agents of my
model so maybe I can help if you have more precise questions.

Hope it will help,

Cheers,

Geraldine

Florent Arrignon wrote:

> Dear members,
>
> I’m trying to model the population dynamics of a beneficial insect in
> winter, and I’d like to focus on its spatial dynamics.
>
> In this way, I’d like to follow each individual in the space at each
> time step so that I’d be able to draw its trajectory during the
> simulation.
>
> I project to create an attribute that would store at each time step
> the spatial location of the individual but I was wondering if this
> kind of study had already been done in the Cormas community and if
> they were already methods that had been developed in this purpose.
>
> Thanks you in advance,
>
> Florent Arrignon
>
> Doctorant
>
> Laboratoire "Biodiversite dans les Agroecosystemes"
> UMR 1201 Dynafor - FR 2576- INRA / INP-ENSAT
>
> Institut National Polytechnique
> Ecole Nationale Superieure Agronomique de Toulouse *
> *Avenue de l'Agrobiopôle
> BP 32607
> F-31326 AUZEVILLE-TOLOSANE
>
> farri@toulouse.inra.fr <mailto:farri@toulouse.inra.fr>
>

New Message Reply Date view Thread view Subject view Author view
 

Back to home