swarm-support
[Top][All Lists]
Advanced

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

Re: incompatible types in assignment


From: Manor Askenazi
Subject: Re: incompatible types in assignment
Date: Wed, 29 Jan 1997 12:22:52 -0800

> Or, perhaps you could do it this way:
>
> ---------------------------------------------------------------------
>   id <Schedule> schedule;
>   id <List> agentList[10];
>   int agentSpeed[10], sortedAgentSpeed[10], sortMap[10];
>   int maxAgentSpeed;
>
>   schedule = [Schedule createBegin: [self getZone]];
>   [schedule setRepeatInterval: 1];
>   schedule = [schedule createEnd];
>
>   sortedAgentSpeed = sort(agentSpeed, sortMap);
>   for (i=0; i<10; i++) {
>     j = sortedAgentSpeed[i];
>     while (j <= maxAgentSpeed) {
>        [schedule at: j createActionForEach: agentList[sortMap[i]]
>             message: M(step)];
>        j += mod( sortedAgentSpeed[i],maxAgentSpeed)
>     }
>   }
> -------------------------------------------------------------------

I have a few questions about the latter suggestion:

1) why mod(A,B) when A is by definition smaller than B ?

2) Presumably the idea of flattening the 'inner loop' of fast agent step
   calls is used in order to save on 'merge' related overhead (i.e. with
   one schedule there should be no need to call the mechanisms which
   merge two schedules). Well, I'm wondering whether the overhead is being
   avoided by flattening the inner loop and furthermore I'm wondering
   whether that overhead is very large in the first place. Roger should
   post something about this trade-off (i.e. does his library 'notice' the
   case where no merging is necessary).

3) Of course there is a serious memory penalty for this approach (consider
   the case where speedA=3 and speedB=10000 --> you would get a schedule
   containing quite a few events...)

4) You set the repeatInterval on a schedule to 1, but then you set actions
   to occur at times greater than 1 --> presumably you meant:

     [schedule setRepeatInterval: maxAgentSpeed];

5) Also, isn't i only supposed to iterate until 5? If not, then what is
   in sortedAgentSpeed[5]?

Regards,

Manor.


reply via email to

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