# Operators (B to C)

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

## Definitionâ€‹

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.

## Priority between operatorsâ€‹

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.

## Using actions as operatorsâ€‹

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).

## Table of Contentsâ€‹

## Operators by categoriesâ€‹

### 3Dâ€‹

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

### Arithmetic operatorsâ€‹

-, /, ^, *, +, 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,

### BDIâ€‹

add_values, 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, get_values, 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, not, 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_values,

### Casting operatorsâ€‹

as, as_int, as_matrix, field_with, font, is, is_skill, list_with, matrix_with, species_of, to_gaml, to_geojson, to_list, with_size, with_style,

### Color-related operatorsâ€‹

-, /, *, +, blend, brewer_colors, brewer_palettes, gradient, grayscale, hsb, mean, median, palette, rgb, rnd_color, scale, sum, to_hsb,

### Comparison operatorsâ€‹

### Containers-related operatorsâ€‹

-, ::, +, accumulate, all_match, among, as_json_string, at, cartesian_product, collect, contains, contains_all, contains_any, contains_key, count, empty, every, first, first_with, get, group_by, in, index_by, inter, interleave, 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, remove_duplicates, reverse, shuffle, sort_by, split, split_in, split_using, sum, sum_of, union, variance_of, where, with_max_of, with_min_of,

### Date-related operatorsâ€‹

-, !=, +, <, <=, =, >, >=, 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,

### Datesâ€‹

### Displaysâ€‹

### edgeâ€‹

### EDP-related operatorsâ€‹

### Files-related operatorsâ€‹

agent_file, copy_file, crs, csv_file, delete_file, dxf_file, evaluate_sub_model, file_exists, folder, folder_exists, gaml_file, geojson_file, get, gif_file, gml_file, graph6_file, graphdimacs_file, graphdot_file, graphgexf_file, graphgml_file, graphml_file, graphtsplib_file, grid_file, image_file, is_agent, is_csv, is_dxf, is_gaml, is_geojson, is_gif, is_gml, is_graph6, is_graphdimacs, is_graphdot, is_graphgexf, is_graphgml, is_graphml, is_graphtsplib, is_grid, is_image, is_json, is_obj, is_osm, is_pgm, is_property, is_shape, is_simulation, is_svg, is_text, is_threeds, is_xml, json_file, new_folder, obj_file, osm_file, pgm_file, property_file, read, rename_file, shape_file, simulation_file, step_sub_model, svg_file, text_file, threeds_file, unzip, writable, xml_file, zip,

### GamaMetaTypeâ€‹

### GamaSVGFileâ€‹

### Graphs-related operatorsâ€‹

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, as_spatial_graph, 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_random_graph, generate_watts_strogatz, girvan_newman_clustering, grid_cells_to_graph, in_degree_of, in_edges_of, k_spanning_tree_clustering, label_propagation_clustering, layout_circle, layout_force, layout_force_FR, layout_force_FR_indexed, layout_grid, 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_k_shortest_path_algorithm, with_shortest_path_algorithm, with_weights,

### Grid-related operatorsâ€‹

as_4_grid, as_grid, as_hexagonal_grid, cell_at, cells_in, cells_overlapping, field, grid_at, neighbors_of, path_between, points_in, values_in,

### ImageOperatorsâ€‹

*, antialiased, blend, blurred, brighter, clipped_with, darker, grayscale, horizontal_flip, image, matrix, rotated_by, sharpened, snapshot, tinted_with, vertical_flip, with_height, with_size, with_width,

### Iterator operatorsâ€‹

accumulate, all_match, as_map, collect, count, create_map, 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, where, where, with_max_of, with_min_of,

### List-related operatorsâ€‹

all_indexes_of, copy_between, index_of, last_index_of,

### Logical operatorsâ€‹

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

### Map comparaison operatorsâ€‹

fuzzy_kappa, fuzzy_kappa_sim, kappa, kappa_sim, percent_absolute_deviation,

### Map-related operatorsâ€‹

as_map, create_map, index_of, last_index_of,

### Matrix-related operatorsâ€‹

-, /, ., *, +, append_horizontally, append_vertically, column_at, columns_list, determinant, eigenvalues, flatten, index_of, inverse, last_index_of, row_at, rows_list, shuffle, trace, transpose,

### multicriteria operatorsâ€‹

electre_DM, evidence_theory_DM, fuzzy_choquet_DM, promethee_DM, weighted_means_DM,

### Path-related operatorsâ€‹

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

### Pedestrianâ€‹

### Points-related operatorsâ€‹

-, /, *, +, <, <=, >, >=, add_point, angle_between, any_location_in, centroid, closest_points_with, farthest_point_to, grid_at, norm, points_along, points_at, points_on,

### Random operatorsâ€‹

binomial, exp_density, exp_rnd, flip, gamma_density, gamma_rnd, gamma_trunc_rnd, gauss, generate_terrain, lognormal_density, lognormal_rnd, lognormal_trunc_rnd, poisson, rnd, rnd_choice, sample, shuffle, skew_gauss, truncated_gauss, weibull_density, weibull_rnd, weibull_trunc_rnd,

### ReverseOperatorsâ€‹

### Shapeâ€‹

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

### Spatial operatorsâ€‹

-, *, +, add_point, agent_closest_to, agent_farthest_to, agents_at_distance, agents_covering, agents_crossing, agents_inside, agents_overlapping, agents_partially_overlapping, agents_touching, angle_between, any_location_in, arc, around, as_4_grid, as_driving_graph, as_grid, as_hexagonal_grid, at_distance, at_location, box, centroid, circle, clean, clean_network, closest_points_with, closest_to, cone, cone3D, convex_hull, covering, covers, cross, crosses, crossing, crs, CRS_transform, cube, curve, cylinder, direction_between, disjoint_from, distance_between, distance_to, ellipse, elliptical_arc, envelope, farthest_point_to, farthest_to, geometry_collection, gini, hexagon, hierarchical_clustering, IDW, inside, inter, intersects, inverse_rotation, k_nearest_neighbors, line, link, masked_by, moran, neighbors_at, neighbors_of, normalized_rotation, overlapping, overlaps, partially_overlapping, partially_overlaps, path_between, path_to, plan, points_along, points_at, points_on, polygon, polyhedron, pyramid, rectangle, rotated_by, rotation_composition, 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, touching, towards, transformed_by, translated_by, triangle, triangulate, union, using, voronoi, with_precision, without_holes,

### Spatial properties operatorsâ€‹

covers, crosses, intersects, partially_overlaps, touches,

### Spatial queries operatorsâ€‹

agent_closest_to, agent_farthest_to, agents_at_distance, agents_covering, agents_crossing, agents_inside, agents_overlapping, agents_partially_overlapping, agents_touching, at_distance, closest_to, covering, crossing, farthest_to, inside, neighbors_at, neighbors_of, overlapping, partially_overlapping, touching,

### Spatial relations operatorsâ€‹

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

### Spatial statistical operatorsâ€‹

hierarchical_clustering, k_nearest_neighbors, simple_clustering_by_distance,

### Spatial transformations operatorsâ€‹

-, *, +, as_4_grid, as_grid, as_hexagonal_grid, at_location, clean, clean_network, convex_hull, CRS_transform, inverse_rotation, normalized_rotation, rotated_by, rotation_composition, 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,

### Species-related operatorsâ€‹

index_of, last_index_of, of_generic_species, of_species,

### Statistical operatorsâ€‹

