Code Monkey home page Code Monkey logo

phase's Introduction

PHASE(Parallel High-performence Agent-based Simulation Environment)

Demo: Game Of Life

2019.3 Version 1.0

1 Description

1.1 Introduction 

This tutorial will introduce a series of examples demonstrating several ways to build an Agent Based Modeling of HPC model. Its purpose is to showcase a set of features included in the Platform Toolkit and to provide a working demo of how to build models that use these features in different ways. Discuss some of the features related to the platform infrastructure, such as how to set and change model parameters, get and record analog output, and implement different forms of random number generation. In particular, it is convenient to construct an ABM model in which agents interact according to certain structural constraints, including spatial placement and network connectivity.

1.2 Requirement

This tutorial is for anyone who wants to learn more about the platform and is proficient in the ABM model. For those who are not familiar with the HPC environment, it is mainly for people who understand the basics of Agent-Based Modeling (ABM) and are familiar with the X10 language grammar.

2 Demo: Game Of Life

2.1 Introduction

GameOfLife is the most famous set of rules in the Cellular Automaton/Automata (the idea of the rules can be traced back to von Neumann, alias " GameOfLife"). The state of death or viability of each cell is determined by the eight cells surrounding it.The rules are as follows:
1."Small population": If there are less than 2 live neighbors, any living cells will die.
2."Normal": If there are 2 or 3 live neighbors, any living cells will continue to live.
3."Excessive population": If there are more than 3 live neighbors, any living cells will die.
4."Breeding": If there are exactly 3 live neighbors, any dead cells will survive.

2.2 Construct steps

    2.2.1 Step 1: Agent
    Add all the attributes of the entity in the Agent.x10 file. The existing location and status attributes are added. Other attributes are added after AddCode.  In this example, location acquisition, state acquisition, neighbor acquisition, etc. are added as required by the model.
    
    2.2.2 Step 2: Grid
    The grid is set in the Grid.x10 file. In this example, the grid is initially set as 10 both horizontal and vertical, for a total of 100 grids.

    2.2.3 Step 3: Event
    The simulation event design is performed in the EventSequence.x10 file. In this Demo, four events are set, which are life game initialization (init()), get agent neighbor information (AgentNeighborState()), and life game evolution according to rules (Interactive( )), agent information display (Display ()) four events, at the same time according to the scheduling steps written to the corresponding step.

    2.2.4 Step 4: Model
    Schedule design in the Model.x10 file to run the specified event at the specified time.

    2.2.5 Step 5: DataCollection
    Data collection can occur in any given event or at any time, but you need to customize the data collection event.
    1、Class instantiation

    2、Class implementation

    2.2.6 Step 6: Run
    Count the time in the main function in the Run.x10 file and set the relevant parameters in the Setting.x10 file.。

NOTE

We have released version 2.0, please see Demo_PredatorPrey and Demo_GameOfLife_2.

phase's People

Contributors

hpmsxjtu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.