swarm-support
[Top][All Lists]
Advanced

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

Re: remove actions from schedule


From: Doug Donalson;
Subject: Re: remove actions from schedule
Date: Wed, 14 May 1997 11:49:54 -0700 (PDT)

Hi,

   I don't know about the exact problem you are having, but I
think I know a simple way around it.  When your monkey creates
its actions, save the returned values (the ID of the action).
Then when you want to remove one of then you can use the message

[modelSchedule remove: anAction];

This is actually a useful way to handle onjects that create their
own actions in general and can make debugging somewhat easier.

There is presently a complicating when using the 2-tiered concurrent
schedule for asynchronous schedules with removes.  Roger Burkhart
and I are activily (and sometimes) working on a fix.  If you
are using this let me know.

Cheers,

   Doug Donalson

***************************************************************************
* Doug Donalson                          * Office: (805) 893-2962         *
* Ecology, Evolution, and Marine Biology * Home:   (805) 961-4447         *
* UC Santa Barbara                       * email address@hidden
* Santa Barbara Ca. 93106                *                                *
***************************************************************************
*                                                                         *
*   The most exciting phrase to hear in science, the one that             *
*   hearlds new discoveries, is not "EUREKA" (I have found it) but        *
*   "That's funny ...?"                                                   *
*                                                                         *
*       Isaac Asimov                                                      *
*                                                                         *
***************************************************************************


On Wed, 14 May 1997, Mirjana Majdandzic wrote:

> I have a question concerning the removal of actions from a schedule.
> 
> I use dynamic scheduling, so after the first timestep, my agents 
> ("monkeys") tell the modelSchedule themselves when they want to be
> updated again.
> But they can be (should be able to be...)  killed by predators, and 
> then their future actions have to be removed from the modelSchedule 
> 
> I tried to figure out what is exactly the things that are in the schedule
> and how to remove only (and all) the actions of the monkey to be killed, but 
> it doesn't work. 
> I keep running into the object actionConcurrent_c of which I do not understand
> its funtcion.
> 
> I don't know if it helps if I include the method under consideration, 
> but here it is.
> 
> Thanks in advance.
> 
> ************
> //This is a method in ModelSwarm.
> //The predator tells modelSwarm to schedule the death of its victim, 
> //and the actial killing is done here:
> 
> -killMonkey: (Monkey*) aMonkey {
>   int n, i, count1, count2;
>   id removedAction;
>   id groupOfActions;
> 
>   count1 = [modelSchedule getCount];
> 
>   for (i = 0; i < count1; i++) { 
>     groupOfActions = [modelSchedule atOffset: i];
>     count2 = [groupOfActions getCount];
> 
>     for (n = 0; n < count2; n++) { 
> 
>       if ((removedAction = [groupOfActions atOffset: n])   
>       && ([removedAction getTarget] == aMonkey) 
>       && ([removedAction getMessageSelector] != M(killMonkey))) { 
> 
>       [groupOfActions remove: removedAction];
>       [removedAction drop];
>       }
>     }
>   }
> 
>   [monkeyList remove: aMonkey];
>   [aMonkey drop];
>   
>   return self;
> }
> ******************
> 
> 
>                   ==================================
>    Swarm-Support is for discussion of the technical details of the day
>    to day usage of Swarm.  For list administration needs (esp.
>    [un]subscribing), please send a message to <address@hidden>
>    with "help" in the body of the message.
>                   ==================================
> 



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

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