(Moving in the reverse direction is equivalent, passing from x=0 to x=99.) The Repast HPC demos given later in this tutorial will make this clearer. This file contains the three elements needed. The implementation can use the same components, because Point objects in Repast HPC are n-dimensional; they can also use the same conceptual framework of 'buffer zones' discussed here. (Technically, 'periodic' boundaries create 'toroidal' spaces.) important differences, someone who is familiar with Java can usually read C++ code and begin to write it quickly. To do this, you must create three classes: Ordinarily you might choose to create each of these classes with its own .h header file; .cpp files will not be used, because the code is templated code. If the concept of a 'Header File' is new to you, what you need to know for now is this: C++ code is usually broken into two parts: header files and source files. This also mirrors Repast's built-in edges. The following compiled libraries and associated header files: Boost (version 1.54 or later), including all headers and the 'serialization', 'mpi', 'system', and 'filesystem' libraries. An agent at x=99 and an agent at x=0 are 99 units apart. Repast HPC implements two distinct kinds of boundary conditions; the choice of the appropriate condition depends on the simulation: WrapAroundBorders are also called toroidal or periodic. Java syntax is based on C++ syntax, and though there are Headers describe the structure of what is in the source files; source files contain the actual code. In this portion of the tutorial, we will present the procedure for creating and using a spatial projection. It must also provide the 'serialize' method. However, these advanced techniques are not implemented in Repast HPC. The four constructors that include only 'source', 'target', and 'weight' variables simply extend the RepastEdge's built-in constructors; two of these use standard C++ pointers and two use Boost 'shared' pointers. The creation of an instance of the network occurs definition, which is in the source (.cpp) file: We next need to change the way that edges are created when the network is being created, in the connectAgentNetwork method: The model passes an instance of this network to the agents in the 'doSomething' network, when the agent's 'play' method is called; the agents receive this and act on it. After downloading the tarball, untar it, follow the installation instructions in the enclosed INSTALL.txt file, and then consult the Tutorial and Repast HPC Manual. The class itself is templated to take any object as a vertex. In Demo 02, we created a network projection and explicitly connected agents using network links. Less obvious is the fact that the position of an agent in space is only relevant when considered with respect to the positions of other agents in the space. Each 'move Because of this, the Agent.h and Agent.cpp code must also be updated. By specifying simple rules, complex dynamics can emerge that lead to systems-level characteristics and examples of order at a macro-scale that is difficult to derive from the micro-level (agent) rules. To use space for this, imagine that we can run the simulation on four processes. Users in this tutorial is on laying out how Repast HPC and ReLogo are structured, and how to begin to compose, compile, and run models in Repast HPC. The next section of the code defines the Edge Content that will be associated with this class. Getting Started with Repast HPC Table of Contents How to use this tutorial Repast HPC Demos in this Tutorial HPC Demo 00 Overview HPC:D00, Step 01: Hello, World! In this way, space is very similar to a network. Creating custom edges in Repast HPC requires several steps; this is because you must provide extended functionality to replace several actions that Repast HPC perfoms invisibly for its built-in edge type. 'Linking' refers to the fact that code is usually built in pieces that must be 'linked' together in order to run. Nevertheless both space and networks both represent relationships. obtain and record simulation output, achieve different forms of random number generation, etc; other features are more central to how a Repast HPC This figure illustrates the 4 process case, taking the view of Process 1, at the center. set of structured constraints (including spatial arrangements and network connections). In the current implementation of Repast HPC space is always divided evenly across processes: each process's space is the same size in the x and y directions. an HPC environment will involve steps that are unfamiliar to Java users, and these are covered in greater detail in this tutorial. The intent to is In any case, the emphasis The depiction above shows the case with StrictBorders; with WrapAround borders the picture is more complicated, as there are buffer zones on all sides of a given process. For simplicity, we will place all of the code in a single file, called Demo_02_Network.h, which we will place in the 'includes' directory. Here we will again extend Repast's built-in class: This section of code extends the RepastEdgeContent class. show a range of features that are included in the Repast HPC toolkit, and provide worked examples of how models that make use of these features in A system that includes the 'make' and 'diff' utilities (standard on most Unix-like systems). However, each process is aware of its position within the global space: it knows the global boundaries, and it knows the global coordinates of its local region of the space. For example, suppose that the 'space' is actually one-dimensional (a line), and there are 5 elements on it which, labeled in order, are A, B, C, D, and E. The labeling is arbitrary, but in a line (assuming you cannot have two elements in the same place) the elements must be in a sequence, and each element can have 2 neighbors: 'B' is neighbors with A and C; 'D' is neighbors with C and E; etc. 'Compiling' means taking the code that you type and transforming it into the sequence of instructions that the processor executes. Note that to decompress the file you may need to use the command line program 'tar'; a command like "tar -xvf SRC.tar.gz" should extract the contents of the folder to the current directory. However, Repast HPC behaves very differently when the space is used to parallelize the simulation. Repast HPC, however, needs a way to manage what is going on at the boundaries of these spaces. Repast HPC Tutorial: Repast HPC Demos In the previous demo we have made use of two spatial projections for efficiency. This section of code (which ends with the close of the '#ifdef' statement from the header) defines the customized Edge Content Manager. Also, the example here has used a non-toroidal space; in a toroidal space, the coordinates 'wrap around' so that the highest coordinate is adjacent to the lowest, and the buffer zones also extend into all adjacent processes. These have only one attribute, the Edge Weight. Custom Edges: An Advanced Topic In the previous steps we have used Repast HPC's built in default edges. The fundamental idea is the creation of a population of 'agents', which are entities that can perceive their environment and interact with it and with each other. The output from this should be another file, Demo_00.exe. In our simple demonstration, with only four processes, the buffer zones on either side of a given process along one axis are, in fact, the same process; in a larger simulation, with more processes in each axis dimension, this would not be the case. In this Repast HPC is not unlike most other ABM simulation frameworks, including Repast Simphony. It is an int, with a basic getter and setter (the last two lines of the class's code). If a space goes from 0,0 to 100,100 and has 'WrapAroundBorders', an agent moving upward along the x-axis in intervals of 1 unit would pass from x=97 to x=98, x=99, and then x=0, passing back to the other end of the space. Agents that are copied from adjacent processes because they are in the buffer zone are. A system capable of compiling and running MPI-based code. Repast HPC has more than one way to achieve this; the one we will use ensures that the order of play is randomized each turn. Repast HPC provides a lean and expert-focused C++-based modeling system for use on large computing clusters and supercomputers. There are also two functions that include the 'confidence' variable, one using the normal pointer and one using the shared pointer. Space that is toroidal is in one sense infinite: movement in one direction can continue without stopping. Many more detailed discussions are available online; because Repast HPC is specifically for agent-based modeling, this tutorial assumes familiarity with ABM approaches. In theory, a space could be created with one dimension using one kind of boundary and another with a different boundary- 'WrapAround' for the x dimension, but 'Strict' for the y dimension. Headers usually have a .h extension; source files have a .c extension (for C code) or .cpp (for C++ code). First, we must include the new network file in the Model.h file: Next we have to change the instance variables for the network and the edge content manager to the new types: Notice that it is at this point that we take the generic classes that we created, templated to an abstract vertex 'V', and begin to instantiate them with a specific vertex, the RepastHPCDemoAgent. In the example pictured,the coordinates in each of the spaces are: Notice that the coordinates at the inner corners are shared. Detailed information about how to write C++ code is not included. In theory, the space should be unified across processes, but if we have divided space up into pieces, is it really unified?