mparker | 6e96f89 | 2009-12-15 22:52:46 +0000 | [diff] [blame] | 1 | <?xml version='1.0' encoding='utf-8' ?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 | <title>Escape</title> |
| 7 | </head> |
| 8 | <body> |
| 9 | <h1 id="Overview">Overview</h1> |
| 10 | <p>Escape is a full-featured Agent-Based Modeling (ABM) integrated development environment (IDE) with a Java based |
| 11 | API and end user modeling tools. It's based on Ascape, which has been in use for more than 10 years. The core API is |
| 12 | very stable, and that should give users a way to explore the features of AMP without concerns about keeping in synch |
| 13 | with the rapidly evolving AXF /AGF API. It allows modelers to code in Java and/or generate models with AMF and then |
| 14 | execute those models within the same development environment.</p> |
mparker | 3a32197 | 2009-12-16 23:07:24 +0000 | [diff] [blame^] | 15 | <p><img src="image/AMPScreenshot.png" /></p> |
mparker | 6e96f89 | 2009-12-15 22:52:46 +0000 | [diff] [blame] | 16 | <p>A primary purpose of the Escape project -- apart from the obvious goal of providing a nice Eclipse hosted ABM |
| 17 | toolkit -- is to provide an exemplar to demonstrate how any arbitrary agent modeling framework can be integrated within |
| 18 | the AMP environment. A cool aspect of this is that AMP has no dependencies on Escape, but also that the underlying ABM |
| 19 | modeling framework for Escape has no dependencies on AMP -- instead Escape simply provides the runtime glue between AMP |
| 20 | and the ABM framework. The underlying ABM framework uses the Ascape API, an API that first began development more than |
| 21 | ten years ago and that has not been modified at all in order for it to work within the AMP environment.</p> |
| 22 | <p>(Well, not quite.. Ascape was refactored into separate non-UI core and a Swing UI projects. This involved a bit |
| 23 | of repackaging, but was really straightforward as Ascape follows a strict MVC architecture. Note that currently Escape |
| 24 | is bulkier than it will eventually be -- over time we will be generalizing more aspects of Escape into the AMP AXF and |
| 25 | AGF components.)</p> |
| 26 | <h1 id="Getting_Started">Getting Started</h1> |
| 27 | <h3 id="Documentation_and_other_Resources">Documentation and other Resources</h3> |
| 28 | <p>Because it's API is based on Ascape, Escape is one component of AMP that already has extensive documentation. |
| 29 | There is complete Javadoc as well as a manual and other web resources. See the <a href="http://ascape.sourceforge.net">Ascape |
| 30 | Website</a> to locate these resources. The documentation on the main page is a good place to start. It's written for Ascape |
| 31 | so ignore all of the bits about project setup, and a lot of the UI is different, but the basics apply to Escape just as |
| 32 | well. The <a href="http://ascape.sourceforge.net/docs/TheAscapeManual5.pdf">Ascape Manual</a> written by Damon Centola |
| 33 | should be very helpful. Take a look at the conversion link below for ideas on how to make the models form the manual |
| 34 | work under Ascape. (Converting these models is a great opportunity for a community contribution!)</p> |
| 35 | <h2 id="Installation">Installation</h2> |
| 36 | <p>Escape is <a href="http://eclipse.org/amp/installing/">installed</a> by default with the other model components. |
| 37 | If you want to do 3D (really 2 1/2) visualizations, you will want AGF3D and the LWJGL dependency. You can build from |
| 38 | source but in that case you'l need to launch a self-hosted runtime, so it's best to simply install from the update site |
| 39 | if you're not actually doing AMP development.</p> |
| 40 | <h2 id="Exploring_Example_ABM_Models">Exploring Example ABM Models</h2> |
| 41 | <p>The first thing most people will want to do in AMP is to play with the example models. You don't need to do any |
| 42 | programming for this, and the setup is really straightforward. Of course, the first think you'll need to do is <a |
| 43 | href="http://eclipse.org/amp/installing">Install AMP</a>. (You don't need any of the optional components unless you |
| 44 | want to play with the 3D visualizations, Ascape, or Repast.) You can explore AMF models as well as some really |
| 45 | interesting classic ABM models.</p> |
| 46 | <h3 id="AMF_Models">AMF Models</h3> |
| 47 | <p>There are a number of models developed with AMF that can automatically generate example models to run in Escape. |
| 48 | There are two ways to run the example models:</p> |
| 49 | <h4 id="Setup_Escape_Projects">Setup Escape Projects</h4> |
| 50 | <h5 id="Creating_a_New_Escape_Project">Creating a New Escape Project</h5> |
| 51 | <p>The best option is to simply create a new Escape project and drag the models into it! We're working on a simple |
| 52 | cheat sheet for this, but until then, just follow these simple steps:</p> |
| 53 | <ol> |
| 54 | <li>If you're not already there, open the Agent Modeling Perspective. Select Window : Open Perspective : |
| 55 | Other.. and then Agent Modeling. (Or you can choose Window : Reset Perspective and the Agent Modeling perspective |
| 56 | should appear in the Open Perspective list itself.)</li> |
| 57 | <li>Next, let's create the project where we'll place our model. Select File : New : Escape AMF Project. Give it |
| 58 | a name like "escape.tutorial", then click Finish.</li> |
| 59 | <li>Finally grab the Epidemic.metaabm model at <a |
| 60 | href="http://download.eclipse.org/amp/models/Epidemic.metaabm">http://download.eclipse.org/amp/models/Epidemic.metaabm</a> |
| 61 | and drag it into the project. (Depending on your browser the file may load as text directly into your browser, in |
| 62 | which case just right-click on the link and save it to a file.)</li> |
| 63 | </ol> |
| 64 | <h5 id="Using_an_Pre-Built_Example_Project">Using an Pre-Built Example Project</h5> |
| 65 | <p>If you get really stuck somewhere, you can also get ready made projects from CVS. See <a |
| 66 | href="http://eclipse.org/amp/developers/repositoryDetails.php">this page</a> for information on CVS setup. The |
| 67 | project for Escape example models are located at:</p> |
| 68 | <pre>org.eclipse.amp/org.eclipse.amp.amf/examples/org.eclipse.amp.amf.examples.escape |
| 69 | </pre> |
| 70 | <h4 id="Run_the_Model">Run the Model</h4> |
| 71 | <p>Right-click on the model, and select "Execute"! You should see something like this:</p> |
mparker | 3a32197 | 2009-12-16 23:07:24 +0000 | [diff] [blame^] | 72 | <p><img src="image/EpidemicModelRunning.png" /></p> |
mparker | 6e96f89 | 2009-12-15 22:52:46 +0000 | [diff] [blame] | 73 | <p>We're working on more end-user documentaiton, but hopefully you'll find model control pretty self-explanatory. |
| 74 | The toolbar buttons allow you to control model execution.</p> |
mparker | 3a32197 | 2009-12-16 23:07:24 +0000 | [diff] [blame^] | 75 | <p><img src="image/EpidemicModelControls.png" /></p> |
mparker | 6e96f89 | 2009-12-15 22:52:46 +0000 | [diff] [blame] | 76 | <p>From right to left, you can start, restart, pause, step, stop and close a model. You can even run multiple models |
| 77 | and control them independently. You can also move views around, close them and so on as with any other Eclipse views. |
| 78 | Here we're running two separate models for comparison.</p> |
mparker | 3a32197 | 2009-12-16 23:07:24 +0000 | [diff] [blame^] | 79 | <p><img src="image/EpidemicModelComparison.png" /></p> |
mparker | 6e96f89 | 2009-12-15 22:52:46 +0000 | [diff] [blame] | 80 | <p>If you want to find out more about an agent, show the properties view, and click on agent.</p> |
mparker | 3a32197 | 2009-12-16 23:07:24 +0000 | [diff] [blame^] | 81 | <p><img src="image/EpidemicModelAgentProperties.png" /></p> |
mparker | 6e96f89 | 2009-12-15 22:52:46 +0000 | [diff] [blame] | 82 | <p>You can experiment with different parameters (settings) for models by then clicking in the gray area away within |
| 83 | the view.</p> |
mparker | 3a32197 | 2009-12-16 23:07:24 +0000 | [diff] [blame^] | 84 | <p><img src="image/EpidemicModelProperties.png" /></p> |
mparker | 6e96f89 | 2009-12-15 22:52:46 +0000 | [diff] [blame] | 85 | <p>There are a number of other things to play around with, such as zooming the agent view or selecting other chart |
| 86 | series to display using the Chart Customizer, so just explore. You can always close an active model by clicking on the |
| 87 | close toolbar button. Or if you can't access the models controls for some reason, you can open the progress view and |
| 88 | close projects form there.</p> |
| 89 | <h4 id="Next_Steps">Next Steps</h4> |
| 90 | <p>Other models are located at: (to do)</p> |
| 91 | <p>To understand the capabilities of AMF, you might also want to try out running the same models automatically |
| 92 | generated for Ascape or Repast.</p> |
| 93 | <pre>org.eclipse.amp/org.eclipse.amp.amf/examples/org.eclipse.amp.amf.examples.ascape |
| 94 | org.eclipse.amp/org.eclipse.amp.amf/examples/org.eclipse.amp.amf.examples.repast |
| 95 | </pre> |
| 96 | <h3 id="Classic_Java_ABM_Models">Classic Java ABM Models</h3> |
| 97 | <p>Many models have been created using Ascape over the years, including all of the classic models created at |
| 98 | Brookings and some other cool models such as Craig Reynold's Boids and a pretty cool little traffic model, and they've |
| 99 | all been converted to run in Escape. They're in Java but you can execute and explore them in exactly the same way as the |
| 100 | Epidemic model above. All of the Ascape example models have been converted (a straightforward process) from their intial |
| 101 | Ascape incarnations. For licensing reasons (they're BSD, not EPL) we can't host them directly on the Eclipse site. You |
| 102 | can get the projects in two ways:</p> |
| 103 | <h4 id="From_Project_Archive">From Project Archive</h4> |
| 104 | <ul> |
| 105 | <li>Download the Escape examples zip from the Ascape sourceforge site: <a |
| 106 | href="http://sourceforge.net/projects/ascape/files/Escape/5.2.0/EscapeExamples.zip/download">http://sourceforge.net/projects/ascape/files/Escape/5.2.0/EscapeExamples.zip/download</a> |
| 107 | </li> |
| 108 | <li>Unzip the file.</li> |
| 109 | <li>Import them into your workspace. For help, see <a |
| 110 | href="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jst.j2ee.doc.user/topics/ph-projects.html">this |
| 111 | page</a>.</li> |
| 112 | </ul> |
| 113 | <h4 id="From_SVN">From SVN</h4> |
| 114 | <ul> |
| 115 | <li>Import the SVN projects from the sourceforge SVN. For help, see <a |
| 116 | href="/http://www.eclipse.org/subversive/documentation/teamSupport/find_check_wiz.php_this_page" |
| 117 | title="http://www.eclipse.org/subversive/documentation/teamSupport/find_check_wiz.php this page">http://www.eclipse.org/subversive/documentation/teamSupport/find_check_wiz.php |
| 118 | this page</a>.</li> |
| 119 | </ul> |
| 120 | <pre>http://ascape.svn.sourceforge.net/svnroot/ascape/org.ascape.escape.models.brook |
| 121 | http://ascape.svn.sourceforge.net/svnroot/ascape/org.ascape.escape.models.examples |
| 122 | </pre> |
| 123 | <p>Once you've downloaded the projects, open up the src folder and navigate to the Java files for the actual models. |
| 124 | For example, to run Conway's Life, you'll want src/edu.brook.life.ConwayLife. Right-click on the Java file and select |
| 125 | "Execute". There are many models to explore! (It's not always obvious which Java files are for models, so you may have |
| 126 | to poke around a bit. We need to put together a catalog here. Another nice opportunity for user contributions.)</p> |
| 127 | <h2 id="Developing_Models">Developing Models</h2> |
| 128 | <p>The easiest way for Java developers to get started doing agent-based modeling in Eclipse is to begin to write |
| 129 | programs using it.To develop new models, you can:</p> |
| 130 | <ol> |
| 131 | <li>Create a new Escape project. The Escape projects are actually configured for AMF code generation so there |
| 132 | are dependencies and builders in there that you don't need; you can remove all of the escape builders and any of the |
| 133 | kitchen sink items. We'll try to get a POJO Escape project wizard out there at some point.</li> |
| 134 | <li>But it might be simpler to just create a new Plugin Project and add the necessary dependencies there. Have |
| 135 | a look at the example escape project to see what you need. Note that you will likely need more dependencies then you |
| 136 | need to simply build -- this is because the class loader uses the classes from the project path and so runtime |
| 137 | classes have to be there as well. We may simply package an Eclipse runtime convenience plugin to gather these |
| 138 | dependencies up a bit.</li> |
| 139 | </ol> |
| 140 | <p>Then just create new Java classes for your root model scape and agents just as you would for an Ascape project.</p> |
| 141 | <h1 id="Reference">Reference</h1> |
| 142 | <h2 id="Converting_Existing_Ascape_models">Converting Existing Ascape models</h2> |
| 143 | <p>There are only a few changes should have to make to existing Ascape models or to use existing Ascape |
| 144 | documentation to develop Escape models.</p> |
| 145 | <h4 id="Model">Model</h4> |
| 146 | <p>The core model is completely API compatible. No changes!</p> |
| 147 | <h4 id="View">View</h4> |
| 148 | <p>Because Escape uses SWT and Ascape uses Swing, there are a few unavoidable incompatibilities. Most of these we |
| 149 | avoid by using higher level APIs but here are the key changes that you're likely to have to make:</p> |
| 150 | <h5 id="Convert_the_low-level_imports_from_AWT_and_Swing_to_SWT">Convert the low-level imports from AWT and Swing |
| 151 | to SWT</h5> |
| 152 | <p>The simplest way to accomplish this is to remove all of the imports and then organize imports. For example:</p> |
| 153 | <pre>java.awt.Color <b>to</b> org.eclipse.swt.graphics.Color |
| 154 | java.awt.Graphics <b>to</b> org.eclipse.draw2d.Graphics |
| 155 | </pre> |
| 156 | <p>Then just do a global find for all of the imports and replace them with nothing. This is a great place for a |
| 157 | regexp. Try:</p> |
| 158 | <pre>find: import java\.awt\.(.*); |
| 159 | replace: [nothing] |
| 160 | </pre> |
| 161 | <p>You don't have to replace these with the SWT equivalents, just click on the project, right-click and choose |
| 162 | "Source:Organize Imports.." By the way, a great way to avoid having to select the right entries in optimize imports and |
| 163 | to alert you when you have missed anything is to prevent the awt and swing classes from being used at all. Right-click |
| 164 | on project, choose "Build Path:Configure Build Path", go to Libraries tab, open JRE System Library, choose "Access |
| 165 | Rules", edit, and then add entries for java/awt/** and javax/swing/**. The code will regenerate and you'll have error |
| 166 | markers for all of the stuff that won't work with Escape and Eclipse.</p> |
| 167 | <h5 id="Convert_color_features">Convert color features</h5> |
| 168 | <p>You can't use AWT colors either so you'll need to replace any colors. AMP provides a convenience classes for |
| 169 | Colors called ColorFeature and ColorFeatureConcrete. You can use these or any of the other ways to define SWT colors. |
| 170 | For example:</p> |
| 171 | <pre>Color.lightGray <b>to</b> ColorFeature.LIGHT_GRAY |
| 172 | new Color(Math.min(1.0f, (float) (redEnergy + orangeEnergy)), (float) orangeEnergy * .8f, (float) blueEnergy) <b>to</b> |
| 173 | ColorFeatureConcrete.create(Math.min(1.0f, (float) (redEnergy + orangeEnergy)), (float) orangeEnergy * .8f, (float) blueEnergy) |
| 174 | </pre> |
| 175 | <h5 id="Change_agent_color_getters">Change agent color getters</h5> |
| 176 | <p>If you've defined colors through overriding Agents as in most models, you'll need to change the method signature. |
| 177 | You could just do a global replace for this one.</p> |
| 178 | <pre>public Color getColor( <b>to</b> public Object getPlatformColor( |
| 179 | </pre> |
| 180 | <h5 id="Get_rid_of_image_features">Get rid of image features</h5> |
| 181 | <p>Escape doesn't support them. In practice they haven't been used a lot. At some point perhaps we'll have nice |
| 182 | sprite support instead. :)</p> |
| 183 | <pre>public Image getImage() {**} <b>to</b> "" |
| 184 | </pre> |
| 185 | <h5 id="Modify_usages_of_DrawFeatures">Modify usages of DrawFeatures</h5> |
| 186 | <p>If you've created any of your own draw features, you'll need to change them slightly to accommodate the |
| 187 | differences between the AWT and SWT / Draw2D APIs. This should be pretty straightforwrd. For example:</p> |
| 188 | <pre>g.setColor(... |
| 189 | g.fillOval(.. |
| 190 | becomes: |
| 191 | g.setBackgroundColor( |
| 192 | g.fillOval(.. |
| 193 | </pre> |
| 194 | <p>That's about it, though it's probable that we've missed something. Please post a message on the amp newsgroup if |
| 195 | you run into any other conversion issues.</p> |
| 196 | <h4 id="Configuration">Configuration</h4> |
| 197 | <p>Instead of using Ant, Escape has really nice support for parameterizing and testing models. See <a |
| 198 | href="/wiki/Experimenting_and_Testing" title="Experimenting and Testing">Experimenting and Testing</a> (todo). If |
| 199 | you do want to work with ant you will need to install the plugins from the Sourceforge download site. (These have |
| 200 | dependencies that I didn't want to bother with going through the Eclipse IP process to get in. If for some reason you |
| 201 | think these should be part of core Escape let Miles know and I'll take care of it.) Ant has not been tested for Escape |
| 202 | so it's not even clear it will work.</p> |
| 203 | <h2 id="Current_Limitations">Current Limitations</h2> |
| 204 | <ol> |
| 205 | <li>Escape is pretty robust, and the APIs are solid and well-tested but the runtime is not going to be as |
| 206 | stable for a while as Ascape which has been around for a long time.</li> |
| 207 | <li>Escape graphics performance is generally slower especially for charts. But on the other hand you can run |
| 208 | multiple models at once and the headless models should perform just as well as console launched Ascape programs. In |
| 209 | practice this shouldn't affect your normal model exploration work.</li> |
| 210 | <li>We don't have the speed slider working yet. See <a |
| 211 | href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291299">https://bugs.eclipse.org/bugs/show_bug.cgi?id=291299</a> |
| 212 | </li> |
| 213 | <li>Charts only support time series, not histograms and pie. See <a |
| 214 | href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282953">https://bugs.eclipse.org/bugs/show_bug.cgi?id=282953</a> |
| 215 | </li> |
| 216 | </ol> |
| 217 | </body> |
| 218 | </html> |