geopro:pedro:swarm
Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
Próxima revisão | Revisão anterior | ||
geopro:pedro:swarm [2007/07/03 00:38] – created pedro | geopro:pedro:swarm [2007/07/17 19:50] (atual) – pedro | ||
---|---|---|---|
Linha 1: | Linha 1: | ||
+ | ====== Swarm ====== | ||
+ | |||
+ | //Swarm is a multi-agent software platform for the simulation of complex adaptive systems. Swarm supports hierarchical | ||
+ | modeling approaches [and] provides object oriented libraries of reusable components for building models and analyzing, | ||
+ | displaying, and controlling experiments on those models.// | ||
+ | |||
+ | \\ | ||
+ | |||
+ | {{ http:// | ||
+ | |||
+ | ^**Homepage** | ||
+ | ^**Origin** | ||
+ | ^**Year** | ||
+ | ^**Version** | ||
+ | ^**License** | ||
+ | ^**Language** | ||
+ | |||
+ | \\ | ||
+ | |||
+ | There is a GIS extension of swarm called [[http:// | ||
+ | details and no source code. Basically it can load data exported from GIS to files in some format. | ||
+ | From the floatspace example: //A datafile object [...] reads in GIS data and assigns a certain data | ||
+ | value of a geographical coordinate to a cell object residing at the corresponding coordinate. A cell, therefore, has | ||
+ | variables of these geographical data and whether any agents are staying at its coordinate or not.//) | ||
+ | |||
+ | How to compile swarm in ubuntu [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | \\ | ||
+ | ==== The Swarm Simulation System: A Toolkit for Building Multi-agent Simulations==== | ||
+ | |N. Minar, R. Burkhart, C. Langton, M. Askenazi, | [[http:// | ||
+ | \\ | ||
+ | |||
+ | **Abstract: | ||
+ | systems. In the Swarm system the basic unit of simulation is the swarm, a collection of agents executing a schedule of actions. | ||
+ | Swarm supports hierarchical modeling approaches whereby agents can be composed of swarms of other agents in nested | ||
+ | structures. Swarm provides object oriented libraries of reusable components for building models and analyzing, displaying, and | ||
+ | controlling experiments on those models. | ||
+ | |||
+ | \\ | ||
+ | |||
+ | [...] collection of independent agents interacting via discrete events. [...] There are no domain | ||
+ | specific requirements such as particular spatial environments, | ||
+ | Swarm simulations have been written for such diverse areas [...] | ||
+ | |||
+ | The basic unit of a Swarm simulation is the agent. An agent is any actor in a system, | ||
+ | any entity that can generate events that affect itself and other agents. Simulations consist | ||
+ | of groups of many interacting agents. [...] Simulation of discrete interactions between | ||
+ | agents stands in contrast to continuous system simulations, | ||
+ | phenomena are quantities in a system of coupled equations. | ||
+ | |||
+ | In addition to being containers for agents, swarms can themselves be agents. [...] | ||
+ | an agent can also itself be a swarm: a collection of objects and a schedule of actions. | ||
+ | In this case, the agent' | ||
+ | its swarm. Hierarchical models can be built by nesting multiple swarms. | ||
+ | |||
+ | Swarm has the following components: | ||
+ | * **SwarmObject**: | ||
+ | * **Swarm**: Model swarms and observer swarms are written by using code inherited from this base class. | ||
+ | * **Activity**: | ||
+ | * **Simtools**: | ||
+ | |||
+ | Ambiguity can occur in partial orders and time-based schedules as a result of two or | ||
+ | more actions scheduled at the same time or in the same relative order. Swarm resolves | ||
+ | such ambiguity by defining a " | ||
+ | execute a group of actions that are defined at the same time. Options include running the | ||
+ | group in an arbitrary, fixed order running the group in a random order every time or | ||
+ | actually running each action concurrently, | ||
+ | The explicit notation of a concurrent group type helps to expose and remove any hidden | ||
+ | assumptions in the time structure of a model. | ||
+ | |||
+ | __TerraME: | ||
+ | |||
+ | |||
+ | |||
+ | =====Swarm User Guide===== | ||
+ | Available [[http:// | ||
+ | |||
+ | //Most swarm applications have a structure that roughly goes like this. First, a top level - often called the " | ||
+ | created. That layer creates screen displays and it also creates the level below it, which is called the "model swarm" | ||
+ | swarm in turn creates the individual agents, schedules their activities, collects information about them and relays that information | ||
+ | when the observer swarm needs it. This terminology is not required by Swarm, but its use does facilitate it.// | ||
+ | |||
+ | //Current priorities for the Swarm team [...] include the further generalization of Swarm to be useful on a broader array of platforms | ||
+ | and in conjunction with additional computer languages. Prototype XML and Scheme layers for Swarm have been tested, for example.// | ||
+ | |||
+ | One agent always inherits the class SwarmObject, | ||
+ | |||
+ | @interface Person: SwarmObject { | ||
+ | int x, y; | ||
+ | int xsize, | ||
+ | int myColor; | ||
+ | int unhappy; | ||
+ | int nhoodType; | ||
+ | int radius; | ||
+ | int idnumber; | ||
+ | double myTolerance, | ||
+ | | ||
+ | BOOL edgeWrap; | ||
+ | BOOL moved; | ||
+ | SchellingWorld * myWorld; | ||
+ | } | ||
+ | |||
+ | When those objects are no longer needed, the program can send that object the drop message, which removes it from memory. | ||
+ | |||
+ | We define the scheduler of agents inside of them, and each agent has a buildActions method. | ||
+ | |||
+ | //[...] when the observer swarm needs a list of all the agents in a simulation in order to create a graph, the model swarm | ||
+ | should have a method, such as getAgentList, | ||
+ | |||
+ | The ModelSwarm controls the application, | ||
+ | |||
+ | @interface ModelSwarm : Swarm { | ||
+ | // [...] | ||
+ | id < | ||
+ | id world; | ||
+ | } | ||
+ | | ||
+ | // functions of the class | ||
+ | // [...] | ||
+ | stepThroughList; | ||
+ | getAgentList; | ||
+ | |||
+ | The ModelSwarm defines a scheduler of actions it will execute, and it sends " | ||
+ | |||
+ | buildActions | ||
+ | { | ||
+ | [super buildActions]; | ||
+ | id modelActions = [ActionGroup create: self]; | ||
+ | [modelActions createActionTo: | ||
+ | | ||
+ | [modelActions createActionTo: | ||
+ | if (synchronous) | ||
+ | [modelActions createActionTo: | ||
+ | | ||
+ | modelSchedule = [Schedule createBegin: | ||
+ | [modelSchedule setRepeatInterval: | ||
+ | modelSchedule = [modelSchedule createEnd]; | ||
+ | | ||
+ | [modelSchedule at: 0 createAction: | ||
+ | return self; | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | ===== space.h===== | ||
+ | |||
+ | There is a class [[http:// | ||
+ | 2D space, but each cell can have only one object, and they are referred as (x,y) coordinates. | ||
+ | They have a to do list: // Briefly, coordinates need to be elevated to the status of objects, which | ||
+ | should hopefully allow spaces of different scales and boundary conditions to interact | ||
+ | through a common reference system. In addition, other types of spaces are desired: | ||
+ | continuous coordinates, | ||
+ | |||
+ | From the paper below: //The current space library is merely | ||
+ | a suggestion of the kinds of environments a model could use: in the future, we plan to have | ||
+ | spaces with continuous values and dynamics defined by differential equations. Spaces with | ||
+ | other topologies are also crucial: three dimensions, non-discrete coordinates, | ||
+ | graph structures are all needed by applications.// | ||
+ | |||
+ | The library space provides 9 classes: | ||
+ | * GridData: basic class. getObjectAt (an agent), getValueAt (an integer value) | ||
+ | * Discrete2d: | ||
+ | * DblBuffer2d: | ||
+ | * Ca2d: abstract protocol for cellular automata | ||
+ | * Value2dDisplay: | ||
+ | * ConwayLife2d: | ||
+ | * Diffuse2d: 2d difussion with evaporation | ||
+ | * Grid2d: A 2d container class for agents. It gets most of its behaviour from Discrete2d, [and] check that you don't overwrite things by accident. Only one object can be stored at a site, no boundary conditions are implied, etc. | ||
+ | * Object2dDisplay: | ||
+ | * Int2dFiler: (deprecated) save the state of any Discrete2d: object (or a subclass thereof) to a specified file. | ||
+ | |||
+ | |||
+ | |||
+ | ===== Examples available at swarm wiki===== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | Despite the representation of the space (always a grid) and its limited functionality, | ||
+ | the programmer. For example, in the implementation of Schelling' | ||
+ | of going through the neighborhood (/ | ||
+ | |||
+ | for(i = -radius; i< radius + 1; i++) | ||
+ | { | ||
+ | int xcoord = x+i; | ||
+ | if ( xcoord< 0 || xcoord >= xsize) | ||
+ | { | ||
+ | if (edgeWrap == NO) continue; | ||
+ | else xcoord = [self wrapXCoord: xcoord]; | ||
+ | } | ||
+ | | ||
+ | for(j = -radius; j< radius +1 ; j++) | ||
+ | { | ||
+ | int ycoord = y+j; | ||
+ | if ( ycoord< 0 || ycoord >= ysize) | ||
+ | { | ||
+ | if (edgeWrap == NO) continue; | ||
+ | else ycoord = [self wrapYCoord: ycoord]; | ||
+ | } | ||
+ | if( (neighbor = [[myWorld getObjectGrid] getObjectAtX: | ||
+ | { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | //In this edition, there is also some trivial clarification/ | ||
+ | agents and the SchellingWorld. | ||
+ | " | ||
+ | Nhood2dCounters, | ||
+ | just tells SchellingWorld to remove it, or add itself. In Person.m, for example:// | ||
+ | |||
+ | [myWorld findEmptyLocationX: | ||
+ | [myWorld removeObject: | ||
+ | [myWorld addObject: self atX: newX Y: newY]; | ||
+ | |||
+ | //The SchellingWorld does the bookwork of putting agents in and out of objectGrid and also updating the | ||
+ | Nhood2dCounter objects.// But the functions of SchellingWorld are implemented by the programmer. | ||
+ | |||
+ | Note that this // | ||
+ | When an agent registers itself in some spatial location, it can be referred by any other agent that wants to | ||
+ | interact with someone in that cell. | ||
+ | |||
+ | The next example shows how an agent moves in the space. It is from the example heatbugs: | ||
+ | |||
+ | rand_move: p | ||
+ | { | ||
+ | id loc; | ||
+ | | ||
+ | do{ | ||
+ | loc=[self getRandLoc]; | ||
+ | } while([world at: loc]!=nil); | ||
+ | | ||
+ | [p moveTo: loc]; | ||
+ | return self; | ||
+ | } | ||
+ | |||
+ | __TerraME: | ||
+ | instead of searching the whole cellular space. We would need functions such as " | ||
+ | some support to randomness. | ||
+ | |||
+ | |||
+ | The creation of a group of agents, by a Model Swarm. Note that the model creates and puts it in the world. | ||
+ | |||
+ | for(i = 0; i < 100; i++) | ||
+ | { | ||
+ | StupidBug* stupidBug = nil; | ||
+ | | ||
+ | stupidBug = [StupidBug create: modelZone]; | ||
+ | [stupidBug setWorld: world]; | ||
+ | [stupidBug setRandPosition]; | ||
+ | | ||
+ | [bugList addLast: stupidBug]; | ||
+ | } | ||
+ | |||
+ | __TerraME__: | ||
+ | this moment, each agent chooses his position/ | ||
+ | |||
+ | |||
+ | =====TODO===== | ||
+ | |||
+ | Some applications using swarm: | ||
+ | |||
+ | * Schelhorn, T., O' | ||
+ | * Haklay, M., O' | ||
+ | * Batty, M., Desyllas, J. and Duxbury, E. (2003), ' | ||
+ | |||
+ | Swarm learning curve: | ||
+ | |||
+ | * Najlis, R., Janssen, M.A. and Parker, D.C. (2001), ' | ||
+ | |||
- | **Origin** | ||
- | **Year** | | ||
- | **Version** | | ||
- | **License** | ||
- | |
geopro/pedro/swarm.1183423081.txt.gz · Última modificação: 2007/07/03 00:38 por pedro