swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Support] Asynchronous schedule


From: Derek Farren
Subject: Re: [Swarm-Support] Asynchronous schedule
Date: Fri, 15 Apr 2005 16:28:19 -0400

Hello Dinis.

I am also new to Swarm, and was in your shoes a few months ago.

Here is what I would do:

1) I would create a class variable that counters the timesteps... lets call it "counter", and a class variable that saves the time where the last event happened, lets call it "lastCounter". 2) you need a method on your agent class that giver you the time for the next event, taken from an exponential distribution. Lets call the method "getNextEventTime" and the class variable that it gives "nextEventTime". 3) create a setter method on your agent class to "refresh" the variable nextEventTime only if its time to do it. It should look like this:

-setNextEventTime
{
  if (counter-lastCounter == nextEventTime)
  {
    nextEventTime = [anAgent getNextEventTime];
    lastCounter = counter;
  }
return self;
}

I hope this helps you.

Derek

----- Original Message ----- From: <address@hidden>
To: <address@hidden>
Sent: Friday, April 15, 2005 2:07 PM
Subject: [Swarm-Support] Asynchronous schedule


Hello everyone,

I'm trying to build a Swarm (java version) model with timesteps dependant
on the state of things at different times. Basically i want to draw the
time to the next event from an exponential distribution, choose my event,
and then schedule it. This is what I've done in a mean field simulation in
fortran but I'm not quite sure that this can be done for multiple
individuals. I suppose so but I don't know exactly how.

I suppose each individual should have a method that, when called, inserts
the time to the next event in the schedule, and at that time, the method
gets called againd to determine the time to the next event. But then...
how to schedule a message for that agent only? I suppose it has something
to do with indexes but I also don't know how to use those. Not a lot of
information around for Java too... Maybe I sould have gone for objective C
but everyone kept telling me that it wasn't used anymore, Java was
everywhere, blah blah blah...

I'm new to programming and Swarm altogether, and I've spent the last month
struggling until I finally got something close to what I wanted working. I
hope I haven't reached a dead-end after all that I had to learn this past
month just to get one lousy algorithm working! :-)

Anyway Swarm looks cool even if just for fun, and there seems to be a lot
of enthusiasts of ABM, but right now I needed a serious algorithm for
serious work. Hope someone can/will help me... A future Swarm citation in
a scientific paper could be in hand if I get this done! ;-)

Dinis Gökaydin

Theoretical Epidemiology Group - IGC (www.igc.gulbenkian.pt/sites/ggomes)

Oeiras - Portugal


_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]