#Operators (N to R)

**This file is automatically generated from java files. Do Not Edit It.**

Operators in the GAML language are used to compose complex expressions. An operator performs a function on one, two, or n operands (which are other expressions and thus may be themselves composed of operators) and returns the result of this function.

Most of them use a classical prefixed functional syntax (i.e. `operator_name(operand1, operand2, operand3)`

, see below), with the exception of arithmetic (e.g. `+`

, `/`

), logical (`and`

, `or`

), comparison (e.g. `>`

, `<`

), access (`.`

, `[..]`

) and pair (`::`

) operators, which require an infixed notation (i.e. `operand1 operator_symbol operand1`

).

The ternary functional if-else operator, `? :`

, uses a special infixed syntax composed with two symbols (e.g. `operand1 ? operand2 : operand3`

). Two unary operators (`-`

and `!`

) use a traditional prefixed syntax that does not require parentheses unless the operand is itself a complex expression (e.g. ` - 10`, `

! (operand1 or operand2)`).

Finally, special constructor operators (`{...}`

for constructing points, `[...]`

for constructing lists and maps) will require their operands to be placed between their two symbols (e.g. `{1,2,3}`

, `[operand1, operand2, ..., operandn]`

or `[key1::value1, key2::value2... keyn::valuen]`

).

With the exception of these special cases above, the following rules apply to the syntax of operators:

- if they only have one operand, the functional prefixed syntax is mandatory (e.g.
`operator_name(operand1)`

) - if they have two arguments, either the functional prefixed syntax (e.g.
`operator_name(operand1, operand2)`

) or the infixed syntax (e.g.`operand1 operator_name operand2`

) can be used. - if they have more than two arguments, either the functional prefixed syntax (e.g.
`operator_name(operand1, operand2, ..., operand)`

) or a special infixed syntax with the first operand on the left-hand side of the operator name (e.g.`operand1 operator_name(operand2, ..., operand)`

) can be used.

All of these alternative syntaxes are completely equivalent.

Operators in GAML are purely functional, i.e. they are guaranteed to not have any side effects on their operands. For instance, the `shuffle`

operator, which randomizes the positions of elements in a list, does not modify its list operand but returns a new shuffled list.

The priority of operators determines, in the case of complex expressions composed of several operators, which one(s) will be evaluated first.

GAML follows in general the traditional priorities attributed to arithmetic, boolean, comparison operators, with some twists. Namely:

- the constructor operators, like
`::`