auto_correlation, beta, binomial_coeff, binomial_complemented, binomial_sum, build, chi_square, chi_square_complemented, correlation, covariance, dbscan, distribution_of, distribution2d_of, dtw, durbin_watson, frequency_of, gamma, gamma_distribution, gamma_distribution_complemented, geometric_mean, gini, harmonic_mean, hierarchical_clustering, incomplete_beta, incomplete_gamma, incomplete_gamma_complement, k_nearest_neighbors, kmeans, kurtosis, log_gamma, max, mean, mean_deviation, median, min, moment, moran, morrisAnalysis, mul, normal_area, normal_density, normal_inverse, predict, pValue_for_fStat, pValue_for_tStat, quantile, quantile_inverse, rank_interpolated, residuals, rms, rSquare, simple_clustering_by_distance, skewness, sobolAnalysis, split, split_in, split_using, standard_deviation, student_area, student_t_inverse, sum, t_test, variance,

### Strings-related operatorsâ€‹

+, <, <=, >, >=, at, capitalize, 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, regex_matches, replace, replace_regex, reverse, sample, shuffle, split_with, string, upper_case,

### SubModelâ€‹

### Systemâ€‹

., choose, command, copy, copy_from_clipboard, copy_to_clipboard, copy_to_clipboard, dead, enter, eval_gaml, every, is_error, is_reachable, is_warning, play_sound, user_confirm, user_input_dialog, wizard, wizard_page,

### Time-related operatorsâ€‹

### Types-related operatorsâ€‹

action, agent, attributes, BDIPlan, bool, container, conversation, directory, emotion, file, float, gaml_type, geometry, graph, int, kml, list, map, matrix, mental_state, message, Norm, pair, path, point, predicate, regression, rgb, Sanction, skill, social_link, species, topology, unknown,

### User control operatorsâ€‹

choose, enter, user_confirm, user_input_dialog, wizard, wizard_page,

## Operatorsâ€‹

`BDIPlan`

â€‹

#### Possible uses:â€‹

(`BDIPlan`

`any`

) --->`BDIPlan`

#### Result:â€‹

casts the operand in a BDIPlan object.

`before`

â€‹

#### Possible uses:â€‹

(`before`

`date`

) --->`bool`

`any expression`

`before`

`date`

--->`bool`

(`before`

`any expression`

,`date`

) --->`bool`

#### Result:â€‹

Returns true if the current_date of the model is strictly before the date passed in argument. Synonym of 'current_date < argument'

#### Examples:â€‹

`reflex when: before(starting_date) {} // this reflex will never be run`

`beta`

â€‹

#### Possible uses:â€‹

`float`

`beta`

`float`

--->`float`

(`beta`

`float`

,`float`

) --->`float`

#### Result:â€‹

Returns the beta function with arguments a, b.

#### Comment:â€‹

Checked on R. beta(4,5)

#### Examples:â€‹

`float var0 <- beta(4,5) with_precision(4); // var0 equals 0.0036`

`beta_index`

â€‹

#### Possible uses:â€‹

(`beta_index`

`graph`

) --->`float`

#### Result:â€‹

