#Operators (S to Z)

**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, 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, 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, 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, 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_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_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,

`sample`

(`sample`

`any expression`

) —>`string`

`string`

`sample`

`any expression`

—>`string`

(`sample`

`string`

,`any expression`

) —>`string`

(`sample`

`list`

,`int`

,`bool`

) —>`list`

(`sample`

`list`

,`int`

,`bool`

,`list`

) —>`list`

takes a sample of the specified size from the elements of x using either with or without replacement with given weights takes a sample of the specified size from the elements of x using either with or without replacement

```
list var0 <- sample([2,10,1],2,false,[0.1,0.7,0.2]); // var0 equals [10,2]
list var1 <- sample([2,10,1],2,false); // var1 equals [1,2]
```

`Sanction`

(`Sanction`

`any`

) —>`Sanction`

Casts the operand into the type Sanction

`saveAgent`

`agent`

`saveAgent`

`string`

—>`int`

(`saveAgent`

`agent`

,`string`

) —>`int`

`saved_simulation_file`

(`saved_simulation_file`

`string`

) —>`file`

Constructs a file of type saved_simulation. Allowed extensions are limited to gsim, gasim

`saveSimulation`

(`saveSimulation`

`string`

) —>`int`

`scaled_by`

Same signification as [*](OperatorsAA#*)

`scaled_to`

`geometry`

`scaled_to`

`point`

—>`geometry`

(`scaled_to`

`geometry`

,`point`

) —>`geometry`

allows to restrict the size of a geometry so that it fits in the envelope {width, height, depth} defined by the second operand

```
geometry var0 <- shape scaled_to {10,10}; // var0 equals a geometry corresponding to the geometry of the agent applying the operator scaled so that it fits a square of 10x10
```

`select`

Same signification as where

`serialize`

(`serialize`

`unknown`

) —>`string`

It serializes any object, i.e. transform it into a string.

`serializeAgent`

(`serializeAgent`

`agent`

) —>`string`

`set_about`

`emotion`

`set_about`

`predicate`

—>`emotion`

(`set_about`

`emotion`

,`predicate`

) —>`emotion`

change the about value of the given emotion

```
emotion set_about predicate1
```

`set_agent`

`msi.gaml.architecture.simplebdi.SocialLink`

`set_agent`

`agent`

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

(`set_agent`

`msi.gaml.architecture.simplebdi.SocialLink`

,`agent`

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

change the agent value of the given social link

```
social_link set_agent agentA
```

`set_agent_cause`

`emotion`

`set_agent_cause`

`agent`

—>`emotion`

(`set_agent_cause`

`emotion`

,`agent`

) —>`emotion`

`predicate`

`set_agent_cause`

`agent`

—>`predicate`

(`set_agent_cause`

`predicate`

,`agent`

) —>`predicate`

change the agentCause value of the given emotion change the agentCause value of the given predicate

```
emotion set_agent_cause agentA predicate set_agent_cause agentA
```

`set_decay`

`emotion`

`set_decay`

`float`

—>`emotion`

(`set_decay`

`emotion`

,`float`

) —>`emotion`

change the decay value of the given emotion

```
emotion set_decay 12
```

`set_dominance`

`msi.gaml.architecture.simplebdi.SocialLink`

`set_dominance`

`float`

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

(`set_dominance`

`msi.gaml.architecture.simplebdi.SocialLink`

,`float`

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

change the dominance value of the given social link

```
social_link set_dominance 0.4
```

`set_familiarity`

`msi.gaml.architecture.simplebdi.SocialLink`

`set_familiarity`

`float`

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

(`set_familiarity`

`msi.gaml.architecture.simplebdi.SocialLink`

,`float`

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

change the familiarity value of the given social link

```
social_link set_familiarity 0.4
```

`set_intensity`

`emotion`

`set_intensity`

`float`

—>`emotion`

(`set_intensity`

`emotion`

,`float`

) —>`emotion`

change the intensity value of the given emotion

```
emotion set_intensity 12
```

`set_lifetime`

`mental_state`

`set_lifetime`

`int`

—>`mental_state`

(`set_lifetime`

`mental_state`

,`int`

) —>`mental_state`

change the lifetime value of the given mental state

```
mental state set_lifetime 1
```

`set_liking`

`msi.gaml.architecture.simplebdi.SocialLink`

`set_liking`

`float`

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

(`set_liking`

`msi.gaml.architecture.simplebdi.SocialLink`

,`float`

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

change the liking value of the given social link

```
social_link set_liking 0.4
```

`set_modality`

`mental_state`

`set_modality`

`string`

—>`mental_state`

(`set_modality`

`mental_state`

,`string`

) —>`mental_state`

change the modality value of the given mental state

```
mental state set_modality belief
```

`set_predicate`

`mental_state`

`set_predicate`

`predicate`

—>`mental_state`

(`set_predicate`

`mental_state`

,`predicate`

) —>`mental_state`

change the predicate value of the given mental state

```
mental state set_predicate pred1
```

`set_solidarity`

`msi.gaml.architecture.simplebdi.SocialLink`

`set_solidarity`

`float`

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

(`set_solidarity`

`msi.gaml.architecture.simplebdi.SocialLink`

,`float`

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

change the solidarity value of the given social link

```
social_link set_solidarity 0.4
```

`set_strength`

`mental_state`

`set_strength`

`float`

—>`mental_state`

(`set_strength`

`mental_state`

,`float`

) —>`mental_state`

change the strength value of the given mental state

```
mental state set_strength 1.0
```

`set_trust`

`msi.gaml.architecture.simplebdi.SocialLink`

`set_trust`

`float`

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

(`set_trust`

`msi.gaml.architecture.simplebdi.SocialLink`

,`float`

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

change the trust value of the given social link

```
social_link set_familiarity 0.4
```

`set_truth`

`predicate`

`set_truth`

`bool`

—>`predicate`

(`set_truth`

`predicate`

,`bool`

) —>`predicate`

change the is_true value of the given predicate

```
predicate set_truth false
```

`set_z`

`geometry`

`set_z`

`container<float>`

—>`geometry`

(`set_z`

`geometry`

,`container<float>`

) —>`geometry`

(`set_z`

`geometry`

,`int`

,`float`

) —>`geometry`

Sets the z ordinate of the n-th point of a geometry to the value provided by the third argument

```
shape <- triangle(3) set_z [5,10,14]; loop i from: 0 to: length(shape.points) - 1{set shape <- set_z (shape, i, 3.0);}
```

`shape_file`

(`shape_file`

`string`

) —>`file`

Constructs a file of type shape. Allowed extensions are limited to shp

`shuffle`

(`shuffle`

`string`

) —>`string`

(`shuffle`

`matrix`

) —>`matrix`

(`shuffle`

`container`

) —>`list`

The elements of the operand in random order.

- if the operand is empty, returns an empty list (or string, matrix)

```
string var0 <- shuffle ('abc'); // var0 equals 'bac' (for example)
matrix var1 <- shuffle (matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var1 equals matrix([["c12","c21","c11"],["c13","c22","c23"]]) (for example)
list var2 <- shuffle ([12, 13, 14]); // var2 equals [14,12,13] (for example)
```

`signum`

(`signum`

`float`

) —>`int`

Returns -1 if the argument is negative, +1 if it is positive, 0 if it is equal to zero or not a number

```
int var0 <- signum(-12); // var0 equals -1
int var1 <- signum(14); // var1 equals 1
int var2 <- signum(0); // var2 equals 0
```

`simple_clustering_by_distance`

`container<agent>`

`simple_clustering_by_distance`

`float`

—>`list<list<agent>>`

(`simple_clustering_by_distance`

`container<agent>`

,`float`

) —>`list<list<agent>>`

A list of agent groups clustered by distance considering a distance min between two groups.

```
list<list<agent>> var0 <- [ag1, ag2, ag3, ag4, ag5] simpleClusteringByDistance 20.0; // var0 equals for example, can return [[ag1, ag3], [ag2], [ag4, ag5]]
```

`simple_clustering_by_envelope_distance`

Same signification as simple_clustering_by_distance

`simplex_generator`

(`simplex_generator`

`float`

,`float`

,`float`

) —>`float`

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

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

`simplification`

`geometry`

`simplification`

`float`

—>`geometry`

(`simplification`

`geometry`

,`float`

) —>`geometry`

A geometry corresponding to the simplification of the operand (geometry, agent, point) considering a tolerance distance.

The algorithm used for the simplification is Douglas-Peucker

```
geometry var0 <- self simplification 0.1; // var0 equals the geometry resulting from the application of the Douglas-Peuker algorithm on the geometry of the agent applying the operator with a tolerance distance of 0.1.
```

`sin`

(`sin`

`int`

) —>`float`

(`sin`

`float`

) —>`float`

Returns the value (in [-1,1]) of the sinus of the operand (in decimal degrees). The argument is casted to an int before being evaluated.

- Operand values out of the range [0-359] are normalized.

```
float var0 <- sin (0); // var0 equals 0.0
float var1 <- sin(360) with_precision 10 with_precision 10; // var1 equals 0.0
```

`sin_rad`

(`sin_rad`

`float`

) —>`float`

Returns the value (in [-1,1]) of the sinus of the operand (in radians).

```
float var0 <- sin_rad(#pi); // var0 equals 0.0
```

`since`

(`since`

`date`

) —>`bool`

`any expression`

`since`

`date`

—>`bool`

(`since`

`any expression`

,`date`

) —>`bool`

Returns true if the current_date of the model is after (or equal to) the date passed in argument. Synonym of ‘current_date >= argument’. Can be used, like ‘after’, in its composed form with 2 arguments to express the lowest boundary of the computation of a frequency. However, contrary to ‘after’, there is a subtle difference: the lowest boundary will be tested against the frequency as well

```
reflex when: since(starting_date) {} // this reflex will always be run every(2#days) since (starting_date + 1#day) // the computation will return true 1 day after the starting date and every two days after this reference date
```

`skeletonize`

(`skeletonize`

`geometry`

) —>`list<geometry>`

`geometry`

`skeletonize`

`float`

—>`list<geometry>`

(`skeletonize`

`geometry`

,`float`

) —>`list<geometry>`

(`skeletonize`

`geometry`

,`float`

,`float`

) —>`list<geometry>`

(`skeletonize`

`geometry`

,`float`

,`float`

,`bool`

) —>`list<geometry>`

A list of geometries (polylines) corresponding to the skeleton of the operand geometry (geometry, agent) with the given tolerance for the clipping and for the triangulation A list of geometries (polylines) corresponding to the skeleton of the operand geometry (geometry, agent) with the given tolerance for the clipping and for the triangulation A list of geometries (polylines) corresponding to the skeleton of the operand geometry (geometry, agent) with the given tolerance for the clipping A list of geometries (polylines) corresponding to the skeleton of the operand geometry (geometry, agent)

```
list<geometry> var0 <- skeletonize(self); // var0 equals the list of geometries corresponding to the skeleton of the geometry of the agent applying the operator.
list<geometry> var1 <- skeletonize(self); // var1 equals the list of geometries corresponding to the skeleton of the geometry of the agent applying the operator.
list<geometry> var2 <- skeletonize(self); // var2 equals the list of geometries corresponding to the skeleton of the geometry of the agent applying the operator.
list<geometry> var3 <- skeletonize(self); // var3 equals the list of geometries corresponding to the skeleton of the geometry of the agent applying the operator.
```

`skew`

(`skew`

`container`

) —>`float`

`float`

`skew`

`float`

—>`float`

(`skew`

`float`

,`float`

) —>`float`

Returns the skew of a data sequence. Returns the skew of a data sequence, which is moment(data,3,mean) / standardDeviation3

`skew_gauss`

(`skew_gauss`

`float`

,`float`

,`float`

,`float`

) —>`float`

A value from a skew normally distributed random variable with min value (the minimum skewed value possible), max value (the maximum skewed value possible), skew (the degree to which the values cluster around the mode of the distribution; higher values mean tighter clustering) and bias (the tendency of the mode to approach the min, max or midpoint value; positive values bias toward max, negative values toward min).The algorithm was taken from http://stackoverflow.com/questions/5853187/skewing-java-random-number-generation-toward-a-certain-number

```
float var0 <- skew_gauss(0.0, 1.0, 0.7,0.1); // var0 equals 0.1729218460343077
```

gauss, truncated_gauss, poisson,

`skewness`

(`skewness`

`list`

) —>`float`

returns skewness value computed from the operand list of values

- if the length of the list is lower than 3, returns NaN

```
float var0 <- skewness ([1,2,3,4,5]); // var0 equals 0.0
```

`skill`

(`skill`

`any`

) —>`skill`

Casts the operand into the type skill

`smooth`

`geometry`

`smooth`

`float`

—>`geometry`

(`smooth`

`geometry`

,`float`

) —>`geometry`

Returns a ‘smoothed’ geometry, where straight lines are replaces by polynomial (bicubic) curves. The first parameter is the original geometry, the second is the ‘fit’ parameter which can be in the range 0 (loose fit) to 1 (tightest fit).

```
geometry var0 <- smooth(square(10), 0.0); // var0 equals a 'rounded' square
```

`social_link`

(`social_link`

`any`

) —>`social_link`

Casts the operand into the type social_link

`solid`

Same signification as without_holes

`sort`

Same signification as sort_by

`sort_by`

`container`

`sort_by`

`any expression`

—>`list`

(`sort_by`

`container`

,`any expression`

) —>`list`

Returns a list, containing the elements of the left-hand operand sorted in ascending order by the value of the right-hand operand when it is evaluated on them.

the left-hand operand is casted to a list before applying the 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, sort_by throws an error. If the sorting function returns values that cannot be compared, an error will be thrown as well

```
list var0 <- [1,2,4,3,5,7,6,8] sort_by (each); // var0 equals [1,2,3,4,5,6,7,8]
list var2 <- g2 sort_by (length(g2 out_edges_of each) ); // var2 equals [node9, node7, node10, node8, node11, node6, node5, node4]
list var3 <- (list(node) sort_by (round(node(each).location.x)); // var3 equals [node5, node1, node0, node2, node3]
list var4 <- [1::2, 5::6, 3::4] sort_by (each); // var4 equals [2, 4, 6]
```

`source_of`

`graph`

`source_of`

`unknown`

—>`unknown`

(`source_of`

`graph`

,`unknown`

) —>`unknown`

returns the source of the edge (right-hand operand) contained in the graph given in left-hand operand.

- if the lef-hand operand (the graph) is nil, throws an Exception

```
graph graphEpidemio <- generate_barabasi_albert( ["edges_species"::edge,"vertices_specy"::node,"size"::3,"m"::5] );
unknown var1 <- graphEpidemio source_of(edge(3)); // var1 equals node1graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
point var3 <- graphFromMap source_of(link({1,5},{12,45})); // var3 equals {1,5}
```

`spatial_graph`

(`spatial_graph`

`container`

) —>`graph`

allows to create a spatial graph from a container of vertices, without trying to wire them. The container can be empty. Emits an error if the contents of the container are not geometries, points or agents

`species`

(`species`

`unknown`

) —>`species`

casting of the operand to a species.

- if the operand is nil, returns nil;
- if the operand is an agent, returns its species;
- if the operand is a string, returns the species with this name (nil if not found);
- otherwise, returns nil

```
species var0 <- species(self); // var0 equals the species of the current agent
species var1 <- species('node'); // var1 equals node
species var2 <- species([1,5,9,3]); // var2 equals nil
species var3 <- species(node1); // var3 equals node
```

`species_of`

Same signification as species

`sphere`

(`sphere`

`float`

) —>`geometry`

A sphere geometry which radius is equal to the operand.

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

- returns a point if the operand is lower or equal to 0.

```
geometry var0 <- sphere(10); // var0 equals a geometry as a circle of radius 10 but displays a sphere.
```

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

`split`

(`split`

`list`

) —>`list<list>`

Splits a list of numbers into n=(1+3.3*log10(elements)) bins. The splitting is strict (i.e. elements are in the ith bin if they are strictly smaller than the ith bound

`split_at`

`geometry`

`split_at`

`point`

—>`list<geometry>`

(`split_at`

`geometry`

,`point`

) —>`list<geometry>`

The two part of the left-operand lines split at the given right-operand point

- if the left-operand is a point or a polygon, returns an empty list

```
list<geometry> var0 <- polyline([{1,2},{4,6}]) split_at {7,6}; // var0 equals [polyline([{1.0,2.0},{7.0,6.0}]), polyline([{7.0,6.0},{4.0,6.0}])]
```

`split_geometry`

`geometry`

`split_geometry`

`float`

—>`list<geometry>`

(`split_geometry`

`geometry`

,`float`

) —>`list<geometry>`

`geometry`

`split_geometry`

`point`

—>`list<geometry>`

(`split_geometry`

`geometry`

,`point`

) —>`list<geometry>`

(`split_geometry`

`geometry`

,`int`

,`int`

) —>`list<geometry>`

A list of geometries that result from the decomposition of the geometry according to a grid with the given number of rows and columns (geometry, nb_cols, nb_rows) A list of geometries that result from the decomposition of the geometry by square cells of the given side size (geometry, size) A list of geometries that result from the decomposition of the geometry by rectangle cells of the given dimension (geometry, {size_x, size_y})

```
list<geometry> var0 <- to_rectangles(self, 10,20); // var0 equals the list of the geometries corresponding to the decomposition of the geometry of the agent applying the operator
list<geometry> var1 <- to_squares(self, 10.0); // var1 equals the list of the geometries corresponding to the decomposition of the geometry by squares of side size 10.0
list<geometry> var2 <- to_rectangles(self, {10.0, 15.0}); // var2 equals the list of the geometries corresponding to the decomposition of the geometry by rectangles of size 10.0, 15.0
```

`split_in`

`list`

`split_in`

`int`

—>`list<list>`

(`split_in`

`list`

,`int`

) —>`list<list>`

(`split_in`

`list`

,`int`

,`bool`

) —>`list<list>`

Splits a list of numbers into n bins defined by n-1 bounds between the minimum and maximum values found in the first argument. The boolean argument controls whether or not the splitting is strict (if true, elements are in the ith bin if they are strictly smaller than the ith bound Splits a list of numbers into n bins defined by n-1 bounds between the minimum and maximum values found in the first argument. The splitting is strict (i.e. elements are in the ith bin if they are strictly smaller than the ith bound

`split_lines`

(`split_lines`

`container<geometry>`

) —>`list<geometry>`

`container<geometry>`

`split_lines`

`bool`

—>`list<geometry>`

(`split_lines`

`container<geometry>`

,`bool`

) —>`list<geometry>`

A list of geometries resulting after cutting the lines at their intersections. if the last boolean operand is set to true, the split lines will import the attributes of the initial lines A list of geometries resulting after cutting the lines at their intersections.

```
list<geometry> var0 <- split_lines([line([{0,10}, {20,10}]), line([{0,10}, {20,10}])]); // var0 equals a list of four polylines: line([{0,10}, {10,10}]), line([{10,10}, {20,10}]), line([{10,0}, {10,10}]) and line([{10,10}, {10,20}])
list<geometry> var1 <- split_lines([line([{0,10}, {20,10}]), line([{0,10}, {20,10}])]); // var1 equals a list of four polylines: line([{0,10}, {10,10}]), line([{10,10}, {20,10}]), line([{10,0}, {10,10}]) and line([{10,10}, {10,20}])
```

`split_using`

`list`

`split_using`

`msi.gama.util.IList<? extends java.lang.Comparable>`

—>`list<list>`

(`split_using`

`list`

,`msi.gama.util.IList<? extends java.lang.Comparable>`

) —>`list<list>`

(`split_using`

`list`

,`msi.gama.util.IList<? extends java.lang.Comparable>`

,`bool`

) —>`list<list>`

Splits a list of numbers into n+1 bins using a set of n bounds passed as the second argument. The boolean argument controls whether or not the splitting is strict (if true, elements are in the ith bin if they are strictly smaller than the ith bound Splits a list of numbers into n+1 bins using a set of n bounds passed as the second argument. The splitting is strict (i.e. elements are in the ith bin if they are strictly smaller than the ith bound

`split_with`

`string`

`split_with`

`string`

—>`list`

(`split_with`

`string`

,`string`

) —>`list`

(`split_with`

`string`

,`string`

,`bool`

) —>`list`

Returns a list containing the sub-strings (tokens) of the left-hand operand delimited by each of the characters of the right-hand operand. Returns a list containing the sub-strings (tokens) of the left-hand operand delimited either by each of the characters of the right-hand operand (false) or by the whole right-hand operand (true).

Delimiters themselves are excluded from the resulting list.Delimiters themselves are excluded from the resulting list.

```
list var0 <- 'to be or not to be,that is the question' split_with ' ,'; // var0 equals ['to','be','or','not','to','be','that','is','the','question']
list var1 <- 'aa::bb:cc' split_with ('::', true); // var1 equals ['aa','bb:cc']
```

`sqrt`

(`sqrt`

`float`

) —>`float`

(`sqrt`

`int`

) —>`float`

Returns the square root of the operand.

- if the operand is negative, an exception is raised

```
float var0 <- sqrt(4); // var0 equals 2.0
float var1 <- sqrt(4); // var1 equals 2.0
```

`square`

(`square`

`float`

) —>`geometry`

A square geometry which side size is equal to the operand.

the centre of the square 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 <- square(10); // var0 equals a geometry as a square of side size 10.
```

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

`squircle`

`float`

`squircle`

`float`

—>`geometry`

(`squircle`

`float`

,`float`

) —>`geometry`

A mix of square and circle geometry (see : http://en.wikipedia.org/wiki/Squircle), which side size is equal to the first operand and power is equal to the second operand

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

- returns a point if the side operand is lower or equal to 0.

```
geometry var0 <- squircle(4,4); // var0 equals a geometry as a squircle of side 4 with a power of 4.
```

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

`stack`

(`stack`

`msi.gama.util.IList<java.lang.Integer>`

) —>`msi.gama.util.tree.GamaNode<java.lang.String>`

`standard_deviation`

(`standard_deviation`

`container`

) —>`float`

the standard deviation on the elements of the operand. See Standard_deviation for more details.

The operator casts all the numerical element of the list into float. The elements that are not numerical are discarded.

```
float var0 <- standard_deviation ([4.5, 3.5, 5.5, 7.0]); // var0 equals 1.2930100540985752
```

`step_sub_model`

(`step_sub_model`

`msi.gama.kernel.experiment.IExperimentAgent`

) —>`int`

Load a submodel

loaded submodel

`strahler`

(`strahler`

`graph`

) —>`map`

retur for each edge, its strahler number

`string`

`date`

`string`

`string`

—>`string`

(`string`

`date`

,`string`

) —>`string`

(`string`

`date`

,`string`

,`string`

) —>`string`

converts a date to astring following a custom pattern. The pattern can use “%Y %M %N %D %E %h %m %s %z” for outputting years, months, name of month, days, name of days, hours, minutes, seconds and the time-zone. A null or empty pattern will return the complete date as defined by the ISO date & time format. The pattern can also follow the pattern definition found here, which gives much more control over the format of the date: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns. Different patterns are available by default as constants: #iso_local, #iso_simple, #iso_offset, #iso_zoned and #custom, which can be changed in the preferences converts a date to astring following a custom pattern and using a specific locale (e.g.: ‘fr’, ‘en’, etc.). The pattern can use “%Y %M %N %D %E %h %m %s %z” for outputting years, months, name of month, days, name of days, hours, minutes, seconds and the time-zone. A null or empty pattern will return the complete date as defined by the ISO date & time format. The pattern can also follow the pattern definition found here, which gives much more control over the format of the date: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns. Different patterns are available by default as constants: #iso_local, #iso_simple, #iso_offset, #iso_zoned and #custom, which can be changed in the preferences

```
format(#now, 'yyyy-MM-dd') format(#now, 'yyyy-MM-dd')
```

`student_area`

`float`

`student_area`

`int`

—>`float`

(`student_area`

`float`

,`int`

) —>`float`

Returns the area to the left of x in the Student T distribution with the given degrees of freedom.

`student_t_inverse`

`float`

`student_t_inverse`

`int`

—>`float`

(`student_t_inverse`

`float`

,`int`

) —>`float`

Returns the value, t, for which the area under the Student-t probability density function (integrated from minus infinity to t) is equal to x.

`subtract_days`

Same signification as minus_days

`subtract_hours`

Same signification as minus_hours

`subtract_minutes`

Same signification as minus_minutes

`subtract_months`

Same signification as minus_months

`subtract_ms`

Same signification as minus_ms

`subtract_seconds`

Same signification as -

`subtract_weeks`

Same signification as minus_weeks

`subtract_years`

Same signification as minus_years

`successors_of`

`graph`

`successors_of`

`unknown`

—>`list`

(`successors_of`

`graph`

,`unknown`

) —>`list`

returns the list of successors (i.e. targets of out edges) of the given vertex (right-hand operand) in the given graph (left-hand operand)

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

predecessors_of, neighbors_of,

`sum`

(`sum`

`graph`

) —>`float`

(`sum`

`container`

) —>`unknown`

the sum of all the elements of the operand

the behavior depends on the nature of the operand

- if it is a population or a list of other types: sum transforms all elements into float and sums them
- if it is a map, sum returns the sum of the value of all elements
- if it is a file, sum returns the sum of the content of the file (that is also a container)
- if it is a graph, sum returns the total weight of the graph
- if it is a matrix of int, float or object, sum returns the sum of all the numerical elements (i.e. all elements for integer and float matrices)
- if it is a matrix of other types: sum transforms all elements into float and sums them
- if it is a list of colors: sum will sum them and return the blended resulting color
- if it is a list of int or float: sum returns the sum of all the elements

```
int var0 <- sum ([12,10,3]); // var0 equals 25
```

- if it is a list of points: sum returns the sum of all points as a point (each coordinate is the sum of the corresponding coordinate of each element)

```
unknown var1 <- sum([{1.0,3.0},{3.0,5.0},{9.0,1.0},{7.0,8.0}]); // var1 equals {20.0,17.0}
```

mul,

`sum_of`

`container`

`sum_of`

`any expression`

—>`unknown`

(`sum_of`

`container`

,`any expression`

) —>`unknown`

the sum 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] sum_of (each + 3); // var1 equals 21
```

```
unknown var0 <- [1,2] sum_of (each * 100 ); // var0 equals 300
```

min_of, max_of, product_of, mean_of,

`svg_file`

(`svg_file`

`string`

) —>`file`

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

`tan`

(`tan`

`int`

) —>`float`

(`tan`

`float`

) —>`float`

Returns the value (in [-1,1]) of the trigonometric tangent of the operand (in decimal degrees).

- Operand values out of the range [0-359] are normalized. Notice that tan(360) does not return 0.0 but -2.4492935982947064E-16
- The tangent is only defined for any real number except 90 + k
`*`

180 (k an positive or negative integer). Nevertheless notice that tan(90) returns 1.633123935319537E16 (whereas we could except infinity).

```
float var0 <- tan (0); // var0 equals 0.0
float var1 <- tan(90); // var1 equals 1.633123935319537E16
```

`tan_rad`

(`tan_rad`

`float`

) —>`float`

Returns the value (in [-1,1]) of the trigonometric tangent of the operand (in radians).

`tanh`

(`tanh`

`float`

) —>`float`

(`tanh`

`int`

) —>`float`

Returns the value (in the interval [-1,1]) of the hyperbolic tangent of the operand (which can be any real number, expressed in decimal degrees).

```
float var0 <- tanh(0); // var0 equals 0.0
float var1 <- tanh(100); // var1 equals 1.0
```

`target_of`

`graph`

`target_of`

`unknown`

—>`unknown`

(`target_of`

`graph`

,`unknown`

) —>`unknown`

returns the target of the edge (right-hand operand) contained in the graph given in left-hand operand.

- if the lef-hand operand (the graph) is nil, returns nil

```
graph graphEpidemio <- generate_barabasi_albert( ["edges_species"::edge,"vertices_specy"::node,"size"::3,"m"::5] );
unknown var1 <- graphEpidemio source_of(edge(3)); // var1 equals node1graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
unknown var3 <- graphFromMap target_of(link({1,5},{12,45})); // var3 equals {12,45}
```

`teapot`

(`teapot`

`float`

) —>`geometry`

A teapot geometry which radius is equal to the operand.

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

- returns a point if the operand is lower or equal to 0.

```
geometry var0 <- teapot(10); // var0 equals a geometry as a circle of radius 10 but displays a teapot.
```

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

`text_file`

(`text_file`

`string`

) —>`file`

Constructs a file of type text. Allowed extensions are limited to txt, data, text

`TGauss`

Same signification as truncated_gauss

`threeds_file`

(`threeds_file`

`string`

) —>`file`

Constructs a file of type threeds. Allowed extensions are limited to 3ds, max

`to`

Same signification as until

`date`

`to`

`date`

—>`msi.gama.util.IList<msi.gama.util.GamaDate>`

(`to`

`date`

,`date`

) —>`msi.gama.util.IList<msi.gama.util.GamaDate>`

builds an interval between two dates (the first inclusive and the second exclusive, which behaves like a read-only list of dates. The default step between two dates is the step of the model

The default step can be overruled by using the every operator applied to this interval

```
date('2000-01-01') to date('2010-01-01') // builds an interval between these two dates (date('2000-01-01') to date('2010-01-01')) every (#month) // builds an interval between these two dates which contains all the monthly dates starting from the beginning of the interval
```

`to_GAMA_CRS`

(`to_GAMA_CRS`

`geometry`

) —>`geometry`

`geometry`

`to_GAMA_CRS`

`string`

—>`geometry`

(`to_GAMA_CRS`

`geometry`

,`string`

) —>`geometry`

- returns the geometry corresponding to the transformation of the given geometry to the GAMA CRS (Coordinate Reference System) assuming the given geometry is referenced by given CRS

```
geometry var0 <- to_GAMA_CRS({121,14}, "EPSG:4326"); // var0 equals a geometry corresponding to the agent geometry transformed into the GAMA CRS
```

- returns the geometry corresponding to the transformation of the given geometry to the GAMA CRS (Coordinate Reference System) assuming the given geometry is referenced by the current CRS, the one corresponding to the world’s agent one

```
geometry var1 <- to_GAMA_CRS({121,14}); // var1 equals a geometry corresponding to the agent geometry transformed into the GAMA CRS
```

`to_gaml`

(`to_gaml`

`unknown`

) —>`string`

returns the literal description of an expression or description – action, behavior, species, aspect, even model – in gaml

```
string var0 <- to_gaml(0); // var0 equals '0'
string var1 <- to_gaml(3.78); // var1 equals '3.78'
string var2 <- to_gaml(true); // var2 equals 'true'
string var3 <- to_gaml({23, 4.0}); // var3 equals '{23.0,4.0,0.0}'
string var4 <- to_gaml(5::34); // var4 equals '5::34'
string var5 <- to_gaml(rgb(255,0,125)); // var5 equals 'rgb (255, 0, 125,255)'
string var6 <- to_gaml('hello'); // var6 equals "'hello'"
string var7 <- to_gaml([1,5,9,3]); // var7 equals '[1,5,9,3]'
string var8 <- to_gaml(['a'::345, 'b'::13, 'c'::12]); // var8 equals "map(['a'::345,'b'::13,'c'::12])"
string var9 <- to_gaml([[3,5,7,9],[2,4,6,8]]); // var9 equals '[[3,5,7,9],[2,4,6,8]]'
string var10 <- to_gaml(a_graph); // var10 equals ([((1 as node)::(3 as node))::(5 as edge),((0 as node)::(3 as node))::(3 as edge),((1 as node)::(2 as node))::(1 as edge),((0 as node)::(2 as node))::(2 as edge),((0 as node)::(1 as node))::(0 as edge),((2 as node)::(3 as node))::(4 as edge)] as map ) as graph
string var11 <- to_gaml(node1); // var11 equals 1 as node
```

`to_rectangles`

Same signification as split_geometry

(`to_rectangles`

`geometry`

,`point`

,`bool`

) —>`list<geometry>`

(`to_rectangles`

`geometry`

,`int`

,`int`

,`bool`

) —>`list<geometry>`

A list of rectangles of the size corresponding to the given dimension that result from the decomposition of the geometry into rectangles (geometry, dimension, overlaps), if overlaps = true, add the rectangles that overlap the border of the geometry A list of rectangles corresponding to the given dimension that result from the decomposition of the geometry into rectangles (geometry, nb_cols, nb_rows, overlaps) by a grid composed of the given number of columns and rows, if overlaps = true, add the rectangles that overlap the border of the geometry

```
list<geometry> var0 <- to_rectangles(self, {10.0, 15.0}, true); // var0 equals the list of rectangles of size {10.0, 15.0} corresponding to the discretization into rectangles of the geometry of the agent applying the operator. The rectangles overlapping the border of the geometry are kept
list<geometry> var1 <- to_rectangles(self, 5, 20, true); // var1 equals the list of rectangles corresponding to the discretization by a grid of 5 columns and 20 rows into rectangles of the geometry of the agent applying the operator. The rectangles overlapping the border of the geometry are kept
```

`to_squares`

Same signification as split_geometry

(`to_squares`

`geometry`

,`int`

,`bool`

) —>`list<geometry>`

(`to_squares`

`geometry`

,`float`

,`bool`

) —>`list<geometry>`

(`to_squares`

`geometry`

,`int`

,`bool`

,`float`

) —>`list<geometry>`

A list of a given number of squares from the decomposition of the geometry into squares (geometry, nb_square, overlaps, precision_coefficient), if overlaps = true, add the squares that overlap the border of the geometry, coefficient_precision should be close to 1.0 A list of a given number of squares from the decomposition of the geometry into squares (geometry, nb_square, overlaps), if overlaps = true, add the squares that overlap the border of the geometry A list of squares of the size corresponding to the given size that result from the decomposition of the geometry into squares (geometry, size, overlaps), if overlaps = true, add the squares that overlap the border of the geometry

```
list<geometry> var0 <- to_squares(self, 10, true, 0.99); // var0 equals the list of 10 squares corresponding to the discretization into squares of the geometry of the agent applying the operator. The squares overlapping the border of the geometry are kept
list<geometry> var1 <- to_squares(self, 10, true); // var1 equals the list of 10 squares corresponding to the discretization into squares of the geometry of the agent applying the operator. The squares overlapping the border of the geometry are kept
list<geometry> var2 <- to_squares(self, 10.0, true); // var2 equals the list of squares of side size 10.0 corresponding to the discretization into squares of the geometry of the agent applying the operator. The squares overlapping the border of the geometry are kept
```

`to_sub_geometries`

`geometry`

`to_sub_geometries`

`list<float>`

—>`list<geometry>`

(`to_sub_geometries`

`geometry`

,`list<float>`

) —>`list<geometry>`

(`to_sub_geometries`

`geometry`

,`list<float>`

,`float`

) —>`list<geometry>`

A list of geometries resulting after spliting the geometry into sub-geometries. A list of geometries resulting after spliting the geometry into sub-geometries.

```
list<geometry> var0 <- to_sub_geometries(rectangle(10, 50), [0.1, 0.5, 0.4]); // var0 equals a list of three geometries corresponding to 3 sub-geometries
list<geometry> var1 <- to_sub_geometries(rectangle(10, 50), [0.1, 0.5, 0.4], 1.0); // var1 equals a list of three geometries corresponding to 3 sub-geometries using cubes of 1m size
```

`to_triangles`

Same signification as triangulate

`tokenize`

Same signification as split_with

`topology`

(`topology`

`unknown`

) —>`topology`

casting of the operand to a topology.

- if the operand is a topology, returns the topology itself;
- if the operand is a spatial graph, returns the graph topology associated;
- if the operand is a population, returns the topology of the population;
- if the operand is a shape or a geometry, returns the continuous topology bounded by the geometry;
- if the operand is a matrix, returns the grid topology associated
- if the operand is another kind of container, returns the multiple topology associated to the container
- otherwise, casts the operand to a geometry and build a topology from it.

```
topology var0 <- topology(0); // var0 equals niltopology(a_graph) --: Multiple topology in POLYGON ((24.712119771887785 7.867357373616512, 24.712119771887785 61.283226839310565, 82.4013676510046 7.867357373616512)) at location[53.556743711446195;34.57529210646354]
```

`topology`

(`topology`

`any`

) —>`topology`

Casts the operand into the type topology

`touches`

`geometry`

`touches`

`geometry`

—>`bool`

(`touches`

`geometry`

,`geometry`

) —>`bool`

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

returns true when the left-operand only touches the right-operand. When one geometry covers partially (or fully) the other one, it returns false.

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

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

disjoint_from, crosses, overlaps, partially_overlaps, intersects,

`towards`

`geometry`

`towards`

`geometry`

—>`float`

(`towards`

`geometry`

,`geometry`

) —>`float`

The direction (in degree) between the two geometries (geometries, agents, points) considering the topology of the agent applying the operator.

```
float var0 <- ag1 towards ag2; // var0 equals the direction between ag1 and ag2 and ag3 considering the topology of the agent applying the operator
```

distance_between, distance_to, direction_between, path_between, path_to,

`trace`

(`trace`

`matrix`

) —>`float`

The trace of the given matrix (the sum of the elements on the main diagonal).

```
float var0 <- trace(matrix([[1,2],[3,4]])); // var0 equals 5
```

`transformed_by`

`geometry`

`transformed_by`

`point`

—>`geometry`

(`transformed_by`

`geometry`

,`point`

) —>`geometry`

A geometry resulting from the application of a rotation and a scaling (right-operand : point {angle(degree), scale factor} of the left-hand operand (geometry, agent, point)

```
geometry var0 <- self transformed_by {45, 0.5}; // var0 equals the geometry resulting from 45 degrees rotation and 50% scaling of the geometry of the agent applying the operator.
```

`translated_by`

`geometry`

`translated_by`

`point`

—>`geometry`

(`translated_by`

`geometry`

,`point`

) —>`geometry`

A geometry resulting from the application of a translation by the right-hand operand distance to the left-hand operand (geometry, agent, point)

```
geometry var0 <- self translated_by {10,10,10}; // var0 equals the geometry resulting from applying the translation to the left-hand geometry (or agent).
```

`translated_to`

Same signification as at_location

`transpose`

(`transpose`

`matrix`

) —>`matrix`

The transposition of the given matrix

```
matrix var0 <- transpose(matrix([[5,-3],[6,-4]])); // var0 equals matrix([[5,6],[-3,-4]])
```

`triangle`

(`triangle`

`float`

) —>`geometry`

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

the center of the triangle 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 <- triangle(5); // var0 equals a geometry as a triangle with side_size = 5.
```

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

`triangulate`

(`triangulate`

`geometry`

) —>`list<geometry>`

(`triangulate`

`list<geometry>`

) —>`list<geometry>`

`geometry`

`triangulate`

`float`

—>`list<geometry>`

(`triangulate`

`geometry`

,`float`

) —>`list<geometry>`

(`triangulate`

`geometry`

,`float`

,`float`

) —>`list<geometry>`

(`triangulate`

`geometry`

,`float`

,`float`

,`bool`

) —>`list<geometry>`

A list of geometries (triangles) corresponding to the Delaunay triangulation of the operand geometry (geometry, agent, point) A list of geometries (triangles) corresponding to the Delaunay triangulation of the operand geometry (geometry, agent, point) with the given tolerance for the clipping A list of geometries (triangles) corresponding to the Delaunay triangulation of the operand geometry (geometry, agent, point, use_approx_clipping) with the given tolerance for the clipping and for the triangulation with using an approximate clipping is the last operand is true A list of geometries (triangles) corresponding to the Delaunay triangulation computed from the list of polylines A list of geometries (triangles) corresponding to the Delaunay triangulation of the operand geometry (geometry, agent, point) with the given tolerance for the clipping and for the triangulation

```
list<geometry> var0 <- triangulate(self); // var0 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator.
list<geometry> var1 <- triangulate(self, 0.1); // var1 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator.
list<geometry> var2 <- triangulate(self,0.1, 1.0); // var2 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator.
list<geometry> var3 <- triangulate([line([{0,50},{100,50}]), line([{50,0},{50,100}])); // var3 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator.
list<geometry> var4 <- triangulate(self,0.1, 1.0); // var4 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator.
```

`truncated_gauss`

(`truncated_gauss`

`list`

) —>`float`

(`truncated_gauss`

`point`

) —>`float`

A random value from a normally distributed random variable in the interval ]mean - standardDeviation; mean + standardDeviation[.

- if the operand is a list, only the two first elements are taken into account as [mean, standardDeviation]
- when truncated_gauss is called with a list of only one element mean, it will always return 0.0
- when the operand is a point, it is read as {mean, standardDeviation}

```
float var0 <- truncated_gauss ([0.5, 0.0]); // var0 equals 0.5
float var1 <- truncated_gauss ({0, 0.3}); // var1 equals a float between -0.3 and 0.3
```

`type_of`

(`type_of`

`unknown`

) —>`msi.gaml.types.IType<?>`

`undirected`

(`undirected`

`graph`

) —>`graph`

the operand graph becomes an undirected graph.

the operator alters the operand graph, it does not create a new one.

`union`

(`union`

`container<geometry>`

) —>`geometry`

`container`

`union`

`container`

—>`list`

(`union`

`container`

,`container`

) —>`list`

returns a new list containing all the elements of both containers without duplicated elements.

- if the left or right operand is nil, union throws an error
- if the right-operand is a container of points, geometries or agents, returns the geometry resulting from the union all the geometries

```
list var0 <- [1,2,3,4,5,6] union [2,4,9]; // var0 equals [1,2,3,4,5,6,9]
list var1 <- [1,2,3,4,5,6] union [0,8]; // var1 equals [1,2,3,4,5,6,0,8]
list var2 <- [1,3,2,4,5,6,8,5,6] union [0,8]; // var2 equals [1,3,2,4,5,6,8,0]
geometry var3 <- union([geom1, geom2, geom3]); // var3 equals a geometry corresponding to union between geom1, geom2 and geom3
```

`unknown`

(`unknown`

`any`

) —>`unknown`

Casts the operand into the type unknown

`until`

(`until`

`date`

) —>`bool`

`any expression`

`until`

`date`

—>`bool`

(`until`

`any expression`

,`date`

) —>`bool`

Returns true if the current_date of the model is before (or equel to) the date passed in argument. Synonym of ‘current_date <= argument’

```
reflex when: until(starting_date) {} // This reflex will be run only once at the beginning of the simulation
```

`upper_case`

(`upper_case`

`string`

) —>`string`

Converts all of the characters in the string operand to upper case

```
string var0 <- upper_case("Abc"); // var0 equals 'ABC'
```

`URL_file`

(`URL_file`

`string`

) —>`file`

Constructs a file of type URL. Allowed extensions are limited to url

`use_cache`

`graph`

`use_cache`

`bool`

—>`graph`

(`use_cache`

`graph`

,`bool`

) —>`graph`

if the second operand is true, the operand graph will store in a cache all the previously computed shortest path (the cache be cleared if the graph is modified).

the operator alters the operand graph, it does not create a new one.

`user_input`

(`user_input`

`any expression`

) —>`map<string,unknown>`

`string`

`user_input`

`any expression`

—>`map<string,unknown>`

(`user_input`

`string`

,`any expression`

) —>`map<string,unknown>`

asks the user for some values (not defined as parameters). Takes a string (optional) and a map as arguments. The string is used to specify the message of the dialog box. The map is to specify the parameters you want the user to change before the simulation starts, with the name of the parameter in string key, and the default value as value.

This operator takes a map [string::value] as argument, displays a dialog asking the user for these values, and returns the same map with the modified values (if any). The dialog is modal and will interrupt the execution of the simulation until the user has either dismissed or accepted it. It can be used, for instance, in an init section to force the user to input new values instead of relying on the initial values of parameters :

```
map<string,unknown> values <- user_input(["Number" :: 100, "Location" :: {10, 10}]); create bug number: int(values at "Number") with: [location:: (point(values at "Location"))]; map<string,unknown> values2 <- user_input("Enter numer of agents and locations",["Number" :: 100, "Location" :: {10, 10}]); create bug number: int(values2 at "Number") with: [location:: (point(values2 at "Location"))];
```

`using`

`any expression`

`using`

`topology`

—>`unknown`

(`using`

`any expression`

,`topology`

) —>`unknown`

Allows to specify in which topology a spatial computation should take place.

- has no effect if the topology passed as a parameter is nil

```
unknown var0 <- (agents closest_to self) using topology(world); // var0 equals the closest agent to self (the caller) in the continuous topology of the world
```

`variance`

(`variance`

`container`

) —>`float`

the variance of the elements of the operand. See Variance for more details.

The operator casts all the numerical element of the list into float. The elements that are not numerical are discarded.

```
float var0 <- variance ([4.5, 3.5, 5.5, 7.0]); // var0 equals 1.671875
```

`variance`

(`variance`

`float`

) —>`float`

(`variance`

`int`

,`float`

,`float`

) —>`float`

Returns the variance of a data sequence. That is (sumOfSquares - mean*sum) / size with mean = sum/size. Returns the variance from a standard deviation.

`variance_of`

`container`

`variance_of`

`any expression`

—>`unknown`

(`variance_of`

`container`

,`any expression`

) —>`unknown`

the variance 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.

min_of, max_of, sum_of, product_of,

`vertical`

(`vertical`

`msi.gama.util.GamaMap<java.lang.Object,java.lang.Integer>`

) —>`msi.gama.util.tree.GamaNode<java.lang.String>`

`voronoi`

(`voronoi`

`list<point>`

) —>`list<geometry>`

`list<point>`

`voronoi`

`geometry`

—>`list<geometry>`

(`voronoi`

`list<point>`

,`geometry`

) —>`list<geometry>`

A list of geometries corresponding to the Voronoi diagram built from the list of points according to the given clip A list of geometries corresponding to the Voronoi diagram built from the list of points

```
list<geometry> var0 <- voronoi([{10,10},{50,50},{90,90},{10,90},{90,10}], square(300)); // var0 equals the list of geometries corresponding to the Voronoi Diagram built from the list of points with a square of 300m side size as clip.
list<geometry> var1 <- voronoi([{10,10},{50,50},{90,90},{10,90},{90,10}]); // var1 equals the list of geometries corresponding to the Voronoi Diagram built from the list of points.
```

`weight_of`

`graph`

`weight_of`

`unknown`

—>`float`

(`weight_of`

`graph`

,`unknown`

) —>`float`

returns the weight of the given edge (right-hand operand) contained in the graph given in right-hand operand.

In a localized graph, an edge has a weight by default (the distance between both vertices).

- if the left-operand (the graph) is nil, returns nil
- if the right-hand operand is not an edge of the given graph, weight_of checks whether it is a node of the graph and tries to return its weight
- if the right-hand operand is neither a node, nor an edge, returns 1.

```
graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
float var1 <- graphFromMap weight_of(link({1,5},{12,45})); // var1 equals 1.0
```

`weighted_means_DM`

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

`weighted_means_DM`

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

—>`int`

(`weighted_means_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 candidate that maximizes the weighted mean of its criterion values. The first operand is the list of candidates (a candidate is a list of criterion values); the second operand the list of criterion (list of map)

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

```
int var0 <- weighted_means_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], [["name"::"utility", "weight" :: 2.0],["name"::"price", "weight" :: 1.0]]); // var0 equals 1
```

promethee_DM, electre_DM, evidence_theory_DM,

`where`

`container`

`where`

`any expression`

—>`list`

(`where`

`container`

,`any expression`

) —>`list`

a list containing all the elements of the left-hand operand that make the right-hand operand evaluate to true.

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-hand operand is a list nil, where returns a new empty list
- if the left-operand is a map, the keyword each will contain each value

```
list var4 <- [1::2, 3::4, 5::6] where (each >= 4); // var4 equals [4, 6]
```

```
list var0 <- [1,2,3,4,5,6,7,8] where (each > 3); // var0 equals [4, 5, 6, 7, 8]
list var2 <- g2 where (length(g2 out_edges_of each) = 0 ); // var2 equals [node9, node7, node10, node8, node11]
list var3 <- (list(node) where (round(node(each).location.x) > 32); // var3 equals [node2, node3]
```

`with_lifetime`

`predicate`

`with_lifetime`

`int`

—>`predicate`

(`with_lifetime`

`predicate`

,`int`

) —>`predicate`

change the parameters of the given predicate

```
predicate with_lifetime 10
```

`with_max_of`

`container`

`with_max_of`

`any expression`

—>`unknown`

(`with_max_of`

`container`

,`any expression`

) —>`unknown`

one of elements of the left-hand operand that maximizes the value of the right-hand operand

- if the left-hand operand is nil, with_max_of returns the default value of the right-hand operand

```
unknown var0 <- [1,2,3,4,5,6,7,8] with_max_of (each ); // var0 equals 8
unknown var2 <- g2 with_max_of (length(g2 out_edges_of each) ) ; // var2 equals node4
unknown var3 <- (list(node) with_max_of (round(node(each).location.x)); // var3 equals node3
unknown var4 <- [1::2, 3::4, 5::6] with_max_of (each); // var4 equals 6
```

`with_min_of`

`container`

`with_min_of`

`any expression`

—>`unknown`

(`with_min_of`

`container`

,`any expression`

) —>`unknown`

one of elements of the left-hand operand that minimizes the value of the right-hand operand

- if the left-hand operand is nil, with_max_of returns the default value of the right-hand operand

```
unknown var0 <- [1,2,3,4,5,6,7,8] with_min_of (each ); // var0 equals 1
unknown var2 <- g2 with_min_of (length(g2 out_edges_of each) ); // var2 equals node11
unknown var3 <- (list(node) with_min_of (round(node(each).location.x)); // var3 equals node0
unknown var4 <- [1::2, 3::4, 5::6] with_min_of (each); // var4 equals 2
```

`with_optimizer_type`

`graph`

`with_optimizer_type`

`string`

—>`graph`

(`with_optimizer_type`

`graph`

,`string`

) —>`graph`

changes the shortest path computation method of the given graph

the right-hand operand can be “Djikstra”, “Bellmann”, “Astar” to use the associated algorithm. Note that these methods are dynamic: the path is computed when needed. In contrarily, if the operand is another string, a static method will be used, i.e. all the shortest are previously computed.

```
graphEpidemio <- graphEpidemio with_optimizer_type "static";
```

`with_precision`

`float`

`with_precision`

`int`

—>`float`

(`with_precision`

`float`

,`int`

) —>`float`

`point`

`with_precision`

`int`

—>`point`

(`with_precision`

`point`

,`int`

) —>`point`

`geometry`

`with_precision`

`int`

—>`geometry`

(`with_precision`

`geometry`

,`int`

) —>`geometry`

Rounds off the value of left-hand operand to the precision given by the value of right-hand operand Rounds off the ordinates of the left-hand point to the precision given by the value of right-hand operand A geometry corresponding to the rounding of points of the operand considering a given precison.

```
float var0 <- 12345.78943 with_precision 2; // var0 equals 12345.79
float var1 <- 123 with_precision 2; // var1 equals 123.00
point var2 <- {12345.78943, 12345.78943, 12345.78943} with_precision 2 ; // var2 equals {12345.79, 12345.79, 12345.79}
geometry var3 <- self with_precision 2; // var3 equals the geometry resulting from the rounding of points of the geometry with a precision of 0.1.
```

`with_values`

`predicate`

`with_values`

`map`

—>`predicate`

(`with_values`

`predicate`

,`map`

) —>`predicate`

change the parameters of the given predicate

```
predicate with_values ["time"::10]
```

`with_weights`

`graph`

`with_weights`

`map`

—>`graph`

(`with_weights`

`graph`

,`map`

) —>`graph`

`graph`

`with_weights`

`list`

—>`graph`

(`with_weights`

`graph`

,`list`

) —>`graph`

returns the graph (left-hand operand) with weight given in the map (right-hand operand).

this operand re-initializes the path finder

- if the right-hand operand is a list, affects the n elements of the list to the n first edges. Note that the ordering of edges may change overtime, which can create some problems…
- if the left-hand operand is a map, the map should contains pairs such as: vertex/edge::double

```
graph_from_edges (list(ant) as_map each::one_of (list(ant))) with_weights (list(ant) as_map each::each.food)
```

`without_holes`

(`without_holes`

`geometry`

) —>`geometry`

A geometry corresponding to the operand geometry (geometry, agent, point) without its holes

```
geometry var0 <- solid(self); // var0 equals the geometry corresponding to the geometry of the agent applying the operator without its holes.
```

`writable`

`file`

`writable`

`bool`

—>`file`

(`writable`

`file`

,`bool`

) —>`file`

Marks the file as read-only or not, depending on the second boolean argument, and returns the first argument

A file is created using its native flags. This operator can change them. Beware that this change is system-wide (and not only restrained to GAMA): changing a file to read-only mode (e.g. “writable(f, false)”)

```
file var0 <- shape_file("../images/point_eau.shp") writable false; // var0 equals returns a file in read-only mode
```

file,

`xml_file`

(`xml_file`

`string`

) —>`file`

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

`xor`

`bool`

`xor`

`bool`

—>`bool`

(`xor`

`bool`

,`bool`

) —>`bool`

a bool value, equal to the logical xor between the left-hand operand and the right-hand operand. False when they are equal

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

`years_between`

`date`

`years_between`

`date`

—>`int`

(`years_between`

`date`

,`date`

) —>`int`

Provide the exact number of years between two dates. This number can be positive or negative (if the second operand is smaller than the first one)

```
int var0 <- years_between(date('2000-01-01'), date('2010-01-01')); // var0 equals 10
```