swarm-support
[Top][All Lists]
Advanced

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

Multi-level swarm


From: Frank Lin
Subject: Multi-level swarm
Date: Wed, 8 May 1996 15:10:53 -0500 (CDT)

>  Hi, Roger,
>    As you indicated, I do check the two programs, grid9.m and mousetraps.m, 
> to understand how multi-level swarm can be used.  The followings are things 
> needed your clarification.
>  
>  ---- The last part of the mousetraps.m program from grid test directory at 
> 960110 distribution ----
>  
>    // create the mousetrap world schedule and schedule its first action
>  
>    worldSchedule = [Schedule createBegin: aZone];
>    [worldSchedule setAutoDrop: 1];
>    worldSchedule = [worldSchedule createEnd];
>  
>    aMousetrap = [grid atX: gridSize/2 atY: gridSize/2];
>    [worldSchedule at: 0 createActionTo: aMousetrap message: M(trigger)];
>  
>    // include the mousetrap world in its own swarm
>    
>    worldSwarm = [Swarm create: aZone];
>    startupPlan = [worldSwarm getSwarmPlan];
>    [startupPlan createActionTo: worldSchedule message: M(start)];
>  
>    // create display schedule and schedule the display events
>  
>    displaySchedule = [Schedule createBegin: aZone];
>    [displaySchedule setRepeatInterval: 10];
>    displaySchedule = [displaySchedule createEnd];
>  
>    [displaySchedule at: 0 createActionTo:
>      [grid atX: (gridSize + gridSize/2)/(gridSize/2) atY: gridSize/2]
>      message: M(printTriggered)];
>    [displaySchedule at: 9 createActionCall: (func_t)testTerminate : (id)250];
>  
>    // create a swarm to combine the display schedule and the world swarm
>  
>    experimentSwarm = [Swarm create: aZone];
>    startupPlan = [experimentSwarm getSwarmPlan];
>    [startupPlan createActionTo: displaySchedule message: M(start)];
>    [startupPlan createActionTo: worldSwarm message: M(start)];
>  
>    // start the world and schedule its termination
>  
>    swarmActivity = [experimentSwarm start];
>  
>    // [worldSchedule at: 20 createActionTo: swarmActivity message: 
> M(terminate)];
>  
>    // run the simulation
> 
>    [swarmActivity run];
>    printf( "total number of mousetraps triggered: %d\n", numTriggered );
>    return 0;
>  }
>  
>  
>  1) Are the following two groups of statement equal?
>  
>    worldSwarm = [Swarm create: aZone];
>    startupPlan = [worldSwarm getSwarmPlan];
>    [startupPlan createActionTo: worldSchedule message: M(start)];
>  
>  vs.
>  
>    startupPlan = [SwarmPlan create: aZone];
>    [startupPlan createActionTo: worldSchedule message: M(start)];
>  
>  2) What is the relationship between "worldSwarm" and "experimentSwarm"?
>     Why both are using the "startupPlan"?
>  
>  3) Could you explain the meanings of the following statements?  Are they 
> redundent?
>    
>      
>    worldSwarm = [Swarm create: aZone];
>    startupPlan = [worldSwarm getSwarmPlan];
>    [startupPlan createActionTo: worldSchedule message: M(start)];
>  
>  vs.
>  
>    [startupPlan createActionTo: worldSwarm message: M(start)];
>  
>  Frank Lin
>  
>  > As far as I know, the only running examples which used multi-level
>  > swarms before were grid9.m and mousetraps.m in the grid test program
>  > directory (not the mousetraps application), but I don't think this is
>  > currently being distributed since we split out the apps from the
>  > library releases.  But all the machinery for multi-level swarms is
>  > already in place and working, at least as exercised by these earlier
>  > tests.  And they're very much at the core of what Swarm is intended to
>  > be, so it's important that we have what you're asking for.
>  > 
>  > Roger Burkhart
>  > 
>  
> 


reply via email to

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