Statements
This file is automatically generated from java files. Do Not Edit It.
Table of Contents​
=, abort, action, add, agents, annealing, ask, aspect, assert, benchmark, betad, break, browse, camera, capture, catch, category, chart, conscious_contagion, continue, coping, create, data, datalist, default, diffuse, diffusion, display, display_grid, do, draw, else, emotional_contagion, enforcement, enter, equation, error, event, exit, experiment, exploration, focus, focus_on, generate, genetic, global, graphics, grid, highlight, hill_climbing, if, image_layer, init, inspect, invoke, law, layout, let, light, loop, match, match_between, match_one, match_regex, mesh, migrate, monitor, morris, norm, output, output_file, overlay, parameter, perceive, permanent, plan, pso, put, reactive_tabu, reflex, release, remove, return, rotation, rule, rule, run, sanction, save, set, setup, sobol, socialize, solve, species, species_layer, start_simulation, state, status, stochanalyse, switch, tabu, task, test, text, trace, transition, try, unconscious_contagion, user_command, user_init, user_input, user_panel, using, Variable_container, Variable_number, Variable_regular, warn, write,
Statements by kinds​
- Batch method
- Behavior
- Experiment
- Layer
- agents, camera, chart, display_grid, event, graphics, image_layer, light, mesh, overlay, rotation, species_layer,
- Output
- Parameter
- Sequence of statements or action
- Single statement
- =, add, assert, break, category, conscious_contagion, continue, data, datalist, diffuse, diffusion, do, draw, emotional_contagion, enforcement, error, focus, focus_on, highlight, invoke, law, let, put, remove, return, rule, save, set, socialize, solve, status, text, unconscious_contagion, user_input, warn, write,
- Species
- Variable (container)
- Variable (number)
- Variable (regular)
Statements by embedment​
- Behavior
- add, ask, assert, benchmark, capture, conscious_contagion, create, diffuse, do, emotional_contagion, enforcement, error, focus, focus_on, generate, highlight, if, inspect, let, loop, migrate, put, release, remove, return, run, save, set, socialize, solve, start_simulation, status, switch, trace, transition, try, unconscious_contagion, using, warn, write,
- Environment
- Experiment
- Layer
- Model
- action, aspect, coping, equation, experiment, law, norm, output, perceive, plan, reflex, rule, rule, run, sanction, setup, species, start_simulation, state, task, test, user_command, user_init, user_panel, Variable_container, Variable_number, Variable_regular,
- Output
- Sequence of statements or action
- add, ask, assert, assert, benchmark, break, capture, conscious_contagion, continue, create, data, datalist, diffuse, do, draw, emotional_contagion, enforcement, error, focus, focus_on, generate, highlight, if, inspect, let, loop, migrate, put, release, remove, return, save, set, socialize, solve, status, switch, trace, transition, try, unconscious_contagion, using, warn, write,
- Single statement
- Species
- action, aspect, coping, equation, law, norm, perceive, plan, reflex, rule, rule, run, sanction, setup, species, start_simulation, state, task, test, user_command, user_init, user_panel, Variable_container, Variable_number, Variable_regular,
- action
- aspect
- draw,
- chart
- display
- agents, camera, chart, display_grid, event, graphics, image_layer, light, mesh, overlay, rotation, species_layer,
- equation
- =,
- fsm
- if
- else,
- output
- parallel_bdi
- permanent
- probabilistic_tasks
- task,
- rules
- rule,
- simple_bdi
- sorted_tasks
- task,
- species_layer
- state
- switch
- test
- try
- user_command
- user_first
- user_init
- user_last
- user_only
- user_panel
- weighted_tasks
- task,
General syntax​
A statement represents either a declaration or an imperative command. It consists in a keyword, followed by specific facets, some of them mandatory (in bold), some of them optional. One of the facet names can be omitted (the one denoted as omissible). It has to be the first one.
statement_keyword expression1 facet2: expression2 ... ;
or
statement_keyword facet1: expression1 facet2: expression2 ...;
If the statement encloses other statements, it is called a sequence statement, and its sub-statements (either sequence statements or single statements) are declared between curly brackets, as in:
statement_keyword1 expression1 facet2: expression2... { // a sequence statement
statement_keyword2 expression1 facet2: expression2...; // a single statement
statement_keyword3 expression1 facet2: expression2...;
}
=
Facets​
right
(float), (omissible) : the right part of the equation (it is mandatory that it can be evaluated as a floatleft
(any type): the left part of the equation (it should be a variable or a call to the diff() or diff2() operators)
Definition​
Allows to implement an equation in the form function(n, t) = expression. The left function is only here as a placeholder for enabling a simpler syntax and grabbing the variable as its left member.
Usages​
- The syntax of the = statement is a bit different from the other statements. It has to be used as follows (in an equation):
float t;
float S;
float I;
equation SI {
diff(S,t) = (- 0.3 * S * I / 100);
diff(I,t) = (0.3 * S * I / 100);
}
Embedments​
- The
=
statement is of type: Single statement - The
=
statement can be embedded into: equation, - The
=
statement embeds statements:
action​
Facets​
name
(an identifier), (omissible) : identifier of the actionindex
(a datatype identifier): if the action returns a map, the type of its keysof
(a datatype identifier): if the action returns a container, the type of its elementstype
(a datatype identifier): the action returned typevirtual
(boolean): whether the action is virtual (defined without a set of instructions) (false by default)
Definition​
Allows to define in a species, model or experiment a new action that can be called elsewhere.
Usages​
- The simplest syntax to define an action that does not take any parameter and does not return anything is:
action simple_action {
// [set of statements]
}
- If the action needs some parameters, they can be specified betwee, braquets after the identifier of the action:
action action_parameters(int i, string s){
// [set of statements using i and s]
}
- If the action returns any value, the returned type should be used instead of the "action" keyword. A return statement inside the body of the action statement is mandatory.
int action_return_val(int i, string s){
// [set of statements using i and s]
return i + i;
}
- If virtual: is true, then the action is abstract, which means that the action is defined without body. A species containing at least one abstract action is abstract. Agents of this species cannot be created. The common use of an abstract action is to define an action that can be used by all its sub-species, which should redefine all abstract actions and implements its body.
species parent_species {
int virtual_action(int i, string s);
}
species children parent: parent_species {
int virtual_action(int i, string s) {
return i + i;
}
}
- See also: do,
Embedments​
- The
action
statement is of type: Sequence of statements or action - The
action
statement can be embedded into: Species, Experiment, Model, - The
action
statement embeds statements: assert, return,
add​
Facets​
to
(any type in [container, species, agent, geometry]): an expression that evaluates to a containeritem
(any type), (omissible) : any expression to add in the containerall
(any type): Allows to either pass a container so as to add all its element, or 'true', if the item to add is already a container.at
(any type): position in the container of added element
Definition​
Allows to add, i.e. to insert, a new element in a container (a list, matrix, map, ...).Incorrect use: The addition of a new element at a position out of the bounds of the container will produce a warning and let the container unmodified. If all: is specified, it has no effect if its argument is not a container, or if its argument is 'true' and the item to add is not a container. In that latter case
Usages​
- The new element can be added either at the end of the container or at a particular position.
add expr to: expr_container; // Add at the end
add expr at: expr to: expr_container; // Add at position expr
- Case of a list, the expression in the facet at: should be an integer.
list<int> workingList <- [];
add 0 at: 0 to: workingList ; // workingList equals [0]
add 10 at: 0 to: workingList ; // workingList equals [10,0]
add 20 at: 2 to: workingList ; // workingList equals [10,0,20]
add 50 to: workingList; // workingList equals [10,0,20,50]
add [60,70] all: true to: workingList; // workingList equals [10,0,20,50,60,70]
- Case of a map: As a map is basically a list of pairs key::value, we can also use the add statement on it. It is important to note that the behavior of the statement is slightly different, in particular in the use of the at facet, which denotes the key of the pair.
map<string,string> workingMap <- [];
add "val1" at: "x" to: workingMap; // workingMap equals ["x"::"val1"]
- If the at facet is omitted, a pair (expr_item::expr_item) will be added to the map. An important exception is the case where the expr_item is a pair: in this case the pair is added.
add "val2" to: workingMap; // workingMap equals ["x"::"val1", "val2"::"val2"]
add "5"::"val4" to: workingMap; // workingMap equals ["x"::"val1", "val2"::"val2", "5"::"val4"]
- Notice that, as the key should be unique, the addition of an item at an existing position (i.e. existing key) will only modify the value associated with the given key.
add "val3" at: "x" to: workingMap; // workingMap equals ["x"::"val3", "val2"::"val2", "5"::"val4"]
- On a map, the all facet will add all value of a container in the map (so as pair val_cont::val_cont)
add ["val4","val5"] all: true at: "x" to: workingMap; // workingMap equals ["x"::"val3", "val2"::"val2", "5"::"val4","val4"::"val4","val5"::"val5"]
- In case of a graph, we can use the facets
node
,edge
andweight
to add a node, an edge or weights to the graph. However, these facets are now considered as deprecated, and it is advised to use the various edge(), node(), edges(), nodes() operators, which can build the correct objects to add to the graph
graph g <- as_edge_graph([{1,5}::{12,45}]);
add edge: {1,5}::{2,3} to: g;
list var <- g.vertices; // var equals [{1,5},{12,45},{2,3}]
list var <- g.edges; // var equals [polyline({1.0,5.0}::{12.0,45.0}),polyline({1.0,5.0}::{2.0,3.0})]
add node: {5,5} to: g;
list var <- g.vertices; // var equals [{1.0,5.0},{12.0,45.0},{2.0,3.0},{5.0,5.0}]
list var <- g.edges; // var equals [polyline({1.0,5.0}::{12.0,45.0}),polyline({1.0,5.0}::{2.0,3.0})]
- Case of a matrix: this statement can not be used on matrix. Please refer to the statement put.
- See also: put, remove,
Embedments​
- The
add
statement is of type: Single statement - The
add
statement can be embedded into: chart, Behavior, Sequence of statements or action, Layer, - The
add
statement embeds statements:
agents​
Facets​
value
(container): the set of agents to displayname
(a label), (omissible) : Human readable title of the layeraspect
(an identifier): the name of the aspect that should be used to display the speciesfading
(boolean): Used in conjunction with 'trace:', allows to apply a fading effect to the previous traces. Default is falseposition
(point): position of the upper-left corner of the layer. Note that if coordinates are in [0,1[, the position is relative to the size of the environment (e.g. {0.5,0.5} refers to the middle of the display) whereas it is absolute when coordinates are greater than 1 for x and y. The z-ordinate can only be defined between 0 and 1. The position can only be a 3D point {0.5, 0.5, 0.5}, the last coordinate specifying the elevation of the layer. In case of negative value OpenGl will position the layer out of the environment.refresh
(boolean): (openGL only) specify whether the display of the species is refreshed. (true by default, useful in case of agents that do not move)rotate
(float): Defines the angle of rotation of this layer, in degrees, around the z-axis.selectable
(boolean): Indicates whether the agents present on this layer are selectable by the user. Default is truesize
(point): extent of the layer in the screen from its position. Coordinates in [0,1[ are treated as percentages of the total surface, while coordinates > 1 are treated as absolute sizes in model units (i.e. considering the model occupies the entire view). Like in 'position', an elevation can be provided with the z coordinate, allowing to scale the layer in the 3 directionstrace
(any type in [boolean, int]): Allows to aggregate the visualization of agents at each timestep on the display. Default is false. If set to an int value, only the last n-th steps will be visualized. If set to true, no limit of timesteps is applied.transparency
(float): the transparency level of the layer (between 0 -- opaque -- and 1 -- fully transparent)visible
(boolean): Defines whether this layer is visible or not
Definition​
agents
allows the modeler to display only the agents that fulfill a given condition.
Usages​
- The general syntax is:
display my_display {
agents layer_name value: expression [additional options];
}
- For instance, in a segregation model,
agents
will only display unhappy agents:
display Segregation {
agents agentDisappear value: people as list where (each.is_happy = false) aspect: with_group_color;
}
- See also: display, chart, event, graphics, display_grid, image_layer, overlay, species_layer,
Embedments​
- The
agents
statement is of type: Layer - The
agents
statement can be embedded into: display, - The
agents
statement embeds statements:
annealing​
Facets​
name
(an identifier), (omissible) : The name of the method. For internal use onlyaggregation
(a label), takes values in: {min, max}: the agregation methodinit_solution
(map): init solution: key: name of the variable, value: value of the variablemaximize
(float): the value the algorithm tries to maximizeminimize
(float): the value the algorithm tries to minimizenb_iter_cst_temp
(int): number of iterations per level of temperaturetemp_decrease
(float): temperature decrease coefficient. At each iteration, the current temperature is multiplied by this coefficient.temp_end
(float): final temperaturetemp_init
(float): initial temperature
Definition​
This algorithm is an implementation of the Simulated Annealing algorithm. See the wikipedia article and [batch161 the batch dedicated page].
Usages​
- As other batch methods, the basic syntax of the annealing statement uses
method annealing
instead of the expectedannealing name: id
:
method annealing [facet: value];
- For example:
method annealing temp_init: 100 temp_end: 1 temp_decrease: 0.5 nb_iter_cst_temp: 5 maximize: food_gathered;
Embedments​
- The
annealing
statement is of type: Batch method - The
annealing
statement can be embedded into: Experiment, - The
annealing
statement embeds statements:
ask​
Facets​
target
(any type in [container, agent]), (omissible) : an expression that evaluates to an agent or a list of agentsas
(species): an expression that evaluates to a speciesparallel
(any type in [boolean, int]): (experimental) setting this facet to 'true' will allow 'ask' to use concurrency when traversing the targets; setting it to an integer will set the threshold under which they will be run sequentially (the default is initially 20, but can be fixed in the preferences). This facet is false by default.
Definition​
Allows an agent, the sender agent (that can be the [Sections161#global world agent]), to ask another (or other) agent(s) to perform a set of statements. If the value of the target facet is nil or empty, the statement is ignored.
Usages​
- Ask a set of receiver agents, stored in a container, to perform a block of statements. The block is evaluated in the context of the agents' species
ask ${receiver_agents} {
${cursor}
}
- Ask one agent to perform a block of statements. The block is evaluated in the context of the agent's species
ask ${one_agent} {
${cursor}
}
- If the species of the receiver agent(s) cannot be determined, it is possible to force it using the
as
facet. An error is thrown if an agent is not a direct or undirect instance of this species
ask ${receiver_agent(s)} as: ${a_species_expression} {
${cursor}
}
- To ask a set of agents to do something only if they belong to a given species, the
of_species
operator can be used. If none of the agents belong to the species, nothing happens
ask ${receiver_agents} of_species ${species_name} {
${cursor}
}
- Any statement can be declared in the block statements. All the statements will be evaluated in the context of the receiver agent(s), as if they were defined in their species, which means that an expression like
self
will represent the receiver agent and not the sender. If the sender needs to refer to itself, some of its own attributes (or temporary variables) within the block statements, it has to use the keywordmyself
.
species animal {
float energy <- rnd (1000) min: 0.0;
reflex when: energy > 500 { // executed when the energy is above the given threshold
list<animal> others <- (animal at_distance 5); // find all the neighboring animals in a radius of 5 meters
float shared_energy <- (energy - 500) / length (others); // compute the amount of energy to share with each of them
ask others { // no need to cast, since others has already been filtered to only include animals
if (energy < 500) { // refers to the energy of each animal in others
energy <- energy + myself.shared_energy; // increases the energy of each animal
myself.energy <- myself.energy - myself.shared_energy; // decreases the energy of the sender
}
}
}
}
- If the species of the receiver agent cannot be determined, it is possible to force it by casting the agent. Nothing happens if the agent cannot be casted to this species
Embedments​
- The
ask
statement is of type: Sequence of statements or action - The
ask
statement can be embedded into: chart, Behavior, Sequence of statements or action, Layer, Output, - The
ask
statement embeds statements:
aspect​
Facets​
name
(an identifier), (omissible) : identifier of the aspect (it can be used in a display to identify which aspect should be used for the given species). Two special names can also be used: 'default' will allow this aspect to be used as a replacement for the default aspect defined in preferences; 'highlighted' will allow the aspect to be used when the agent is highlighted as a replacement for the default (application of a color)
Definition​
Aspect statement is used to define a way to draw the current agent. Several aspects can be defined in one species. It can use attributes to customize each agent's aspect. The aspect is evaluate for each agent each time it has to be displayed.
Usages​
- An example of use of the aspect statement:
species one_species {
int a <- rnd(10);
aspect aspect1 {
if(a mod 2 = 0) { draw circle(a);}
else {draw square(a);}
draw text: "a= " + a color: #black size: 5;
}
}
Embedments​
- The
aspect
statement is of type: Behavior - The
aspect
statement can be embedded into: Species, Model, - The
aspect
statement embeds statements: draw,
assert​
Facets​
value
(boolean), (omissible) : a boolean expression. If its evaluation is true, the assertion is successful. Otherwise, an error (or a warning) is raised.label
(string): a string displayed instead of the failed expression in order to customize the error or warning if the assertion is falsewarning
(boolean): if set to true, makes the assertion emit a warning instead of an error
Definition​
Allows to check if the evaluation of a given expression returns true. If not, an error (or a warning) is raised. If the statement is used inside a test, the error is not propagagated but invalidates the test (in case of a warning, it partially invalidates it). Otherwise, it is normally propagated
Usages​
- Any boolean expression can be used
assert (2+2) = 4;
assert self != nil;
int t <- 0; assert is_error(3/t);
(1 / 2) is float
- if the 'warn:' facet is set to true, the statement emits a warning (instead of an error) in case the expression is false
assert 'abc' is string warning: true
- See also: test, setup, is_error, is_warning,
Embedments​
- The
assert
statement is of type: Single statement - The
assert
statement can be embedded into: test, action, Sequence of statements or action, Behavior, Sequence of statements or action, - The
assert
statement embeds statements:
benchmark​
Facets​
message
(any type), (omissible) : A message to display alongside the results. Should concisely describe the contents of the benchmarkrepeat
(int): An int expression describing how many executions of the block must be handled. The output in this case will return the min, max and average durations
Definition​
Displays in the console the duration in ms of the execution of the statements included in the block. It is possible to indicate, with the 'repeat' facet, how many times the sequence should be run
Usages​
Embedments​
- The
benchmark
statement is of type: Sequence of statements or action - The
benchmark
statement can be embedded into: Behavior, Sequence of statements or action, Layer, - The
benchmark
statement embeds statements:
betad​
Facets​
name
(an identifier), (omissible) : The name of the method. For internal use onlyoutputs
(list): The list of output variables to analysereport
(string): The path to the file where the Betad report will be writtensampling
(an identifier): The sampling method to build parameters sets that must be factorial based to some extends - available are saltelli and default uniformfactorial
(list): The number of sample required.results
(string): The path to the file where the automatic batch report will be writtensample
(int): The number of sample required.
Definition​
This algorithm runs an exploration with a given sampling to compute BetadKu - see doi: 10.1007/s10588-021-09358-5
Usages​
- For example:
method sobol sample_size:100 outputs:['my_var'] report:'../path/to/report/file.txt';
Embedments​
- The
betad
statement is of type: Batch method - The
betad
statement can be embedded into: Experiment, - The
betad
statement embeds statements:
break​
Facets​
Definition​
break
allows to interrupt the current sequence of statements.
Usages​
Embedments​
- The
break
statement is of type: Single statement - The
break
statement can be embedded into: Sequence of statements or action, - The
break
statement embeds statements:
camera​
Facets​
name
(string), (omissible) : The name of the camera. Will be used to populate a menu with the other camera presets. Can provide a value to the 'camera:' facet of the display, which specifies which camera to use.Using the special constant #default will make it the default of the surrounding displaydistance
(float): If the 'location:' facet is not defined, defines the distance (in world units) that separates the camera from its target. If 'location:' is defined, especially if it is using a symbolic position, allows to specify the distance to keep from the target. If neither 'location:' or 'distance:' is defined, the default distance is the maximum between the width and the height of the worlddynamic
(boolean): If true, the location, distance and target are automatically recomputed every step. Default is false. When true, will also set 'locked' to true, to avoid interferences from userslens
(any type in [float, int]): Allows to define the lens -- field of view in degrees -- of the camera. Between 0 and 360. Defaults to 45°location
(any type in [point, string]): Allows to define the location of the camera in the world, i.e. from where it looks at its target. If 'distance:' is specified, the final location is translated on the target-camera axis to respect the distance. Can be a (possibly dynamically computed) point or a symbolic position (#from_above, #from_left, #from_right, #from_up_right, #from_up_left, #from_front, #from_up_front) that will be dynamically recomputed if the target movesIf 'location:' is not defined, it will be that of the default camera (#from_top, #from_left...) defined in the preferences.locked
(boolean): If true, the user cannot modify the camera location and target by interacting with the display. It is automatically set when the camera is dynamic, so that the display can 'follow' the coordinates; but it can also be used with fixed coordinates to 'focus' the display on a specific scenetarget
(any type in [point, agent, geometry]): Allows to define the target of the camera (what does it look at). It can be a point (in world coordinates), a geometry or an agent, in which case its (possibly dynamic) location it used as the target. This facet can be complemented by 'distance:' and/or 'location:' to specify from where the target is looked at. If 'target:' is not defined, the default target is the centroid of the world shape.
Definition​
camera
allows the modeler to define a camera. The display will then be able to choose among the camera defined (either within this statement or globally in GAMA) in a dynamic way. Several preset cameras are provided and accessible in the preferences (to choose the default) or in GAML using the keywords #from_above, #from_left, #from_right, #from_up_right, #from_up_left, #from_front, #from_up_front, #isometric.These cameras are unlocked (so that they can be manipulated by the user), look at the center of the world from a symbolic position, and the distance between this position and the target is equal to the maximum of the width and height of the world's shape. These preset cameras can be reused when defining new cameras, since their names can become symbolic positions for them. For instance: camera 'my_camera' location: #from_top distance: 10; will lower (or extend) the distance between the camera and the center of the world to 10. camera 'my_camera' locked: true location: #from_up_front target: people(0); will continuously follow the first agent of the people species from the up-front position.
Usages​
- See also: display, agents, chart, event, graphics, display_grid, image_layer, species_layer,
Embedments​
- The
camera
statement is of type: Layer - The
camera
statement can be embedded into: display, - The
camera
statement embeds statements:
capture​
Facets​
target
(any type in [agent, container]), (omissible) : an expression that is evaluated as an agent or a list of the agent to be capturedas
(species): the species that the captured agent(s) will become, this is a micro-species of the calling agent's speciesreturns
(a new identifier): a list of the newly captured agent(s)
Definition​
Allows an agent to capture other agent(s) as its micro-agent(s).
Usages​
- The preliminary for an agent A to capture an agent B as its micro-agent is that the A's species must defined a micro-species which is a sub-species of B's species (cf. [Species161#Nesting_species Nesting species]).
species A {
...
}
species B {
...
species C parent: A {
...
}
...
}
- To capture all "A" agents as "C" agents, we can ask an "B" agent to execute the following statement:
capture list(B) as: C;
- Deprecated writing:
capture target: list (B) as: C;
- See also: release,
Embedments​
- The
capture
statement is of type: Sequence of statements or action - The
capture
statement can be embedded into: Behavior, Sequence of statements or action, - The
capture
statement embeds statements:
catch​
Facets​
Definition​
This statement cannot be used alone
Usages​
- See also: try,
Embedments​
- The
catch
statement is of type: Sequence of statements or action - The
catch
statement can be embedded into: try, - The
catch
statement embeds statements:
category​
Facets​
name
(a label), (omissible) : The title of the category displayed in the UIcolor
(rgb): The background color of the category in the UIexpanded
(boolean): Whether the category is initially expanded or not
Definition​
Allows to define a category of parameters that will serve to group parameters in the UI. The category can be declared as initially expanded or closed (overriding the corresponding preference) and with a background color
Usages​
Embedments​
- The
category
statement is of type: Single statement - The
category
statement can be embedded into: Experiment, - The
category
statement embeds statements:
chart​
Facets​
name
(string), (omissible) : the identifier of the chart layeraxes
(rgb): the axis colorbackground
(rgb): the background colorcolor
(rgb): Text colorgap
(float): minimum gap between bars (in proportion)label_background_color
(rgb): Color of the label background (for Pie chart)label_font
(any type in [string, font]): Label font face. Either the name of a font face or a fontlabel_text_color
(rgb): Color of the label text (for Pie chart)legend_font
(any type in [string, font]): Legend font face. Either the name of a font face or a fontmemorize
(boolean): Whether or not to keep the values in memory (in order to produce a csv file, for instance). The default value, true, can also be changed in the preferencesposition
(point): position of the upper-left corner of the layer. Note that if coordinates are in [0,1[, the position is relative to the size of the environment (e.g. {0.5,0.5} refers to the middle of the display) whereas it is absolute when coordinates are greater than 1 for x and y. The z-ordinate can only be defined between 0 and 1. The position can only be a 3D point {0.5, 0.5, 0.5}, the last coordinate specifying the elevation of the layer.reverse_axes
(boolean): reverse X and Y axis (for example to get horizental bar chartsseries_label_position
(an identifier), takes values in: {default, none, legend, onchart, yaxis, xaxis}: Position of the Series names: default (best guess), none, legend, onchart, xaxis (for category plots) or yaxis (uses the first serie name).size
(point): the layer resize factor: {1,1} refers to the original size whereas {0.5,0.5} divides by 2 the height and the width of the layer. In case of a 3D layer, a 3D point can be used (note that {1,1} is equivalent to {1,1,0}, so a resize of a layer containing 3D objects with a 2D points will remove the elevation)style
(an identifier), takes values in: {line, area, bar, dot, step, spline, stack, 3d, ring, exploded, default}: The sub-style style, also default style for the series.tick_font
(any type in [string, font]): Tick font face. Either the name of a font face or a font. When used for a series chart, it will set the font of values on the axes, but When used with a pie, it will modify the font of messages associated to each pie section.tick_line_color
(rgb): the tick lines colortitle_font
(any type in [string, font]): Title font face. Either the name of a font face or a fonttitle_visible
(boolean): chart title visibletransparency
(float): the transparency level of the layer (between 0 -- opaque -- and 1 -- fully transparent)type
(an identifier), takes values in: {xy, scatter, histogram, series, pie, radar, heatmap, box_whisker}: the type of chart. It could be histogram, series, xy, pie, radar, heatmap or box whisker. The difference between series and xy is that the former adds an implicit x-axis that refers to the numbers of cycles, while the latter considers the first declaration of data to be its x-axis.visible
(boolean): Defines whether this layer is visible or notx_label
(string): the title for the X axisx_log_scale
(boolean): use Log Scale for X axisx_range
(any type in [float, int, point, list]): range of the x-axis. Can be a number (which will set the axis total range) or a point (which will set the min and max of the axis).x_serie
(any type in [list, float, int]): for series charts, change the default common x serie (simulation cycle) for an other value (list or numerical).x_serie_labels
(any type in [list, float, int, a label]): change the default common x series labels (replace x value or categories) for an other value (string or numerical).x_tick_line_visible
(boolean): X tick line visiblex_tick_unit
(float): the tick unit for the y-axis (distance between horizontal lines and values on the left of the axis).x_tick_values_visible
(boolean): X tick values visibley_label
(string): the title for the Y axisy_log_scale
(boolean): use Log Scale for Y axisy_range
(any type in [float, int, point, list]): range of the y-axis. Can be a number (which will set the axis total range) or a point (which will set the min and max of the axis).y_serie_labels
(any type in [list, float, int, a label]): for heatmaps/3d charts, change the default y serie for an other value (string or numerical in a list or cumulative).y_tick_line_visible
(boolean): Y tick line visibley_tick_unit
(float): the tick unit for the x-axis (distance between vertical lines and values bellow the axis).y_tick_values_visible
(boolean): Y tick values visibley2_label
(string): the title for the second Y axisy2_log_scale
(boolean): use Log Scale for second Y axisy2_range
(any type in [float, int, point, list]): range of the second y-axis. Can be a number (which will set the axis total range) or a point (which will set the min and max of the axis).y2_tick_unit
(float): the tick unit for the x-axis (distance between vertical lines and values bellow the axis).
Definition​
chart
allows modeler to display a chart: this enables to display specific values of the model at each iteration. GAMA can display various chart types: time series (series), pie charts (pie) and histograms (histogram).
Usages​
- The general syntax is:
display chart_display {
chart "chart name" type: series [additional options] {
[Set of data, datalists statements]
}
}
- See also: display, agents, event, graphics, display_grid, image_layer, overlay, quadtree, species_layer, text,
Embedments​
- The
chart
statement is of type: Layer - The
chart
statement can be embedded into: display, - The
chart
statement embeds statements: add, ask, data, datalist, do, put, remove, set, using,
conscious_contagion​
Facets​
emotion_created
(emotion): the emotion that will be created with the contagionemotion_detected
(emotion): the emotion that will start the contagionname
(an identifier), (omissible) : the identifier of the unconscious contagioncharisma
(float): The charisma value of the perceived agent (between 0 and 1)decay
(float): The decay value of the emotion added to the agentintensity
(float): The intensity value of the emotion added to the agentreceptivity
(float): The receptivity value of the current agent (between 0 and 1)threshold
(float): The threshold value to make the contagionwhen
(boolean): A boolean value to get the emotion only with a certain condition
Definition​
enables to directly add an emotion of a perceived species if the perceived agent gets a particular emotion.
Usages​
- Other examples of use:
conscious_contagion emotion_detected:fear emotion_created:fearConfirmed;
conscious_contagion emotion_detected:fear emotion_created:fearConfirmed charisma: 0.5 receptivity: 0.5;
Embedments​
- The
conscious_contagion
statement is of type: Single statement - The
conscious_contagion
statement can be embedded into: Behavior, Sequence of statements or action, - The
conscious_contagion
statement embeds statements:
continue​
Facets​
Definition​
continue
allows to skip the remaining statements inside a loop and an ask and directly move to the next element. Inside a switch, it has the same effect as break.
Usages​
Embedments​
- The
continue
statement is of type: Single statement - The
continue
statement can be embedded into: Sequence of statements or action, - The
continue
statement embeds statements:
coping​
Facets​
name
(an identifier), (omissible) : The name of the rulebelief
(predicate): The mandatory beliefbeliefs
(list): The mandatory beliefsdesire
(predicate): The mandatory desiredesires
(list): The mandatory desiresemotion
(emotion): The mandatory emotionemotions
(list): The mandatory emotionsideal
(predicate): The mandatory idealideals
(list): The mandatory idealslifetime
(int): the lifetime value of the mental state creatednew_belief
(predicate): The belief that will be addednew_beliefs
(list): The belief that will be addednew_desire
(predicate): The desire that will be addednew_desires
(list): The desire that will be addednew_emotion
(emotion): The emotion that will be addednew_emotions
(list): The emotion that will be addednew_ideal
(predicate): The ideal that will be addednew_ideals
(list): The ideals that will be addednew_uncertainties
(list): The uncertainty that will be addednew_uncertainty
(predicate): The uncertainty that will be addedobligation
(predicate): The mandatory obligationobligations
(list): The mandatory obligationsparallel
(any type in [boolean, int]): setting this facet to 'true' will allow 'perceive' to use concurrency with a parallel_bdi architecture; setting it to an integer will set the threshold under which they will be run sequentially (the default is initially 20, but can be fixed in the preferences). This facet is true by default.remove_belief
(predicate): The belief that will be removedremove_beliefs
(list): The belief that will be removedremove_desire
(predicate): The desire that will be removedremove_desires
(list): The desire that will be removedremove_emotion
(emotion): The emotion that will be removedremove_emotions
(list): The emotion that will be removedremove_ideal
(predicate): The ideal that will be removedremove_ideals
(list): The ideals that will be removedremove_intention
(predicate): The intention that will be removedremove_obligation
(predicate): The obligation that will be removedremove_obligations
(list): The obligation that will be removedremove_uncertainties
(list): The uncertainty that will be removedremove_uncertainty
(predicate): The uncertainty that will be removedstrength
(any type in [float, int]): The stregth of the mental state createdthreshold
(float): Threshold linked to the emotion.uncertainties
(list): The mandatory uncertaintiesuncertainty
(predicate): The mandatory uncertaintywhen
(boolean):
Definition​
enables to add or remove mantal states depending on the emotions of the agent, after the emotional engine and before the cognitive or normative engine.
Usages​
- Other examples of use:
coping emotion: new_emotion("fear") when: flip(0.5) new_desire: new_predicate("test");
Embedments​
- The
coping
statement is of type: Behavior - The
coping
statement can be embedded into: simple_bdi, parallel_bdi, Species, Model, - The
coping
statement embeds statements:
create​
Facets​
species
(any type in [species, agent]), (omissible) : an expression that evaluates to a species, the species of the agents to be created. In the case of simulations, the name 'simulation', which represents the current instance of simulation, can also be used as a proxy to their speciesas
(species): optionally indicates a species into which to cast the created agents.from
(any type): an expression that evaluates to a localized entity, a list of localized entities, a string (the path of a file), a file (shapefile, a .csv, a .asc or a OSM file) or a container returned by a request to a databasenumber
(int): an expression that evaluates to an int, the number of created agentsreturns
(a new identifier): a new temporary variable name containing the list of created agents (a list, even if only one agent has been created)with
(map): an expression that evaluates to a map, for each pair the key is a species attribute and the value the assigned value
Definition​
Allows an agent to create number
agents of species species
, to create agents of species species
from a shapefile or to create agents of species species
from one or several localized entities (discretization of the localized entity geometries).
Usages​
- Its simple syntax to create
an_int
agents of speciesa_species
is:
create a_species number: an_int;
create species_of(self) number: 5 returns: list5Agents;
- In GAML modelers can create agents of species
a_species
(with two attributestype
andnature
with types corresponding to the types of the shapefile attributes) from a shapefilethe_shapefile
while reading attributes 'TYPE_OCC' and 'NATURE' of the shapefile. One agent will be created by object contained in the shapefile:
create a_species from: the_shapefile with: [type:: read('TYPE_OCC'), nature::read('NATURE')];
- In order to create agents from a .csv file, facet
header
can be used to specified whether we can use columns header:
create toto from: "toto.csv" header: true with:[att1::read("NAME"), att2::read("TYPE")];
or
create toto from: "toto.csv" with:[att1::read(0), att2::read(1)]; //with read(int), the index of the column
- Similarly to the creation from shapefile, modelers can create agents from a set of geometries. In this case, one agent per geometry will be created (with the geometry as shape)
create species_of(self) from: [square(4), circle(4)]; // 2 agents have been created, with shapes respectively square(4) and circle(4)
- Created agents are initialized following the rules of their species. If one wants to refer to them after the statement is executed, the returns keyword has to be defined: the agents created will then be referred to by the temporary variable it declares. For instance, the following statement creates 0 to 4 agents of the same species as the sender, and puts them in the temporary variable children for later use.
create species (self) number: rnd (4) returns: children;
ask children {
// ...
}
- If one wants to specify a special initialization sequence for the agents created, create provides the same possibilities as ask. This extended syntax is:
create a_species number: an_int {
[statements]
}
- The same rules as in ask apply. The only difference is that, for the agents created, the assignments of variables will bypass the initialization defined in species. For instance:
create species(self) number: rnd (4) returns: children {
set location <- myself.location + {rnd (2), rnd (2)}; // tells the children to be initially located close to me
set parent <- myself; // tells the children that their parent is me (provided the variable parent is declared in this species)
}
- Deprecated uses:
// Simple syntax
create species: a_species number: an_int;
- If
number
equals 0 or species is not a species, the statement is ignored.
Embedments​
- The
create
statement is of type: Sequence of statements or action - The
create
statement can be embedded into: Behavior, Sequence of statements or action, - The
create
statement embeds statements:
data​
Facets​
legend
(string), (omissible) : The legend of the chartvalue
(any type in [float, point, list]): The value to output on the chartaccumulate_values
(boolean): Force to replace values at each step (false) or accumulate with previous steps (true)color
(any type in [rgb, list]): color of the serie, for heatmap can be a list to specify [minColor,maxColor] or [minColor,medColor,maxColor]fill
(boolean): Marker filled (true) or not (false)line_visible
(boolean): Whether lines are visible or notmarker
(boolean): marker visible or notmarker_shape
(an identifier), takes values in: {marker_empty, marker_square, marker_circle, marker_up_triangle, marker_diamond, marker_hor_rectangle, marker_down_triangle, marker_hor_ellipse, marker_right_triangle, marker_vert_rectangle, marker_left_triangle}: Shape of the markermarker_size
(float): Size in pixels of the markerstyle
(an identifier), takes values in: {line, area, bar, dot, step, spline, stack, 3d, ring, exploded}: Style for the serie (if not the default one sepecified on chart statement)thickness
(float): The thickness of the lines to drawuse_second_y_axis
(boolean): Use second y axis for this seriex_err_values
(any type in [float, list]): the X Error bar values to display. Has to be a List. Each element can be a number or a list with two values (low and high value)y_err_values
(any type in [float, list]): the Y Error bar values to display. Has to be a List. Each element can be a number or a list with two values (low and high value)y_minmax_values
(list): the Y MinMax bar values to display (BW charts). Has to be a List. Each element can be a number or a list with two values (low and high value)
Definition​
This statement allows to describe the values that will be displayed on the chart.
Usages​
Embedments​
- The
data
statement is of type: Single statement - The
data
statement can be embedded into: chart, Sequence of statements or action, - The
data
statement embeds statements:
datalist​
Facets​
value
(list): the values to display. Has to be a matrix, a list or a List of List. Each element can be a number (series/histogram) or a list with two values (XY chart)legend
(list), (omissible) : the name of the series: a list of strings (can be a variable with dynamic names)accumulate_values
(boolean): Force to replace values at each step (false) or accumulate with previous steps (true)color
(list): list of colors, for heatmaps can be a list of [minColor,maxColor] or [minColor,medColor,maxColor]fill
(boolean): Marker filled (true) or not (false), same for all series.line_visible
(boolean): Line visible or not (same for all series)marker
(boolean): marker visible or notmarker_shape
(an identifier), takes values in: {marker_empty, marker_square, marker_circle, marker_up_triangle, marker_diamond, marker_hor_rectangle, marker_down_triangle, marker_hor_ellipse, marker_right_triangle, marker_vert_rectangle, marker_left_triangle}: Shape of the marker. Same one for all series.marker_size
(list): the marker sizes to display. Can be a list of numbers (same size for each marker of the series) or a list of list (different sizes by point)style
(an identifier), takes values in: {line, area, bar, dot, step, spline, stack, 3d, ring, exploded}: Style for the serie (if not the default one sepecified on chart statement)thickness
(float): The thickness of the lines to drawuse_second_y_axis
(boolean): Use second y axis for this seriex_err_values
(list): the X Error bar values to display. Has to be a List. Each element can be a number or a list with two values (low and high value)y_err_values
(list): the Y Error bar values to display. Has to be a List. Each element can be a number or a list with two values (low and high value)y_minmax_values
(list): the Y MinMax bar values to display (BW charts). Has to be a List. Each element can be a number or a list with two values (low and high value)
Definition​
add a list of series to a chart. The number of series can be dynamic (the size of the list changes each step). See Ant Foraging (Charts) model in ChartTest for examples.
Usages​
Embedments​
- The
datalist
statement is of type: Single statement - The
datalist
statement can be embedded into: chart, Sequence of statements or action, - The
datalist
statement embeds statements:
default​
Facets​
value
(any type), (omissible) : The value or values this statement tries to match
Definition​
Used in a switch match structure, the block prefixed by default is executed only if no other block has matched (otherwise it is not).
Usages​
Embedments​
- The
default
statement is of type: Sequence of statements or action - The
default
statement can be embedded into: switch, - The
default
statement embeds statements:
diffuse​
Facets​
var
(an identifier), (omissible) : the variable to be diffused. If diffused over a field, then this name will serve to identify the diffusionon
(any type in [species, field, list]): the list of agents (in general cells of a grid), or a field on which the diffusion will occuravoid_mask
(boolean): if true, the value will not be diffused in the masked cells, but will be restitute to the neighboring cells, multiplied by the proportion value (no signal lost). If false, the value will be diffused in the masked cells, but masked cells won't diffuse the value afterward (lost of signal). (default value : false)cycle_length
(int): the number of diffusion operation applied in one simulation stepmask
(matrix): a matrix that masks the diffusion ( created from an image for instance). The cells corresponding to the values smaller than "-1" in the mask matrix will not diffuse, and the other will diffuse.matrix
(matrix): the diffusion matrix ("kernel" or "filter" in image processing). Can have any size, as long as dimensions are odd values.method
(an identifier), takes values in: {convolution, dot_product}: the diffusion method. One of 'convolution' or 'dot_product'min
(float): if a value is smaller than this value, it will not be diffused. By default, this value is equal to 0.0. This value cannot be smaller than 0.propagation
(a label), takes values in: {diffusion, gradient}: represents both the way the signal is propagated and the way to treat multiple propagation of the same signal occurring at once from different places. If propagation equals 'diffusion', the intensity of a signal is shared between its neighbors with respect to 'proportion', 'variation' and the number of neighbors of the environment places (4, 6 or 8). I.e., for a given signal S propagated from place P, the value transmitted to its N neighbors is : S' = (S / N / proportion) - variation. The intensity of S is then diminished by S*
proportion on P. In a diffusion, the different signals of the same name see their intensities added to each other on each place. If propagation equals 'gradient', the original intensity is not modified, and each neighbors receives the intensity : S / proportion - variation. If multiple propagation occur at once, only the maximum intensity is kept on each place. If 'propagation' is not defined, it is assumed that it is equal to 'diffusion'.proportion
(float): a diffusion rateradius
(int): a diffusion radius (in number of cells from the center)variation
(float): an absolute value to decrease at each neighbors
Definition​
This statements allows a value to diffuse among a species on agents (generally on a grid) depending on a given diffusion matrix.
Usages​
- A basic example of diffusion of the variable phero defined in the species cells, given a diffusion matrix math_diff is:
matrix<float> math_diff <- matrix([[1/9,1/9,1/9],[1/9,1/9,1/9],[1/9,1/9,1/9]]);
diffuse var: phero on: cells matrix: math_diff;
- The diffusion can be masked by obstacles, created from a bitmap image:
diffuse var: phero on: cells matrix: math_diff mask: mymask;
- A convenient way to have an uniform diffusion in a given radius is (which is equivalent to the above diffusion):
diffuse var: phero on: cells proportion: 1/9 radius: 1;
Embedments​
- The
diffuse
statement is of type: Single statement - The
diffuse
statement can be embedded into: Behavior, Sequence of statements or action, - The
diffuse
statement embeds statements:
display​
Facets​
name
(a label), (omissible) : the identifier of the displayantialias
(boolean): Indicates whether to use advanced antialiasing for the display or not. The default value is the one indicated in the preferences of GAMA ('false' is its factory default). Antialising produces smoother outputs, but comes with a cost in terms of speed and memory used.autosave
(any type in [boolean, point, string]): Allows to save this display on disk. This facet accepts bool, point or string values. If it is false or nil, nothing happens. 'true' will save it at a resolution of 500x500 with a standard name (containing the name of the model, display, resolution, cycle and time). A non-nil point will change that resolution. A non-nil string will keep 500x500 and change the filename (if it is not dynamically built, the previous file will be erased). Note that setting autosave to true in a display will synchronize all the displays defined in the experimentaxes
(boolean): Allows to enable/disable the drawing of the world shape and the ordinate axes. Default can be configured in Preferencesbackground
(rgb): Allows to fill the background of the display with a specific colorcamera
(string): Allows to define the name of the camera to use. Default value is 'default'. Accepted values are (1) the name of one of the cameras defined using the 'camera' statement or (2) one of the preset cameras, accessible using constants: #from_above, #from_left, #from_right, #from_up_left, #from_up_right, #from_front, #from_up_front, #isometricfullscreen
(any type in [boolean, int]): Indicates, when using a boolean value, whether or not the display should cover the whole screen (default is false). If an integer is passed, specifies also the screen to use: 0 for the primary monitor, 1 for the secondary one, and so on and so forth. If the monitor is not available, the first one is usedkeystone
(container): Set the position of the 4 corners of your screen ([topLeft,topRight,botLeft,botRight]), in (x,y) coordinate ( the (0,0) position is the top left corner, while the (1,1) position is the bottom right corner). The default value is : [{0,0},{1,0},{0,1},{1,1}]light
(boolean): Allows to enable/disable the light at once. Default is trueorthographic_projection
(boolean): Allows to enable/disable the orthographic projection. Default can be configured in Preferencesparent
(an identifier): Declares that this display inherits its layers and attributes from the parent display named as the argument. Expects the identifier of the parent display or a string if the name of the parent contains spacesrefresh
(boolean): Indicates the condition under which this output should be refreshed (default is true)show_fps
(boolean): Allows to enable/disable the drawing of the number of frames per secondtoolbar
(any type in [boolean, rgb]): Indicates whether the top toolbar of the display view should be initially visible or not. If a color is passed, then the background of the toolbar takes this colortype
(a label): Allows to use either Java2D (for planar models) or OpenGL (for 3D models) as the rendering subsystemvirtual
(boolean): Declaring a display as virtual makes it invisible on screen, and only usable for display inheritancez_far
(float): Set the distances to the far depth clipping planes. Must be positive.z_near
(float): Set the distances to the near depth clipping planes. Must be positive.
Definition​
A display refers to an independent and mobile part of the interface that can display species, images, texts or charts.
Usages​
- The general syntax is:
display my_display [additional options] { ... }
- Each display can include different layers (like in a GIS).
display gridWithElevationTriangulated type: opengl ambient_light: 100 {
grid cell elevation: true triangulation: true;
species people aspect: base;
}
Embedments​
- The
display
statement is of type: Output - The
display
statement can be embedded into: output, permanent, - The
display
statement embeds statements: agents, camera, chart, display_grid, event, graphics, image_layer, light, mesh, overlay, rotation, species_layer,
display_grid​
Facets​
species
(species), (omissible) : the species of the agents in the gridborder
(rgb): the color to draw lines (borders of cells)elevation
(any type in [matrix, float, int, boolean]): Allows to specify the elevation of each cell, if any. Can be a matrix of float (provided it has the same size than the grid), an int or float variable of the grid species, or simply true (in which case, the variable called 'grid_value' is used to compute the elevation of each cell)grayscale
(boolean): if true, givse a grey value to each polygon depending on its elevation (false by default)hexagonal
(boolean):position
(point): position of the upper-left corner of the layer. Note that if coordinates are in [0,1[, the position is relative to the size of the environment (e.g. {0.5,0.5} refers to the middle of the display) whereas it is absolute when coordinates are greater than 1 for x and y. The z-ordinate can only be defined between 0 and 1. The position can only be a 3D point {0.5, 0.5, 0.5}, the last coordinate specifying the elevation of the layer. In case of negative value OpenGl will position the layer out of the environment.refresh
(boolean): (openGL only) specify whether the display of the species is refreshed. (true by default, usefull in case of agents that do not move)rotate
(float): Defines the angle of rotation of this layer, in degrees, around the z-axis.selectable
(boolean): Indicates whether the agents present on this layer are selectable by the user. Default is truesize
(point): extent of the layer in the screen from its position. Coordinates in [0,1[ are treated as percentages of the total surface, while coordinates > 1 are treated as absolute sizes in model units (i.e. considering the model occupies the entire view). Like in 'position', an elevation can be provided with the z coordinate, allowing to scale the layer in the 3 directionssmooth
(boolean): Applies a simple convolution (box filter) to smooth out the terrain produced by this field. Does not change the values of course.text
(boolean): specify whether the attribute used to compute the elevation is displayed on each cells (false by default)texture
(file): Either file containing the texture image to be applied on the grid or, if not specified, the use of the image composed by the colors of the cellstransparency
(float): the transparency level of the layer (between 0 -- opaque -- and 1 -- fully transparent)triangulation
(boolean): specifies whther the cells will be triangulated: if it is false, they will be displayed as horizontal squares at a given elevation, whereas if it is true, cells will be triangulated and linked to neighbors in order to have a continuous surface (false by default)visible
(boolean): Defines whether this layer is visible or notwireframe
(boolean): if true displays the grid in wireframe using the lines color
Definition​
display_grid
is used using the grid
keyword. It allows the modeler to display in an optimized way all cell agents of a grid (i.e. all agents of a species having a grid topology).
Usages​
- The general syntax is:
display my_display {
grid ant_grid lines: #black position: { 0.5, 0 } size: {0.5,0.5};
}
- To display a grid as a DEM:
display my_display {
grid cell texture: texture_file text: false triangulation: true elevation: true;
}
Embedments​
- The
display_grid
statement is of type: Layer - The
display_grid
statement can be embedded into: display, - The
display_grid
statement embeds statements: