[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compound Actions
From: |
Benedikt Stefansson |
Subject: |
Re: Compound Actions |
Date: |
Fri, 29 Oct 1999 16:50:40 -0600 |
>
> I am trying to have an "initial action" and then
> a set of different repeating actions:
>
> -0-----1-----2-----3-----4-----5--
> A1
> A2 A2 A2 A2 A2
>
> I built 2 Schedules but and init the start time
> differently but got a core dump and a message about
> cannot insert action at time >= repeat interval.
> Any help would be appreciated in identifying the
> problem.
>
The error message is normal. There are a couple of ways accomplish what you
want to do. In general, if actions on a
schedule have to start after the initial period, you need to schedule the
activation of that schedule from another
schedule. In this case (assuming that these actions are the only ones in the
model) you can use this method:
mainSchedule = [Schedule createBegin: aZone];
mainSchedule = [Schedule createEnd];
repeatSchedule = [Schedule createBegin: aZone];
repeatSchedule = [repeatSchedule setRepeatInterval: 1];
repeatSchedule = [repeatSchedule createEnd];
[repeatSchedule at: 0 createActionForEach: ua_array message:
M(calcRatingAgentReputation)];
[repeatSchedule at: 0 createActionTo: resultGraph message: M(step)];
[repeatSchedule at: 0createActionTo: self message: M(checkToStop)];
[mainSchedule at: 0 createActionTo: resultGraph message: M(step)];
[mainSchedule at: 0 createActionTo: repeatSchedule message: M(activateIn:) :
aZone];
[mainSchedule activateIn: aZone];
Note: I haven't tested this. My recollection is that the first execution of
repeatSchedule would come on the first
timestep after the activation, so that you need to activate it at 0 on
mainSchedule. Correct me if I'm wrong.
Another,and messier way, if the only thing you want to avoid is to call
ua_array and self on the first step, would be to
reroute these messages to messages in the ModelSwarm and dispatch the message
to calcRatingAgentReputation and
checkToStop only when step >= 1.
-Benedikt
> Thanks in advance.
>
> Regards, Lik
>
> ---------------------------------------------------
> > *** event raised for error: InvalidArgument
> > *** function: _activity_insertAction(), file:
> > /home/alex/redhat/BUILD/swarm-2.0.1/src/activity/Schedule.m, line: 304
> > cannot insert action at time greater than or equal to repeat interval
> > *** execution terminating due to error
> > /home/alex/redhat/BUILD/swarm-2.0.1/src/defobj/Symbol.m:173 -[Error(c)
> > _raiseEvent:]
> > Abort (core dumped)
>
> relevant code is:
> ---------------------------------------------------
>
> // initializing actions --------------------------------------------
> initModelActions = [ActionGroup create: [self getZone]];
> [initModelActions createActionTo: resultGraph message: M(step)];
>
> // Build a simple schedule to send a "step" message
> // to each action object
> initModelSchedule = [Schedule createBegin: self];
> initModelSchedule = [initModelSchedule createEnd];
> [initModelSchedule at: 0 createAction: initModelActions];
>
> // repeated actions ------------------------------------------------
> // Create actionGroup
> modelActions = [ActionGroup create: [self getZone]];
> [modelActions createActionForEach: ua_array message:
> M(calcRatingAgentReputation)];
> [modelActions createActionTo: resultGraph message: M(step)];
> [modelActions createActionTo: self message: M(checkToStop)];
>
> modelSchedule = [Schedule createBegin: self];
> [modelSchedule setRepeatInterval: 1];
> modelSchedule = [modelSchedule createEnd];
>
> [modelSchedule at: 1 createAction: modelActions];
>
> -----------------------------------------------------------------------
>
> ==================================
> 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.