returns the beta index of the graph (Measures the level of connectivity in a graph and is expressed by the relationship between the number of links (e) over the number of nodes (v) : beta = e/v.

#### Examples:â€‹

`graph graphEpidemio <- graph([]); `

float var1 <- beta_index(graphEpidemio); // var1 equals the beta index of the graph

**See also:** alpha_index, gamma_index, nb_cycles, connectivity_index,

`between`

â€‹

Same signification as copy_between

#### Possible uses:â€‹

`date`

`between`

`date`

--->`bool`

(`between`

`date`

,`date`

) --->`bool`

(`between`

`date`

,`date`

,`date`

) --->`bool`

(`between`

`any expression`

,`date`

,`date`

) --->`bool`

(`between`

`int`

,`int`

,`int`

) --->`bool`

(`between`

`float`

,`float`

,`float`

) --->`bool`

#### Result:â€‹

returns true the first operand is bigger than the second operand and smaller than the third operand

#### Special cases:â€‹

- returns true if the first operand is between the two dates passed in arguments (both exclusive). Can be combined with 'every' to express a frequency between two dates

`bool var0 <- (date('2016-01-01') between(date('2000-01-01'), date('2020-02-02'))); // var0 equals true `

// will return true every new day between these two dates, taking the first one as the starting point

every(#day between(date('2000-01-01'), date('2020-02-02')))

- With only 2 date operands, it returns true if the current_date is between the 2 date operands.

`bool var3 <- between(date('2000-01-01'), date('2020-02-02')); // var3 equals false`

#### Examples:â€‹

`bool var4 <- between(5, 1, 10); // var4 equals true `

bool var5 <- between(5.0, 1.0, 10.0); // var5 equals true

`betweenness_centrality`

â€‹

#### Possible uses:â€‹

(`betweenness_centrality`

`graph`

) --->`map`

#### Result:â€‹

returns a map containing for each vertex (key), its betweenness centrality (value): number of shortest paths passing through each vertex

#### Examples:â€‹

`graph graphEpidemio <- graph([]); `

map var1 <- betweenness_centrality(graphEpidemio); // var1 equals the betweenness centrality index of the graph

`biggest_cliques_of`

â€‹

#### Possible uses:â€‹

(`biggest_cliques_of`

`graph`

) --->`list<list>`

#### Result:â€‹

returns the biggest cliques of a graph using the Bron-Kerbosch clique detection algorithm

#### Examples:â€‹

`graph my_graph <- graph([]); `

list<list> var1 <- biggest_cliques_of (my_graph); // var1 equals the list of the biggest cliques as list

**See also:** maximal_cliques_of,

`binomial`

â€‹

#### Possible uses:â€‹

`int`

`binomial`

`float`

--->`int`

(`binomial`

`int`

,`float`

) --->`int`

#### Result:â€‹

A value from a random variable following a binomial distribution. The operands represent the number of experiments n and the success probability p.

#### Comment:â€‹

The binomial distribution is the discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p, cf. Binomial distribution on Wikipedia.

#### Examples:â€‹

`int var0 <- binomial(15,0.6); // var0 equals a random positive integer`

**See also:** gamma_rnd, gauss_rnd, lognormal_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_rnd,

`binomial_coeff`

â€‹

#### Possible uses:â€‹

`int`

`binomial_coeff`

`int`

--->`float`

(`binomial_coeff`

`int`

,`int`

) --->`float`

#### Result:â€‹

Returns n choose k as a double. Note the integerization of the double return value.

#### Examples:â€‹

`float var0 <- binomial_coeff(10,2); // var0 equals 45`

`binomial_complemented`

â€‹

#### Possible uses:â€‹

(`binomial_complemented`

`int`

,`int`

,`float`

) --->`float`

#### Result:â€‹

Returns the sum of the terms k+1 through n of the Binomial probability density, where n is the number of trials and P is the probability of success in the range 0 to 1.

#### Examples:â€‹

`float var0 <- binomial_complemented(10,5,0.5) with_precision(2); // var0 equals 0.38`

`binomial_sum`

â€‹

#### Possible uses:â€‹

(`binomial_sum`

`int`

,`int`

,`float`

) --->`float`

#### Result:â€‹

Returns the sum of the terms 0 through k of the Binomial probability density, where n is the number of trials and p is the probability of success in the range 0 to 1.

#### Examples:â€‹

`float var0 <- binomial_sum(5,10,0.5) with_precision(2); // var0 equals 0.62`

`blend`

â€‹

#### Possible uses:â€‹

`rgb`

`blend`

`rgb`

--->`rgb`

(`blend`

`rgb`

,`rgb`

) --->`rgb`

(`blend`

`rgb`

,`rgb`

,`float`

) --->`rgb`

#### Result:â€‹

Blend two colors with an optional ratio (c1 `*`

r + c2 `*`

(1 - r)) between 0 and 1

#### Special cases:â€‹

- If the ratio is omitted, an even blend is done

`rgb var1 <- blend(#red, #blue); // var1 equals to a color very close to the purple`

#### Examples:â€‹

`rgb var0 <- blend(#red, #blue, 0.3); // var0 equals to a color between the purple and the blue`

`blend`

â€‹

#### Possible uses:â€‹

(`blend`

`image`

,`image`

,`float`

) --->`image`

#### Result:â€‹

Blend two images with an optional ratio between 0 and 1 (determines the transparency of the second image, applied as an overlay to the first). The size of the resulting image is that of the first parameter. The original image is left untouched

#### Examples:â€‹

`image var0 <- blend(img1, img2, 0.3); // var0 equals to a composed image with the two`

`blurred`

â€‹

#### Possible uses:â€‹

(`blurred`

`image`

) --->`image`

#### Result:â€‹

Application of a blurrying filter to the image passed in parameter. This operation can be applied multiple times. The original image is left untouched

`bool`

â€‹

#### Possible uses:â€‹

(`bool`

`any`

) --->`bool`

#### Result:â€‹

casts the operand in a bool object.

`box`

â€‹

#### Possible uses:â€‹

(`box`

`point`

) --->`geometry`

(`box`

`float`

,`float`

,`float`

) --->`geometry`

#### Result:â€‹

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

#### Comment:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`geometry var0 <- box({10, 5 , 5}); // var0 equals a geometry as a rectangle with width = 10, height = 5 depth= 5. `

float var1 <- (box({10, 10 , 5}) at_location point(50,50,0)).location.y; // var1 equals 50.0

geometry var2 <- box(10, 5 , 5); // var2 equals a geometry as a rectangle with width = 10, height = 5 depth= 5.

**See also:** around, circle, sphere, cone, line, link, norm, point, polygon, polyline, square, cube, triangle,

`brewer_colors`

â€‹

#### Possible uses:â€‹

(`brewer_colors`

`string`

) --->`list<rgb>`

`string`

`brewer_colors`

`int`

--->`list<rgb>`

(`brewer_colors`

`string`

,`int`

) --->`list<rgb>`

#### Result:â€‹

Build a list of colors of a given type (see website http://colorbrewer2.org/) with a given number of classes Build a list of colors of a given type (see website http://colorbrewer2.org/). The list of palettes can be obtained by calling brewer_palettes. This list can be safely modified afterwards (adding or removing colors)

#### Examples:â€‹

`list<rgb> var0 <- list<rgb> colors <- brewer_colors("Pastel1", 5);; // var0 equals a list of 5 sequential colors in the palette named 'Pastel1'. The list of palettes can be obtained by calling brewer_palettes `

list<rgb> var1 <- list<rgb> colors <- brewer_colors("OrRd");; // var1 equals a list of 6 blue colors

**See also:** brewer_palettes,

`brewer_palettes`

â€‹

#### Possible uses:â€‹

(`brewer_palettes`

`int`

) --->`list<string>`

`int`

`brewer_palettes`

`int`

--->`list<string>`

(`brewer_palettes`

`int`

,`int`

) --->`list<string>`

#### Result:â€‹

returns the list a palette with a given min number of classes) returns the list a palette with a given min number of classes and max number of classes)

#### Examples:â€‹

`list<string> var0 <- list<string> palettes <- brewer_palettes(3);; // var0 equals a list of palettes that are composed of a min of 3 colors `

list<string> var1 <- list<string> palettes <- brewer_palettes(5,10);; // var1 equals a list of palettes that are composed of a min of 5 colors and a max of 10 colors

**See also:** brewer_colors,

`brighter`

â€‹

#### Possible uses:â€‹

(`brighter`

`image`

) --->`image`

#### Result:â€‹

Used to return an image 10% brigther. This operation can be applied multiple times in a row if greater than 10% changes in brightness are desired.

`buffer`

â€‹

Same signification as +

`build`

â€‹

#### Possible uses:â€‹

(`build`

`matrix`

) --->`regression`

#### Result:â€‹

returns the regression build from the matrix data (a row = an instance, the first value of each line is the y value) while using the given ordinary least squares method. Usage: build(data)

#### Examples:â€‹

`build(matrix([[1.0,2.0,3.0,4.0],[2.0,3.0,4.0,2.0]]))`

`capitalize`

â€‹

#### Possible uses:â€‹

(`capitalize`

`string`

) --->`string`

#### Result:â€‹

Returns a string where the first letter is capitalized

#### Examples:â€‹

`string var0 <- capitalize("abc"); // var0 equals 'Abc'`

**See also:** lower_case, upper_case,

`cartesian_product`

â€‹

#### Possible uses:â€‹

(`cartesian_product`

`list`

) --->`unknown`

`ceil`

â€‹

#### Possible uses:â€‹

(`ceil`

`float`

) --->`float`

#### Result:â€‹

Maps the operand to the smallest following integer, i.e. the smallest integer not less than x.

#### Examples:â€‹

`float var0 <- ceil(3); // var0 equals 3.0 `

float var1 <- ceil(3.5); // var1 equals 4.0

float var2 <- ceil(-4.7); // var2 equals -4.0

`cell_at`

â€‹

#### Possible uses:â€‹

`field`

`cell_at`

`point`

--->`geometry`

(`cell_at`

`field`

,`point`

) --->`geometry`

(`cell_at`

`field`

,`int`

,`int`

) --->`geometry`

`cells_in`

â€‹

#### Possible uses:â€‹

`field`

`cells_in`

`geometry`

--->`list<geometry>`

(`cells_in`

`field`

,`geometry`

) --->`list<geometry>`

`cells_overlapping`

â€‹

#### Possible uses:â€‹

`field`

`cells_overlapping`

`geometry`

--->`list<geometry>`

(`cells_overlapping`

`field`

,`geometry`

) --->`list<geometry>`

`centroid`

â€‹

#### Possible uses:â€‹

(`centroid`

`geometry`

) --->`point`

#### Result:â€‹

Centroid (weighted sum of the centroids of a decomposition of the area into triangles) of the operand-geometry. Can be different to the location of the geometry

#### Examples:â€‹

`point var0 <- centroid(world); // var0 equals the centroid of the square, for example : {50.0,50.0}.`

**See also:** any_location_in, closest_points_with, farthest_point_to, points_at,

`char`

â€‹

#### Possible uses:â€‹

(`char`

`int`

) --->`string`

#### Special cases:â€‹

- converts ACSII integer value to character

`string var0 <- char (34); // var0 equals '"'`

`chi_square`

â€‹

#### Possible uses:â€‹

`float`

`chi_square`

`float`

--->`float`

(`chi_square`

`float`

,`float`

) --->`float`

#### Result:â€‹

Returns the area under the left hand tail (from 0 to x) of the Chi square probability density function with df degrees of freedom.

#### Examples:â€‹

`float var0 <- chi_square(20.0,10) with_precision(3); // var0 equals 0.971`

`chi_square_complemented`

â€‹

#### Possible uses:â€‹

`float`

`chi_square_complemented`

`float`

--->`float`

(`chi_square_complemented`

`float`

,`float`

) --->`float`

#### Result:â€‹

Returns the area under the right hand tail (from x to infinity) of the Chi square probability density function with df degrees of freedom.

#### Examples:â€‹

`float var0 <- chi_square_complemented(2,10) with_precision(3); // var0 equals 0.996`

`choose`

â€‹

#### Possible uses:â€‹

(`choose`

`string`

,`any GAML type`

,`unknown`

,`list`

) --->`unknown`

#### Result:â€‹

Allows the user to choose a value by specifying a title, a type, and a list of possible values

`circle`

â€‹

#### Possible uses:â€‹

(`circle`

`float`

) --->`geometry`

`float`

`circle`

`point`

--->`geometry`

(`circle`

`float`

,`point`

) --->`geometry`

#### Result:â€‹

A circle geometry which radius is equal to the operand.

#### Comment:â€‹

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

#### Special cases:â€‹

- returns a point if the radius operand is lower or equal to 0.
- When circle is used with 2 operands, the second one is the center of the created circle.

`geometry var0 <- circle(10,{80,30}); // var0 equals a geometry as a circle of radius 10, the center will be in the location {80,30}.`

#### Examples:â€‹

`geometry var1 <- circle(10); // var1 equals a geometry as a circle of radius 10.`

**See also:** around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,

`clean`

â€‹

#### Possible uses:â€‹

(`clean`

`geometry`

) --->`geometry`

#### Result:â€‹

A geometry corresponding to the cleaning of the operand (geometry, agent, point)

#### Comment:â€‹

The cleaning corresponds to a buffer with a distance of 0.0

#### Examples:â€‹

`geometry var0 <- clean(self); // var0 equals returns the geometry resulting from the cleaning of the geometry of the agent applying the operator.`

`clean_network`

â€‹

#### Possible uses:â€‹

(`clean_network`

`list<geometry>`

,`float`

,`bool`

,`bool`

) --->`list<geometry>`

#### Result:â€‹

A list of polylines corresponding to the cleaning of the first operand (list of polyline geometry or agents), considering the tolerance distance given by the second operand; the third operator is used to define if the operator should as well split the lines at their intersections(true to split the lines); the last operandis used to specify if the operator should as well keep only the main connected component of the network. Usage: clean_network(lines:list of geometries or agents, tolerance: float, split_lines: bool, keepMainConnectedComponent: bool)

#### Comment:â€‹

The cleaned set of polylines

#### Examples:â€‹

`list<geometry> var0 <- clean_network(my_road_shapefile.contents, 1.0, true, false); // var0 equals returns the list of polulines resulting from the cleaning of the geometry of the agent applying the operator with a tolerance of 1m, and splitting the lines at their intersections. `

list<geometry> var1 <- clean_network([line({10,10}, {20,20}), line({10,20},{20,10})],3.0,true,false); // var1 equals [line({10.0,20.0,0.0},{15.0,15.0,0.0}),line({15.0,15.0,0.0},{20.0,10.0,0.0}), line({10.0,10.0,0.0},{15.0,15.0,0.0}), line({15.0,15.0,0.0},{20.0,20.0,0.0})]

`clipped_with`

â€‹

#### Possible uses:â€‹

(`clipped_with`

`image`

,`int`

,`int`

,`int`

,`int`

) --->`image`

#### Result:â€‹

Used to crop the given image using a rectangle starting at the top-left x, y coordinates and expanding using the width and height. If one of the dimensions of the resulting image is 0, of if they are equal to that of the given image, returns it. The original image is left untouched

`closest_points_with`

â€‹

#### Possible uses:â€‹

`geometry`

`closest_points_with`

`geometry`

--->`list<point>`

(`closest_points_with`

`geometry`

,`geometry`

) --->`list<point>`

#### Result:â€‹

A list of two closest points between the two geometries.

#### Examples:â€‹

`list<point> var0 <- geom1 closest_points_with(geom2); // var0 equals [pt1, pt2] with pt1 the closest point of geom1 to geom2 and pt1 the closest point of geom2 to geom1`

**See also:** any_location_in, any_point_in, farthest_point_to, points_at,

`closest_to`

â€‹

#### Possible uses:â€‹

`container<unknown,geometry>`

`closest_to`

`geometry`

--->`geometry`

(`closest_to`

`container<unknown,geometry>`

,`geometry`

) --->`geometry`

(`closest_to`

`container<unknown,geometry>`

,`geometry`

,`int`

) --->`list<geometry>`

#### Result:â€‹

The N agents or geometries among the left-operand list of agents, species or meta-population (addition of species), that are the closest to the operand (casted as a geometry). An agent or a geometry among the left-operand list of agents, species or meta-population (addition of species), the closest to the operand (casted as a geometry).

#### Comment:â€‹

the distance is computed in the topology of the calling agent (the agent in which this operator is used), with the distance algorithm specific to the topology.the distance is computed in the topology of the calling agent (the agent in which this operator is used), with the distance algorithm specific to the topology.

#### Examples:â€‹

`list<geometry> var0 <- [ag1, ag2, ag3] closest_to(self, 2); // var0 equals return the 2 closest agents among ag1, ag2 and ag3 to the agent applying the operator. `

(species1 + species2) closest_to (self, 5)

geometry var2 <- [ag1, ag2, ag3] closest_to(self); // var2 equals return the closest agent among ag1, ag2 and ag3 to the agent applying the operator.

(species1 + species2) closest_to self

**See also:** neighbors_at, neighbors_of, inside, overlapping, agents_overlapping, agents_inside, agent_closest_to,

`collect`

â€‹

#### Possible uses:â€‹

`container`

`collect`

`any expression`

--->`list`

(`collect`

`container`

,`any expression`

) --->`list`

#### Result:â€‹

returns a new list, in which each element is the evaluation of the right-hand operand.

#### Comment:â€‹

collect is similar to accumulate except that accumulate always produces flat lists if the right-hand operand returns a list.In addition, collect can be applied to any container.

#### Special cases:â€‹

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

#### Examples:â€‹

`list var0 <- [1,2,4] collect (each *2); // var0 equals [2,4,8] `

list var1 <- [1,2,4] collect ([2,4]); // var1 equals [[2,4],[2,4],[2,4]]

list var2 <- [1::2, 3::4, 5::6] collect (each + 2); // var2 equals [4,6,8]

list var3 <- (list(node) collect (node(each).location.x * 2); // var3 equals the list of nodes with their x multiplied by 2

**See also:** accumulate,

`column_at`

â€‹

#### Possible uses:â€‹

`matrix<unknown>`

`column_at`

`int`

--->`list<unknown>`

(`column_at`

`matrix<unknown>`

,`int`

) --->`list<unknown>`

#### Result:â€‹

returns the column at a num_col (right-hand operand)

#### Examples:â€‹

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

`columns_list`

â€‹

#### Possible uses:â€‹

(`columns_list`

`matrix<unknown>`

) --->`list<list<unknown>>`

#### Result:â€‹

returns a list of the columns of the matrix, with each column as a list of elements

#### Examples:â€‹

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

**See also:** rows_list,

`command`

â€‹

#### Possible uses:â€‹

(`command`

`string`

) --->`string`

`string`

`command`

`string`

--->`string`

(`command`

`string`

,`string`

) --->`string`

(`command`

`string`

,`string`

,`map<string,string>`

) --->`string`

#### Result:â€‹

command allows GAMA to issue a system command using the system terminal or shell and to receive a string containing the outcome of the command or script executed. By default, commands are blocking the agent calling them, unless the sequence ' &' is used at the end. In this case, the result of the operator is an empty string. The basic form with only one string in argument uses the directory of the model and does not set any environment variables. Two other forms (with a directory and a map<string, string> of environment variables) are available.

`cone`

â€‹

#### Possible uses:â€‹

(`cone`

`point`

) --->`geometry`

`int`

`cone`

`int`

--->`geometry`

(`cone`

`int`

,`int`

) --->`geometry`

#### Result:â€‹

A cone geometry which min and max angles are given by the operands.

#### Comment:â€‹

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

#### Special cases:â€‹

- returns nil if the operand is nil.

#### Examples:â€‹

`geometry var0 <- cone({0, 45}); // var0 equals a geometry as a cone with min angle is 0 and max angle is 45. `

geometry var1 <- cone(0, 45); // var1 equals a geometry as a cone with min angle is 0 and max angle is 45.

**See also:** around, circle, line, link, norm, point, polygon, polyline, rectangle, square, triangle,

`cone3D`

â€‹

#### Possible uses:â€‹

`float`

`cone3D`

`float`

--->`geometry`

(`cone3D`

`float`

,`float`

) --->`geometry`

#### Result:â€‹

A cone geometry which base radius size is equal to the first operand, and which the height is equal to the second operand.

#### Comment:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`geometry var0 <- cone3D(10.0,5.0); // var0 equals a geometry as a cone with a base circle of radius 10 and a height of 5.`

**See also:** around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,

`connected_components_of`

â€‹

#### Possible uses:â€‹

(`connected_components_of`

`graph`

) --->`list<list>`

`graph`

`connected_components_of`

`bool`

--->`list<list>`

(`connected_components_of`

`graph`

,`bool`

) --->`list<list>`

#### Result:â€‹

returns the connected components of a graph, i.e. the list of all vertices that are in the maximally connected component together with the specified vertex. returns the connected components of a graph, i.e. the list of all edges (if the boolean is true) or vertices (if the boolean is false) that are in the connected components.

#### Examples:â€‹

`graph my_graph <- graph([]); `

list<list> var1 <- connected_components_of (my_graph); // var1 equals the list of all the components as list

graph my_graph2 <- graph([]);

list<list> var3 <- connected_components_of (my_graph2, true); // var3 equals the list of all the components as list

**See also:** alpha_index, connectivity_index, nb_cycles,

`connectivity_index`

â€‹

#### Possible uses:â€‹

(`connectivity_index`

`graph`

) --->`float`

#### Result:â€‹

returns a simple connectivity index. This number is estimated through the number of nodes (v) and of sub-graphs (p) : IC = (v - p) /(v - 1).

#### Examples:â€‹

`graph graphEpidemio <- graph([]); `

float var1 <- connectivity_index(graphEpidemio); // var1 equals the connectivity index of the graph

**See also:** alpha_index, beta_index, gamma_index, nb_cycles,

`container`

â€‹

#### Possible uses:â€‹

(`container`

`any`

) --->`container`

#### Result:â€‹

casts the operand in a container object.

`contains`

â€‹

#### Possible uses:â€‹

`string`

`contains`

`string`

--->`bool`

(`contains`

`string`

,`string`

) --->`bool`

`container<KeyType,ValueType>`

`contains`

`unknown`

--->`bool`

(`contains`

`container<KeyType,ValueType>`

,`unknown`

) --->`bool`

#### Result:â€‹

true, if the container contains the right operand, false otherwise. 'contains' can also be written 'contains_value'. On graphs, it is equivalent to calling 'contains_edge'

#### Comment:â€‹

the contains operator behavior depends on the nature of the operand

#### Special cases:â€‹

- if both operands are strings, returns true if the right-hand operand contains the right-hand pattern;
- if it is a map, contains, which can also be written 'contains_value', returns true if the operand is a value of the map
- if it is a pair, contains_key returns true if the operand is equal to the value of the pair
- if it is a file, contains returns true it the operand is contained in the file content
- if it is a population, contains returns true if the operand is an agent of the population, false otherwise
- if it is a graph, contains can be written 'contains_edge' and returns true if the operand is an edge of the graph, false otherwise (use 'contains_node' for testing the presence of a node)
- if it is a list or a matrix, contains returns true if the list or matrix contains the right operand

`bool var1 <- [1, 2, 3] contains 2; // var1 equals true `

bool var2 <- [{1,2}, {3,4}, {5,6}] contains {3,4}; // var2 equals true

#### Examples:â€‹

`bool var0 <- 'abcded' contains 'bc'; // var0 equals true`

**See also:** contains_all, contains_any, contains_key,

`contains_all`

â€‹

#### Possible uses:â€‹

`container`

`contains_all`

`container`

--->`bool`

(`contains_all`

`container`

,`container`

) --->`bool`

`string`

`contains_all`

`list`

--->`bool`

(`contains_all`

`string`

,`list`

) --->`bool`

#### Result:â€‹

true if the left operand contains all the elements of the right operand, false otherwise

#### Comment:â€‹

the definition of contains depends on the container

#### Special cases:â€‹

- if the right operand is nil or empty, contains_all returns true
- if the left-operand is a string, test whether the string contains all the element of the list;

`bool var4 <- "abcabcabc" contains_all ["ca","xy"]; // var4 equals false`

#### Examples:â€‹

`bool var0 <- [1,2,3,4,5,6] contains_all [2,4]; // var0 equals true `

bool var1 <- [1,2,3,4,5,6] contains_all [2,8]; // var1 equals false

bool var2 <- [1::2, 3::4, 5::6] contains_all [1,3]; // var2 equals false

bool var3 <- [1::2, 3::4, 5::6] contains_all [2,4]; // var3 equals true

**See also:** contains, contains_any,

`contains_any`

â€‹

#### Possible uses:â€‹

`string`

`contains_any`

`list`

--->`bool`

(`contains_any`

`string`

,`list`

) --->`bool`

`container`

`contains_any`

`container`

--->`bool`

(`contains_any`

`container`

,`container`

) --->`bool`

#### Result:â€‹

true if the left operand contains one of the elements of the right operand, false otherwise

#### Comment:â€‹

the definition of contains depends on the container

#### Special cases:â€‹

- if the right operand is nil or empty, contains_any returns false

#### Examples:â€‹

`bool var0 <- "abcabcabc" contains_any ["ca","xy"]; // var0 equals true `

bool var1 <- [1,2,3,4,5,6] contains_any [2,4]; // var1 equals true

bool var2 <- [1,2,3,4,5,6] contains_any [2,8]; // var2 equals true

bool var3 <- [1::2, 3::4, 5::6] contains_any [1,3]; // var3 equals false

bool var4 <- [1::2, 3::4, 5::6] contains_any [2,4]; // var4 equals true

**See also:** contains, contains_all,

`contains_edge`

â€‹

#### Possible uses:â€‹

`graph`

`contains_edge`

`pair`

--->`bool`

(`contains_edge`

`graph`

,`pair`

) --->`bool`

`graph`

`contains_edge`

`unknown`

--->`bool`

(`contains_edge`

`graph`

,`unknown`

) --->`bool`

#### Result:â€‹

returns true if the graph(left-hand operand) contains the given edge (righ-hand operand), false otherwise

#### Special cases:â€‹

- if the left-hand operand is nil, returns false
- if the right-hand operand is a pair, returns true if it exists an edge between the two elements of the pair in the graph

`bool var0 <- graphEpidemio contains_edge (node(0)::node(3)); // var0 equals true`

#### Examples:â€‹

`graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); `

bool var2 <- graphFromMap contains_edge link({1,5},{12,45}); // var2 equals true

**See also:** contains_vertex,

`contains_key`

â€‹

#### Possible uses:â€‹

`container<KeyType,ValueType>`

`contains_key`

`unknown`

--->`bool`

(`contains_key`

`container<KeyType,ValueType>`

,`unknown`

) --->`bool`

#### Result:â€‹

true, if the left-hand operand -- the container -- contains a key -- or an index -- equal to the right-hand operand, false otherwise. On graphs, 'contains_key' is equivalent to calling 'contains_vertex'

#### Comment:â€‹

the behavior of contains_key depends on the nature of the container

#### Special cases:â€‹

- if it is a map, contains_key returns true if the operand is a key of the map
- if it is a pair, contains_key returns true if the operand is equal to the key of the pair
- if it is a matrix, contains_key returns true if the point operand is a valid index of the matrix (i.e. >= {0,0} and < {rows, col})
- if it is a file, contains_key is applied to the file contents -- a container
- if it is a graph, contains_key returns true if the graph contains the corresponding vertex
- if it is a list, contains_key returns true if the right-hand operand is an integer and if it is a valid index (i.e. >= 0 and < length)

`bool var0 <- [1, 2, 3] contains_key 3; // var0 equals false `

bool var1 <- [{1,2}, {3,4}, {5,6}] contains_key 0; // var1 equals true

**See also:** contains_all, contains, contains_any,

`contains_node`

â€‹

Same signification as contains_key

`contains_value`

â€‹

Same signification as contains

`contains_vertex`

â€‹

#### Possible uses:â€‹

`graph`

`contains_vertex`

`unknown`

--->`bool`

(`contains_vertex`

`graph`

,`unknown`

) --->`bool`

#### Result:â€‹

returns true if the graph(left-hand operand) contains the given vertex (righ-hand operand), false otherwise

#### Special cases:â€‹

- if the left-hand operand is nil, returns false

#### Examples:â€‹

`graph graphFromMap<- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); `

bool var1 <- graphFromMap contains_vertex {1,5}; // var1 equals true

**See also:** contains_edge,

`conversation`

â€‹

#### Possible uses:â€‹

(`conversation`

`any`

) --->`conversation`

#### Result:â€‹

casts the operand in a conversation object.

`convex_hull`

â€‹

#### Possible uses:â€‹

(`convex_hull`

`geometry`

) --->`geometry`

#### Result:â€‹

A geometry corresponding to the convex hull of the operand.

#### Examples:â€‹

`geometry var0 <- convex_hull(self); // var0 equals the convex hull of the geometry of the agent applying the operator`

`copy`

â€‹

#### Possible uses:â€‹

(`copy`

`unknown`

) --->`unknown`

#### Result:â€‹

returns a copy of the operand.

`copy_between`

â€‹

#### Possible uses:â€‹

(`copy_between`

`list`

,`int`

,`int`

) --->`list`

(`copy_between`

`string`

,`int`

,`int`

) --->`string`

#### Result:â€‹

Returns a copy of the first operand between the indexes determined by the second (inclusive) and third operands (exclusive)

#### Special cases:â€‹

- If the first operand is empty, returns an empty object of the same type
- If the second operand is greater than or equal to the third operand, return an empty object of the same type
- If the first operand is nil, raises an error

#### Examples:â€‹

`list var0 <- copy_between ([4, 1, 6, 9 ,7], 1, 3); // var0 equals [1, 6] `

string var1 <- copy_between("abcabcabc", 2,6); // var1 equals "cabc"

`copy_file`

â€‹

#### Possible uses:â€‹

`string`

`copy_file`

`string`

--->`bool`

(`copy_file`

`string`

,`string`

) --->`bool`

(`copy_file`

`string`

,`string`

,`bool`

) --->`bool`

#### Result:â€‹

copy a file or a folder copy a file or a folder

#### Examples:â€‹

`bool copy_file_ok <- copy_file("../includes/my_folder","../includes/my_new_folder"); `

bool copy_file_ok <- copy_file("../includes/my_folder","../includes/my_new_folder",true);

`copy_from_clipboard`

â€‹

#### Possible uses:â€‹

(`copy_from_clipboard`

`any GAML type`

) --->`unknown`

#### Result:â€‹

Tries to copy data from the clipboard by passing its expected type. Returns nil if it has not been correctly retrieved, or not retrievable using the given type or if GAMA is in a headless environment

#### Examples:â€‹

`string copied <- copy_from_clipboard(string);`

`copy_to_clipboard`

â€‹

#### Possible uses:â€‹

(`copy_to_clipboard`

`string`

) --->`bool`

#### Result:â€‹

Tries to copy the text in parameter to the clipboard and returns whether it has been correctly copied or not (for instance it might be impossible in a headless environment)

#### Examples:â€‹

`bool copied <- copy_to_clipboard('text to copy');`

`copy_to_clipboard`

â€‹

#### Possible uses:â€‹

(`copy_to_clipboard`

`image`

) --->`bool`

#### Result:â€‹

Tries to copy the given image to the clipboard and returns whether it has been correctly copied or not (for instance it might be impossible in a headless environment)

#### Examples:â€‹

`bool copied <- copy_to_clipboard(img);`

`correlation`

â€‹

#### Possible uses:â€‹

`container`

`correlation`

`container`

--->`float`

(`correlation`

`container`

,`container`

) --->`float`

#### Result:â€‹

Returns the correlation of two data sequences (having the same size)

#### Examples:â€‹

`float var0 <- correlation([1,2,1,3,1,2], [1,2,1,3,1,2]) with_precision(4); // var0 equals 1.2 `

float var1 <- correlation([13,2,1,4,1,2], [1,2,1,3,1,2]) with_precision(2); // var1 equals -0.21

`cos`

â€‹

#### Possible uses:â€‹

(`cos`

`int`

) --->`float`

(`cos`

`float`

) --->`float`

#### Result:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`float var0 <- cos (0); // var0 equals 1.0 `

float var1 <- cos(360); // var1 equals 1.0

float var2 <- cos(-720); // var2 equals 1.0

float var3 <- cos (0.0); // var3 equals 1.0

float var4 <- cos(360.0); // var4 equals 1.0

float var5 <- cos(-720.0); // var5 equals 1.0

`cos_rad`

â€‹

#### Possible uses:â€‹

(`cos_rad`

`float`

) --->`float`

#### Result:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`float var0 <- cos_rad(0.0); // var0 equals 1.0 `

float var1 <- cos_rad(#pi); // var1 equals -1.0

`count`

â€‹

#### Possible uses:â€‹

`container`

`count`

`any expression`

--->`int`

(`count`

`container`

,`any expression`

) --->`int`

#### Result:â€‹

returns an int, equal to the number of elements of the left-hand operand that make the right-hand operand evaluate to true.

#### Comment:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`int var0 <- [1,2,3,4,5,6,7,8] count (each > 3); // var0 equals 5 `

// Number of nodes of graph g2 without any out edge

graph g2 <- graph([]);

int var3 <- g2 count (length(g2 out_edges_of each) = 0 ) ; // var3 equals the total number of out edges

// Number of agents node with x > 32

int n <- (list(node) count (round(node(each).location.x) > 32);

int var6 <- [1::2, 3::4, 5::6] count (each > 4); // var6 equals 1

**See also:** group_by,

`covariance`

â€‹

#### Possible uses:â€‹

`container`

`covariance`

`container`

--->`float`

(`covariance`

`container`

,`container`

) --->`float`

#### Result:â€‹

Returns the covariance of two data sequences

#### Examples:â€‹

`float var0 <- covariance([13,2,1,4,1,2], [1,2,1,3,1,2]) with_precision(2); // var0 equals -0.67`

`covering`

â€‹

#### Possible uses:â€‹

`container<unknown,geometry>`

`covering`

`geometry`

--->`list<geometry>`

(`covering`

`container<unknown,geometry>`

,`geometry`

) --->`list<geometry>`

#### Result:â€‹

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

#### Examples:â€‹

`list<geometry> var0 <- [ag1, ag2, ag3] covering(self); // var0 equals the agents among ag1, ag2 and ag3 that cover the shape of the right-hand argument. `

list<geometry> var1 <- (species1 + species2) covering (self); // var1 equals the agents among species species1 and species2 that covers the shape of the right-hand argument.

**See also:** neighbors_at, neighbors_of, closest_to, overlapping, agents_overlapping, inside, agents_inside, agent_closest_to,

`covers`

â€‹

#### Possible uses:â€‹

`geometry`

`covers`

`geometry`

--->`bool`

(`covers`

`geometry`

,`geometry`

) --->`bool`

#### Result:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`bool var0 <- square(5) covers square(2); // var0 equals true`

**See also:** disjoint_from, crosses, overlaps, partially_overlaps, touches,

`create_map`

â€‹

#### Possible uses:â€‹

`list`

`create_map`

`list`

--->`map`

(`create_map`

`list`

,`list`

) --->`map`

#### Result:â€‹

returns a new map using the left operand as keys for the right operand

#### Special cases:â€‹

- if the left operand contains duplicates, create_map throws an error.
- if both operands have different lengths, choose the minimum length between the two operandsfor the size of the map

#### Examples:â€‹

`map<int,string> var0 <- create_map([0,1,2],['a','b','c']); // var0 equals [0::'a',1::'b',2::'c'] `

map<int,float> var1 <- create_map([0,1],[0.1,0.2,0.3]); // var1 equals [0::0.1,1::0.2]

map<string,float> var2 <- create_map(['a','b','c','d'],[1.0,2.0,3.0]); // var2 equals ['a'::1.0,'b'::2.0,'c'::3.0]

`cropped_to`

â€‹

Same signification as clipped_with

`cross`

â€‹

#### Possible uses:â€‹

(`cross`

`float`

) --->`geometry`

`float`

`cross`

`float`

--->`geometry`

(`cross`

`float`

,`float`

) --->`geometry`

#### Result:â€‹

A cross, which radius is equal to the first operand (and eventually the width of the lines for the second)

#### Examples:â€‹

`geometry var0 <- cross(10); // var0 equals a geometry as a cross of radius 10 `

geometry var1 <- cross(10,2); // var1 equals a geometry as a cross of radius 10, and with a width of 2 for the lines

**See also:** around, cone, line, link, norm, point, polygon, polyline, super_ellipse, rectangle, square, circle, ellipse, triangle,

`crosses`

â€‹

#### Possible uses:â€‹

`geometry`

`crosses`

`geometry`

--->`bool`

(`crosses`

`geometry`

,`geometry`

) --->`bool`

#### Result:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`bool var0 <- polyline([{10,10},{20,20}]) crosses polyline([{10,20},{20,10}]); // var0 equals true `

bool var1 <- polyline([{10,10},{20,20}]) crosses {15,15}; // var1 equals true

bool var2 <- polyline([{0,0},{25,25}]) crosses polygon([{10,10},{10,20},{20,20},{20,10}]); // var2 equals true

**See also:** disjoint_from, intersects, overlaps, partially_overlaps, touches,

`crossing`

â€‹

#### Possible uses:â€‹

`container<unknown,geometry>`

`crossing`

`geometry`

--->`list<geometry>`

(`crossing`

`container<unknown,geometry>`

,`geometry`

) --->`list<geometry>`

#### Result:â€‹

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

#### Examples:â€‹

`list<geometry> var0 <- [ag1, ag2, ag3] crossing(self); // var0 equals the agents among ag1, ag2 and ag3 that cross the shape of the right-hand argument. `

list<geometry> var1 <- (species1 + species2) crossing (self); // var1 equals the agents among species species1 and species2 that cross the shape of the right-hand argument.

**See also:** neighbors_at, neighbors_of, closest_to, overlapping, agents_overlapping, inside, agents_inside, agent_closest_to,

`crs`

â€‹

#### Possible uses:â€‹

(`crs`

`file`

) --->`string`

#### Result:â€‹

the Coordinate Reference System (CRS) of the GIS file

#### Examples:â€‹

`string var0 <- crs(my_shapefile); // var0 equals the crs of the shapefile`

`CRS_transform`

â€‹

#### Possible uses:â€‹

(`CRS_transform`

`geometry`

) --->`geometry`

`geometry`

`CRS_transform`

`string`

--->`geometry`

(`CRS_transform`

`geometry`

,`string`

) --->`geometry`

(`CRS_transform`

`geometry`

,`string`

,`string`

) --->`geometry`

#### Special cases:â€‹

- returns the geometry corresponding to the transformation of the given geometry by the left operand CRS (Coordinate Reference System)

`geometry var0 <- shape CRS_transform("EPSG:4326"); // var0 equals a geometry corresponding to the agent geometry transformed into the EPSG:4326 CRS`

- returns the geometry corresponding to the transformation of the given geometry from the first CRS to the second CRS (Coordinate Reference System)

`geometry var1 <- {8.35,47.22} CRS_transform("EPSG:4326","EPSG:4326"); // var1 equals {929517.7481238344,5978057.894895313,0.0}`

- returns the geometry corresponding to the transformation of the given geometry by the current CRS (Coordinate Reference System), the one corresponding to the world's agent one

`geometry var2 <- CRS_transform(shape); // var2 equals a geometry corresponding to the agent geometry transformed into the current CRS`

`csv_file`

â€‹

#### Possible uses:â€‹

(`csv_file`

`string`

) --->`file`

`string`

`csv_file`

`bool`

--->`file`

(`csv_file`

`string`

,`bool`

) --->`file`

`string`

`csv_file`

`string`

--->`file`

(`csv_file`

`string`

,`string`

) --->`file`

`string`

`csv_file`

`matrix<unknown>`

--->`file`

(`csv_file`

`string`

,`matrix<unknown>`

) --->`file`

(`csv_file`

`string`

,`string`

,`bool`

) --->`file`

(`csv_file`

`string`

,`string`

,`any GAML type`

) --->`file`

(`csv_file`

`string`

,`string`

,`string`

,`bool`

) --->`file`

(`csv_file`

`string`

,`string`

,`string`

,`any GAML type`

) --->`file`

(`csv_file`

`string`

,`string`

,`any GAML type`

,`bool`

) --->`file`

(`csv_file`

`string`

,`string`

,`any GAML type`

,`point`

) --->`file`

#### Result:â€‹

Constructs a file of type csv. Allowed extensions are limited to csv, tsv

#### Special cases:â€‹

- csv_file(string): This file constructor allows to read a CSV file with the default separator (coma), no header, and no assumption on the type of data. No text qualifier will be used

`csv_file f <- csv_file("file.csv");`

- csv_file(string,bool): This file constructor allows to read a CSV file with the default separator (coma), with specifying if the model has a header or not (boolean), and no assumption on the type of data. No text qualifier will be used

`csv_file f <- csv_file("file.csv",true);`

- csv_file(string,string): This file constructor allows to read a CSV file and specify the separator used, without making any assumption on the type of data. Headers should be detected automatically if they exist. No text qualifier will be used

`csv_file f <- csv_file("file.csv", ";");`

- csv_file(string,string,bool): This file constructor allows to read a CSV file and specify (1) the separator used; (2) if the model has a header or not, without making any assumption on the type of data. No text qualifier will be used

`csv_file f <- csv_file("file.csv", ";",true);`

- csv_file(string,string,string,bool): This file constructor allows to read a CSV file and specify (1) the separator used; (2) the text qualifier used; (3) if the model has a header or not, without making any assumption on the type of data

`csv_file f <- csv_file("file.csv", ';', '"', true);`

- csv_file(string,string,any GAML type): This file constructor allows to read a CSV file with a given separator, no header, and the type of data. No text qualifier will be used

`csv_file f <- csv_file("file.csv", ";",int);`

- csv_file(string,string,string,any GAML type): This file constructor allows to read a CSV file and specify the separator, text qualifier to use, and the type of data to read. Headers should be detected automatically if they exist.

`csv_file f <- csv_file("file.csv", ';', '"', int);`

- csv_file(string,string,any GAML type,bool): This file constructor allows to read a CSV file with a given separator, the type of data, with specifying if the model has a header or not (boolean). No text qualifier will be used

`csv_file f <- csv_file("file.csv", ";",int,true);`

- csv_file(string,string,any GAML type,point): This file constructor allows to read a CSV file with a given separator, the type of data, with specifying the number of cols and rows taken into account. No text qualifier will be used

`csv_file f <- csv_file("file.csv", ";",int,true, {5, 100});`

- csv_file(string,matrix<unknown>): This file constructor allows to store a matrix in a CSV file (it does not save it - just store it in memory),

`csv_file f <- csv_file("file.csv", matrix([10,10],[10,10]));`

**See also:** is_csv,

`cube`

â€‹

#### Possible uses:â€‹

(`cube`

`float`

) --->`geometry`

#### Result:â€‹

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

#### Comment:â€‹

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

#### Special cases:â€‹

- returns nil if the operand is nil.

#### Examples:â€‹

`geometry var0 <- cube(10); // var0 equals a geometry as a square of side size 10.`

**See also:** around, circle, cone, line, link, norm, point, polygon, polyline, rectangle, triangle,

`curve`

â€‹

#### Possible uses:â€‹

(`curve`

`point`

,`point`

,`float`

) --->`geometry`

(`curve`

`point`

,`point`

,`point`

) --->`geometry`

(`curve`

`point`

,`point`

,`point`

,`point`

) --->`geometry`

(`curve`

`point`

,`point`

,`float`

,`float`

) --->`geometry`

(`curve`

`point`

,`point`

,`float`

,`bool`

) --->`geometry`

(`curve`

`point`

,`point`

,`point`

,`int`

) --->`geometry`

(`curve`

`point`

,`point`

,`point`

,`point`

,`int`

) --->`geometry`

(`curve`

`point`

,`point`

,`float`

,`int`

,`float`

) --->`geometry`

(`curve`

`point`

,`point`

,`float`

,`bool`

,`int`

) --->`geometry`

(`curve`

`point`

,`point`

,`float`

,`int`

,`float`

,`float`

) --->`geometry`

(`curve`

`point`

,`point`

,`float`

,`bool`

,`int`

,`float`

) --->`geometry`

#### Result:â€‹

The operator computes a Bezier curve geometry between the given operators, with 10 or a given number of points, and from left to rigth or right to left.

#### Special cases:â€‹

- if one of the operand is nil, returns nil
- When used with 4 points and an integer number of points, it computes a cubic Bezier curve geometry built from the four given points composed of a given number of points. If the number of points is lower than 2, it returns nil.

`geometry var0 <- curve({0,0}, {0,10}, {10,10}); // var0 equals a cubic Bezier curve geometry composed of 10 points from p0 to p3.`

- When used with 4 points, it computes, it computes a cubic Bezier curve geometry built from the four given points and composed of 10 points.

`geometry var1 <- curve({0,0}, {0,10}, {10,10}); // var1 equals a cubic Bezier curve geometry composed of 10 points from p0 to p3.`

- When used with 2 points, a float coefficient, a boolean, an integer number of points, a float proportion, and a float angle, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of the given number of points, considering the given inflection point (between 0.0 and 1.0 - default 0.5), and the given rotation angle (90 = along the z axis).

`geometry var2 <- curve({0,0},{10,10}, 0.5, 100, 0.8, 90); // var2 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.`

- When used with 2 points, a float coefficient, a boolean, an integer number of points, and a float proportion, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of the given number of points - the boolean is used to specified if it is the right side and the last value to indicate where is the inflection point (between 0.0 and 1.0 - default 0.5).

`geometry var3 <- curve({0,0},{10,10}, 0.5, false, 100, 0.8); // var3 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.`

- When used with 2 points, a float coefficient, and a float angle, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius considering the given rotation angle (90 = along the z axis).

`geometry var4 <- curve({0,0},{10,10}, 0.5, 90); // var4 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.`

- When used with 2 points, a float coefficient, a boolean, an integer number of points, and a float angle, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of the given number of points, considering the given rotation angle (90 = along the z axis).

`geometry var5 <- curve({0,0},{10,10}, 0.5, 100, 90); // var5 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.`

- When used with 2 points and a float coefficient, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of 10 points.

`geometry var6 <- curve({0,0},{10,10}, 0.5); // var6 equals a cubic Bezier curve geometry composed of 10 points from p0 to p1.`

- When used with 3 points, it computes a quadratic Bezier curve geometry built from the three given points and composed of 10 points.

`geometry var7 <- curve({0,0}, {0,10}, {10,10}); // var7 equals a quadratic Bezier curve geometry composed of 10 points from p0 to p2.`

- When used with 2 points, a float coefficient and a boolean, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of 10 points. The last boolean is used to specified if it is the right side.

`geometry var8 <- curve({0,0},{10,10}, 0.5, false); // var8 equals a cubic Bezier curve geometry composed of 10 points from p0 to p1 at the left side.`

- When used with 3 points and an integer, it computes a quadratic Bezier curve geometry built from the three given points. If the last operand (number of points) is inferior to 2, returns nil

`geometry var9 <- curve({0,0}, {0,10}, {10,10}, 20); // var9 equals a quadratic Bezier curve geometry composed of 20 points from p0 to p2.`

- When used with 2 points, a float coefficient, a boolean, and an integer number of points, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of the given number of points - the boolean is used to specified if it is the right side.

`geometry var10 <- curve({0,0},{10,10}, 0.5, false, 100); // var10 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.`

**See also:** around, circle, cone, link, norm, point, polygone, rectangle, square, triangle, line,

`cylinder`

â€‹

#### Possible uses:â€‹

`float`

`cylinder`

`float`

--->`geometry`

(`cylinder`

`float`

,`float`

) --->`geometry`

#### Result:â€‹

A cylinder geometry which radius is equal to the operand.

#### Comment:â€‹

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

#### Special cases:â€‹

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

#### Examples:â€‹

`geometry var0 <- cylinder(10,10); // var0 equals a geometry as a circle of radius 10.`

**See also:** around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,