Agent Based modeling in ArcGIS with Agent Analyst (RePast)

12 Oct

I love agent based modeling. I have tried to write agents by hand in classes and then use them to call arcpy to get data. Not a smart or efficient way to go about things. Why reinvent the wheel when there are already some great libraries that handle a lot of the work for you. I want my model to integrate with GIS – because I have tons of data already in GIS and because I need a graphical representation of the model and I do not want to program it by hand.

Agent Analyst is the solution.

There is  even a free book with exercises and data. Simple to install and the book is excellent. I skipped ahead a little for my first model and made agents move randomly, write the agent out and refresh the display.  The example will make more sense if you read the book. Here is my code:

In the Agent, the step() function calls self.move()

def move():

coordinate=self.the_geom.coordinate
rand1=Random.uniform.nextIntFromTo(-500,500)
rand2=Random.uniform.nextIntFromTo(-100,300)
coordinate.x=coordinate.x+rand1
coordinate.y=coordinate.y+rand2

The agents just move in a random direction.

In the Model you need the following functions:

def updateDisplay():
self.updateGISDisplay()

def writeAgents():
self.writeAgents(self.myagents,”C:\Users\Me\Desktop\myagent.shp”)

Then in the Environment, you must schedule the writeAgents() then the updateDisplay() functions.

Not the most detailed post, but I have just started playing and wanted to let you know this tool is out there.

Advertisements

3 Responses to “Agent Based modeling in ArcGIS with Agent Analyst (RePast)”

  1. Ali Imran April 20, 2014 at 11:13 pm #

    Thanks for sharing use full information about agent analyst.
    I am working on this tool, I have to make a model for location suitability scenario, i am working on raster data as well as some vector data.
    I want to discuss some problem that I am facing regarding this tool.
    if you contact me it would be very helfull for me.
    Looking forward for your reply

    Best Regards
    Ali Imran

    • saeid May 18, 2016 at 3:47 pm #

      Hi
      I’m Iranian. Can you help me?
      I must work on migration model by Agent Analyst

      • paulcrickard May 18, 2016 at 10:15 pm #

        I played with it a little but am no expert. What are you needing to do? A little more detail. And where Re you stuck? email me paulcrickard (at) gmail.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: