Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

[cormas] RE: a agent variable changeing its value according to t

New Message Reply Date view Thread view Subject view Author view

Subject: [cormas] RE: a agent variable changeing its value according to t
From: Bousquet (bousquet@cirad.fr)
Date: Mon Aug 06 2007 - 09:15:29 CEST

Another possible solution:
 - create an instance variable for each agent : "lifetime".
- write an init method for the agent
initLifetime: time
time < 50 ifTrue: [self lifetime: 30] ifFalse: [self lifetime: 20].

Activate this initlifetime: from the model (the scheduler, the conductor)
when you instantiate an new agent. The model has a variable t which is the
time step. So from the model you would have part of the method
Step: t
...
 A := Agent new.
A initlifetime: t.
...
.

-----Message d'origine-----
De : owner-cormas@cirad.cirad.fr [mailto:owner-cormas@cirad.cirad.fr] De la
part de Miao Wang
Envoyé : dimanche 5 août 2007 08:02
À : cormas@cirad.fr
Objet : a agent variable changeing its value according to t

Hi all,

 

I have a problem of how to set a agent variable which can change its value
according to t(time step)?

 

In my model, each agent has a variable named ‘lifetime’. It is expected that
the agent’s lifetime is different according to different time steps. For
example: the total simulation time steps are 100, for new agents released
between 1-50 time steps, their lifetime is 30(time steps), for new agents
released between 50-100, their lifetime changed into 20(time steps).

 

I tried to set ‘lifetime’ as a global variable, and tried to change its
value in the model’s STEP method, but it can not be recognized by agent.

 

Does anyone have some idea about this?

 

Great Thanks!

 

<mailto:cormas@cirad.fr>
Miao Wang at Geomatics
School of Civil Engineering and Geosciences
G.19, Cassie Building,
University of Newcastle Upon Tyne, NE1 7RU
England
Email: miao.wang1@ncl.ac.uk

New Message Reply Date view Thread view Subject view Author view
 

Back to home