geopro:pedro:netlogo
Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
Ambos lados da revisão anteriorRevisão anteriorPróxima revisão | Revisão anterior | ||
geopro:pedro:netlogo [2007/07/06 19:23] – pedro | geopro:pedro:netlogo [2011/08/18 20:25] (atual) – pedro | ||
---|---|---|---|
Linha 34: | Linha 34: | ||
* BehaviorSpace tool used to collect data from multiple runs of a model | * BehaviorSpace tool used to collect data from multiple runs of a model | ||
- | =====Models===== | ||
+ | ===== GIS ===== | ||
+ | |||
+ | http:// | ||
+ | |||
+ | load vector GIS data (points, lines, and polygons), and raster GIS data (grids) into NetLogo. The extension supports vector data in the form of ESRI shapefiles. The shapefile (.shp) format is the most common format for storing and exchanging vector GIS data. The extension supports raster data in the form of ESRI ascii Grid files. The ascii grid file (.asc or .grd) is not as common as the shapefile, but is supported as an interchange format by most GIS platforms. | ||
+ | |||
+ | |||
+ | =====Models===== | ||
====Wolf Sheep Model==== | ====Wolf Sheep Model==== | ||
Linha 51: | Linha 58: | ||
setxy random-xcor random-ycor | setxy random-xcor random-ycor | ||
- | The second function moves it from the actual spatial position. | + | The second function moves it from the actual spatial position. |
- | of a direction | + | a direction |
for moving is called fd (forward), and the exemple shows a function of random movement | for moving is called fd (forward), and the exemple shows a function of random movement | ||
to one of four neighbours. | to one of four neighbours. | ||
Linha 63: | Linha 70: | ||
The next function stops a turtle and removes it from the model. Note that the definition | The next function stops a turtle and removes it from the model. Note that the definition | ||
- | of this function (as well as " | + | of this function (as well as " |
- | to agents. | + | to agents, breaking the oo concept. |
to death ;; turtle procedure | to death ;; turtle procedure | ||
Linha 70: | Linha 77: | ||
if energy < 0 [ die ] | if energy < 0 [ die ] | ||
end | end | ||
- | |||
One wolf catches sheeps that stand in the same cell that it is. Note the predicate " | One wolf catches sheeps that stand in the same cell that it is. Note the predicate " | ||
- | the way that agents can exchange information: | + | the way that agents can communicate: |
to catch-sheep | to catch-sheep | ||
Linha 82: | Linha 88: | ||
end | end | ||
- | It is interesting the idea of ask, because it means that the agent is sending an information to another, | + | It is interesting the idea of an "ask," |
- | but in terms of implementation it is executing the code using another agent. | + | to another, but in terms of implementation it is executing the code using another agent. |
ask turtles [set sex (random 2)] | ask turtles [set sex (random 2)] | ||
Linha 89: | Linha 95: | ||
__TerraME: | __TerraME: | ||
- | ForEachAgent(cs, function(agent) | + | ForEachAgent(cellularSpace, function(agent) |
agent.sex = math.random(2) | agent.sex = math.random(2) | ||
end) | end) | ||
- | Question: can an agent get the result of an ask? (I didn't find any example.) Is that useful? | + | (or something like agent.setSex(...)). |
+ | (I didn't find any example.) Is that useful? | ||
Agents are not free to reason. The main function "to go" dictates all the agenda | Agents are not free to reason. The main function "to go" dictates all the agenda | ||
- | of each class of agents. At least " | + | of each class of agents. |
to go | to go | ||
Linha 117: | Linha 124: | ||
display-labels | display-labels | ||
end | end | ||
- | |||
- | |||
- | Sincerely, I don't believe lisp is a good language for teaching programming for children, as presented by the same | ||
- | author in the papers below. | ||
- | |||
Linha 140: | Linha 142: | ||
time someone arrives or leaves it, and the programmer could implement the | time someone arrives or leaves it, and the programmer could implement the | ||
functions to be activated. | functions to be activated. | ||
+ | |||
+ | |||
+ | ====Communication==== | ||
+ | |||
+ | {{ http:// | ||
+ | |||
+ | |||
+ | to interact | ||
+ | ;; interact with Von Neumann neighborhood | ||
+ | ask turtles-on neighbors4 [ | ||
+ | ;; the commands inside the ASK are written from the point of view | ||
+ | ;; of the agent being interacted with. To refer back to the agent | ||
+ | ;; that initiated the interaction, | ||
+ | set meet meet + 1 | ||
+ | ;; do one thing if the individual interacting is the same color as me | ||
+ | if color = [color] of myself [ | ||
+ | ;; record the fact the agent met someone of the own color | ||
+ | set meetown meetown + 1 | ||
+ | ;; if I cooperate then I reduce my PTR and increase my neighbors | ||
+ | if [cooperate-with-same? | ||
+ | set coopown coopown + 1 | ||
+ | set [PTR] of myself [PTR] of myself - cost-of-giving | ||
+ | set PTR PTR + gain-of-receiving | ||
+ | ] | ||
+ | ] | ||
+ | ;; [...] | ||
+ | ] | ||
+ | |||
+ | |||
+ | Much effort for little results. If the implementation followed the idea of reading data from the neighbours and write only in | ||
+ | itself, instead of one agent sends a message to its neighbours to increment the value of " | ||
+ | "for each neighbour" | ||
+ | work, and perhaps it would be necessary to have a third agent, a " | ||
+ | |||
+ | |||
+ | |||
+ | ====Car Cruising model: A GIS Example==== | ||
+ | |||
+ | {{ http:// | ||
+ | \\ | ||
+ | |||
+ | Presented [[http:// | ||
+ | |||
+ | A good example of where GIS can be introduced into a model, is for dynamic car cruising within the Santa Fe downtown area. | ||
+ | |||
+ | The background map of the model is the result of converting GIS data into an image, initially a jpeg file. It was then converted into a text format image file: PPM (portable pix map) consisting of three RGB values for each pixel. These were converted into NetLogo color values using the import-ppm procedure. The data was cleaned up a bit within Netlogo itself with the cleanup-map procedure, then written to an external data file via the export-dat procedure. Finally, for this version of the model, the data written out in the preceeding step was cut & paste into the model as an array of integer values. | ||
+ | |||
+ | The model itself simply manages automobiles driving on the map staying on the " | ||
+ | |||
+ | __TerraME__: | ||
===== Papers ===== | ===== Papers ===== | ||
Linha 146: | Linha 198: | ||
|U. Wilensky, 2001| Proceedings of EuroLogo|[[http:// | |U. Wilensky, 2001| Proceedings of EuroLogo|[[http:// | ||
- | {{ http:// | + | {{http:// |
\\ | \\ | ||
Linha 157: | Linha 209: | ||
The paper describes two models. The first is the model of predator/ | The paper describes two models. The first is the model of predator/ | ||
- | (the same example used in a paper that describes [[geopro: | + | (the one cited above, and the same example used in a paper that describes [[geopro: |
The second model studies the trajectory of gas particles in a box, as shown in the figure. | The second model studies the trajectory of gas particles in a box, as shown in the figure. | ||
//The yellow zig-zag line traces the movement of a single particle.// | //The yellow zig-zag line traces the movement of a single particle.// | ||
+ | |||
Linha 183: | Linha 235: | ||
//Finished models can be published on the web as Java applets.// | //Finished models can be published on the web as Java applets.// | ||
- | //NetLogo includes a still evolving tool called BehaviorSpace that allows “parameter sweeping, | + | //NetLogo includes a still evolving tool called BehaviorSpace that allows “parameter sweeping, |
- | a range of parameter settings.// | + | |
- | The space is not fixed to a cellular space, one can use the turtles to represent nodes and edges in a network, | + | The space is not fixed to a grid, one can use the turtles to represent nodes and edges in a network, |
as shown in the graph on the right. | as shown in the graph on the right. | ||
+ | Networks can be read from external text files. | ||
//There are many language elements for talking about space and spatial relations: towards, distance, neighbors, forward and back, left and right, | //There are many language elements for talking about space and spatial relations: towards, distance, neighbors, forward and back, left and right, |
geopro/pedro/netlogo.1183749834.txt.gz · Última modificação: 2007/07/06 19:23 por pedro