{"data":{"markdownRemark":{"html":"<h1 id=\"building-a-simple-economy-model\"><a href=\"#building-a-simple-economy-model\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Building a Simple Economy Model</h1>\n<p>In this exercise you will build a very basic simulation model containing a single agent type with only a single variable. The model you will build will consist of simple agents that have a wallet and the ability to randomly select another agent at each step and send them £1. If an agent has run out of money, they must wait until they receive more money before they can randomly send money again.</p>\n<p>The flow of the model is as such:</p>\n<ol>\n<li>Initialize Simple Agents with <code class=\"language-text\">wallet</code> parameter and fully connect them to all other agents. (only at beginning)</li>\n<li>Each Simple Agent chooses another agent in the system at random and sends them £1.</li>\n<li>Each Simple Agent that has a message will accumulate the value of the messages and increment their wallet.</li>\n</ol>\n<p>if at any point a Simple Agent does not have money, it must wait until it receives money from another agent before it can resume sending.</p>\n<p>The Simudyne SDK uses a message passing framework to handle the communication between agents. It may differ from other frameworks you've used previously and this challenge will help you grasp the fundamentals of defining a model, agents, links, messages and actions with the Simudyne SDK.</p>\n<p>The output of this model is quite simple but is an example of how wealth distribution can emerge from a single simple set of interactions.</p>\n<p>Below is a starter project that contains the necessary files to get started as well as an answer key should you require any assistance or want to validate the results.</p>\n<a href=\"https://simudynecontent.blob.core.windows.net/$web/2.6.0-RC4/simple_econ_challenge_tbc_2.6.0-RC4.zip\" class=\"ui button primary\" download>\n\tDownload Challenge Base Model</a>\n<a href=\"https://simudynecontent.blob.core.windows.net/$web/2.5.0/simple_econ_challenge_complete_2.5.0.zip\" class=\"ui button primary\" download>\n\tDownload Answer Key</a>\n<p>The exercise consists of 3 parts and should take no longer than 2 hours to complete:</p>\n<ol>\n<li>Defining main model class</li>\n<li>Defining agents &#x26; network</li>\n<li>Defining behaviors</li>\n</ol>\n<p>Each section contains a set of numbered <code class=\"language-text\">TODOs</code> that you will need to complete in order to successfully complete the challenge.</p>\n<p>Below is a diagram to help visualize the flow of money in each step, every step consists of a check to see if the agent has money, if true, then the agent sends £1 to another agent at random. Agents can receive multiple payments in a single step, but can only send 1 at a time.</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 100.374531835206%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsSAAALEgHS3X78AAADNUlEQVQ4y4VUS2sUQRgcvHgS/4B4EhEkCCqo+BMUJR7EF/kFRgXxgeJJUYh4ED0oqKCIBxGNCEpIgg9EMRIFoyRKNmbJ7mZ3s8/Z6cfs7GzZ1Z19JAoemumZ6a6qr77q9pRS0FqhXtcIQw2+CyEgpUAgJKK6QKksUam6uTDf+M89/x5eoVBGLl9EKpVDKp1DsVgxoBJBINCIBH7OKGzeH2PboRizKYl6aIiCDuhyYG8+W8DERAIjo18wNDxugPNWqV8TiBsCg6MaK7cAKzYBox810HSALbBaIJeo9qhGa41mHAJQCE35uXwJv6YzKFUUqr7AwL0QNx+FFqhckW2FHCTQqmOFFxi/Qi2QyQq8+6wwn5PI5gWKpZr1kIsBN5QUbVC/5sbrTwqFkjRVLSokqjKb9p1owNsAXLxVt5sDW5JTUTQbqtVWWQ4UscD563W75+DpqN0wC8gG7O03gBuBCzccYC3olFE0Xa76bq6ktP6yOSevRnbPnqMNW6UFJBu7OZWQePBc24j4vosJF1A91ZCEXs8mc5ieyRtCjXxB4P6gtt2nwsApNMymDCGV6apsM9EfesX5nSchHr7QyC5I43FgCAMbEa5txiQSbXs8TsJQITlXQCpTbQebQFT18q3G6h3Aqu3AmzFlvskuf6X1t1br+NsG/J3MG8CKPTX8WS77YALGvyus2xWjpzfGZEItUUNSdtj3lwA6nyq+CW1ML6TxpoYfk3OWnd4k09KeGG0yW646fxnoZsN5ywPgqhKuKfzx+JVG37kIH74q2xiWwdC3yicJu8tvruMSY98UjpyNMPReW1CmxaM6St7ZF8NbA/RfjhZj48AYk1JZYHJqzpC4ZnAj1xDMWwtsPRAvLZllXbpdx/rdMZ6NaJuxjtGuxELRkZBACHM7hdJ0PjT+NjFwN7TRswpbHvLosBT+aEWG7yRjmRyhJRJIZ8pYKAoLWqkKu6atsPsaap3V1l3IOUPbe7yBw2cipLPKnPMA04m0VdPZ09WU7qune7Bk+vR0WNury+uBzSQ9VNo9WyDdw1t+43YT0Aqe42NXIpy6VrckzGG3ov8CLgfl8eKdt/zeE+LfCv8AyszLuTiciQAAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-8e416.webp 173w,\n/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-0b506.webp 345w,\n/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-58be5.webp 690w,\n/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-a2582.webp 801w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-7e3fa.png 173w,\n/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-7f1d4.png 345w,\n/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-13856.png 690w,\n/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-8d81a.png 801w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-13856.png\"\n          alt=\"diagram simple econ\"\n          title=\"\"\n          src=\"/static/diagram_simple_econ-3b5b385467c79aaf33f4f18c8f9ecf0d-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<h2 id=\"defining-the-main-model-class\"><a href=\"#defining-the-main-model-class\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Defining the Main Model Class</h2>\n<p>In this section you will define the main model class that contains the 2 main functions of your agent-based model: the <code class=\"language-text\">step()</code>  and the <code class=\"language-text\">setup()</code></p>\n<h3 id=\"step-1-the-global-state\"><a href=\"#step-1-the-global-state\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Step 1: The Global State</h3>\n<p>All the agents in your model are connected to the same Global State. This Global State class is accessible to every single agent in the system, making it the ideal place to store system level parameters or data structure that you would expect all of your agents in the system to have access to.</p>\n<p>Agents can access the GlobalState by calling <code class=\"language-text\">getGlobals()</code>.</p>\n<p>Open the starter model project that you downloaded above, it should contain a structure that looks like the image below:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 55.82785415421399%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABPUlEQVQoz5WS23KCMBCGeRkIERUQ5BTCwQOOUrUv0Kte9P2f4O8mNbRTY8defLObZfPNDlnndLmgG0b0RLMZkBclkjRDlpeohEQpaoi60bkhKysUpcA6KzSpinRP1Zz9eMXuOEKSbF1U8FwXjDF4nke4Gtd1p/wLT8PYLd7Ovu/DEcc3iNcPyOs74vqsm9SHe9iD+jecz+DU/QBJU7bjCSmNrKYzDSbn6kzNvs/hM7tY9XLO4bTDAeP1BU3fIc2LO2EQBAijFWaLSEvZM8Lj+YwNRZtwPp9jlazBg8X0O2zSSVg1HRSi21iFqklJ1aTsgcwqrC1C02jQtZ+5TVi3/Z/C/6BfWfZblLKFaEmY5XoPzZ49gv3G7COjPez3B3TbPbrdgEo2iOIV4iShl42wDEMiuhFOcbG0QPU4TfEJpjtTZKCUn3sAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-8e416.webp 173w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-0b506.webp 345w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-58be5.webp 690w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-59b8d.webp 1035w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-4a474.webp 1380w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-bc809.webp 2070w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-aaf04.webp 3346w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-7e3fa.png 173w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-7f1d4.png 345w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-13856.png 690w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-045bb.png 1035w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-f46ab.png 1380w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-ea5f6.png 2070w,\n/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-75ffd.png 3346w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-13856.png\"\n          alt=\"project screenshot\"\n          title=\"\"\n          src=\"/static/project_screenshot-e97412cb3363b91d98896af8ea48ba9a-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>The project already has your classes and structure of those classes pre-defined for you so you will just need to start with your first TODO. </p>\n<p>This section contains 2 <code class=\"language-text\">TODOs</code>:</p>\n<ol>\n<li>Add a field of type <code class=\"language-text\">long</code> to store the number of Simple Agents for your simulation</li>\n<li>Add a field of type <code class=\"language-text\">int</code> to store the starting value of the wallets of the simple agents</li>\n</ol>\n<h4 id=\"todo-1-number-of-agents\"><a href=\"#todo-1-number-of-agents\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 1 (Number of Agents)</h4>\n<p>Add a field of type <code class=\"language-text\">long</code> with a starting value of 100.</p>\n<p>Tag the field with an <code class=\"language-text\">@Input</code> annotation. This annotation will expose the field to the console making it easier to modify between runs.</p>\n<h4 id=\"todo-2-starting-wallet\"><a href=\"#todo-2-starting-wallet\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 2 (Starting Wallet)</h4>\n<p>Add a new field of type <code class=\"language-text\">int</code> with a starting value of 100.</p>\n<p>Tag the field with an <code class=\"language-text\">@Input</code> annotation.</p>\n<p>This value will be used when generating your Simple Agents, so you can modify the starting wallet from the console.</p>\n<h2 id=\"defining-agents--network\"><a href=\"#defining-agents--network\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Defining Agents &#x26; Network</h2>\n<p>In this section you will generate a Group of agents and connect them to one another. This functionality is contained in the <code class=\"language-text\">setup()</code> method and can either be data driven, where the agents and network are generated automatically from a data source, or they can be generated using built in topologies that are common in many agent-based models.</p>\n<h3 id=\"the-setup\"><a href=\"#the-setup\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Setup</h3>\n<p>The <code class=\"language-text\">setup()</code> is executed right at initialization and is where all the logic for the generation of your agent populations is located.</p>\n<p>The general structure of this function is to first generate groups and then connect those groups using a topology generator. These groups of agents can be generated from data or directly defined in your logic.</p>\n<p>This section contains 3 <code class=\"language-text\">TODOs</code>:</p>\n<ol>\n<li>Generate a Group of Simple Agents</li>\n<li>Fully connect the Group of Simple Agents</li>\n<li>Register your agent and link with the model schema</li>\n</ol>\n<h4 id=\"todo-3-generate-a-group\"><a href=\"#todo-3-generate-a-group\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 3 (Generate a group)</h4>\n<p>Add a field of type <code class=\"language-text\">Group&lt;SimpleAgent&gt;</code> and assign it using the <code class=\"language-text\">generateGroup()</code> feature. More info on group generation can be found here <a href=\":version/reference/agents/creation\">Groups</a>.</p>\n<p>Note that this functions takes in 2 arguments:</p>\n<ol>\n<li>The class of agent you want to generate in the group</li>\n<li>The number of agents that you want to generate in that group</li>\n</ol>\n<p>Once you have the above completed, open a lambda and assign the field called <code class=\"language-text\">wallet</code> on the agents with the value you created above in the Globals. (use <code class=\"language-text\">getGlobals()</code> to access the variable)</p>\n<h4 id=\"todo-4-connect-the-group\"><a href=\"#todo-4-connect-the-group\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 4 (Connect the group)</h4>\n<p>Connections between agents can either be created by ingesting data on the network or by using one of the common topology generators built into the SDK.</p>\n<p>In this instance we will use a built-in topology generator called <code class=\"language-text\">fullyConnected()</code>. More on topologies can be found here <a href=\":version/reference/agents/connection\">Connections</a>.</p>\n<p>Use <code class=\"language-text\">fullyConnected()</code> to connect all of your agents. Notice that this function requires 2 arguments: a target group and a class of Link to establish between your agents.</p>\n<p>A Link has already been defined for you in the <code class=\"language-text\">Links.java</code> class called <code class=\"language-text\">SimpleAgentLink.class</code>.</p>\n<h4 id=\"todo-5-register-agent-and-link\"><a href=\"#todo-5-register-agent-and-link\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 5 (Register agent and link)</h4>\n<p>In the <code class=\"language-text\">init()</code> function, you will see 2 methods being called: <code class=\"language-text\">registerAgentTypes()</code> and <code class=\"language-text\">registerLinkTypes()</code>. Any Agents and Links used in your models must be registered here so that the SDK knows the structure of the data it needs to output.</p>\n<p>Add your Agent class, <code class=\"language-text\">SimpleAgent.class</code> and your <code class=\"language-text\">SimpleAgentLink.class</code> to their respective function.</p>\n<p>Now that this is complete, we can validate that we have generated a fully connected network by running our <code class=\"language-text\">Main.java</code>. Once the model has been compiled you will see a url indicating that the simulation is active on the local server:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 55.96165368484123%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABuElEQVQoz4WT65KjIBCFfZ14CRFFEkEFIybmUjPv/zJnDo7ZTdVWan98dQCbpm8mt+cNbprhpwvseUY7OFg3Ity/MF4WcoWfSaDNOcCNAb0/ww4exnn01LZ3MLw3jBOS+fGF6brQaMKxG6DVAUetoE8tqlphfzggyzOSI3+jKAoU+/2vkjwvUFYVEs/o3BKjpEPToZYCJyVRVyVEKXipgBAHCF7OsxRp+oHdbn0gqa2HnG+QIUC2HSMqsaeDnK+mdJBl2Z+o4voT0WlR0OE4X7A8H7De4Wi79TC+Fg1+DbO/Ubw7+OTQM93H9xNjmFg3s9Yji87+Q/rPfrdmlVh2JnbX+IDGDsiY7o4FfpG+6WudvWBEKznrS42lSvqwYBo4Dm0PT/rGwKoTuqZdabe1oUbit6Y+oq71qmpDyAaVNkimKeAuJRaOxzf1Se5lpFzXC/W+6YN647eO3dRMr2ajqg3BtBul2BQO7IWGIw1DqTBLhSv38SzwkbMQmJhKXM/Ec3/lJIxUwzQlGxIp6VBzbpPej3DWYuBQd51Hxzo6djtitMap0Wg3ThvxXKsGdYRO4g9QMTrT9/gBlDRjgpUb/J0AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-8e416.webp 173w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-0b506.webp 345w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-58be5.webp 690w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-59b8d.webp 1035w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-4a474.webp 1380w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-bc809.webp 2070w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-5cb94.webp 3338w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-7e3fa.png 173w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-7f1d4.png 345w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-13856.png 690w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-045bb.png 1035w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-f46ab.png 1380w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-ea5f6.png 2070w,\n/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-574c9.png 3338w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-13856.png\"\n          alt=\"ready localhost\"\n          title=\"\"\n          src=\"/static/ready_localhost-9162970227391fe35bf07cf67c57a3f6-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>Click on the url and a console window should open in your default browser like so:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 55.48271752085816%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAwElEQVQoz53R2wqCQBAG4H2HstSyJE+rwZJgRVT0BILl4SK66v3f4c9FrLSsXS8+hN3Zf2aQbNYR9scTDqVVGMGjARyXwvV8CQFYyLDbhiCOf4EbpLDpGZaXwLRjzK0YpgReb9MES5aDDLUcNUXnil74+4FaBo6nGX4ZTX7ft5WBOdqqkOqrGs2zf0jXhaJnMBZX+OwObVY0mvQMTGE6t2egyHSdgfUUfEpOamVe2Pb6Ge8NPuu+IaKrCK8s0lXGAxR0UFn2RIZPAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-8e416.webp 173w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-0b506.webp 345w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-58be5.webp 690w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-59b8d.webp 1035w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-4a474.webp 1380w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-bc809.webp 2070w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-0ba7c.webp 3356w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-7e3fa.png 173w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-7f1d4.png 345w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-13856.png 690w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-045bb.png 1035w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-f46ab.png 1380w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-ea5f6.png 2070w,\n/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-e69bf.png 3356w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-13856.png\"\n          alt=\"console landing\"\n          title=\"\"\n          src=\"/static/console_landing-9b39dac7d15a1f749207895ec1c590d7-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>Click on your model, and you should see a dashboard like the image below:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 55.48271752085816%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABS0lEQVQoz62S207CQBRF+6yhUHrBUnqDchFqaNQCClqUVoiJGrAlIfFP/Agivvmz29OWwAsxNvqwspPOOWvmzJRxXQdX1zcYjjxcun20OzbqjSbR+oEmrHpaE2ejeQq7a2PQc8A41js6jo9W+xHVuk8EMGoP0KsBNNOHVt1i7jGtKWqNWVIXp14L0LKfcNZ9AWOyX5A0D3JlDsNaEW8Q5BCisoRYjg4i0ZqUrO8zhqc+xmA/UdLjXVdQzRAl5ZmKXlGqRESYGUbPfaAou2C5MdjiCEUpSGVKSOIDTbtv0cGkE25o5CE4wQcn3kGUZ1tRtMssMEZuA07uocDfk3QM4WRKouhvQkEZpML/OGFyh+U+CScoCN7+DjM/yFaoHq2RE84TYZ6/TYTxyNlJH5FRj9dgxYtk5Dzv0dgT+n2WKGsLyOqcWPyCedIT8w0TaU4aops8+AAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-8e416.webp 173w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-0b506.webp 345w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-58be5.webp 690w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-59b8d.webp 1035w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-4a474.webp 1380w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-bc809.webp 2070w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-0ba7c.webp 3356w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-7e3fa.png 173w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-7f1d4.png 345w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-13856.png 690w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-045bb.png 1035w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-f46ab.png 1380w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-ea5f6.png 2070w,\n/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-e69bf.png 3356w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-13856.png\"\n          alt=\"dashboard uninitialized\"\n          title=\"\"\n          src=\"/static/dashboard_uninitialized-cb9f1a1400e77b2e37a725afd6ffae9f-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>Notice that on the left hand panel you can now see the 2 input parameters that were defined in the Globals.</p>\n<p>Hit initialize and your console should be showing a single chart called <code class=\"language-text\">wallet</code> as below:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 56.033452807646356%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABrUlEQVQoz42STU/CQBCGezdIS7stpQsUqYCCgYhAVIKIheIHiCh48Ohv8G68KXdPnvyjr9OtFDCGcHgyuzDzdGd2pVqtguPTFk6bLVSP6tjbL8HZzWM3t555ThALKJVLaNTLkCq5FxQrbRSKfezkXGRzXTj5S9hOD+mdbkgq41J0Rcw4HuX0YWd7YSyUBjgoDyHZ0U+Y9ghafIx4cgDLnkK3HgSaeR/CEnP8/6YCllhEH9V8gORo36g1v5AvvuKg8iyEzOwTHmJGL0RPeMQlCcYw+AQGfdDgf5nQCeUZjNQJVCrS4h6JrqCwLqJqC7LWptj+jWeQ2cU/wslKpJZnYPwEstohWkKqMPdXSBI1INh3QqFuzSWrSGkSKvEGFV2QqE3CPszUkE7sQtEXxGhvJq83E2rWsTihws7F/HjmkYZ8Q6Ieyf1LuSKhB24HbenWGmFq+wMxsxG0TC3GSGLweyq4I+mI1uOVtZiXtcTfS7G23hHRqqJlf/C+UDwLPqWE6dL6MXwu/j5E/DYR+E9K4pE3bLNDcZOy2iRhB1aa3iQfboSZvKX8O1GTzT/hB2MeS3b3mEWlAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-8e416.webp 173w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-0b506.webp 345w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-58be5.webp 690w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-59b8d.webp 1035w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-4a474.webp 1380w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-bc809.webp 2070w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-81400.webp 3348w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-7e3fa.png 173w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-7f1d4.png 345w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-13856.png 690w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-045bb.png 1035w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-f46ab.png 1380w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-ea5f6.png 2070w,\n/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-92135.png 3348w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-13856.png\"\n          alt=\"dashboard initialized\"\n          title=\"\"\n          src=\"/static/dashboard_initialized-612beca49cb954fa928b9cccec209a24-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>Click the <code class=\"language-text\">VIEW TYPE</code> drop down menu in the top right that says <code class=\"language-text\">Graphs</code> and select the <code class=\"language-text\">Network</code> view option. You should be able to see a fully connected network of agents, if you hover over one of the agents, you should see that their starting wallet is set to 100:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 55.343283582089555%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAACUUlEQVQoz2WS7U/TUBTG990IuL5s7dpthW3tHEN5mWBABoMNRhgbrOvAjTEnb0PRQKIhJmhINFFgHyQxYtBPxr/z8fS2EIwfnpy297m/e57T63mUGsLj8TQmnkxhJDWG+4kkojGDFEfstvT/5fgM9px8mMTY6CA8DyLvEB9IQ4/PQ4tkoUVzCPdlEerNIqhloWpOVcJZyMFZSMEZVlUth95oHn2xBfLOQU8sITFQhEfrvoSklSH4TfjVAm20oIRM2mRBkCtMHK3JqoWBZAMjQy0YRh2ibIKXLfiUa58FTjLhifC/kZr4CSNxguTgJgPy0gpEpQK/YhtNRKJrKMwdoFY9QW3tI9ZXT5BJv4Qatti6T7lWBZ5w9xkEJQWvMAPOl4Mg5eELOIsiVT8ZF3Ov0ah/Qat1ge3t79hodvCm/QnTEzt0eJl5HZk2sANBHUcPN4MePg3eP08gx8BTBN14imr5mCBf0W7/wOHhH8xmm6gu78JaPkYgaEJwG3A77MArjRIwg3vCFEFuA8uIx2tYNT/geYuAe1fY3/+F9osrNJ9dYGXpCCHtOrYLDHWdg5PHXOA0iyy6J9rGkFbFSuEtGusdbG19w87uJTapNhtnyM++YuMRbyITMEhAp0OKzKXhFXM383CgZfqzTdSs96jXTrHROKd5fkaleASDuufl2zMkoHLnFHf5YQbs5iYZ0I58I3eW/f0NzGX2sZA7QGZyD7puw0zXZzLZI2LALmGYRXaA9qW1IKnL/0gMlCApJbqPJfgDReedvsvBMvkrbI+eaOEv/8Js7giTC14AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-8e416.webp 173w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-0b506.webp 345w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-58be5.webp 690w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-59b8d.webp 1035w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-4a474.webp 1380w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-bc809.webp 2070w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-a4ca8.webp 3350w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-7e3fa.png 173w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-7f1d4.png 345w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-13856.png 690w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-045bb.png 1035w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-f46ab.png 1380w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-ea5f6.png 2070w,\n/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-32589.png 3350w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-13856.png\"\n          alt=\"simple econ network\"\n          title=\"\"\n          src=\"/static/simple_econ_network-dfbd6dc0c4ace28b0d21fd444c714e48-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>Now that our agents have been initialized and connected, we can define their interactions and behaviors.</p>\n<h2 id=\"defining-behaviors\"><a href=\"#defining-behaviors\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Defining Behaviors</h2>\n<p>In this section you will define the logic of the 2 behaviors, or Actions, of the Simple Agents. Remember that the Simudyne SDK uses a message passing framework and interactions between the agents are facilitated via the sending and receiving of Messages.</p>\n<h3 id=\"the-step\"><a href=\"#the-step\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Step</h3>\n<p>The <code class=\"language-text\">step()</code> function contains the logic sequence of behaviors that we expect to be executed at every time step. This function is where you will define run sequences which contain a message passing phase.</p>\n<p>A run sequence contains a sequence of Actions where each Action sends a message and immediately afterwards that message is handled by the agent receiving the message. More info on how actions and sequencing works here <a href=\":version/reference/agents/communication\">Communication</a>. </p>\n<h4 id=\"todo-6-calling-actions\"><a href=\"#todo-6-calling-actions\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 6 (Calling Actions)</h4>\n<p>create a new run sequence in the <code class=\"language-text\">step()</code> method in your <code class=\"language-text\">SimpleEconomyModel.java</code> class.</p>\n<p>There are already 2 shell actions defined in your <code class=\"language-text\">SimpleAgent.java</code> class. The actions should be called in your sequence in the order that information flows.</p>\n<p>Your Actions should have a structure similar to below, but with the unique Actions for this model:</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token function\">run</span><span class=\"token punctuation\">(</span>Agent<span class=\"token punctuation\">.</span>sendMessage<span class=\"token punctuation\">,</span> Agent<span class=\"token punctuation\">.</span>receiveMessage<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h4 id=\"todo-7-sending-a-message\"><a href=\"#todo-7-sending-a-message\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 7 (Sending a message)</h4>\n<p>Go to your <code class=\"language-text\">SimpleAgent.java</code> class where you should see 2 shell actions named <code class=\"language-text\">sendMoney</code> and <code class=\"language-text\">receiveMoney</code>. In this <code class=\"language-text\">TODO</code> you will be defining the logic in the <code class=\"language-text\">sendMoney</code> behavior.</p>\n<p>The behavior is as follows:</p>\n<ol>\n<li>Check that the agent has money, if true then,</li>\n<li>Collect the agents links using <code class=\"language-text\">getLinks()</code> into a temporary list</li>\n<li>Shuffle the list in a random order</li>\n<li>Select the first element of that list (a Link) and store the ID of the agent on the other side of the link using <code class=\"language-text\">getID()</code></li>\n<li>Send a message to the Agent at the other end of the Link by calling <code class=\"language-text\">send().to()</code></li>\n<li>Decrement the wallet by 1</li>\n</ol>\n<p>Note that you already have a message in your <code class=\"language-text\">Messages.java</code> class.</p>\n<p>Also, the functions mentioned above in the description of the behavior all require arguments (except for <code class=\"language-text\">getID()</code>) that indicate the class of Message or Link you want to send or retrieve.</p>\n<h4 id=\"todo-8\"><a href=\"#todo-8\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TODO 8</h4>\n<p>The agent needs to receive all messages that were sent to it and increment its wallet by 1 for each message it has received in the step.</p>\n<p>The behavior is as follows:</p>\n<ol>\n<li>Retrieve messages from step and iterate over them using <code class=\"language-text\">getMessagesOfType().forEach()</code></li>\n<li>For each message, increment the wallet by 1</li>\n</ol>\n<p>Note that you will be getting the same message type that was sent in the previous Action</p>\n<h2 id=\"evaluating-your-model\"><a href=\"#evaluating-your-model\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evaluating your model</h2>\n<p>Your model is now complete, you should be able to run your <code class=\"language-text\">Main.java</code> and run your simulation.</p>\n<p>To validate that the model is working correctly, go to the console, hit initialize and then hit run. You should get a window that looks like the below:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 55.53571428571429%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAACDUlEQVQoz3WSSW8SYRjH51rNlBlmgVmdYQlSoI2BmNAY1oJpjTgwDEppLb15bWI0br243Ks1ejBR45b4gdSY6MH4Pf4+vKUsWg+/PM+7/Z/t5QqZXSyfKyGTqSCeXEUydYH8OrLZNSwt1RjLuSZyuQbS6Rojm23QnRpSqQo7T6XK7M0IzuVfQTJKCCvrUPRL0M/4UDQfYbUNQfGINkKyx/zRnhTpQI7SHb3L7inavOUS4gesnD9E4uw+kuk+DCeAYV9GIu7BcVpw3SvMJhO0jrWhGj4iZkB0xzaYrKNWAC4WeolY2odGG5q1jgWxieDiED8/PsbXtw/x/d0jZn9/foIXN/cgRtqIHgsaU1TjKADn8E8R1goIhStUdhkLwhoJbuPH+3v48voOvr25y+yvT/fxfO8GhIg3FZzJcCLoLh5CMVchyHXqURW81EAxH2B/d4hbg23cHmwx+2B4HYONTUha58SSJ4IxEpTNIgSpBlGpEnVY7lUqvwVJbcKgIanaBsOO0UO9PSfwj6DDP6MpF1mGglyBqDag2wE1eDTNFg2pRz3ySMijHxBMhqLO9G9O0D51AF7OU4Z1hKQyld2gw6OoUbM39nuM4/2IEfw14SmcffoAi0qBlTwV7LJMGKZ/sj+DoncInwVkgrySHwuWIMpV6NY1+kYDRI0+NGPzv4zOdWsLtrsDJ96H5XTxB3zhZObMFaPCAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-8e416.webp 173w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-0b506.webp 345w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-58be5.webp 690w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-59b8d.webp 1035w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-4a474.webp 1380w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-bc809.webp 2070w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-4524e.webp 3360w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-7e3fa.png 173w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-7f1d4.png 345w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-13856.png 690w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-045bb.png 1035w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-f46ab.png 1380w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-ea5f6.png 2070w,\n/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-1a3cb.png 3360w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-13856.png\"\n          alt=\"model run view\"\n          title=\"\"\n          src=\"/static/model_run_view-2f8509f4a4cdd0befea8fb238007c5ca-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>Because our graph is currently in an aggregate view and plotting the sum of all <code class=\"language-text\">wallet</code> variables on our agents, we want to change the view. Select 3 dots in the corner of the tile, go to <code class=\"language-text\">Aggregation</code> and select <code class=\"language-text\">none</code></p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 55.60859188544153%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAAB3ElEQVQoz42SXXPSQBSGc18pmLANS0I+KAk0xVKtFKtMoRAKbaekTUiZzvg544/wzh9gtfd66/98PbtEwREdL545m+zus+fsWaXdfoyjF8fodns4eNpBEDRR8+rwfEHjL9SzNQ0ZfX8Hj1pNdA73oex7HxC0+mgEE1S9EFV/hG3/DM72KSx3BLu6wHLDX7i1Ma2ZyDUi2hQbzUuSRlDc/Fdw9wqslIBbEUxnji0jgW7OwMqJROMxilyMxb+U5m8krLyMAo3PoNS072h3v6EefIS3cwteiaEbFyiwER5oIXIEt86glYZ4uDWguSlJZvLAdShO/gt06wgqow3sBKo+huVM0TuMEJ2kuOyndE8XJBpjd2+OkjkhYUqb00zyeyThPZj5HAVNCPtU2oQ2n4MbAxjmUMJ4SCIStuYw3essw1XREsXZvIdafiaFhWKfyhqhbE1hWGO61xCaPkTFOafxQH7rZiIzFNJlpitCO/cZKu9kwh5UEnIrhu3GJFrAK1dERAddZw37KVyTobnxCbniEynMa8dSKE4W3WTGgkVGN2sz+kNY2bjDJjtYEZ5mpyf/DTNi+aTEPsrwDjkpHJCwR42hZtivqLy3VObrf/BGRsN+Rw/7PVzvJb3hFD8AE9NPUaJ4kAEAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-8e416.webp 173w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-0b506.webp 345w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-58be5.webp 690w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-59b8d.webp 1035w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-4a474.webp 1380w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-bc809.webp 2070w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-cd13f.webp 3352w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-7e3fa.png 173w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-7f1d4.png 345w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-13856.png 690w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-045bb.png 1035w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-f46ab.png 1380w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-ea5f6.png 2070w,\n/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-0abcc.png 3352w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-13856.png\"\n          alt=\"adjusted graph view\"\n          title=\"\"\n          src=\"/static/adjusted_graph_view-a80d2a6edb6b155019ff78e069e0f8dc-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<h2 id=\"conclusion\"><a href=\"#conclusion\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>You've completed your first simple model in the Simudyne SDK!</p>\n<p>This is not quite a true ABM, but it's a great start for layering in more complex behaviors and interactions.</p>\n<p>You can extend this model however you see fit or use the same structure you just developed and apply it to another system of interest.</p>\n<p>Feeling confident in your abilities? Try a more difficult challenge here <a href=\":version/synthetic_market\">Synthetic Market Challenge</a>.</p>","headings":[{"value":"Building a Simple Economy Model","depth":1},{"value":"Defining the Main Model Class","depth":2},{"value":"Step 1: The Global State","depth":3},{"value":"TODO 1 (Number of Agents)","depth":4},{"value":"TODO 2 (Starting Wallet)","depth":4},{"value":"Defining Agents & Network","depth":2},{"value":"The Setup","depth":3},{"value":"TODO 3 (Generate a group)","depth":4},{"value":"TODO 4 (Connect the group)","depth":4},{"value":"TODO 5 (Register agent and link)","depth":4},{"value":"Defining Behaviors","depth":2},{"value":"The Step","depth":3},{"value":"TODO 6 (Calling Actions)","depth":4},{"value":"TODO 7 (Sending a message)","depth":4},{"value":"TODO 8","depth":4},{"value":"Evaluating your model","depth":2},{"value":"Conclusion","depth":2}],"frontmatter":{"title":"Simple Economy Challenge","toc":true,"experimental":null}},"site":{"siteMetadata":{"title":"Simudyne Docs","latestVersion":"2.6"}}},"pageContext":{"absolutePath":"/home/vsts/work/1/s/content/2.6/docs/challenges/simple_economy.md","versioned":false,"version":"2.6","kind":"docs","pagePath":"/challenges/simple_economy","chronology":{"prev":{"name":"Synthetic Market Challenge","path":"/challenges/synthetic_market"},"next":{"name":"Sample Models","path":"/models"}},"lastUpdated":"2026-04-21T13:56:54.864Z"}}