swarm-support
[Top][All Lists]
Advanced

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

Fine grained actions


From: famasce
Subject: Fine grained actions
Date: Wed, 3 May 2000 11:26:38 +0200

I've replaced the previous action plan in ModelSwarm from:

   bargainActions=[ActionGroup create: self];

   [bargainActions createActionForEach: agentsList message:
M(evalSignals)];
   [bargainActions createActionForEach: agentsList message:
M(sendBestSignal)];
   [bargainActions createActionTo: bbInstance message:
M(calculatePayoffs)];
   [bargainActions createActionTo: self message: M(checkToStop)];

   simulationSchedule=[Schedule create: self setRepeatInterval:1];
   [simulationSchedule at: 0 createAction: bargainActions];

to (suppose 10 agents):

   simulationSchedule=[Schedule create: self setRepeatInterval:13];

  for (instant=0;instant<10;instant++)
    [simulationSchedule at: instant createActionTo:
                      [agentsList atOffset: instant]  message:
M(evalSignals)];
    
    [simulationSchedule at: 10 createActionForEach: agentsList
                                               message: M(sendBestSignal)];
    
    [simulationSchedule at: 11 createActionTo: bbInstance
                                               message: M(calculatePayoffs)];
    
    [simulationSchedule at: 12 createActionTo: self
                                               message: M(checkToStop)];

The method - checkToStop checks if the maximum number of iterations has
been reached:
 
- (void) checkToStop
{
   currentstep++;
   if (currentstep > maxsteps){
         printf("\n\nEnd of simulation. \n\n");

         [self closeOutputFiles];
         [[self getActivity] terminate];
}

Though the simulation correctly completes, the following message is
displayed after 'End of simulation':

***event raised for error: AlreadyAtEnd
***function: _i_ListIndex__linked_next(), file:
/src/Swarm/swarm/src/collections/List_GEN.m, line: 332
*** execution terminating due to error
/src/Swarm/swarm/src/defobj/Symbol.m :173 -[Error(c) _raiseEvent:]
     0 [sig] sim 1391 stackdump: Dumping stack trace to sim.exe.stackdump 

Any hint? 
I was also wondering if the List of agents that is conventionally used in
all Swarm simulations could be replaced by an Array object (if the number
of agents remains unchanged during the simulation)and if this can increase
speed.

Thanks,
Fabio. 


                  ==================================
   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]