, used to compose pairs of operands, have the lowest priority of all operators (e.g.`a > b :: b > c`

will return a pair of boolean values, which means that the two comparisons are evaluated before the operator applies. Similarly,`[a > 10, b > 5]`

will return a list of boolean values. - it is followed by the
`?:`

operator, the functional if-else (e.g. ` a > b ? a + 10 : a - 10` will return the result of the if-else). - next are the logical operators,
`and`

and`or`

(e.g.`a > b or b > c`

will return the value of the test) - next are the comparison operators (i.e.
`>`

,`<`

,`<=`

,`>=`

,`=`

,`!=`

) - next the arithmetic operators in their logical order (multiplicative operators have a higher priority than additive operators)
- next the unary operators
`-`

and`!`

- next the access operators
`.`

and`[]`

(e.g.`{1,2,3}.x > 20 + {4,5,6}.y`

will return the result of the comparison between the x and y ordinates of the two points) - and finally the functional operators, which have the highest priority of all.

Actions defined in species can be used as operators, provided they are called on the correct agent. The syntax is that of normal functional operators, but the agent that will perform the action must be added as the first operand.

For instance, if the following species is defined:

```
species spec1 {
int min(int x, int y) {
return x > y ? x : y;
}
}
```

Any agent instance of spec1 can use `min`

as an operator (if the action conflicts with an existing operator, a warning will be emitted). For instance, in the same model, the following line is perfectly acceptable:

```
global {
init {
create spec1;
spec1 my_agent <- spec1[0];
int the_min <- my_agent min(10,20); // or min(my_agent, 10, 20);
}
}
```

If the action doesn’t have any operands, the syntax to use is `my_agent the_action()`

. Finally, if it does not return a value, it might still be used but is considering as returning a value of type `unknown`

(e.g. `unknown result <- my_agent the_action(op1, op2);`

).

Note that due to the fact that actions are written by modelers, the general functional contract is not respected in that case: actions might perfectly have side effects on their operands (including the agent).

box, cone3D, cube, cylinder, dem, hexagon, pyramid, rgb_to_xyz, set_z, sphere, teapot,

-, /, [^](OperatorsAA#^), [*](OperatorsAA#*), +, abs, acos, asin, atan, atan2, ceil, cos, cos_rad, div, even, exp, fact, floor, hypot, is_finite, is_number, ln, log, mod, round, signum, sin, sin_rad, sqrt, tan, tan_rad, tanh, with_precision,

and, eval_when, get_about, get_agent, get_agent_cause, get_belief_op, get_belief_with_name_op, get_beliefs_op, get_beliefs_with_name_op, get_current_intention_op, get_decay, get_desire_op, get_desire_with_name_op, get_desires_op, get_desires_with_name_op, get_dominance, get_familiarity, get_ideal_op, get_ideal_with_name_op, get_ideals_op, get_ideals_with_name_op, get_intensity, get_intention_op, get_intention_with_name_op, get_intentions_op, get_intentions_with_name_op, get_lifetime, get_liking, get_modality, get_obligation_op, get_obligation_with_name_op, get_obligations_op, get_obligations_with_name_op, get_plan_name, get_predicate, get_solidarity, get_strength, get_super_intention, get_trust, get_truth, get_uncertainties_op, get_uncertainties_with_name_op, get_uncertainty_op, get_uncertainty_with_name_op, has_belief_op, has_belief_with_name_op, has_desire_op, has_desire_with_name_op, has_ideal_op, has_ideal_with_name_op, has_intention_op, has_intention_with_name_op, has_obligation_op, has_obligation_with_name_op, has_uncertainty_op, has_uncertainty_with_name_op, new_emotion, new_mental_state, new_predicate, new_social_link, or, set_about, set_agent, set_agent_cause, set_decay, set_dominance, set_familiarity, set_intensity, set_lifetime, set_liking, set_modality, set_predicate, set_solidarity, set_strength, set_trust, set_truth, with_lifetime, with_values,

as, as_int, as_matrix, font, is, is_skill, list_with, matrix_with, species, to_gaml, topology,

-, /, [*](OperatorsAA#*), +, blend, brewer_colors, brewer_palettes, grayscale, hsb, mean, median, rgb, rnd_color, sum,

-, ::, +, accumulate, all_match, among, at, collect, contains, contains_all, contains_any, count, distinct, empty, every, first, first_with, get, group_by, in, index_by, inter, interleave, internal_at, internal_integrated_value, last, last_with, length, max, max_of, mean, mean_of, median, min, min_of, mul, none_matches, one_matches, one_of, product_of, range, reverse, shuffle, sort_by, split, split_in, split_using, sum, sum_of, union, variance_of, where, with_max_of, with_min_of,

-, !=, +, <, <=, =, >, >=, after, before, between, every, milliseconds_between, minus_days, minus_hours, minus_minutes, minus_months, minus_ms, minus_weeks, minus_years, months_between, plus_days, plus_hours, plus_minutes, plus_months, plus_ms, plus_weeks, plus_years, since, to, until, years_between,

auto_correlation, correlation, covariance, durbin_watson, kurtosis, moment, quantile, quantile_inverse, rank_interpolated, rms, skew, variance,

binomial_coeff, binomial_complemented, binomial_sum, chi_square, chi_square_complemented, gamma_distribution, gamma_distribution_complemented, normal_area, normal_density, normal_inverse, pValue_for_fStat, pValue_for_tStat, student_area, student_t_inverse,

diff, diff2, internal_zero_order_equation,

crs, evaluate_sub_model, file, file_exists, folder, get, load_sub_model, new_folder, osm_file, read, step_sub_model, writable,

beta, gamma, incomplete_beta, incomplete_gamma, incomplete_gamma_complement, log_gamma,

add_edge, add_node, adjacency, agent_from_geometry, all_pairs_shortest_path, alpha_index, as_distance_graph, as_edge_graph, as_intersection_graph, as_path, beta_index, betweenness_centrality, biggest_cliques_of, connected_components_of, connectivity_index, contains_edge, contains_vertex, degree_of, directed, edge, edge_between, edge_betweenness, edges, gamma_index, generate_barabasi_albert, generate_complete_graph, generate_watts_strogatz, grid_cells_to_graph, in_degree_of, in_edges_of, layout, load_graph_from_file, load_shortest_paths, main_connected_component, max_flow_between, maximal_cliques_of, nb_cycles, neighbors_of, node, nodes, out_degree_of, out_edges_of, path_between, paths_between, predecessors_of, remove_node_from, rewire_n, source_of, spatial_graph, strahler, successors_of, sum, target_of, undirected, use_cache, weight_of, with_optimizer_type, with_weights,

as_4_grid, as_grid, as_hexagonal_grid, grid_at, path_between,

accumulate, all_match, as_map, collect, count, create_map, distribution_of, distribution_of, distribution_of, distribution2d_of, distribution2d_of, distribution2d_of, first_with, frequency_of, group_by, index_by, last_with, max_of, mean_of, min_of, none_matches, one_matches, product_of, sort_by, sum_of, variance_of, where, with_max_of, with_min_of,

copy_between, index_of, last_index_of,

:, !, ?, add_3Dmodel, add_geometry, add_icon, and, or, xor,

fuzzy_kappa, fuzzy_kappa_sim, kappa, kappa_sim, percent_absolute_deviation,

as_map, create_map, index_of, last_index_of,

-, /, ., [*](OperatorsAA#*), +, append_horizontally, append_vertically, column_at, columns_list, determinant, eigenvalues, index_of, inverse, last_index_of, row_at, rows_list, shuffle, trace, transpose,

electre_DM, evidence_theory_DM, fuzzy_choquet_DM, promethee_DM, weighted_means_DM,

agent_from_geometry, all_pairs_shortest_path, as_path, load_shortest_paths, max_flow_between, path_between, path_to, paths_between, use_cache,

-, /, [*](OperatorsAA#*), +, <, <=, >, >=, add_point, angle_between, any_location_in, centroid, closest_points_with, farthest_point_to, grid_at, norm, points_along, points_at, points_on,

binomial, flip, gauss, improved_generator, open_simplex_generator, poisson, rnd, rnd_choice, sample, shuffle, simplex_generator, skew_gauss, truncated_gauss,

restoreSimulation, restoreSimulationFromFile, saveAgent, saveSimulation, serialize, serializeAgent,

arc, box, circle, cone, cone3D, cross, cube, curve, cylinder, ellipse, envelope, geometry_collection, hexagon, line, link, plan, polygon, polyhedron, pyramid, rectangle, sphere, square, squircle, teapot, triangle,

-, [*](OperatorsAA#*), +, add_point, agent_closest_to, agent_farthest_to, agents_at_distance, agents_inside, agents_overlapping, angle_between, any_location_in, arc, around, as_4_grid, as_grid, as_hexagonal_grid, at_distance, at_location, box, centroid, circle, clean, clean_network, closest_points_with, closest_to, cone, cone3D, convex_hull, covers, cross, crosses, crs, CRS_transform, cube, curve, cylinder, dem, direction_between, disjoint_from, distance_between, distance_to, ellipse, envelope, farthest_point_to, farthest_to, geometry_collection, gini, hexagon, hierarchical_clustering, IDW, inside, inter, intersects, line, link, masked_by, moran, neighbors_at, neighbors_of, overlapping, overlaps, partially_overlaps, path_between, path_to, plan, points_along, points_at, points_on, polygon, polyhedron, pyramid, rectangle, rgb_to_xyz, rotated_by, round, scaled_to, set_z, simple_clustering_by_distance, simplification, skeletonize, smooth, sphere, split_at, split_geometry, split_lines, square, squircle, teapot, to_GAMA_CRS, to_rectangles, to_segments, to_squares, to_sub_geometries, touches, towards, transformed_by, translated_by, triangle, triangulate, union, using, voronoi, with_precision, without_holes,

covers, crosses, intersects, partially_overlaps, touches,

agent_closest_to, agent_farthest_to, agents_at_distance, agents_inside, agents_overlapping, at_distance, closest_to, farthest_to, inside, neighbors_at, neighbors_of, overlapping,

direction_between, distance_between, distance_to, path_between, path_to, towards,

hierarchical_clustering, simple_clustering_by_distance,

-, [*](OperatorsAA#*), +, as_4_grid, as_grid, as_hexagonal_grid, at_location, clean, clean_network, convex_hull, CRS_transform, rotated_by, scaled_to, simplification, skeletonize, smooth, split_geometry, split_lines, to_GAMA_CRS, to_rectangles, to_segments, to_squares, to_sub_geometries, transformed_by, translated_by, triangulate, voronoi, with_precision, without_holes,

index_of, last_index_of, of_generic_species, of_species,

build, corR, dbscan, distribution_of, distribution2d_of, dtw, frequency_of, gamma_rnd, geometric_mean, gini, harmonic_mean, hierarchical_clustering, kmeans, kurtosis, max, mean, mean_deviation, meanR, median, min, moran, mul, predict, simple_clustering_by_distance, skewness, split, split_in, split_using, standard_deviation, sum, variance,

+, <, <=, >, >=, at, char, contains, contains_all, contains_any, copy_between, date, empty, first, in, indented_by, index_of, is_number, last, last_index_of, length, lower_case, replace, replace_regex, reverse, sample, shuffle, split_with, string, upper_case,

., command, copy, dead, eval_gaml, every, is_error, is_warning, user_input,

`nb_cycles`

(`nb_cycles`

`graph`

) —>`int`

returns the maximum number of independent cycles in a graph. This number (u) is estimated through the number of nodes (v), links (e) and of sub-graphs (p): u = e - v + p.

```
graph graphEpidemio <- graph([]);
int var1 <- nb_cycles(graphEpidemio); // var1 equals the number of cycles in the graph
```

alpha_index, beta_index, gamma_index, connectivity_index,

`neighbors_at`

`geometry`

`neighbors_at`

`float`

—>`list`

(`neighbors_at`

`geometry`

,`float`

) —>`list`

a list, containing all the agents of the same species than the left argument (if it is an agent) located at a distance inferior or equal to the right-hand operand to the left-hand operand (geometry, agent, point).

The topology used to compute the neighborhood is the one of the left-operand if this one is an agent; otherwise the one of the agent applying the operator.

```
list var0 <- (self neighbors_at (10)); // var0 equals all the agents located at a distance lower or equal to 10 to the agent applying the operator.
```

neighbors_of, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to, at_distance,

`neighbors_of`

`topology`

`neighbors_of`

`agent`

—>`list`

(`neighbors_of`

`topology`

,`agent`

) —>`list`

`graph`

`neighbors_of`

`unknown`

—>`list`

(`neighbors_of`

`graph`

,`unknown`

) —>`list`

(`neighbors_of`

`topology`

,`geometry`

,`float`

) —>`list`

a list, containing all the agents of the same species than the argument (if it is an agent) located at a distance inferior or equal to 1 to the right-hand operand agent considering the left-hand operand topology.

- a list, containing all the agents of the same species than the left argument (if it is an agent) located at a distance inferior or equal to the third argument to the second argument (agent, geometry or point) considering the first operand topology.

```
list var0 <- neighbors_of (topology(self), self,10); // var0 equals all the agents located at a distance lower or equal to 10 to the agent applying the operator considering its topology.
```

```
list var1 <- topology(self) neighbors_of self; // var1 equals returns all the agents located at a distance lower or equal to 1 to the agent applying the operator considering its topology.
list var2 <- graphEpidemio neighbors_of (node(3)); // var2 equals [node0,node2]
list var3 <- graphFromMap neighbors_of node({12,45}); // var3 equals [{1.0,5.0},{34.0,56.0}]
```

neighbors_at, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to, predecessors_of, successors_of,

`new_emotion`

(`new_emotion`

`string`

) —>`emotion`

`string`

`new_emotion`

`agent`

—>`emotion`

(`new_emotion`

`string`

,`agent`

) —>`emotion`

`string`

`new_emotion`

`float`

—>`emotion`

(`new_emotion`

`string`

,`float`

) —>`emotion`

`string`

`new_emotion`

`predicate`

—>`emotion`

(`new_emotion`

`string`

,`predicate`

) —>`emotion`

(`new_emotion`

`string`

,`predicate`

,`agent`

) —>`emotion`

(`new_emotion`

`string`

,`float`

,`float`

) —>`emotion`

(`new_emotion`

`string`

,`float`

,`predicate`

) —>`emotion`

(`new_emotion`

`string`

,`float`

,`agent`

) —>`emotion`

(`new_emotion`

`string`

,`float`

,`predicate`

,`agent`

) —>`emotion`

(`new_emotion`

`string`

,`float`

,`predicate`

,`float`

) —>`emotion`

(`new_emotion`

`string`

,`float`

,`float`

,`agent`

) —>`emotion`

(`new_emotion`

`string`

,`float`

,`predicate`

,`float`

,`agent`

) —>`emotion`

a new emotion with the given properties (name) a new emotion with the given properties (name,intensity,decay) a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name, intensity) a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name,intensity,about) a new emotion with the given properties (name) a new emotion with the given properties (name,about)

```
emotion("joy",12.3,eatFood,4) emotion("joy",12.3,4) emotion("joy") emotion("joy",12.3,eatFood,4) emotion("joy",12.3,eatFood,4) emotion("joy",12.3) emotion("joy",12.3,eatFood,4) emotion("joy",12.3,eatFood,4) emotion("joy",12.3,eatFood,4) emotion("joy",12.3,eatFood) emotion("joy",12.3,eatFood,4) emotion("joy",eatFood)
```

`new_folder`

(`new_folder`

`string`

) —>`file`

opens an existing repository or create a new folder if it does not exist.

- If the specified string does not refer to an existing repository, the repository is created.
- If the string refers to an existing file, an exception is risen.

```
file dirNewT <- new_folder("incl/"); // dirNewT represents the repository "../incl/" // eventually creates the directory ../incl
```

`new_mental_state`

(`new_mental_state`

`string`

) —>`mental_state`

`string`

`new_mental_state`

`predicate`

—>`mental_state`

(`new_mental_state`

`string`

,`predicate`

) —>`mental_state`

`string`

`new_mental_state`

`emotion`

—>`mental_state`

(`new_mental_state`

`string`

,`emotion`

) —>`mental_state`

`string`

`new_mental_state`

`mental_state`

—>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

) —>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`emotion`

,`float`

) —>`mental_state`

(`new_mental_state`

`string`

,`emotion`

,`int`

) —>`mental_state`

(`new_mental_state`

`string`

,`predicate`

,`float`

) —>`mental_state`

(`new_mental_state`

`string`

,`emotion`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

,`int`

) —>`mental_state`

(`new_mental_state`

`string`

,`predicate`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

,`float`

) —>`mental_state`

(`new_mental_state`

`string`

,`predicate`

,`int`

) —>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

,`float`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`emotion`

,`float`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

,`int`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`predicate`

,`float`

,`int`

) —>`mental_state`

(`new_mental_state`

`string`

,`predicate`

,`int`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

,`float`

,`int`

) —>`mental_state`

(`new_mental_state`

`string`

,`predicate`

,`float`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`emotion`

,`float`

,`int`

) —>`mental_state`

(`new_mental_state`

`string`

,`emotion`

,`int`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`predicate`

,`float`

,`int`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`mental_state`

,`float`

,`int`

,`agent`

) —>`mental_state`

(`new_mental_state`

`string`

,`emotion`

,`float`

,`int`

,`agent`

) —>`mental_state`

a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state a new mental state

```
new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief) new_mental-state(belief)
```

`new_predicate`

(`new_predicate`

`string`

) —>`predicate`

`string`

`new_predicate`

`agent`

—>`predicate`

(`new_predicate`

`string`

,`agent`

) —>`predicate`

`string`

`new_predicate`

`bool`

—>`predicate`

(`new_predicate`

`string`

,`bool`

) —>`predicate`

`string`

`new_predicate`

`map`

—>`predicate`

(`new_predicate`

`string`

,`map`

) —>`predicate`

`string`

`new_predicate`

`int`

—>`predicate`

(`new_predicate`

`string`

,`int`

) —>`predicate`

(`new_predicate`

`string`

,`map`

,`agent`

) —>`predicate`

(`new_predicate`

`string`

,`map`

,`bool`

) —>`predicate`

(`new_predicate`

`string`

,`map`

,`int`

) —>`predicate`

(`new_predicate`

`string`

,`map`

,`bool`

,`agent`

) —>`predicate`

(`new_predicate`

`string`

,`map`

,`int`

,`agent`

) —>`predicate`

(`new_predicate`

`string`

,`map`

,`int`

,`bool`

) —>`predicate`

(`new_predicate`

`string`

,`map`

,`int`

,`bool`

,`agent`

) —>`predicate`

a new predicate with the given properties (name, values, agentCause) a new predicate with the given properties (name, values, lifetime) a new predicate with the given properties (name, values, is_true) a new predicate with the given properties (name, values, lifetime) a new predicate with the given is_true (name, is_true) a new predicate with the given properties (name, values, is_true, agentCause) a new predicate with the given properties (name, values, lifetime, is_true, agentCause) a new predicate with the given properties (name, values, lifetime, agentCause) a new predicate with the given properties (name, values) a new predicate with the given properties (name) a new predicate with the given properties (name, values, lifetime, is_true) a new predicate with the given is_true (name, lifetime)

```
predicate("people to meet", ["time"::10], agentA) predicate("people to meet", ["time"::10], true) predicate("people to meet", ["time"::10], true) predicate("people to meet", ["time"::10], true) predicate("hasWater", true) predicate("people to meet", ["time"::10], true, agentA) predicate("people to meet", ["time"::10], 10, true, agentA) predicate("people to meet", ["time"::10], 10, agentA) predicate("people to meet", people1 ) predicate("people to meet") predicate("people to meet", ["time"::10], 10,true) predicate("hasWater", 10
```

`new_social_link`

(`new_social_link`

`agent`

) —>`msi.gaml.architecture.simplebdi.SocialLink`

(`new_social_link`

`agent`

,`float`

,`float`

,`float`

,`float`

) —>`msi.gaml.architecture.simplebdi.SocialLink`

a new social link a new social link

```
new_social_link(agentA,0.0,-0.1,0.2,0.1) new_social_link(agentA)
```

`node`

(`node`

`unknown`

) —>`unknown`

`unknown`

`node`

`float`

—>`unknown`

(`node`

`unknown`

,`float`

) —>`unknown`

`nodes`

(`nodes`

`container`

) —>`container`

`none_matches`

`container`

`none_matches`

`any expression`

—>`bool`

(`none_matches`

`container`

,`any expression`

) —>`bool`

Returns true if none of the elements of the left-hand operand make the right-hand operand evaluate to true. Returns true if the left-hand operand is empty. ‘c none_matches each.property’ is strictly equivalent to ‘(c count each.property) = 0’

in the right-hand operand, the keyword each can be used to represent, in turn, each of the elements.

- if the left-hand operand is nil, none_matches throws an error

```
bool var0 <- [1,2,3,4,5,6,7,8] none_matches (each > 3); // var0 equals false
bool var1 <- [1::2, 3::4, 5::6] none_matches (each > 4); // var1 equals false
```

one_matches, all_match, count,

`none_verifies`

Same signification as none_matches

`norm`

(`norm`

`point`

) —>`float`

the norm of the vector with the coordinates of the point operand.

```
float var0 <- norm({3,4}); // var0 equals 5.0
```

`Norm`

(`Norm`

`any`

) —>`Norm`

Casts the operand into the type Norm

`normal_area`

(`normal_area`

`float`

,`float`

,`float`

) —>`float`

Returns the area to the left of x in the normal distribution with the given mean and standard deviation.

`normal_density`

(`normal_density`

`float`

,`float`

,`float`

) —>`float`

Returns the probability of x in the normal distribution with the given mean and standard deviation.

`normal_inverse`

(`normal_inverse`

`float`

,`float`

,`float`

) —>`float`

Returns the x in the normal distribution with the given mean and standard deviation, to the left of which lies the given area. normal.Inverse returns the value in terms of standard deviations from the mean, so we need to adjust it for the given mean and standard deviation.

`not`

Same signification as !

`obj_file`

(`obj_file`

`string`

) —>`file`

Constructs a file of type obj. Allowed extensions are limited to obj, OBJ

`of`

Same signification as .

`of_generic_species`

`container`

`of_generic_species`

`species`

—>`list`

(`of_generic_species`

`container`

,`species`

) —>`list`

a list, containing the agents of the left-hand operand whose species is that denoted by the right-hand operand and whose species extends the right-hand operand species

```
// species test {} // species sous_test parent: test {}
list var2 <- [sous_test(0),sous_test(1),test(2),test(3)] of_generic_species test; // var2 equals [sous_test0,sous_test1,test2,test3]
list var3 <- [sous_test(0),sous_test(1),test(2),test(3)] of_generic_species sous_test; // var3 equals [sous_test0,sous_test1]
list var4 <- [sous_test(0),sous_test(1),test(2),test(3)] of_species test; // var4 equals [test2,test3]
list var5 <- [sous_test(0),sous_test(1),test(2),test(3)] of_species sous_test; // var5 equals [sous_test0,sous_test1]
```

`of_species`

`container`

`of_species`

`species`

—>`list`

(`of_species`

`container`

,`species`

) —>`list`

a list, containing the agents of the left-hand operand whose species is the one denoted by the right-hand operand.The expression agents of_species (species self) is equivalent to agents where (species each = species self); however, the advantage of using the first syntax is that the resulting list is correctly typed with the right species, whereas, in the second syntax, the parser cannot determine the species of the agents within the list (resulting in the need to cast it explicitly if it is to be used in an ask statement, for instance).

- if the right operand is nil, of_species returns the right operand

```
list var0 <- (self neighbors_at 10) of_species (species (self)); // var0 equals all the neighboring agents of the same species.
list var1 <- [test(0),test(1),node(1),node(2)] of_species test; // var1 equals [test0,test1]
```

`one_matches`

`container`

`one_matches`

`any expression`

—>`bool`

(`one_matches`

`container`

,`any expression`

) —>`bool`

Returns true if at least one of the elements of the left-hand operand make the right-hand operand evaluate to true. Returns false if the left-hand operand is empty. ‘c one_matches each.property’ is strictly equivalent to ‘(c count each.property) > 0’ but faster in most cases (as it is a shortcircuited operator)

in the right-hand operand, the keyword each can be used to represent, in turn, each of the elements.

- if the left-hand operand is nil, one_matches throws an error

```
bool var0 <- [1,2,3,4,5,6,7,8] one_matches (each > 3); // var0 equals true
bool var1 <- [1::2, 3::4, 5::6] one_matches (each > 4); // var1 equals true
```

none_matches, all_match, count,

`one_of`

(`one_of`

`container<KeyType,ValueType>`

) —>`ValueType`

one of the values stored in this container at a random key

the one_of operator behavior depends on the nature of the operand

- if it is a graph, one_of returns one of the lists of edges
- if it is a file, one_of returns one of the elements of the content of the file (that is also a container)
- if the operand is empty, one_of returns nil

```
```

- if it is a list or a matrix, one_of returns one of the values of the list or of the matrix

```
int
i <- any ([1,2,3]); //i equals 1, 2 or 3string sMat <- one_of(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // sMat equals "c11","c12","c13", "c21","c22" or "c23"
```

- if it is a map, one_of returns one the value of a random pair of the map

```
int im <- one_of ([2::3, 4::5, 6::7]); // im equals 3, 5 or 7
bool var6 <- [2::3, 4::5, 6::7].values contains im; // var6 equals true
```

- if it is a population, one_of returns one of the agents of the population

```
bug b <- one_of(bug); // Given a previously defined species bug, b is one of the created bugs, e.g. bug3
```

`one_verifies`

Same signification as one_matches

`open_simplex_generator`

(`open_simplex_generator`

`float`

,`float`

,`float`

) —>`float`

take a x, y and a bias parameters and gives a value

```
float var0 <- open_simplex_generator(2,3,253); // var0 equals 10.2
```

`or`

`bool`

`or`

`any expression`

—>`bool`

(`or`

`bool`

,`any expression`

) —>`bool`

a bool value, equal to the logical or between the left-hand operand and the right-hand operand.

both operands are always casted to bool before applying the operator. Thus, an expression like 1 or 0 is accepted and returns true.

`or`

`predicate`

`or`

`predicate`

—>`predicate`

(`or`

`predicate`

,`predicate`

) —>`predicate`

create a new predicate from two others by including them as subintentions. It’s an exclusive “or”

```
predicate1 or predicate2
```

`osm_file`

`string`

`osm_file`

`map<string,list>`

—>`file`

(`osm_file`

`string`

,`map<string,list>`

) —>`file`

(`osm_file`

`string`

,`map<string,list>`

,`int`

) —>`file`

opens a file that a is a kind of OSM file with some filtering. opens a file that a is a kind of OSM file with some filtering, forcing the initial CRS to be the one indicated by the second int parameter (see http://spatialreference.org/ref/epsg/). If this int parameter is equal to 0, the data is considered as already projected.

The file should have a OSM file extension, cf. file type definition for supported file extensions.The file should have a OSM file extension, cf. file type definition for supported file extensions.

- If the specified string does not refer to an existing OSM file, an exception is risen.
- If the specified string does not refer to an existing OSM file, an exception is risen.

```
file myOSMfile <- osm_file("../includes/rouen.osm", ["highway"::["primary","motorway"]]); file myOSMfile2 <- osm_file("../includes/rouen.osm",["highway"::["primary","motorway"]], 0);
```

file,

`out_degree_of`

`graph`

`out_degree_of`

`unknown`

—>`int`

(`out_degree_of`

`graph`

,`unknown`

) —>`int`

returns the out degree of a vertex (right-hand operand) in the graph given as left-hand operand.

```
int var1 <- graphFromMap out_degree_of (node(3)); // var1 equals 4
```

`out_edges_of`

`graph`

`out_edges_of`

`unknown`

—>`list`

(`out_edges_of`

`graph`

,`unknown`

) —>`list`

returns the list of the out-edges of a vertex (right-hand operand) in the graph given as left-hand operand.

```
list var1 <- graphFromMap out_edges_of (node(3)); // var1 equals 3
```

`overlapping`

`container<agent>`

`overlapping`

`geometry`

—>`list<geometry>`

(`overlapping`

`container<agent>`

,`geometry`

) —>`list<geometry>`

A list of agents or geometries among the left-operand list, species or meta-population (addition of species), overlapping the operand (casted as a geometry).

```
list<geometry> var0 <- [ag1, ag2, ag3] overlapping(self); // var0 equals return the agents among ag1, ag2 and ag3 that overlap the shape of the agent applying the operator.(species1 + species2) overlapping self
```

neighbors_at, neighbors_of, agent_closest_to, agents_inside, closest_to, inside, agents_overlapping,

`overlaps`

`geometry`

`overlaps`

`geometry`

—>`bool`

(`overlaps`

`geometry`

,`geometry`

) —>`bool`

A boolean, equal to true if the left-geometry (or agent/point) overlaps the right-geometry (or agent/point).

- if one of the operand is null, returns false.
- if one operand is a point, returns true if the point is included in the geometry

```
bool var0 <- polyline([{10,10},{20,20}]) overlaps polyline([{15,15},{25,25}]); // var0 equals true
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals true
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps {25,25}; // var2 equals false
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{35,35},{35,45},{45,45},{45,35}]); // var3 equals false
bool var4 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polyline([{10,10},{20,20}]); // var4 equals true
bool var5 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps {15,15}; // var5 equals true
bool var6 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{0,0},{0,30},{30,30}, {30,0}]); // var6 equals true
bool var7 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var7 equals true
bool var8 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{10,20},{20,20},{20,30},{10,30}]); // var8 equals true
```

disjoint_from, crosses, intersects, partially_overlaps, touches,

`pair`

(`pair`

`any`

) —>`pair`

Casts the operand into the type pair

`partially_overlaps`

`geometry`

`partially_overlaps`

`geometry`

—>`bool`

(`partially_overlaps`

`geometry`

,`geometry`

) —>`bool`

A boolean, equal to true if the left-geometry (or agent/point) partially overlaps the right-geometry (or agent/point).

if one geometry operand fully covers the other geometry operand, returns false (contrarily to the overlaps operator).

- if one of the operand is null, returns false.

```
bool var0 <- polyline([{10,10},{20,20}]) partially_overlaps polyline([{15,15},{25,25}]); // var0 equals true
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals true
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps {25,25}; // var2 equals false
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{35,35},{35,45},{45,45},{45,35}]); // var3 equals false
bool var4 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polyline([{10,10},{20,20}]); // var4 equals false
bool var5 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps {15,15}; // var5 equals false
bool var6 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{0,0},{0,30},{30,30}, {30,0}]); // var6 equals false
bool var7 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var7 equals true
bool var8 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{10,20},{20,20},{20,30},{10,30}]); // var8 equals false
```

disjoint_from, crosses, overlaps, intersects, touches,

`path`

(`path`

`any`

) —>`path`

Casts the operand into the type path

`path_between`

`msi.gama.util.GamaMap<msi.gama.metamodel.agent.IAgent,java.lang.Object>`

`path_between`

`container<geometry>`

—>`path`

(`path_between`

`msi.gama.util.GamaMap<msi.gama.metamodel.agent.IAgent,java.lang.Object>`

,`container<geometry>`

) —>`path`

`list<agent>`

`path_between`

`container<geometry>`

—>`path`

(`path_between`

`list<agent>`

,`container<geometry>`

) —>`path`

`topology`

`path_between`

`container<geometry>`

—>`path`

(`path_between`

`topology`

,`container<geometry>`

) —>`path`

(`path_between`

`list<agent>`

,`geometry`

,`geometry`

) —>`path`

(`path_between`

`graph`

,`geometry`

,`geometry`

) —>`path`

(`path_between`

`msi.gama.util.GamaMap<msi.gama.metamodel.agent.IAgent,java.lang.Object>`

,`geometry`

,`geometry`

) —>`path`

(`path_between`

`topology`

,`geometry`

,`geometry`

) —>`path`

The shortest path between several objects according to set of cells with corresponding weights The shortest path between two objects according to set of cells The shortest path between several objects according to set of cells The shortest path between a list of two objects in a graph The shortest path between two objects according to set of cells with corresponding weights

```
path var0 <- path_between (cell_grid as_map (each::each.is_obstacle ? 9999.0 : 1.0), [ag1, ag2, ag3]); // var0 equals A path between ag1 and ag2 and ag3 passing through the given cell_grid agents with minimal cost
path var1 <- path_between (cell_grid where each.is_free, ag1, ag2); // var1 equals A path between ag1 and ag2 passing through the given cell_grid agents
path var2 <- path_between (cell_grid where each.is_free, [ag1, ag2, ag3]); // var2 equals A path between ag1 and ag2 and ag3 passing through the given cell_grid agents
path var3 <- path_between (my_graph, ag1, ag2); // var3 equals A path between ag1 and ag2
path var4 <- path_between (cell_grid as_map (each::each.is_obstacle ? 9999.0 : 1.0), ag1, ag2); // var4 equals A path between ag1 and ag2 passing through the given cell_grid agents with a minimal cost
path var5 <- my_topology path_between (ag1, ag2); // var5 equals A path between ag1 and ag2
path var6 <- my_topology path_between [ag1, ag2]; // var6 equals A path between ag1 and ag2
```

towards, direction_to, distance_between, direction_between, path_to, distance_to,

`path_to`

`geometry`

`path_to`

`geometry`

—>`path`

(`path_to`

`geometry`

,`geometry`

) —>`path`

`point`

`path_to`

`point`

—>`path`

(`path_to`

`point`

,`point`

) —>`path`

A path between two geometries (geometries, agents or points) considering the topology of the agent applying the operator.

```
path var0 <- ag1 path_to ag2; // var0 equals the path between ag1 and ag2 considering the topology of the agent applying the operator
```

towards, direction_to, distance_between, direction_between, path_between, distance_to,

`paths_between`

(`paths_between`

`graph`

,`pair`

,`int`

) —>`msi.gama.util.IList<msi.gama.util.path.GamaSpatialPath>`

The K shortest paths between a list of two objects in a graph

```
msi.gama.util.IList<msi.gama.util.path.GamaSpatialPath> var0 <- paths_between(my_graph, ag1:: ag2, 2); // var0 equals the 2 shortest paths (ordered by length) between ag1 and ag2
```

`pbinom`

Same signification as binomial_sum

`pchisq`

Same signification as chi_square

`percent_absolute_deviation`

`list<float>`

`percent_absolute_deviation`

`list<float>`

—>`float`

(`percent_absolute_deviation`

`list<float>`

,`list<float>`

) —>`float`

percent absolute deviation indicator for 2 series of values: percent_absolute_deviation(list_vals_observe,list_vals_sim)

```
percent_absolute_deviation([200,300,150,150,200],[250,250,100,200,200])
```

`percentile`

Same signification as quantile_inverse

`pgamma`

Same signification as gamma_distribution

`pgm_file`

(`pgm_file`

`string`

) —>`file`

Constructs a file of type pgm. Allowed extensions are limited to pgm

`plan`

`container<geometry>`

`plan`

`float`

—>`geometry`

(`plan`

`container<geometry>`

,`float`

) —>`geometry`

A polyline geometry from the given list of points.

- if the operand is nil, returns the point geometry {0,0}
- if the operand is composed of a single point, returns a point geometry.

```
geometry var0 <- polyplan([{0,0}, {0,10}, {10,10}, {10,0}],10); // var0 equals a polyline geometry composed of the 4 points with a depth of 10.
```

around, circle, cone, link, norm, point, polygone, rectangle, square, triangle,

`plus_days`

`date`

`plus_days`

`int`

—>`date`

(`plus_days`

`date`

,`int`

) —>`date`

Add a given number of days to a date

```
date var0 <- date('2000-01-01') plus_days 12; // var0 equals date('2000-01-13')
```

`plus_hours`

`date`

`plus_hours`

`int`

—>`date`

(`plus_hours`

`date`

,`int`

) —>`date`

Add a given number of hours to a date

```
// equivalent to date1 + 15 #h
date var1 <- date('2000-01-01') plus_hours 24; // var1 equals date('2000-01-02')
```

`plus_minutes`

`date`

`plus_minutes`

`int`

—>`date`

(`plus_minutes`

`date`

,`int`

) —>`date`

Add a given number of minutes to a date

```
// equivalent to date1 + 5 #mn
date var1 <- date('2000-01-01') plus_minutes 5 ; // var1 equals date('2000-01-01 00:05:00')
```

`plus_months`

`date`

`plus_months`

`int`

—>`date`

(`plus_months`

`date`

,`int`

) —>`date`

Add a given number of months to a date

```
date var0 <- date('2000-01-01') plus_months 5; // var0 equals date('2000-06-01')
```

`plus_ms`

`date`

`plus_ms`

`int`

—>`date`

(`plus_ms`

`date`

,`int`

) —>`date`

Add a given number of milliseconds to a date

```
// equivalent to date('2000-01-01') + 15 #ms
date var1 <- date('2000-01-01') plus_ms 1000 ; // var1 equals date('2000-01-01 00:00:01')
```

`plus_seconds`

Same signification as +

`plus_weeks`

`date`

`plus_weeks`

`int`

—>`date`

(`plus_weeks`

`date`

,`int`

) —>`date`

Add a given number of weeks to a date

```
date var0 <- date('2000-01-01') plus_weeks 15; // var0 equals date('2000-04-15')
```

`plus_years`

`date`

`plus_years`

`int`

—>`date`

(`plus_years`

`date`

,`int`

) —>`date`

Add a given number of years to a date

```
date var0 <- date('2000-01-01') plus_years 15; // var0 equals date('2015-01-01')
```

`pnorm`

Same signification as normal_area

`point`

(`point`

`any`

) —>`point`

Casts the operand into the type point

`points_along`

`geometry`

`points_along`

`list<float>`

—>`list`

(`points_along`

`geometry`

,`list<float>`

) —>`list`

A list of points along the operand-geometry given its location in terms of rate of distance from the starting points of the geometry.

```
list var0 <- line([{10,10},{80,80}]) points_along ([0.3, 0.5, 0.9]); // var0 equals the list of following points: [{31.0,31.0,0.0},{45.0,45.0,0.0},{73.0,73.0,0.0}]
```

closest_points_with, farthest_point_to, points_at, points_on,

`points_at`

`int`

`points_at`

`float`

—>`list<point>`

(`points_at`

`int`

,`float`

) —>`list<point>`

A list of left-operand number of points located at a the right-operand distance to the agent location.

```
list<point> var0 <- 3 points_at(20.0); // var0 equals returns [pt1, pt2, pt3] with pt1, pt2 and pt3 located at a distance of 20.0 to the agent location
```

any_location_in, any_point_in, closest_points_with, farthest_point_to,

`points_on`

`geometry`

`points_on`

`float`

—>`list`

(`points_on`

`geometry`

,`float`

) —>`list`

A list of points of the operand-geometry distant from each other to the float right-operand .

```
list var0 <- square(5) points_on(2); // var0 equals a list of points belonging to the exterior ring of the square distant from each other of 2.
```

closest_points_with, farthest_point_to, points_at,

`poisson`

(`poisson`

`float`

) —>`int`

A value from a random variable following a Poisson distribution (with the positive expected number of occurence lambda as operand).

The Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time and/or space if these events occur with a known average rate and independently of the time since the last event, cf. Poisson distribution on Wikipedia.

```
int var0 <- poisson(3.5); // var0 equals a random positive integer
```

`polygon`

(`polygon`

`container<agent>`

) —>`geometry`

A polygon geometry from the given list of points.

- if the operand is nil, returns the point geometry {0,0}
- if the operand is composed of a single point, returns a point geometry
- if the operand is composed of 2 points, returns a polyline geometry.

```
geometry var0 <- polygon([{0,0}, {0,10}, {10,10}, {10,0}]); // var0 equals a polygon geometry composed of the 4 points.
```

around, circle, cone, line, link, norm, point, polyline, rectangle, square, triangle,

`polyhedron`

`container<geometry>`

`polyhedron`

`float`

—>`geometry`

(`polyhedron`

`container<geometry>`

,`float`

) —>`geometry`

A polyhedron geometry from the given list of points.

- if the operand is nil, returns the point geometry {0,0}
- if the operand is composed of a single point, returns a point geometry
- if the operand is composed of 2 points, returns a polyline geometry.

```
geometry var0 <- polyhedron([{0,0}, {0,10}, {10,10}, {10,0}],10); // var0 equals a polygon geometry composed of the 4 points and of depth 10.
```

around, circle, cone, line, link, norm, point, polyline, rectangle, square, triangle,

`polyline`

Same signification as line

`polyplan`

Same signification as plan

`predecessors_of`

`graph`

`predecessors_of`

`unknown`

—>`list`

(`predecessors_of`

`graph`

,`unknown`

) —>`list`

returns the list of predecessors (i.e. sources of in edges) of the given vertex (right-hand operand) in the given graph (left-hand operand)

```
list var1 <- graphEpidemio predecessors_of ({1,5}); // var1 equals []
list var2 <- graphEpidemio predecessors_of node({34,56}); // var2 equals [{12;45}]
```

`predicate`

(`predicate`

`any`

) —>`predicate`

Casts the operand into the type predicate

`predict`

`regression`

`predict`

`list<float>`

—>`float`

(`predict`

`regression`

,`list<float>`

) —>`float`

returns the value predict by the regression parameters for a given instance. Usage: predict(regression, instance)

```
predict(my_regression, [1,2,3])
```

`product`

Same signification as mul

`product_of`

`container`

`product_of`

`any expression`

—>`unknown`

(`product_of`

`container`

,`any expression`

) —>`unknown`

the product of the right-hand expression evaluated on each of the elements of the left-hand operand

in the right-hand operand, the keyword each can be used to represent, in turn, each of the right-hand operand elements.

- if the left-operand is a map, the keyword each will contain each value

```
unknown var1 <- [1::2, 3::4, 5::6] product_of (each); // var1 equals 48
```

```
unknown var0 <- [1,2] product_of (each * 10 ); // var0 equals 200
```

min_of, max_of, sum_of, mean_of,

`promethee_DM`

`msi.gama.util.IList<java.util.List>`

`promethee_DM`

`msi.gama.util.IList<java.util.Map<java.lang.String,java.lang.Object>>`

—>`int`

(`promethee_DM`

`msi.gama.util.IList<java.util.List>`

,`msi.gama.util.IList<java.util.Map<java.lang.String,java.lang.Object>>`

) —>`int`

The index of the best candidate according to the Promethee II method. This method is based on a comparison per pair of possible candidates along each criterion: all candidates are compared to each other by pair and ranked. More information about this method can be found in [http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6VCT-4VF56TV-1&_user=10&_coverDate=01%2F01%2F2010&_rdoc=1&_fmt=high&_orig=search&_sort=d&_docanchor=&view=c&_searchStrId=1389284642&_rerunOrigin=google&_acct=C000050221&_version=1&_urlVersion=0&_userid=10&md5=d334de2a4e0d6281199a39857648cd36 Behzadian, M., Kazemzadeh, R., Albadvi, A., M., A.: PROMETHEE: A comprehensive literature review on methodologies and applications. European Journal of Operational Research(2009)]. The first operand is the list of candidates (a candidate is a list of criterion values); the second operand the list of criterion: A criterion is a map that contains fours elements: a name, a weight, a preference value (p) and an indifference value (q). The preference value represents the threshold from which the difference between two criterion values allows to prefer one vector of values over another. The indifference value represents the threshold from which the difference between two criterion values is considered significant.

- returns -1 is the list of candidates is nil or empty

```
int var0 <- promethee_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], [["name"::"utility", "weight" :: 2.0,"p"::0.5, "q"::0.0, "s"::1.0, "maximize" :: true],["name"::"price", "weight" :: 1.0,"p"::0.5, "q"::0.0, "s"::1.0, "maximize" :: false]]); // var0 equals 1
```

weighted_means_DM, electre_DM, evidence_theory_DM,

`property_file`

(`property_file`

`string`

) —>`file`

Constructs a file of type property. Allowed extensions are limited to properties

`pValue_for_fStat`

(`pValue_for_fStat`

`float`

,`int`

,`int`

) —>`float`

Returns the P value of F statistic fstat with numerator degrees of freedom dfn and denominator degress of freedom dfd. Uses the incomplete Beta function.

`pValue_for_tStat`

`float`

`pValue_for_tStat`

`int`

—>`float`

(`pValue_for_tStat`

`float`

,`int`

) —>`float`

Returns the P value of the T statistic tstat with df degrees of freedom. This is a two-tailed test so we just double the right tail which is given by studentT of -|tstat|.

`pyramid`

(`pyramid`

`float`

) —>`geometry`

A square geometry which side size is given by the operand.

the center of the pyramid is by default the location of the current agent in which has been called this operator.

- returns nil if the operand is nil.

```
geometry var0 <- pyramid(5); // var0 equals a geometry as a square with side_size = 5.
```

around, circle, cone, line, link, norm, point, polygon, polyline, rectangle, square,

`quantile`

`container`

`quantile`

`float`

—>`float`

(`quantile`

`container`

,`float`

) —>`float`

Returns the phi-quantile; that is, an element elem for which holds that phi percent of data elements are less than elem. The quantile need not necessarily be contained in the data sequence, it can be a linear interpolation. Note that the container holding the values must be sorted first

`quantile_inverse`

`container`

`quantile_inverse`

`float`

—>`float`

(`quantile_inverse`

`container`

,`float`

) —>`float`

Returns how many percent of the elements contained in the receiver are <= element. Does linear interpolation if the element is not contained but lies in between two contained elements. Note that the container holding the values must be sorted first

`R_correlation`

Same signification as corR

`R_file`

(`R_file`

`string`

) —>`file`

Constructs a file of type R. Allowed extensions are limited to r

`R_mean`

Same signification as meanR

`range`

(`range`

`int`

) —>`list`

`int`

`range`

`int`

—>`list`

(`range`

`int`

,`int`

) —>`list`

(`range`

`int`

,`int`

,`int`

) —>`list`

Allows to build a list of int representing all contiguous values from zero to the argument. The range can be increasing or decreasing. Passing 0 will return a singleton list with 0 Allows to build a list of int representing all contiguous values from the first to the second argument, using the step represented by the third argument. The range can be increasing or decreasing. Passing the same value for both will return a singleton list with this value. Passing a step of 0 will result in an exception. Attempting to build infinite ranges (e.g. end > start with a negative step) will similarly not be accepted and yield an exception Allows to build a list of int representing all contiguous values from the first to the second argument. The range can be increasing or decreasing. Passing the same value for both will return a singleton list with this value

`rank_interpolated`

`container`

`rank_interpolated`

`float`

—>`float`

(`rank_interpolated`

`container`

,`float`

) —>`float`

Returns the linearly interpolated number of elements in a list less or equal to a given element. The rank is the number of elements <= element. Ranks are of the form {0, 1, 2,…, sortedList.size()}. If no element is <= element, then the rank is zero. If the element lies in between two contained elements, then linear interpolation is used and a non integer value is returned. Note that the container holding the values must be sorted first

`read`

(`read`

`string`

) —>`unknown`

Reads an attribute of the agent. The attribute’s name is specified by the operand.

```
unknown
agent_name <- read ('name'); //agent_name equals reads the 'name' variable of agent then assigns the returned value to the 'agent_name' variable.
```

`rectangle`

(`rectangle`

`point`

) —>`geometry`

`point`

`rectangle`

`point`

—>`geometry`

(`rectangle`

`point`

,`point`

) —>`geometry`

`float`

`rectangle`

`float`

—>`geometry`

(`rectangle`

`float`

,`float`

) —>`geometry`

A rectangle geometry which side sizes are given by the operands.

the center of the rectangle is by default the location of the current agent in which has been called this operator.the center of the rectangle is by default the location of the current agent in which has been called this operator.

- returns nil if the operand is nil.
- returns nil if the operand is nil.
- returns nil if the operand is nil.

```
geometry var0 <- rectangle({2.0,6.0}, {6.0,20.0}); // var0 equals a geometry as a rectangle with {2.0,6.0} as the upper-left corner, {6.0,20.0} as the lower-right corner.
geometry var1 <- rectangle(10, 5); // var1 equals a geometry as a rectangle with width = 10 and height = 5.
geometry var2 <- rectangle({10, 5}); // var2 equals a geometry as a rectangle with width = 10 and height = 5.
```

around, circle, cone, line, link, norm, point, polygon, polyline, square, triangle,

`reduced_by`

Same signification as -

`regression`

(`regression`

`any`

) —>`regression`

Casts the operand into the type regression

`remove_duplicates`

Same signification as distinct

`remove_node_from`

`geometry`

`remove_node_from`

`graph`

—>`graph`

(`remove_node_from`

`geometry`

,`graph`

) —>`graph`

removes a node from a graph.

all the edges containing this node are also removed.

```
graph var0 <- node(0) remove_node_from graphEpidemio; // var0 equals the graph without node(0)
```

`replace`

(`replace`

`string`

,`string`

,`string`

) —>`string`

Returns the String resulting by replacing for the first operand all the sub-strings corresponding the second operand by the third operand

```
string var0 <- replace('to be or not to be,that is the question','to', 'do'); // var0 equals 'do be or not do be,that is the question'
```

`replace_regex`

(`replace_regex`

`string`

,`string`

,`string`

) —>`string`

Returns the String resulting by replacing for the first operand all the sub-strings corresponding to the regular expression given in the second operand by the third operand

```
string var0 <- replace_regex("colour, color", "colou?r", "col"); // var0 equals 'col, col'
```

`restoreSimulation`

(`restoreSimulation`

`string`

) —>`int`

restoreSimulation

`restoreSimulationFromFile`

(`restoreSimulationFromFile`

`ummisco.gama.serializer.gaml.GamaSavedSimulationFile`

) —>`int`

restoreSimulationFromFile

`reverse`

(`reverse`

`string`

) —>`string`

(`reverse`

`msi.gama.util.GamaMap<K,V>`

) —>`container`

(`reverse`

`container<KeyType,ValueType>`

) —>`container`

the operand elements in the reversed order in a copy of the operand.

the reverse operator behavior depends on the nature of the operand

- if it is a file, reverse returns a copy of the file with a reversed content
- if it is a population, reverse returns a copy of the population with elements in the reversed order
- if it is a graph, reverse returns a copy of the graph (with all edges and vertexes), with all of the edges reversed
- if it is a string, reverse returns a new string with characters in the reversed order

```
string var0 <- reverse ('abcd'); // var0 equals 'dcba'
```

- if it is a list, reverse returns a copy of the operand list with elements in the reversed order

```
container var1 <- reverse ([10,12,14]); // var1 equals [14, 12, 10]
```

- if it is a map, reverse returns a copy of the operand map with each pair in the reversed order (i.e. all keys become values and values become keys)

```
map<int,string> var2 <- reverse (['k1'::44, 'k2'::32, 'k3'::12]); // var2 equals [44::'k1', 32::'k2', 12::'k3']
```

- if it is a matrix, reverse returns a new matrix containing the transpose of the operand.

```
container var3 <- reverse(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var3 equals matrix([["c11","c21"],["c12","c22"],["c13","c23"]])
```

`rewire_n`

`graph`

`rewire_n`

`int`

—>`graph`

(`rewire_n`

`graph`

,`int`

) —>`graph`

rewires the given count of edges.

If there are too many edges, all the edges will be rewired.

```
graph var1 <- graphEpidemio rewire_n 10; // var1 equals the graph with 3 edges rewired
```

`rgb`

`string`

`rgb`

`int`

—>`rgb`

(`rgb`

`string`

,`int`

) —>`rgb`

`rgb`

`rgb`

`float`

—>`rgb`

(`rgb`

`rgb`

,`float`

) —>`rgb`

`rgb`

`rgb`

`int`

—>`rgb`

(`rgb`

`rgb`

,`int`

) —>`rgb`

(`rgb`

`int`

,`int`

,`int`

) —>`rgb`

(`rgb`

`int`

,`int`

,`int`

,`int`

) —>`rgb`

(`rgb`

`int`

,`int`

,`int`

,`float`

) —>`rgb`

Returns a color defined by red, green, blue components and an alpha blending value.

- It can be used with a name of color and alpha (between 0 and 255)
- It can be used with r=red, g=green, b=blue, each between 0 and 255
- It can be used with a color and an alpha between 0 and 1
- It can be used with r=red, g=green, b=blue (each between 0 and 255), a=alpha (between 0 and 255)
- It can be used with r=red, g=green, b=blue (each between 0 and 255), a=alpha (between 0.0 and 1.0)
- It can be used with a color and an alpha between 0 and 255

```
rgb var0 <- rgb ("red"); // var0 equals rgb(255,0,0)
rgb var1 <- rgb (255,0,0); // var1 equals #red
rgb var2 <- rgb(rgb(255,0,0),0.5); // var2 equals a light red color
rgb var3 <- rgb (255,0,0,125); // var3 equals a light red color
rgb var5 <- rgb (255,0,0,0.5); // var5 equals a light red color
rgb var6 <- rgb(rgb(255,0,0),125); // var6 equals a light red color
```

hsb,

`rgb`

(`rgb`

`any`

) —>`rgb`

Casts the operand into the type rgb

`rgb_to_xyz`

(`rgb_to_xyz`

`file`

) —>`list<point>`

A list of point corresponding to RGB value of an image (r:x , g:y, b:z)

```
list<point> var0 <- rgb_to_xyz(texture); // var0 equals a list of points
```

`rms`

`int`

`rms`

`float`

—>`float`

(`rms`

`int`

,`float`

) —>`float`

Returns the RMS (Root-Mean-Square) of a data sequence. The RMS of data sequence is the square-root of the mean of the squares of the elements in the data sequence. It is a measure of the average size of the elements of a data sequence.

`rnd`

(`rnd`

`point`

) —>`point`

(`rnd`

`int`

) —>`int`

(`rnd`

`float`

) —>`float`

`float`

`rnd`

`float`

—>`float`

(`rnd`

`float`

,`float`

) —>`float`

`int`

`rnd`

`int`

—>`int`

(`rnd`

`int`

,`int`

) —>`int`

`point`

`rnd`

`point`

—>`point`

(`rnd`

`point`

,`point`

) —>`point`

(`rnd`

`float`

,`float`

,`float`

) —>`float`

(`rnd`

`point`

,`point`

,`float`

) —>`point`

(`rnd`

`int`

,`int`

,`int`

) —>`int`

a random integer in the interval [0, operand]

to obtain a probability between 0 and 1, use the expression (rnd n) / n, where n is used to indicate the precision

- if the operand is a point, returns a point with three random float ordinates, each in the interval [0, ordinate of argument]
- if the operand is a float, returns an uniformly distributed float random number in [0.0, to]

```
point var0 <- rnd ({2.5,3, 0.0}); // var0 equals {x,y} with x in [0.0,2.0], y in [0.0,3.0], z = 0.0
int var1 <- rnd (2); // var1 equals 0, 1 or 2
float var2 <- rnd (1000) / 1000; // var2 equals a float between 0 and 1 with a precision of 0.001
float var3 <- rnd (2.0, 4.0, 0.5); // var3 equals a float number between 2.0 and 4.0 every 0.5
float var4 <- rnd(3.4); // var4 equals a random float between 0.0 and 3.4
float var5 <- rnd (2.0, 4.0); // var5 equals a float number between 2.0 and 4.0
int var6 <- rnd (2, 4); // var6 equals 2, 3 or 4
point var7 <- rnd ({2.0, 4.0}, {2.0, 5.0, 10.0}); // var7 equals a point with x = 2.0, y between 2.0 and 4.0 and z between 0.0 and 10.0
point var8 <- rnd ({2.0, 4.0}, {2.0, 5.0, 10.0}, 1); // var8 equals a point with x = 2.0, y equal to 2.0, 3.0 or 4.0 and z between 0.0 and 10.0 every 1.0
int var9 <- rnd (2, 12, 4); // var9 equals 2, 6 or 10
```

flip,

`rnd_choice`

(`rnd_choice`

`list`

) —>`int`

returns an index of the given list with a probability following the (normalized) distribution described in the list (a form of lottery)

```
int var0 <- rnd_choice([0.2,0.5,0.3]); // var0 equals 2/10 chances to return 0, 5/10 chances to return 1, 3/10 chances to return 2
```

rnd,

`rnd_color`

(`rnd_color`

`int`

) —>`rgb`

`int`

`rnd_color`

`int`

—>`rgb`

(`rnd_color`

`int`

,`int`

) —>`rgb`

rgb color Return a random color equivalent to rgb(rnd(first_op, last_op),rnd(first_op, last_op),rnd(first_op, last_op))

Return a random color equivalent to rgb(rnd(operand),rnd(operand),rnd(operand))

```
rgb var0 <- rnd_color(255); // var0 equals a random color, equivalent to rgb(rnd(255),rnd(255),rnd(255))
rgb var1 <- rnd_color(100, 200); // var1 equals a random color, equivalent to rgb(rnd(100, 200),rnd(100, 200),rnd(100, 200))
```

`rotated_by`

`geometry`

`rotated_by`

`int`

—>`geometry`

(`rotated_by`

`geometry`

,`int`

) —>`geometry`

`geometry`

`rotated_by`

`float`

—>`geometry`

(`rotated_by`

`geometry`

,`float`

) —>`geometry`

(`rotated_by`

`geometry`

,`float`

,`point`

) —>`geometry`

A geometry resulting from the application of a rotation by the right-hand operand angles (degree) along the three axis (x,y,z) to the left-hand operand (geometry, agent, point) A geometry resulting from the application of a rotation by the right-hand operand angle (degree) to the left-hand operand (geometry, agent, point)

the right-hand operand can be a float or a int

```
geometry var0 <- rotated_by(pyramid(10),45, {1,0,0}); // var0 equals the geometry resulting from a 45 degrees rotation along the {1,0,0} vector to the geometry of the agent applying the operator.
geometry var1 <- self rotated_by 45; // var1 equals the geometry resulting from a 45 degrees rotation to the geometry of the agent applying the operator.
```

transformed_by, translated_by,

`round`

(`round`

`int`

) —>`int`

(`round`

`point`

) —>`point`

(`round`

`float`

) —>`int`

Returns the rounded value of the operand.

- if the operand is an int, round returns it

```
point var0 <- {12345.78943, 12345.78943, 12345.78943} with_precision 2; // var0 equals {12345.79,12345.79,12345.79}
int var1 <- round (0.51); // var1 equals 1
int var2 <- round (100.2); // var2 equals 100
int var3 <- round(-0.51); // var3 equals -1
```

`row_at`

`matrix`

`row_at`

`int`

—>`list`

(`row_at`

`matrix`

,`int`

) —>`list`

returns the row at a num_line (right-hand operand)

```
list var0 <- matrix([["el11","el12","el13"],["el21","el22","el23"],["el31","el32","el33"]]) row_at 2; // var0 equals ["el13","el23","el33"]
```

`rows_list`

(`rows_list`

`matrix`

) —>`list<list>`

returns a list of the rows of the matrix, with each row as a list of elements

```
list<list> var0 <- rows_list(matrix([["el11","el12","el13"],["el21","el22","el23"],["el31","el32","el33"]])); // var0 equals [["el11","el21","el31"],["el12","el22","el32"],["el13","el23","el33"]]
```