[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
remove actions from schedule
From: |
Mirjana Majdandzic |
Subject: |
remove actions from schedule |
Date: |
Wed, 14 May 1997 13:54:29 +0200 (MDT) |
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;
}
******************
- remove actions from schedule,
Mirjana Majdandzic <=