-
Notifications
You must be signed in to change notification settings - Fork 99
DevelopingControlArchitectures
benoitgaudou edited this page Aug 5, 2019
·
8 revisions
In addition to existing control architectures, developers can add new ones.
Defining a new control architecture needs to create new statements of type behavior and included in species statements and to define how to manage their execution.
A control architecture is a Java class, that:
- is annotated by the @skill annotation,
- extends the
AbstractArchitecture
class (to get benefits of everything from thereflex
-based control architecture, theReflexArchitecture
class can be extended instead).
The AbstractArchitecture
extends the ISkill
and IStatement
interfaces and add the 2 following methods:
public abstract boolean init(IScope scope) throws GamaRuntimeException;
public abstract void verifyBehaviors(ISpecies context);
The three main methods to implement are thus:
-
public void setChildren(final List<? extends ISymbol> children)
: this method will be called at the compilation of the model. It allows to manage all the embeded statements (inchildren
) and for example separate the statements that should be executed at the initialization only from the ones that should be executed at each simulation step. Following example allows to test the name of the all the embedded statements:
for ( final ISymbol c : children ) {
if( IKeyword.INIT.equals(c.getFacet(IKeyword.KEYWORD).literalValue()) ) {
-
public abstract boolean init(IScope scope) throws GamaRuntimeException
: this method is called only once, at the initialization of the agent. -
public Object executeOn(final IScope scope) throws GamaRuntimeException
: this method is executed at each simulation step. It should manage the execution of the various embedded behaviors (e.g. their order or choose which one will be executed...).
- Installation and Launching
- Workspace, Projects and Models
- Editing Models
- Running Experiments
- Running Headless
- Preferences
- Troubleshooting
- Introduction
- Manipulate basic Species
- Global Species
- Defining Advanced Species
- Defining GUI Experiment
- Exploring Models
- Optimizing Model Section
- Multi-Paradigm Modeling
- Manipulate OSM Data
- Diffusion
- Using Database
- Using FIPA ACL
- Using BDI with BEN
- Using Driving Skill
- Manipulate dates
- Manipulate lights
- Using comodel
- Save and restore Simulations
- Using network
- Headless mode
- Using Headless
- Writing Unit Tests
- Ensure model's reproducibility
- Going further with extensions
- Built-in Species
- Built-in Skills
- Built-in Architecture
- Statements
- Data Type
- File Type
- Expressions
- Exhaustive list of GAMA Keywords
- Installing the GIT version
- Developing Extensions
- Introduction to GAMA Java API
- Using GAMA flags
- Creating a release of GAMA
- Documentation generation