Operators - gama-platform/gama GitHub Wiki

Operators


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, atan2_rad, 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_agent, get_belief_op, get_belief_with_name_op, get_beliefs_op, get_beliefs_with_name_op, get_current_intention_op, get_desire_op, get_desire_with_name_op, get_desires_op, get_desires_with_name_op, get_ideal_op, get_ideal_with_name_op, get_ideals_op, get_ideals_with_name_op, get_intention_op, get_intention_with_name_op, get_intentions_op, get_intentions_with_name_op, get_obligation_op, get_obligation_with_name_op, get_obligations_op, get_obligations_with_name_op, get_plan_name, 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, not, or, set_lifetime, set_modality, set_predicate, set_strength, with_about, with_agent, with_agent_cause, with_decay, with_dominance, with_familiarity, with_intensity, with_liking, with_solidarity, with_trust, with_truth, with_values


Casting operators

as, as_int, as_matrix, deserialize, field_with, font, from_gaml, from_json, is, is_skill, list_with, map_with, matrix_with, parallel_list_with, parallel_matrix_with, serialize, species_of, to_gaml, to_geojson, to_json, 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

!=, <, <=, =, >, >=, between


Containers-related operators

-, ::, +, accumulate, all_match, among, at, cartesian_product, collect, contains, contains_all, contains_any, contains_key, count, empty, every, first, first, first_with, get, group_by, in, index_by, inter, interleave, internal_integrated_value, last, 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, to_list, union, variance_of, where, with_max_of, with_min_of


Dataframe-related operators

+, add_column, cell, column_at, columns_list, dataframe_with, filter, iloc, join, load_sql, load_table, pivot, pretty_print, remove_empty, row_at, rows_list, save_table, select_columns


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


Display operators

horizontal, stack, vertical


edge

edge_between, strahler


EDP-related operators

diff, diff2


Files-related operators

agent_file, copy_file, crs, csv_file, dataframe_file, delete_file, directory, dxf_file, evaluate_sub_model, file_exists, flush_all_files, 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, image_file, is_agent, is_csv, is_dataframe, 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, load_sql, load_table, new_folder, obj_file, osm_file, pgm_file, property_file, read, rename_file, save_table, shape_file, simulation_file, step_sub_model, svg_file, text_file, threeds_file, to_absolute_path, unzip, writable, xml_file, zip


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


Image operators

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


Iterator operators

accumulate, all_match, as_map, collect, count, first_with, frequency_of, group_by, index_by, last_with, list_with, map_with, matrix_with, max_of, mean_of, min_of, none_matches, one_matches, product_of, sort_by, sum_of, variance_of, where, with_max_of, with_min_of


List-related operators

all_indexes_of, copy_between, index_of, last_index_of, slice, sublist


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, as_list, column_at, columns_list, determinant, eigenvalues, flatten, index_of, inverse, last_index_of, row_at, rows_list, shuffle, slice, 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

generate_pedestrian_network


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, round, with_precision


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


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


SPARQL operators

sparql_query


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, equals, 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, 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, touching, towards, transformed_by, translated_by, triangle, triangulate, union, using, voronoi, with_precision, without_holes


Spatial properties operators

covers, crosses, equals, intersects, partially_overlaps


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

anova, 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, glm, harmonic_mean, hierarchical_clustering, hsic, hsic_p_value, incomplete_beta, incomplete_gamma, incomplete_gamma_complement, k_nearest_neighbors, kmeans, kurtosis, log_gamma, max, mean, mean_deviation, median, min, moment, moran, morris_analysis, mul, multi_anova, normal_area, normal_density, normal_inverse, power_test, predict, pValue_for_fStat, pValue_for_tStat, quantile, quantile_inverse, rank_interpolated, residuals, rms, rolling_se, rolling_vc, rSquare, simple_clustering_by_distance, skewness, sobol_analysis, spearman_correlation, split, split_in, split_using, standard_deviation, stochanalysis, student_area, student_t_inverse, sum, t_test, variance


Strings-related operators

+, <, <=, >, >=, at, capitalize, char, compress, concatenate, contains, contains_all, contains_any, copy_between, count, date, empty, ends_with, first, format, in, indented_by, index_of, is_alpha, is_alphanum, is_ascii, is_decimal, is_digit, is_lower, is_number, is_upper, last, last_index_of, length, lower_case, regex_matches, replace, replace_first, replace_regex, reverse, sample, shuffle, split_with, starts_with, string, string_with, tokenize_regex, trim, uncompress, upper_case, whitespace


SubModel

load_sub_model


System

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


Time-related operators

date, string


Types-related operators

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


User control operators

choose, enter, user_confirm, user_input_dialog, wizard, wizard_page


Operators


-

Possible uses:

  • - (point) ---> point
  • matrix<unknown> - float ---> matrix
  • - (matrix<unknown> , float) ---> matrix
  • field - int ---> field
  • - (field , int) ---> field
  • field - float ---> field
  • - (field , float) ---> field
  • point - int ---> point
  • - (point , int) ---> point
  • point - float ---> point
  • - (point , float) ---> point
  • point - point ---> point
  • - (point , point) ---> point
  • matrix<unknown> - int ---> matrix
  • - (matrix<unknown> , int) ---> matrix
  • matrix<unknown> - matrix ---> matrix
  • - (matrix<unknown> , matrix) ---> matrix
  • field - field ---> field
  • - (field , field) ---> field

Result: Returns a point with coordinate resulting from the negation of the operand

Returns a point with coordinate resulting from the first operand minus the second operand.

Returns a point with coordinate resulting from the first operand minus the second operand.

Returns a point with coordinate resulting from the first operand minus the second operand.

Special cases:

  • if left-hand operand is a point and the right-hand a number, returns a new point with each coordinate as the difference of the operand coordinate with this number.
point var3 <- {1, 2} - 4.5; // var3 equals {-3.5, -2.5, -4.5} 
point var4 <- {1, 2} - 4; // var4 equals {-3.0,-2.0,-4.0}
  • if both operands are points, returns their difference (coordinates per coordinates).
point var5 <- {1, 2} - {4, 5}; // var5 equals {-3.0, -3.0}

Examples:

point var0 <- -{3.0,5.0}; // var0 equals {-3.0,-5.0} 
point var1 <- -{1.0,6.0,7.0}; // var1 equals {-1.0,-6.0,-7.0} 
point var2 <- {2.0,3.0,4.0} - 1; // var2 equals {1.0,2.0,3.0}

-

Possible uses:

  • - (float) ---> float
  • - (int) ---> int
  • rgb - int ---> rgb
  • - (rgb , int) ---> rgb
  • float - matrix ---> matrix
  • - (float , matrix) ---> matrix
  • int - float ---> float
  • - (int , float) ---> float
  • map - map ---> map
  • - (map , map) ---> map
  • species - agent ---> list
  • - (species , agent) ---> list
  • float - float ---> float
  • - (float , float) ---> float
  • geometry - geometry ---> geometry
  • - (geometry , geometry) ---> geometry
  • list - unknown ---> list
  • - (list , unknown) ---> list
  • int - int ---> int
  • - (int , int) ---> int
  • date - date ---> float
  • - (date , date) ---> float
  • rgb - rgb ---> rgb
  • - (rgb , rgb) ---> rgb
  • float - int ---> float
  • - (float , int) ---> float
  • geometry - float ---> geometry
  • - (geometry , float) ---> geometry
  • int - matrix ---> matrix
  • - (int , matrix) ---> matrix
  • geometry - container<unknown,geometry> ---> geometry
  • - (geometry , container<unknown,geometry>) ---> geometry
  • map - pair ---> map
  • - (map , pair) ---> map
  • date - int ---> date
  • - (date , int) ---> date
  • container - container ---> list
  • - (container , container) ---> list
  • date - float ---> date
  • - (date , float) ---> date

Result: Returns the difference of the two operands.

If it is used as a unary operator, it returns the arithmetic negation (opposite) of the operand.

Comment: The behavior of the operator depends on the type of the operands.

Special cases:

  • if the left operand is a species and the right operand is an agent of the species, - returns a list containing all the agents of the species minus this agent
  • If the element is not in the list, returns the list unchanged.
  • If the list is empty, returns an empty list.
  • If both dates are equal, returns 0.0.
  • If date1 < date2, returns a negative value.
  • Leap year boundaries are handled correctly by java.time.
  • -0.0 = 0.0 (IEEE 754 negative zero is equal to zero).
  • Subtracting a color from itself yields rgb(0,0,0) (black).
  • Negating Integer.MIN_VALUE overflows to Integer.MIN_VALUE.
  • Subtracting 0 returns the original date.
  • Year boundaries are handled correctly.
  • if both operands are containers and the right operand is empty, - returns the left operand
  • Subtracting 0 returns the original date.
  • Year boundaries are handled correctly.
  • if one operand is a color and the other an integer, returns a new color resulting from the subtraction of each component of the color with the right operand
rgb var0 <- rgb([255, 128, 32]) - 3; // var0 equals rgb([252,125,29])
  • if both operands are a point, a geometry or an agent, returns the geometry resulting from the difference between both geometries
geometry var1 <- geom1 - geom2; // var1 equals a geometry corresponding to difference between geom1 and geom2
  • if the left operand is a list and the right operand is an object of any type (except list), - returns a list containing the elements of the left operand minus the first occurence of this object
list<int> var2 <- [1,2,3,4,5,6,2] - 2; // var2 equals [1,3,4,5,6,2] 
list<int> var3 <- [1,2,3,4,5,6] - 0; // var3 equals [1,2,3,4,5,6]
  • if both operands are numbers, performs a normal arithmetic difference and returns a float if one of them is a float.
int var4 <- 1 - 1; // var4 equals 0
  • if both operands are dates, returns the duration in seconds between date2 and date1. To obtain a more precise duration, in milliseconds, use milliseconds_between(date1, date2)
float var5 <- date('2000-01-02') - date('2000-01-01'); // var5 equals 86400
  • if both operands are colors, returns a new color resulting from the subtraction of the two operands, component by component
rgb var6 <- rgb([255, 128, 32]) - rgb('red'); // var6 equals rgb([0,128,32])
  • if the left-hand operand is a geometry and the right-hand operand a float, returns a geometry corresponding to the left-hand operand (geometry, agent, point) reduced by the right-hand operand distance
geometry var7 <- shape - 5; // var7 equals a geometry corresponding to the geometry of the agent applying the operator reduced by a distance of 5
  • if one operand is a matrix and the other a number (float or int), performs a normal arithmetic difference of the number with each element of the matrix (results are float if the number is a float.
matrix var8 <- 3.5 - matrix([[2,5],[3,4]]); // var8 equals matrix([[1.5,-1.5],[0.5,-0.5]])
  • if the right-operand is a list of points, geometries or agents, returns the geometry resulting from the difference between the left-geometry and all of the right-geometries
geometry var9 <- rectangle(10,10) - [circle(2), square(2)]; // var9 equals rectangle(10,10) - (circle(2) + square(2))
  • if one of the operands is a date and the other a number, returns a date corresponding to the date minus the given number as duration (in seconds)
date var10 <- date('2000-01-01') - 86400; // var10 equals date('1999-12-31')
  • if both operands are containers, returns a new list in which all the elements of the right operand have been removed from the left one
list<int> var11 <- [1,2,3,4,5,6] - [2,4,9]; // var11 equals [1,3,5,6] 
list<int> var12 <- [1,2,3,4,5,6] - [0,8]; // var12 equals [1,2,3,4,5,6]

Examples:

matrix var13 <- (10.0 - (3.0 as_matrix({2,3}))); // var13 equals matrix([[7.0,7.0,7.0],[7.0,7.0,7.0]]) 
float var14 <- 1 - 1.0; // var14 equals 0.0 
float var15 <- 3 - 1.2; // var15 equals 1.8 
map var16 <- ['a'::1,'b'::2] - ['b'::2]; // var16 equals ['a'::1] 
map var17 <- ['a'::1,'b'::2] - ['b'::2,'c'::3]; // var17 equals ['a'::1] 
float var18 <- 1.0 - 1.0; // var18 equals 0.0 
float var19 <- 3.7 - 1.2; // var19 equals 2.5 
float var20 <- 3.0 - 1.2; // var20 equals 1.8 
float var21 <- -(3.5); // var21 equals -3.5 
float var22 <- -(-3.5); // var22 equals 3.5 
float var23 <- -(0.0); // var23 equals 0.0 
int var24 <- - (-56); // var24 equals 56 
int var25 <- -(0); // var25 equals 0 
float var26 <- 1.0 - 1; // var26 equals 0.0 
float var27 <- 3.7 - 1; // var27 equals 2.7 
float var28 <- 3.0 - 1; // var28 equals 2.0 
map var29 <- ['a'::1,'b'::2] - ('b'::2); // var29 equals ['a'::1] 
map var30 <- ['a'::1,'b'::2] - ('c'::3); // var30 equals ['a'::1,'b'::2] 
date var31 <- date('2000-01-01') - 86400; // var31 equals date('1999-12-31')

See also: -, /, *, +, inter, milliseconds_between,


:

Possible uses:

  • unknown : unknown ---> unknown
  • : (unknown , unknown) ---> unknown

Result: Branch-selector operator used exclusively in combination with the {@code ?} ternary operator. If the condition evaluated by {@code ?} is {@code true}, the left-hand operand of {@code :} is returned; otherwise the right-hand operand is returned.

Comment: This operator is never called directly at runtime. It is only used as a syntactic marker for the GAML parser and is always evaluated in the context of a preceding {@code ?} operator.

Examples:

list<string> var0 <- [10, 19, 43, 12, 7, 22] collect ((each > 20) ? 'above' : 'below'); // var0 equals ['below', 'below', 'above', 'below', 'below', 'above'] 
unknown var1 <- (true ? 42 : 0); // var1 equals 42

See also: ?,


::

Possible uses:

  • any expression :: any expression ---> pair
  • :: (any expression , any expression) ---> pair

Result: produces a new pair combining the left and the right operands

Special cases:

  • nil is not acceptable as a key (although it is as a value). If such a case happens, :: will throw an appropriate error

!

Possible uses:

  • ! (bool) ---> bool

Result: Returns the logical negation (NOT) of the boolean operand.

Special cases:

  • If the operand is not a boolean, it is cast to a boolean value before negation: most non-nil, non-zero values cast to {@code true}, so their negation is {@code false}.

Examples:

bool var0 <- ! (true); // var0 equals false 
bool var1 <- ! (false); // var1 equals true 
bool var2 <- not(true); // var2 equals false 
bool var3 <- not(false); // var3 equals true

See also: and, bool, or, xor,


!=

Possible uses:

  • float != int ---> bool
  • != (float , int) ---> bool
  • date != date ---> bool
  • != (date , date) ---> bool
  • unknown != unknown ---> bool
  • != (unknown , unknown) ---> bool
  • int != float ---> bool
  • != (int , float) ---> bool
  • float != float ---> bool
  • != (float , float) ---> bool
  • int != int ---> bool
  • != (int , int) ---> bool

Result: Returns {@code true} if both float operands are different, {@code false} otherwise.

Returns {@code true} if both integer operands are different, {@code false} otherwise.

Special cases:

  • If both operands are {@code nil}, returns {@code false} (they are equal).
  • If one operand is {@code nil} and the other is not, returns {@code true}.
  • If both operands are {@code nil}, returns {@code false} (they are equal).
  • If one operand is {@code nil} and the other is not, returns {@code true}.
  • Two {@code NaN} values are considered equal and therefore {@code !=} returns {@code false} for them.
  • If both operands are {@code nil}, returns {@code false} (they are equal).
  • If one operand is {@code nil} and the other is not, returns {@code true}.

Examples:

bool var0 <- 3.0 != 3; // var0 equals false 
bool var1 <- 4.7 != 4; // var1 equals true 
bool var2 <- 0.0 != 0; // var2 equals false 
bool var3 <- #now != #now minus_hours 1; // var3 equals true 
bool var4 <- [2,3] != [2,3]; // var4 equals false 
bool var5 <- [2,4] != [2,3]; // var5 equals true 
bool var6 <- 'hi' != 'hello'; // var6 equals true 
bool var7 <- 3 != 3.0; // var7 equals false 
bool var8 <- 4 != 4.7; // var8 equals true 
bool var9 <- 0 != 0.0; // var9 equals false 
bool var10 <- 3.0 != 3.0; // var10 equals false 
bool var11 <- 4.0 != 4.7; // var11 equals true 
bool var12 <- 0.0 != 0.0; // var12 equals false 
bool var13 <- 3 != 3; // var13 equals false 
bool var14 <- 4 != 5; // var14 equals true 
bool var15 <- 0 != 0; // var15 equals false

See also: <, <=, =, >, >=,


?

Possible uses:

  • bool ? any expression ---> unknown
  • ? (bool , any expression) ---> unknown

Result: Ternary conditional operator. Used in combination with the {@code :} operator: if the left-hand operand evaluates to {@code true}, returns the value of the left-hand branch of {@code :}; otherwise returns the value of the right-hand branch of {@code :}.

Comment: These ternary expressions can be nested and combined freely. Only the chosen branch is evaluated (lazy evaluation of the other branch).

Special cases:

  • If the condition is {@code nil}, it is cast to {@code false} and the else-branch is returned.
  • Both branches must be of compatible types; a type mismatch will produce a validation warning.

Examples:

list<string> var0 <- [10, 19, 43, 12, 7, 22] collect ((each > 20) ? 'above' : 'below'); // var0 equals ['below', 'below', 'above', 'below', 'below', 'above'] 
unknown var1 <- 1 > 0 ? 'yes' : 'no'; // var1 equals 'yes' 
unknown var2 <- 1 < 0 ? 'yes' : 'no'; // var2 equals 'no' 
rgb col <- (flip(0.3) ? #red : (flip(0.9) ? #blue : #green));

See also: :,


/

Possible uses:

  • field / int ---> field
  • / (field , int) ---> field
  • matrix<unknown> / matrix ---> matrix
  • / (matrix<unknown> , matrix) ---> matrix
  • point / float ---> point
  • / (point , float) ---> point
  • matrix<unknown> / int ---> matrix
  • / (matrix<unknown> , int) ---> matrix
  • field / field ---> field
  • / (field , field) ---> field
  • matrix<unknown> / float ---> matrix
  • / (matrix<unknown> , float) ---> matrix
  • point / int ---> point
  • / (point , int) ---> point
  • field / float ---> field
  • / (field , float) ---> field

Result: Returns a point with coordinates divided by the number

Returns a point with coordinates divided by the number

Special cases:

  • if the left operand is a point, returns a new point with coordinates divided by the right operand
point var0 <- {5, 7.5} / 2.5; // var0 equals {2, 3} 
point var1 <- {2,5} / 4; // var1 equals {0.5,1.25}

/

Possible uses:

  • float / float ---> float
  • / (float , float) ---> float
  • int / float ---> float
  • / (int , float) ---> float
  • float / int ---> float
  • / (float , int) ---> float
  • int / int ---> float
  • / (int , int) ---> float
  • rgb / float ---> rgb
  • / (rgb , float) ---> rgb
  • rgb / int ---> rgb
  • / (rgb , int) ---> rgb

Result: Returns the division of the two operands.

Special cases:

  • if the right-hand operand is equal to zero, raises a "Division by zero" exception
  • Dividing by 1 returns an equivalent color with the same component values.
  • Dividing by 2 halves every component (integer division).
  • if both operands are numbers (float or int), performs a normal arithmetic division and returns a float.
float var0 <- 3 / 5.0; // var0 equals 0.6
  • if one operand is a color and the other a double, returns a new color resulting from the division of each component of the color by the right operand. The result on each component is then truncated.
rgb var1 <- rgb([255, 128, 32]) / 2.5; // var1 equals rgb([102,51,13])
  • if one operand is a color and the other an integer, returns a new color resulting from the division of each component of the color by the right operand
rgb var2 <- rgb([255, 128, 32]) / 2; // var2 equals rgb([127,64,16])

See also: -, *, +,


.

Possible uses:

  • agent . any expression ---> unknown
  • . (agent , any expression) ---> unknown
  • gama.api.kernel.object.IObject . any expression ---> unknown
  • . (gama.api.kernel.object.IObject , any expression) ---> unknown

Result: The dot operator can be the dot product between 2 matrices or return the value of the expression (right-hand operand) in the scope of the left-hand agent or object.

The dot operator can be the dot product between 2 matrices or return the value of the expression (right-hand operand) in the scope of the left-hand agent or object.

Special cases:

  • if the agent is nil or dead, throws an exception
  • if the agent is nil or dead, throws an exception
  • if the left operand is an agent, the right hand expression is evaluated in the scope of that agent
unknown var0 <- agent1.location; // var0 equals the location of the agent agent1
  • if the left operand is an agent, the right hand expression is evaluated in the scope of that agent
unknown var1 <- object1.var1; // var1 equals the value of the variable var1 of the object object1

.

Possible uses:

  • matrix . matrix ---> matrix
  • . (matrix , matrix) ---> matrix

Special cases:

  • if both operands are matrix, returns the dot product of them
matrix var0 <- matrix([[1,1],[1,2]]) . matrix([[1,1],[1,2]]); // var0 equals matrix([[2,3],[3,5]])

^

Possible uses:

  • float ^ int ---> float
  • ^ (float , int) ---> float
  • int ^ float ---> float
  • ^ (int , float) ---> float
  • float ^ float ---> float
  • ^ (float , float) ---> float
  • int ^ int ---> float
  • ^ (int , int) ---> float

Result: Returns the value (always a float) of the left operand raised to the power of the right operand.

Special cases:

  • if the right-hand operand is equal to 0, returns 1
  • if it is equal to 1, returns the left-hand operand.
  • If the right-hand operand is 0, returns 1.0 regardless of the left operand (including 0^0 = 1.0).
  • If the right-hand operand is 1, returns the left-hand operand cast to float.
  • If the left operand is negative and the right operand is a non-integer float (e.g. -4^0.5), returns NaN.
  • Various examples of power
float var1 <- 2 ^ 3; // var1 equals 8.0

Examples:

float var0 <- 4.84 ^ 0.5; // var0 equals 2.2

See also: *, sqrt,


@

Same signification as at


*

Possible uses:

  • point * point ---> float
  • * (point , point) ---> float
  • matrix<unknown> * int ---> matrix
  • * (matrix<unknown> , int) ---> matrix
  • field * float ---> field
  • * (field , float) ---> field
  • matrix<unknown> * float ---> matrix
  • * (matrix<unknown> , float) ---> matrix
  • field * int ---> field
  • * (field , int) ---> field
  • point * int ---> point
  • * (point , int) ---> point
  • field * field ---> field
  • * (field , field) ---> field
  • point * float ---> point
  • * (point , float) ---> point
  • matrix<unknown> * matrix ---> matrix
  • * (matrix<unknown> , matrix) ---> matrix

Result: Returns the scalar product of two points (or dot product).

Returns a point with coordinates multiplied by a number.

Returns a point with coordinates multiplied by a number.

Special cases:

  • if both operands are points, returns their scalar product
float var0 <- {2,5} * {4.5, 5}; // var0 equals 34.0
  • if the left-hand operator is a point and the right-hand a number, returns a point with coordinates multiplied by the number
point var1 <- {2,5} * 4; // var1 equals {8.0, 20.0} 
point var2 <- {2, 4} * 2.5; // var2 equals {5.0, 10.0}

*

Possible uses:

  • int * float ---> float
  • * (int , float) ---> float
  • float * int ---> float
  • * (float , int) ---> float
  • int * int ---> int
  • * (int , int) ---> int
  • float * float ---> float
  • * (float , float) ---> float
  • int * matrix ---> matrix
  • * (int , matrix) ---> matrix
  • float * matrix ---> matrix
  • * (float , matrix) ---> matrix
  • int * field ---> field
  • * (int , field) ---> field
  • rgb * int ---> rgb
  • * (rgb , int) ---> rgb
  • geometry * float ---> geometry
  • * (geometry , float) ---> geometry
  • rgb * float ---> rgb
  • * (rgb , float) ---> rgb
  • geometry * point ---> geometry
  • * (geometry , point) ---> geometry

Result: Returns the product of the two operands.

Special cases:

  • Multiplying by 0 returns rgb(0,0,0) (black).
  • Multiplying by 1 returns an equivalent color with the same component values.
  • if both operands are numbers (float or int), performs a normal arithmetic product and returns a float if one of them is a float.
int var1 <- 1 * 1; // var1 equals 1
  • if one operand is a matrix and the other a number (float or int), performs a normal arithmetic product of the number with each element of the matrix (results are float if the number is a float.
matrix var2 <- 2 * matrix([[2,5],[3,4]]); // var2 equals matrix([[4,10],[6,8]])
  • if one operand is a matrix and the other a number (float or int), performs a normal arithmetic product of the number with each element of the matrix (results are float if the number is a float.
field var3 <- 2 * matrix([[2,5],[3,4]]); // var3 equals matrix([[4,10],[6,8]])
  • if one operand is a color and the other an integer, returns a new color resulting from the product of each component of the color with the right operand (with a maximum value at 255)
rgb var4 <- rgb([255, 128, 32]) * 2; // var4 equals rgb([255,255,64])
  • if the left-hand operand is a geometry and the right-hand operand a float, returns a geometry corresponding to the left-hand operand (geometry, agent, point) scaled by the right-hand operand coefficient
geometry var5 <- circle(10) * 2; // var5 equals circle(20) 
geometry var6 <- (circle(10) * 2).location with_precision 9; // var6 equals (circle(20)).location with_precision 9 
float var7 <- (circle(10) * 2).height with_precision 9; // var7 equals (circle(20)).height with_precision 9
  • if one operand is a color and the other a float, returns a new color resulting from the product of each component of the color with the right operand (with a maximum value at 255)
rgb var8 <- rgb([255, 128, 32]) * 2.0; // var8 equals rgb([255,255,64])
  • if the left-hand operand is a geometry and the right-hand operand a point, returns a geometry corresponding to the left-hand operand (geometry, agent, point) scaled by the right-hand operand coefficients in the 3 dimensions
geometry var9 <- shape * {0.5,0.5,2}; // var9 equals a geometry corresponding to the geometry of the agent applying the operator scaled by a coefficient of 0.5 in x, 0.5 in y and 2 in z

Examples:

float var0 <- 2.5 * 2; // var0 equals 5.0

See also: -, /, ^, +,


*

Possible uses:

  • image * float ---> image
  • * (image , float) ---> image

Result: Applies a proportional scaling ratio to the image passed in parameter and returns a new scaled image. A ratio of 0 will return nil, a ratio of 1 will return the original image. Automatic scaling and resizing methods are used. The original image is left untouched


+

Possible uses:

  • point + point ---> point
  • + (point , point) ---> point
  • field + float ---> field
  • + (field , float) ---> field
  • field + int ---> field
  • + (field , int) ---> field
  • matrix<unknown> + int ---> matrix
  • + (matrix<unknown> , int) ---> matrix
  • point + int ---> point
  • + (point , int) ---> point
  • matrix<unknown> + float ---> matrix
  • + (matrix<unknown> , float) ---> matrix
  • point + float ---> point
  • + (point , float) ---> point
  • field + field ---> field
  • + (field , field) ---> field
  • matrix<unknown> + matrix ---> matrix
  • + (matrix<unknown> , matrix) ---> matrix

Result: Returns a point with coordinate summing of the two operands.

Returns a point with coordinate summing of the two operands.

Returns a point with coordinate summing of the two operands.

Special cases:

  • if both operands are points, returns their sum.
point var1 <- {1, 2} + {4, 5}; // var1 equals {5.0, 7.0}
  • if the left-hand operand is a point and the right-hand a number, returns a new point with each coordinate as the sum of the operand coordinate with this number.
point var2 <- {1, 2} + 4.5; // var2 equals {5.5, 6.5,4.5}

Examples:

point var0 <- {1, 2} + 4; // var0 equals {5.0, 6.0,4.0}

+

Possible uses:

  • map + pair ---> map
  • + (map , pair) ---> map
  • date + int ---> date
  • + (date , int) ---> date
  • container + container ---> container
  • + (container , container) ---> container
  • dataframe + dataframe ---> dataframe
  • + (dataframe , dataframe) ---> dataframe
  • rgb + int ---> rgb
  • + (rgb , int) ---> rgb
  • container + unknown ---> list
  • + (container , unknown) ---> list
  • float + matrix ---> matrix
  • + (float , matrix) ---> matrix
  • float + float ---> float
  • + (float , float) ---> float
  • int + float ---> float
  • + (int , float) ---> float
  • float + int ---> float
  • + (float , int) ---> float
  • geometry + float ---> geometry
  • + (geometry , float) ---> geometry
  • map + map ---> map
  • + (map , map) ---> map
  • string + string ---> string
  • + (string , string) ---> string
  • geometry + geometry ---> geometry
  • + (geometry , geometry) ---> geometry
  • int + int ---> int
  • + (int , int) ---> int
  • string + unknown ---> string
  • + (string , unknown) ---> string
  • rgb + rgb ---> rgb
  • + (rgb , rgb) ---> rgb
  • date + float ---> date
  • + (date , float) ---> date
  • int + matrix ---> matrix
  • + (int , matrix) ---> matrix
  • dataframe + list<unknown> ---> dataframe
  • + (dataframe , list<unknown>) ---> dataframe
  • date + string ---> string
  • + (date , string) ---> string
  • + (geometry, float, int) ---> geometry
  • + (geometry, float, bool) ---> geometry
  • + (geometry, float, int, int) ---> geometry
  • + (geometry, float, int, int, bool) ---> geometry

Result: Returns the sum, union or concatenation of the two operands.

Special cases:

  • Adding 0 seconds returns a date equal to the original.
  • Day boundaries (midnight) are handled correctly.
  • if one of the operands is nil, + throws an error
  • if both operands are species, returns a special type of list called meta-population
  • Adding an empty container to another returns a list containing all elements of the non-empty operand.
  • If one of the operands is nil, + throws an error.
  • Adding 0 returns an equivalent color with the same component values.
  • A buffer distance of 0.0 returns a copy of the original geometry (no expansion).
  • A negative distance erodes the geometry (equivalent to reduced_by); very small geometries may collapse to an empty result.
  • If the right operand is nil, it is converted to the string 'nil'.
  • rgb([0,0,0]) + rgb([0,0,0]) = black.
  • Adding black (rgb(0,0,0)) to any color is an identity operation.
  • Adding 0 seconds returns a date equal to the original.
  • Day boundaries (midnight) are handled correctly.
  • if one of the operands is a date and the other a number, returns a date corresponding to the date plus the given number as duration (in seconds)
date var0 <- date('2000-01-01') + 86400; // var0 equals date('2000-01-02')
  • if both operands are list, +returns the concatenation of both lists.
list<int> var1 <- [1,2,3,4,5,6] + [2,4,9]; // var1 equals [1,2,3,4,5,6,2,4,9] 
list<int> var2 <- [1,2,3,4,5,6] + [0,8]; // var2 equals [1,2,3,4,5,6,0,8]
  • if one operand is a color and the other an integer, returns a new color resulting from the sum of each component of the color with the right operand
rgb var3 <- rgb([255, 128, 32]) + 3; // var3 equals rgb([255,131,35])
  • if the right operand is an object of any type (except a container), + returns a list of the elements of the left operand, to which this object has been added
list<int> var4 <- [1,2,3,4,5,6] + 2; // var4 equals [1,2,3,4,5,6,2] 
list<int> var5 <- [1,2,3,4,5,6] + 0; // var5 equals [1,2,3,4,5,6,0]
  • if the left-hand operand is a geometry and the right-hand operand a float, returns a geometry corresponding to the left-hand operand (geometry, agent, point) enlarged by the right-hand operand distance. The number of segments used by default is 8 and the end cap style is #round
geometry var6 <- circle(5) + 5; // var6 equals circle(10)
  • if the left-hand and right-hand operand are a string, returns the concatenation of the two operands
string var7 <- "hello " + "World"; // var7 equals "hello World"
  • if the right-operand is a point, a geometry or an agent, returns the geometry resulting from the union between both geometries
geometry var8 <- geom1 + geom2; // var8 equals a geometry corresponding to union between geom1 and geom2
  • if both operands are numbers (float or int), performs a normal arithmetic sum and returns a float if one of them is a float.
int var9 <- 1 + 1; // var9 equals 2
  • if the left-hand operand is a string, returns the concatenation of the two operands (the left-hand one beind casted into a string)
string var10 <- "hello " + 12; // var10 equals "hello 12"
  • if the left-hand operand is a geometry and the right-hand operands a float, an integer and one of #round, #square or #flat, returns a geometry corresponding to the left-hand operand (geometry, agent, point) enlarged by the first right-hand operand (distance), using a number of segments equal to the second right-hand operand and a flat, square or round end cap style
geometry var11 <- circle(5) + (5,32,#round); // var11 equals circle(10)
  • if the left-hand operand is a geometry and the right-hand operands a float and an integer, returns a geometry corresponding to the left-hand operand (geometry, agent, point) enlarged by the first right-hand operand (distance), using a number of segments equal to the second right-hand operand
geometry var12 <- circle(5) + (5,32); // var12 equals circle(10)
  • if the left-hand operand is a geometry and the right-hand operands a float and a boolean, returns a geometry corresponding to the left-hand operand (geometry, agent, point) enlarged by the first right-hand operand (distance), single sided is the boolean is true
geometry var13 <- line([{10,10}, {50,50}]) + (5, true); // var13 equals A ploygon corresponding to the buffer generated
  • if the left-hand operand is a geometry and the right-hand operands a float, an integer, one of #round, #square or #flat and a boolean, returns a geometry corresponding to the left-hand operand (geometry, agent, point) enlarged by the first right-hand operand (distance), using a number of segments equal to the second right-hand operand and a flat, square or round end cap style and single sided is the boolean is true
geometry var14 <- line([{10,10}, {50,50}]) + (5,32,#round, true); // var14 equals A ploygon corresponding to the buffer generated
  • if both operands are colors, returns a new color resulting from the sum of the two operands, component by component
rgb var15 <- rgb([255, 128, 32]) + rgb('red'); // var15 equals rgb([255,128,32])
  • if one operand is a matrix and the other a number (float or int), performs a normal arithmetic sum of the number with each element of the matrix (results are float if the number is a float.
matrix var16 <- 3.5 + matrix([[2,5],[3,4]]); // var16 equals matrix([[5.5,8.5],[6.5,7.5]])

Examples:

map var17 <- ['a'::1,'b'::2] + ('c'::3); // var17 equals ['a'::1,'b'::2,'c'::3] 
map var18 <- ['a'::1,'b'::2] + ('c'::3); // var18 equals ['a'::1,'b'::2,'c'::3] 
float var19 <- 1.0 + 1; // var19 equals 2.0 
float var20 <- 1.0 + 2.5; // var20 equals 3.5 
map var21 <- ['a'::1,'b'::2] + ['c'::3]; // var21 equals ['a'::1,'b'::2,'c'::3] 
map var22 <- ['a'::1,'b'::2] + [5::3.0]; // var22 equals ['a'::1,'b'::2,5::3.0] 
date var23 <- date('2016-01-01 00:00:01') + 86400; // var23 equals date('2016-01-02 00:00:01') 
string var24 <- date('2000-01-01 00:00:00') + '_Test'; // var24 equals '2000-01-01 00:00:00_Test'

See also: -, /, *, inter, join, union,


<

Possible uses:

  • date < date ---> bool
  • < (date , date) ---> bool
  • int < float ---> bool
  • < (int , float) ---> bool
  • int < int ---> bool
  • < (int , int) ---> bool
  • point < point ---> bool
  • < (point , point) ---> bool
  • float < int ---> bool
  • < (float , int) ---> bool
  • string < string ---> bool
  • < (string , string) ---> bool
  • float < float ---> bool
  • < (float , float) ---> bool

Result: Returns {@code true} if the left-hand operand is strictly less than the right-hand operand, {@code false} otherwise.

Comment: Point comparison uses a partial order, not a total order. Two points can be incomparable (neither {@code p1 < p2} nor {@code p2 < p1} holds) when one coordinate dominates and the other does not.Comparison is case-sensitive and uses Unicode code-point order.

Special cases:

  • If one of the operands is {@code nil}, returns {@code false}.
  • If one of the operands is {@code nil}, returns {@code false}.
  • Comparing equal values returns {@code false} (strict inequality).
  • Point comparison uses a partial order: p1 < p2 iff p1.x < p2.x AND p1.y < p2.y.
  • Two points where p1.x < p2.x but p1.y > p2.y are incomparable (neither {@code <} nor {@code >}) so both return false.
  • Points with equal x or equal y coordinates are never strictly less.
  • The z component is ignored in this comparison.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If the left operand is {@code nil}, returns {@code false}.
  • An empty string is lexicographically smaller than any non-empty string.
  • Comparing a string with itself always returns {@code false} (strict inequality).
  • If one of the operands is {@code nil}, returns {@code false}.
  • if both operands are points, returns true if and only if both x and y of the left operand are strictly less than x and y of the right operand.
bool var0 <- {3,5} < {4,6}; // var0 equals true 
bool var1 <- {5,7} < {4,6}; // var1 equals false 
bool var2 <- {5,7} < {4,8}; // var2 equals false 
bool var3 <- {3,3} < {3,5}; // var3 equals false
  • if both operands are String, uses a lexicographic comparison of two strings
bool var4 <- 'abc' < 'aeb'; // var4 equals true 
bool var5 <- 'abc' < 'abc'; // var5 equals false 
bool var6 <- '' < 'a'; // var6 equals true

Examples:

bool var7 <- #now < #now minus_hours 1; // var7 equals false 
bool var8 <- 3 < 2.5; // var8 equals false 
bool var9 <- 2 < 2.5; // var9 equals true 
bool var10 <- 3 < 3.0; // var10 equals false 
bool var11 <- 3 < 7; // var11 equals true 
bool var12 <- 7 < 7; // var12 equals false 
bool var13 <- 8 < 7; // var13 equals false 
bool var14 <- 3.5 < 7; // var14 equals true 
bool var15 <- 7.0 < 7; // var15 equals false 
bool var16 <- 8.5 < 7; // var16 equals false 
bool var17 <- 3.5 < 7.6; // var17 equals true 
bool var18 <- 7.6 < 3.5; // var18 equals false 
bool var19 <- 3.5 < 3.5; // var19 equals false

See also: !=, <=, =, >, >=, between,


<=

Possible uses:

  • string <= string ---> bool
  • <= (string , string) ---> bool
  • float <= int ---> bool
  • <= (float , int) ---> bool
  • point <= point ---> bool
  • <= (point , point) ---> bool
  • int <= int ---> bool
  • <= (int , int) ---> bool
  • float <= float ---> bool
  • <= (float , float) ---> bool
  • date <= date ---> bool
  • <= (date , date) ---> bool
  • int <= float ---> bool
  • <= (int , float) ---> bool

Result: Returns {@code true} if the left-hand operand is less than or equal to the right-hand operand, {@code false} otherwise.

Comment: Comparison is case-sensitive and uses Unicode code-point order.Point comparison uses a partial order, not a total order.

Special cases:

  • If the left operand is {@code nil}, returns {@code false}.
  • An empty string is lexicographically smaller than any non-empty string.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If both points are identical, returns {@code true}.
  • The z component is ignored in this comparison.
  • If one of the operands is {@code nil}, returns {@code false}.
  • Returns {@code true} when both operands are equal.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If one of the operands is {@code nil}, returns {@code false}.
  • if both operands are String, uses a lexicographic comparison of two strings
bool var0 <- 'abc' <= 'aeb'; // var0 equals true 
bool var1 <- 'abc' <= 'abc'; // var1 equals true 
bool var2 <- 'aeb' <= 'abc'; // var2 equals false 
bool var3 <- '' <= 'a'; // var3 equals true
  • if both operands are points, returns true if and only if both x and y of the left operand are less than or equal to x and y of the right operand.
bool var4 <- {3,5} <= {4,6}; // var4 equals true 
bool var5 <- {4,6} <= {4,6}; // var5 equals true 
bool var6 <- {5,7} <= {4,6}; // var6 equals false 
bool var7 <- {5,7} <= {4,8}; // var7 equals false

Examples:

bool var8 <- 7.0 <= 7; // var8 equals true 
bool var9 <- 6.5 <= 7; // var9 equals true 
bool var10 <- 8.5 <= 7; // var10 equals false 
bool var11 <- 3 <= 7; // var11 equals true 
bool var12 <- 7 <= 7; // var12 equals true 
bool var13 <- 8 <= 7; // var13 equals false 
bool var14 <- 3.5 <= 3.5; // var14 equals true 
bool var15 <- 3.5 <= 7.6; // var15 equals true 
bool var16 <- 7.6 <= 3.5; // var16 equals false 
bool var17 <- (#now <= (#now minus_hours 1)); // var17 equals false 
bool var18 <- 3 <= 2.5; // var18 equals false 
bool var19 <- 3 <= 3.0; // var19 equals true 
bool var20 <- 2 <= 3.0; // var20 equals true

See also: !=, <, =, >, >=, between,


=

Possible uses:

  • int = float ---> bool
  • = (int , float) ---> bool
  • float = int ---> bool
  • = (float , int) ---> bool
  • unknown = unknown ---> bool
  • = (unknown , unknown) ---> bool
  • float = float ---> bool
  • = (float , float) ---> bool
  • int = int ---> bool
  • = (int , int) ---> bool
  • date = date ---> bool
  • = (date , date) ---> bool

Result: Returns {@code true} if both float operands are equal, {@code false} otherwise.

Returns {@code true} if both integer operands are equal, {@code false} otherwise.

Comment: Float equality is determined using JTS's {@code IntervalSize.isZeroWidth}, which applies a magnitude-relative epsilon rather than strict bit equality. This means that two very close floating-point values may compare as equal.

Special cases:

  • If one of the operands is {@code nil}, uses the same nil-equality semantics as the double overload.
  • If one of the operands is {@code nil}, uses the same nil-equality semantics as the double overload.
  • If both operands are {@code nil}, returns {@code true}.
  • If one operand is {@code nil} and the other is not, returns {@code false}.
  • For agent operands, two references to the same agent instance are equal; dead agents are not equal to any living agent.
  • Two {@code NaN} values are considered equal by this implementation.
  • Two floats that differ by less than the machine epsilon relative to their magnitude may be considered equal.
  • If both operands are {@code nil}, returns {@code true}.
  • If one operand is {@code nil} and the other is not, returns {@code false}.
  • If both operands are {@code nil}, returns {@code true}.
  • If one operand is {@code nil} and the other is not, returns {@code false}.
  • if both operands are any kind of objects, returns true if they are identical (i.e., the same object) or equal (comparisons between nil values are permitted)
bool var0 <- [2,3] = [2,3]; // var0 equals true 
bool var1 <- [2,3] = [2,4]; // var1 equals false 
bool var2 <- 'hello' = 'hello'; // var2 equals true

Examples:

bool var3 <- 3 = 3.0; // var3 equals true 
bool var4 <- 4 = 4.7; // var4 equals false 
bool var5 <- 0 = 0.0; // var5 equals true 
bool var6 <- 4.7 = 4; // var6 equals false 
bool var7 <- 4.0 = 4; // var7 equals true 
bool var8 <- 0.0 = 0; // var8 equals true 
bool var9 <- 4.5 = 4.7; // var9 equals false 
bool var10 <- 4.5 = 4.5; // var10 equals true 
bool var11 <- 0.0 = 0.0; // var11 equals true 
bool var12 <- 4 = 5; // var12 equals false 
bool var13 <- 4 = 4; // var13 equals true 
bool var14 <- 0 = 0; // var14 equals true 
bool var15 <- #now = #now minus_hours 1; // var15 equals false

See also: !=, <, <=, >, >=,


>

Possible uses:

  • date > date ---> bool
  • > (date , date) ---> bool
  • point > point ---> bool
  • > (point , point) ---> bool
  • float > float ---> bool
  • > (float , float) ---> bool
  • string > string ---> bool
  • > (string , string) ---> bool
  • float > int ---> bool
  • > (float , int) ---> bool
  • int > float ---> bool
  • > (int , float) ---> bool
  • int > int ---> bool
  • > (int , int) ---> bool

Result: Returns {@code true} if the left-hand operand is strictly greater than the right-hand operand, {@code false} otherwise.

Comment: Point comparison uses a partial order, not a total order. Two points can be incomparable when one coordinate dominates and the other does not.Comparison is case-sensitive and uses Unicode code-point order.

Special cases:

  • Point comparison uses a partial order: p1 > p2 iff p1.x > p2.x AND p1.y > p2.y.
  • Two points where p1.x > p2.x but p1.y < p2.y are incomparable (neither {@code >} nor {@code <}) so both return false.
  • Points with equal x or equal y coordinates are never strictly greater.
  • The z component is ignored in this comparison.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If the left operand is {@code nil}, returns {@code false}.
  • Comparing a string with itself always returns {@code false} (strict inequality).
  • Upper-case letters precede lower-case letters in Unicode order: 'Z' > 'a' is false.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If one of the operands is {@code nil}, returns {@code false}.
  • Comparing equal values returns {@code false} (strict inequality).
  • if both operands are points, returns true if and only if both x and y of the left operand are strictly greater than x and y of the right operand.
bool var0 <- {5,7} > {4,6}; // var0 equals true 
bool var1 <- {5,7} > {4,8}; // var1 equals false 
bool var2 <- {4,6} > {4,6}; // var2 equals false
  • if both operands are String, uses a lexicographic comparison of two strings
bool var3 <- 'abc' > 'aeb'; // var3 equals false 
bool var4 <- 'aeb' > 'abc'; // var4 equals true 
bool var5 <- 'abc' > 'abc'; // var5 equals false

Examples:

bool var6 <- (#now > (#now minus_hours 1)); // var6 equals true 
bool var7 <- 3.5 > 7.6; // var7 equals false 
bool var8 <- 7.6 > 3.5; // var8 equals true 
bool var9 <- 3.5 > 3.5; // var9 equals false 
bool var10 <- 3.5 > 7; // var10 equals false 
bool var11 <- 7.5 > 7; // var11 equals true 
bool var12 <- 7.0 > 7; // var12 equals false 
bool var13 <- 3 > 2.5; // var13 equals true 
bool var14 <- 3 > 3.0; // var14 equals false 
bool var15 <- 13.0 > 7.0; // var15 equals true 
bool var16 <- 7 > 7; // var16 equals false 
bool var17 <- 6 > 7; // var17 equals false

See also: !=, <, <=, =, >=, between,


>=

Possible uses:

  • int >= int ---> bool
  • >= (int , int) ---> bool
  • string >= string ---> bool
  • >= (string , string) ---> bool
  • date >= date ---> bool
  • >= (date , date) ---> bool
  • float >= float ---> bool
  • >= (float , float) ---> bool
  • point >= point ---> bool
  • >= (point , point) ---> bool
  • int >= float ---> bool
  • >= (int , float) ---> bool
  • float >= int ---> bool
  • >= (float , int) ---> bool

Result: Returns {@code true} if the left-hand operand is greater than or equal to the right-hand operand, {@code false} otherwise.

Comment: Comparison is case-sensitive and uses Unicode code-point order.Point comparison uses a partial order, not a total order.

Special cases:

  • If one of the operands is {@code nil}, returns {@code false}.
  • Returns {@code true} when both operands are equal.
  • If the left operand is {@code nil}, returns {@code false}.
  • An empty string is lexicographically smaller than any non-empty string, so '' >= 'a' returns false.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If both points are identical, returns {@code true}.
  • The z component is ignored in this comparison.
  • If one of the operands is {@code nil}, returns {@code false}.
  • If one of the operands is {@code nil}, returns {@code false}.
  • if both operands are string, uses a lexicographic comparison of the two strings
bool var0 <- 'abc' >= 'aeb'; // var0 equals false 
bool var1 <- 'abc' >= 'abc'; // var1 equals true 
bool var2 <- 'aeb' >= 'abc'; // var2 equals true 
bool var3 <- '' >= 'a'; // var3 equals false
  • if both operands are points, returns true if and only if both x and y of the left operand are greater than or equal to x and y of the right operand.
bool var4 <- {5,7} >= {4,6}; // var4 equals true 
bool var5 <- {4,6} >= {4,6}; // var5 equals true 
bool var6 <- {5,7} >= {4,8}; // var6 equals false 
bool var7 <- {3,5} >= {4,6}; // var7 equals false

Examples:

bool var8 <- 3 >= 7; // var8 equals false 
bool var9 <- 7 >= 7; // var9 equals true 
bool var10 <- 8 >= 7; // var10 equals true 
bool var11 <- #now >= #now minus_hours 1; // var11 equals true 
bool var12 <- 3.5 >= 3.5; // var12 equals true 
bool var13 <- 3.5 >= 7.6; // var13 equals false 
bool var14 <- 7.6 >= 3.5; // var14 equals true 
bool var15 <- 3 >= 2.5; // var15 equals true 
bool var16 <- 3 >= 3.0; // var16 equals true 
bool var17 <- 2 >= 3.0; // var17 equals false 
bool var18 <- 3.5 >= 7; // var18 equals false 
bool var19 <- 7.0 >= 7; // var19 equals true 
bool var20 <- 8.5 >= 7; // var20 equals true

See also: !=, <, <=, =, >, between,


abs

Possible uses:

  • abs (float) ---> float
  • abs (int) ---> int

Result: Returns the absolute value of the operand (so a positive int or float depending on the type of the operand).

Examples:

float var0 <- abs (200 * -1 + 0.5); // var0 equals 199.5 
int var1 <- abs (-10); // var1 equals 10 
int var2 <- abs (10); // var2 equals 10

accumulate

Possible uses:

  • accumulate (string, container, any expression) ---> list

Result: returns a new flat list, in which each element is the evaluation of the right-hand operand. If this evaluation returns a list, the elements of this result are added directly to the list returned

Comment: accumulate is dedicated to the application of a same computation on each element of a container (and returns a list). In the right-hand operand, the keyword each can be used to represent, in turn, each of the left-hand operand elements.

Examples:

list var0 <- [a1,a2,a3] accumulate (each neighbors_at 10); // var0 equals a flat list of all the neighbors of these three agents 
list<int> var1 <- [1,2,4] accumulate ([2,4]); // var1 equals [2,4,2,4,2,4] 
list<int> var2 <- [1,2,4] accumulate (each * 2); // var2 equals [2,4,8]

See also: collect,


acos

Possible uses:

  • acos (int) ---> float
  • acos (float) ---> float

Result: Returns the value (in the interval [0,180], in decimal degrees) of the arccos of the operand (which should be in [-1,1]).

Special cases:

  • if the operand is outside of [-1,1], returns NaN.
  • if the right-hand operand is outside of the [-1,1] interval, returns NaN

Examples:

float var0 <- acos (0); // var0 equals 90.0

See also: asin, atan, atan2, cos,


action

Possible uses:

  • action (any) ---> action

Result: casts the operand in a action object.


actual_type_of

Possible uses:

  • actual_type_of (any expression) ---> gaml_type<unknown>

Result: Returns the GAML type of the operand. Note that the type of a variable, e.g. type_of(v) may not correspond to its declared type, as actual_type_of will recompute the type of its contents. So, for instance, if v is declared as list, then type_of will return list<int> if it is equal to [1,2].

Examples:

string var0 <- string(type_of("a string")); // var0 equals "string" 
string var1 <- string(type_of([1,2,3,4,5])); // var1 equals "list<int>" 
string var2 <- string(type_of(g0)); // var2 equals "point"

add_3Dmodel

Possible uses:

  • add_3Dmodel (kml, point, float, float, string) ---> kml
  • add_3Dmodel (kml, point, float, float, string, date, date) ---> kml

Result: the kml export manager with new 3D model: specify the 3D model (collada) to add to the kml

Special cases:

  • If the kml argument is nil, returns nil without modification.
  • If loc is nil, or file is nil or empty, returns the kml object unchanged.
  • If the kml argument is nil, returns nil without modification.
  • If loc is nil, or file is nil or empty, returns the kml object unchanged.
  • Uses the current simulation clock time as begin date and adds one step as end date.

See also: add_geometry, add_icon, add_label,


add_column

Possible uses:

  • add_column (dataframe, string, unknown) ---> dataframe

Result: Returns a new dataframe with an additional column filled with the given default value.

Special cases:

  • Add a 'score' column with default value 0
dataframe df2 <- add_column(my_df, "score", 0);

See also: select_columns,


add_days

Same signification as plus_days


add_edge

Possible uses:

  • graph add_edge pair ---> graph
  • add_edge (graph , pair) ---> graph

Result: add an edge between a source vertex and a target vertex (resp. the left and the right element of the pair operand)

Comment: WARNING / side effect: this operator modifies the operand and does not create a new graph. If the edge already exists, the graph is unchanged

Examples:

graph <- graph add_edge (source::target);

See also: add_node, graph,


add_geometry

Possible uses:

  • add_geometry (kml, geometry, rgb, rgb) ---> kml
  • add_geometry (kml, geometry, float, rgb) ---> kml
  • add_geometry (kml, geometry, float, rgb, rgb) ---> kml
  • add_geometry (kml, geometry, float, rgb, rgb, date) ---> kml
  • add_geometry (kml, geometry, float, rgb, rgb, date, date) ---> kml

Result: Define the kml export manager with new geometry

Special cases:

  • If the kml argument is nil, returns nil without modification.
  • If the shape is nil, returns the kml object unchanged.
  • Uses the current simulation clock time as the begin date.
  • If the kml argument is nil, returns nil without modification.
  • If the shape is nil, returns the kml object unchanged.
  • Uses a default line width of 1.0.
  • If the kml argument is nil, returns nil without modification.
  • If the shape is nil, returns the kml object unchanged.
  • The single color is used for both line and fill.
  • If the kml argument is nil, returns nil without modification.
  • If the shape is nil, returns the kml object unchanged.
  • Uses the current simulation clock time as begin date and adds one step as end date.
  • If the kml argument is nil, returns nil without modification.
  • If the shape is nil, returns the kml object unchanged.

See also: add_3Dmodel, add_icon, add_label,


add_hours

Same signification as plus_hours


add_icon

Possible uses:

  • add_icon (kml, point, float, float, string) ---> kml
  • add_icon (kml, point, float, float, string, date, date) ---> kml

Result: Define the kml export manager with new icons

Special cases:

  • If the kml argument is nil, returns nil without modification.
  • If loc is nil, or file is nil or empty, returns the kml object unchanged.
  • If the kml argument is nil, returns nil without modification.
  • If loc is nil, or file is nil or empty, returns the kml object unchanged.
  • Uses the current simulation clock time as begin date and adds one step as end date.

See also: add_3Dmodel, add_geometry, add_icon,


add_minutes

Same signification as plus_minutes


add_months

Same signification as plus_months


add_ms

Same signification as plus_ms


add_node

Possible uses:

  • graph add_node geometry ---> graph
  • add_node (graph , geometry) ---> graph

Result: adds a node in a graph.

Comment: WARNING / side effect: this operator modifies the operand and does not create a new graph

Examples:

graph var0 <- graph add_node node(0); // var0 equals the graph, to which node(0) has been added

See also: add_edge, graph,


add_point

Possible uses:

  • geometry add_point point ---> geometry
  • add_point (geometry , point) ---> geometry

Result: A new geometry resulting from the addition of the right point (coordinate) to the left-hand geometry. Note that adding a point to a line or polyline will always return a closed contour. Also note that the position at which the added point will appear in the geometry is not necessarily the last one, as points are always ordered in a clockwise fashion in geometries

Examples:

geometry var0 <- polygon([{10,10},{10,20},{20,20}]) add_point {20,10}; // var0 equals polygon([{10,10},{10,20},{20,20},{20,10}])

add_seconds

Same signification as +


add_values

Possible uses:

  • predicate add_values map ---> predicate
  • add_values (predicate , map) ---> predicate

Result: add a new value to the map of the given predicate

Examples:

predicate add_values ["time"::10];

add_weeks

Same signification as plus_weeks


add_years

Same signification as plus_years


adjacency

Possible uses:

  • adjacency (graph) ---> matrix

Result: adjacency matrix of the given graph.


after

Possible uses:

  • after (date) ---> bool
  • any expression after date ---> bool
  • after (any expression , date) ---> bool

Result: Returns true if the current_date of the model is strictly after the date passed in argument. Synonym of 'current_date > argument'. Can be used in its composed form with 2 arguments to express the lower boundary for the computation of a frequency. Note that only dates strictly after this one will be tested against the frequency

Examples:

reflex when: after(starting_date) {} 	// this reflex will always be run after the first step 
reflex when: false after(starting date + #10days) {} 	// This reflex will not be run after this date. Better to use 'until' or 'before' in that case 
every(2#days) after (starting_date + 1#day) 	// the computation will return true every two days (using the starting_date of the model as the starting point) only for the dates strictly after this starting_date + 1#day

agent

Possible uses:

  • agent (any) ---> agent

Result: casts the operand in a agent object.


agent_closest_to

Possible uses:

  • agent_closest_to (unknown) ---> agent

Result: An agent, 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.

Examples:

agent var0 <- agent_closest_to(self); // var0 equals the closest agent to the agent applying the operator.

See also: 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,


agent_farthest_to

Possible uses:

  • agent_farthest_to (unknown) ---> agent

Result: An agent, the farthest 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.

Examples:

agent var0 <- agent_farthest_to(self); // var0 equals the farthest agent to the agent applying the operator.

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


agent_file

Possible uses:

  • agent_file (string) ---> file

Result: Constructs a file of type agent. Allowed extensions are limited to agent

Special cases:

  • agent_file(string): File containing a saved agent in the java binary serialisation protocol

See also: is_agent,


agent_from_geometry

Possible uses:

  • path agent_from_geometry geometry ---> agent
  • agent_from_geometry (path , geometry) ---> agent

Result: returns the agent corresponding to given geometry (right-hand operand) in the given path (left-hand operand).

Special cases:

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

Examples:

geometry line <- one_of(path_followed.segments); 
road ag <- road(path_followed agent_from_geometry line);

See also: path,


agent_intersecting

Same signification as agents_overlapping


agents_at_distance

Possible uses:

  • agents_at_distance (float) ---> list

Result: A list of agents situated at a distance lower than the right argument.

Examples:

list var0 <- agents_at_distance(20); // var0 equals all the agents (excluding the caller) which distance to the caller is lower than 20

See also: agent_closest_to, agents_inside, at_distance, closest_to, inside, neighbors_at, neighbors_of, overlapping,


agents_covering

Possible uses:

  • agents_covering (unknown) ---> list<agent>

Result: A list of agents covered by the operand (casted as a geometry).

Examples:

list<agent> var0 <- agents_covering(self); // var0 equals the agents that cover the shape of the agent applying the operator.

See also: agent_closest_to, agents_overlapping, closest_to, inside, overlapping,


agents_crossing

Possible uses:

  • agents_crossing (unknown) ---> list<agent>

Result: A list of agents cross the operand (casted as a geometry).

Examples:

list<agent> var0 <- agents_crossing(self); // var0 equals the agents that crossing the shape of the agent applying the operator.

See also: agent_closest_to, agents_overlapping, closest_to, inside, overlapping,


agents_inside

Possible uses:

  • agents_inside (unknown) ---> list<agent>

Result: A list of agents covered by the operand (casted as a geometry).

Examples:

list<agent> var0 <- agents_inside(self); // var0 equals the agents that are covered by the shape of the agent applying the operator.

See also: agent_closest_to, agent_farthest_to, agents_at_distance, agents_overlapping, at_distance, closest_to, covering, crossing, farthest_to, inside, neighbors_at, neighbors_of, overlapping, partially_overlapping, touching,


agents_overlapping

Possible uses:

  • agents_overlapping (unknown) ---> list<agent>

Result: A list of agents overlapping the operand (casted as a geometry).

Special cases:

  • Returns an empty list if no agents overlap the given shape.
  • The agent itself may be included in the results depending on the topology configuration.

Examples:

list<agent> var0 <- agents_overlapping(self); // var0 equals the agents that overlap the shape of the agent applying the operator.

See also: agent_closest_to, agent_farthest_to, agents_covering, agents_crossing, agents_inside, agents_partially_overlapping, agents_touching, at_distance, closest_to, covering, crossing, farthest_to, inside, neighbors_at, neighbors_of, overlapping, partially_overlapping, touching,


agents_partially_overlapping

Possible uses:

  • agents_partially_overlapping (unknown) ---> list<agent>

Result: A list of agents that partially overlap the operand (casted as a geometry).

Examples:

list<agent> var0 <- agents_partially_overlapping(self); // var0 equals the agents that partially overlap the shape of the agent applying the operator.

See also: agent_closest_to, agents_overlapping, closest_to, inside, overlapping,


agents_touching

Possible uses:

  • agents_touching (unknown) ---> list<agent>

Result: A list of agents touching the operand (casted as a geometry).

Examples:

list<agent> var0 <- agents_touching(self); // var0 equals the agents that touch the shape of the agent applying the operator.

See also: agent_closest_to, agents_overlapping, closest_to, inside, overlapping,


all_indexes_of

Possible uses:

  • list all_indexes_of unknown ---> list
  • all_indexes_of (list , unknown) ---> list

Result: all the index of all the occurences of the right operand in the left operand container

Comment: The definition of all_indexes_of and the type of the index depend on the container

Special cases:

  • if the left operand is a list, all_indexes_of returns a list of all the indexes as integers
list var0 <- [1,2,3,1,2,3] all_indexes_of 1; // var0 equals [0,3] 
list var1 <- [1,2,3,1,2,3] all_indexes_of 4; // var1 equals []

See also: index_of, last_index_of,


all_match

Possible uses:

  • all_match (string, container, any expression) ---> bool

Result: Returns true if all the elements of the left-hand operand make the right-hand operand evaluate to true. Returns true if the left-hand operand is empty. 'c all_match each.property' is strictly equivalent to '(c count each.property) = length(c)' but faster in most cases (as it is a shortcircuited operator)

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, all_match throws an error
  • if the left-hand operand is empty, all_match returns true

Examples:

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

See also: count, none_matches, one_matches,


all_pairs_shortest_path

Possible uses:

  • all_pairs_shortest_path (graph) ---> matrix

Result: returns the successor matrix of shortest paths between all node pairs (rows: source, columns: target): a cell (i,j) will thus contains the next node in the shortest path between i and j.

Examples:

matrix var0 <- all_pairs_shortest_paths(my_graph); // var0 equals shortest_paths_matrix will contain all pairs of shortest paths

all_verify

Same signification as all_match


alpha_index

Possible uses:

  • alpha_index (graph) ---> float

Result: returns the alpha index of the graph (measure of connectivity which evaluates the number of cycles in a graph in comparison with the maximum number of cycles. The higher the alpha index, the more a network is connected: alpha = nb_cycles / (2*S-5) - planar graph)

Examples:

float var1 <- alpha_index(graphEpidemio); // var1 equals the alpha index of the graph

See also: beta_index, connected_components_of, connectivity_index, gamma_index, nb_cycles,


among

Possible uses:

  • int among container ---> list
  • among (int , container) ---> list

Result: Returns a list of length the value of the left-hand operand, containing random elements from the right-hand operand. As of GAMA 1.6, the order in which the elements are returned can be different than the order in which they appear in the right-hand container

Special cases:

  • if the right-hand operand is empty, among returns a new empty list. If it is nil, it throws an error.
  • if the left-hand operand is greater than the length of the right-hand operand, among returns the right-hand operand (converted as a list). If it is smaller or equal to zero, it returns an empty list

Examples:

list<int> var0 <- 3 among [1,2,4,3,5,7,6,8]; // var0 equals [1,2,8] (for example) 
list var1 <- 3 among g2; // var1 equals [node6,node11,node7] 
list var2 <- 3 among list(node); // var2 equals [node1,node11,node4] 
list<int> var3 <- 1 among [1::2,3::4]; // var3 equals 2 or 4

and

Possible uses:

  • bool and any expression ---> bool
  • and (bool , any expression) ---> bool

Result: Returns the logical AND of the two boolean operands.

Comment: Both operands are cast to {@code bool} before the operator is applied. An expression such as {@code (1 and 0)} is therefore accepted and returns {@code false}. The operator uses short-circuit evaluation: if the left operand is {@code false} or {@code nil}, the right operand is not evaluated.

Special cases:

  • If the left operand is {@code nil} or {@code false}, the right operand is never evaluated and the result is {@code false}.
  • If the right operand is {@code nil}, it is cast to {@code false}.

Examples:

bool var0 <- true and false; // var0 equals false 
bool var1 <- false and false; // var1 equals false 
bool var2 <- false and true; // var2 equals false 
bool var3 <- true and true; // var3 equals true 
 int a <- 3 ; int b <- 4; int c <- 7; 
bool var5 <- ((a+b) = c ) and ((a+b) > c ); // var5 equals false

See also: !, bool, or, xor,


and

Possible uses:

  • predicate and predicate ---> predicate
  • and (predicate , predicate) ---> predicate

Result: create a new predicate from two others by including them as subintentions

Examples:

predicate1 and predicate2

angle_between

Possible uses:

  • angle_between (point, point, point) ---> float

Result: the angle between vectors P0P1 and P0P2 (P0, P1, P2 being the three point operands). Returns an oriented angle in 2d (no Z coordinate), and a non-oriented angle in 3d.

Examples:

float var0 <- angle_between({5,5},{10,5},{5,10}); // var0 equals 90

anova

Possible uses:

  • anova (list<list<unknown>>) ---> gama.extension.stats.analysis.GamaAnova

Result: Performs a one-way ANOVA test on a list of groups of data. Each group is a list of numbers.

Examples:

anova([[6.0, 8.0, 4.0, 5.0, 3.0, 4.0], [8.0, 12.0, 9.0, 11.0, 6.0, 8.0], [13.0, 9.0, 11.0, 8.0, 7.0, 12.0]])

antialiased

Possible uses:

  • antialiased (image) ---> image
  • image antialiased int ---> image
  • antialiased (image , int) ---> image

Result: Application of a very light blur kernel that acts like an anti-aliasing filter when applied to an image. If the last argument is > 0, applies the filter the equivalent number of times. If it is equal or smaller than zero, the image is returned untouched

Application of a very light blur kernel that acts like an anti-aliasing filter when applied to an image. This operation can be applied multiple times in a row if greater.


any

Same signification as one_of


any_location_in

Possible uses:

  • any_location_in (geometry) ---> point

Result: A point inside (or touching) the operand-geometry.

Special cases:

  • Returns nil if the operand is nil.
  • For a point geometry, returns that point itself.
  • The result is non-deterministic: the operator may return different interior points across calls.

Examples:

point var0 <- any_location_in(square(5)); // var0 equals a point in the square, for example : {3,4.6}.

See also: centroid, closest_points_with, farthest_point_to, points_at,


any_point_in

Same signification as any_location_in


append_horizontally

Possible uses:

  • matrix append_horizontally matrix ---> matrix
  • append_horizontally (matrix , matrix) ---> matrix

Result: A matrix resulting from the concatenation of the rows of the two given matrices.


append_vertically

Possible uses:

  • matrix append_vertically matrix ---> matrix
  • append_vertically (matrix , matrix) ---> matrix

Result: A matrix resulting from the concatenation of the columns of the two given matrices.

Examples:

matrix var0 <- matrix([[1,2],[3,4]]) append_vertically matrix([[1,2],[3,4]]); // var0 equals matrix([[1,2,1,2],[3,4,3,4]])

arc

Possible uses:

  • arc (float, float, float) ---> geometry
  • arc (float, float, float, bool) ---> geometry

Result: An arc, which radius is equal to the first operand, heading to the second, amplitude to the third and a boolean indicating whether to return a linestring or a polygon to the fourth

Comment: the center of the arc is by default the location of the current agent in which has been called this operator. This operator returns a polygon by default.the center of the arc 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.
  • returns a point if the radius operand is lower or equal to 0.

Examples:

geometry var0 <- arc(4,45,90); // var0 equals a geometry as an arc of radius 4, in a direction of 45° and an amplitude of 90° 
geometry var1 <- arc(4,45,90, false); // var1 equals a geometry as an arc of radius 4, in a direction of 45° and an amplitude of 90°, which only contains the points on the arc

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


around

Possible uses:

  • float around unknown ---> geometry
  • around (float , unknown) ---> geometry

Result: A geometry resulting from the difference between a buffer around the right-operand casted in geometry at a distance left-operand (right-operand buffer left-operand) and the right-operand casted as geometry.

Special cases:

  • returns a circle geometry of radius right-operand if the left-operand is nil

Examples:

geometry var0 <- 10 around circle(5); // var0 equals the ring geometry between 5 and 10.

See also: arc, box, circle, cone, cone3D, cross, cube, curve, cylinder, ellipse, elliptical_arc, geometry_collection, hexagon, line, link, norm, plan, point, polygon, polyhedron, polyline, pyramid, rectangle, sphere, square, squircle, teapot, triangle,


as

Possible uses:

  • unknown as gaml_type ---> unknown
  • as (unknown , gaml_type) ---> unknown

Result: Casting of the first argument into a given type

Comment: It is equivalent to the application of the type operator on the left operand.

Examples:

int var0 <- 3.5 as int; // var0 equals int(3.5)

as_4_grid

Possible uses:

  • geometry as_4_grid point ---> matrix
  • as_4_grid (geometry , point) ---> matrix

Result: A matrix of square geometries (grid with 4-neighborhood) with dimension given by the right-hand operand ({nb_cols, nb_lines}) corresponding to the square tessellation of the left-hand operand geometry (geometry, agent)

Examples:

matrix var0 <- self as_4_grid {10, 5}; // var0 equals the matrix of square geometries (grid with 4-neighborhood) with 10 columns and 5 lines corresponding to the square tessellation of the geometry of the agent applying the operator.

See also: as_grid, as_hexagonal_grid,


as_distance_graph

Possible uses:

  • container as_distance_graph float ---> graph
  • as_distance_graph (container , float) ---> graph
  • as_distance_graph (container, float, species) ---> graph

Result: creates a graph from a list of vertices (left-hand operand). An edge is created between each pair of vertices close enough (less than a distance, right-hand operand).

Comment: as_distance_graph is more efficient for a list of points than as_intersection_graph.

Examples:

list(ant) as_distance_graph 3.0

See also: as_edge_graph, as_intersection_graph,


as_driving_graph

Possible uses:

  • container as_driving_graph container ---> graph
  • as_driving_graph (container , container) ---> graph

Result: creates a graph from the list/map of edges given as operand and connect the node to the edge

Examples:

as_driving_graph(road, node)  --:  build a graph while using the road agents as edges and the node agents as nodes

See also: as_distance_graph, as_edge_graph, as_intersection_graph,


as_edge_graph

Possible uses:

  • as_edge_graph (map) ---> graph
  • as_edge_graph (container) ---> graph
  • container as_edge_graph float ---> graph
  • as_edge_graph (container , float) ---> graph
  • container as_edge_graph container ---> graph
  • as_edge_graph (container , container) ---> graph

Result: creates a graph from the list/map of edges given as operand

Special cases:

  • if the operand is a map, the graph will be built by creating edges from pairs of the map
graph var0 <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); // var0 equals a graph with these three vertices and two edges
  • if the operand is a list and a tolerance (max distance in meters to consider that 2 points are the same node) is given, the graph will be built with elements of the list as edges and two edges will be connected by a node if the distance between their extremity (first or last points) are at distance lower or equal to the tolerance
graph var1 <- as_edge_graph([line([{1,5},{12,45}]),line([{13,45},{34,56}])],1); // var1 equals a graph with two edges and three vertices
  • if the operand is a list, the graph will be built with elements of the list as edges
graph var2 <- as_edge_graph([line([{1,5},{12,45}]),line([{12,45},{34,56}])]); // var2 equals a graph with two edges and three vertices

See also: as_distance_graph, as_intersection_graph, grid_cells_to_graph,


as_grid

Possible uses:

  • geometry as_grid point ---> matrix
  • as_grid (geometry , point) ---> matrix

Result: A matrix of square geometries (grid with 8-neighborhood) with dimension given by the right-hand operand ({nb_cols, nb_lines}) corresponding to the square tessellation of the left-hand operand geometry (geometry, agent)

Examples:

matrix var0 <- self as_grid {10, 5}; // var0 equals a matrix of square geometries (grid with 8-neighborhood) with 10 columns and 5 lines corresponding to the square tessellation of the geometry of the agent applying the operator.

See also: as_4_grid, as_hexagonal_grid,


as_hexagonal_grid

Possible uses:

  • geometry as_hexagonal_grid point ---> list<geometry>
  • as_hexagonal_grid (geometry , point) ---> list<geometry>

Result: A list of geometries (hexagonal) corresponding to the hexagonal tesselation of the first operand geometry

Examples:

list<geometry> var0 <- self as_hexagonal_grid {10, 5}; // var0 equals list of geometries (hexagonal) corresponding to the hexagonal tesselation of the first operand geometry

See also: as_4_grid, as_grid,


as_int

Possible uses:

  • string as_int int ---> int
  • as_int (string , int) ---> int

Result: parses the string argument as a signed integer in the radix specified by the second argument.

Special cases:

  • if the left operand is nil or empty, as_int returns 0
  • if the left operand does not represent an integer in the specified radix, as_int throws an exception

Examples:

int var0 <- '20' as_int 10; // var0 equals 20 
int var1 <- '20' as_int 8; // var1 equals 16 
int var2 <- '20' as_int 16; // var2 equals 32 
int var3 <- '1F' as_int 16; // var3 equals 31 
int var4 <- 'hello' as_int 32; // var4 equals 18306744

See also: int,


as_intersection_graph

Possible uses:

  • container as_intersection_graph float ---> graph
  • as_intersection_graph (container , float) ---> graph
  • as_intersection_graph (container, float, species) ---> graph

Result: creates a graph from a list of vertices (left-hand operand). An edge is created between each pair of vertices with an intersection (with a given tolerance).

creates a graph from a list of vertices (left-hand operand). An edge is created between each pair of vertices with an intersection (with a given tolerance).

Comment: as_intersection_graph is more efficient for a list of geometries (but less accurate) than as_distance_graph.

Examples:

list(ant) as_intersection_graph 0.5

See also: as_distance_graph, as_edge_graph, grid_cells_to_graph,


as_list

Possible uses:

  • as_list (matrix<unknown>) ---> list<unknown>

Result: returns a list of all the elements of the matrix, in row-major order

Examples:

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

See also: columns_list, rows_list,


as_map

Possible uses:

  • as_map (string, container, any expression) ---> map

Result: produces a new map from the evaluation of the right-hand operand for each element of the left-hand operand

Comment: the right-hand operand should be a pair

Special cases:

  • if the left-hand operand is nil, as_map throws an error.

Examples:

map<int,int> var0 <- [1,2,3,4,5,6,7,8] as_map (each::(each * 2)); // var0 equals [1::2, 2::4, 3::6, 4::8, 5::10, 6::12, 7::14, 8::16] 
map<int,int> var1 <- [1::2,3::4,5::6] as_map (each::(each * 2)); // var1 equals [2::4, 4::8, 6::12] 

as_matrix

Possible uses:

  • unknown as_matrix point ---> matrix
  • as_matrix (unknown , point) ---> matrix

Result: casts the left operand into a matrix with right operand as preferred size

Comment: This operator is very useful to cast a file containing raster data into a matrix.Note that both components of the right operand point should be positive, otherwise an exception is raised.The operator as_matrix creates a matrix of preferred size. It fills in it with elements of the left operand until the matrix is full If the size is to short, some elements will be omitted. Matrix remaining elements will be filled in by nil.

Special cases:

  • if the right operand is nil, as_matrix is equivalent to the matrix operator

See also: field_with, matrix, matrix_with, parallel_matrix_with,


as_path

Possible uses:

  • list<geometry> as_path graph ---> path
  • as_path (list<geometry> , graph) ---> path

Result: create a graph path from the list of shape

Examples:

path var0 <- [road1,road2,road3] as_path my_graph; // var0 equals a path road1->road2->road3 of my_graph

as_spatial_graph

Possible uses:

  • as_spatial_graph (graph) ---> graph

Result: Creates a spatial graph out of an arbitrary graph. If the argument is already a spatial graph, returns it unchanged. If it contains geometrical nodes or edges, they are kept unchanged


asin

Possible uses:

  • asin (float) ---> float
  • asin (int) ---> float

Result: the arcsin of the operand

Special cases:

  • if the right-hand operand is outside of the [-1,1] interval, returns NaN

Examples:

float var0 <- asin (0); // var0 equals 0.0 
float var1 <- asin (90); // var1 equals #nan

See also: acos, atan, atan2, sin,


at

Possible uses:

  • container at unknown ---> unknown
  • at (container , unknown) ---> unknown
  • species at int ---> agent
  • at (species , int) ---> agent
  • list at int ---> unknown
  • at (list , int) ---> unknown
  • string at int ---> string
  • at (string , int) ---> string
  • matrix at point ---> unknown
  • at (matrix , point) ---> unknown

Result: the element at the right operand index of the container

Comment: The first element of the container is located at the index 0. In addition, if the user tries to get the element at an index higher or equals than the length of the container, he will get an IndexOutOfBoundException.The at operator behavior depends on the nature of the operand

Special cases:

  • if it is a file, at returns the element of the file content at the index specified by the right operand
  • if it is a population, at returns the agent at the index specified by the right operand
  • if it is a graph and if the right operand is a node, at returns the in and out edges corresponding to that node
  • if it is a graph and if the right operand is an edge, at returns the pair node_out::node_in of the edge
  • if it is a graph and if the right operand is a pair node1::node2, at returns the edge from node1 to node2 in the graph
  • If the index is out of bounds (negative or >= length), raises a runtime error.
  • If the container is nil, raises a runtime error.
  • For an empty container, any index raises a runtime error.
  • if it is a list or a matrix, at returns the element at the index specified by the right operand
int var0 <- [1, 2, 3] at 2; // var0 equals 3 
point var1 <- [{1,2}, {3,4}, {5,6}] at 0; // var1 equals {1.0,2.0}

Examples:

string var2 <- 'abcdef' at 0; // var2 equals 'a'

See also: contains_all, contains_any, index_of, last_index_of,


at_distance

Possible uses:

  • container<unknown,geometry> at_distance float ---> list<geometry>
  • at_distance (container<unknown,geometry> , float) ---> list<geometry>

Result: A list of agents or geometries among the left-operand list that are located at a distance <= the right operand from the caller agent (in its topology)

Examples:

list<geometry> var0 <- [ag1, ag2, ag3] at_distance 20; // var0 equals the agents of the list located at a distance <= 20 from the caller agent (in the same order).

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


at_location

Possible uses:

  • geometry at_location point ---> geometry
  • at_location (geometry , point) ---> geometry

Result: A geometry resulting from the tran of a translation to the right-hand operand point of the left-hand operand (geometry, agent, point)

Examples:

geometry var0 <- self at_location {10, 20}; // var0 equals the geometry resulting from a translation to the location {10, 20} of the left-hand geometry (or agent). 
float var1 <-  (box({10, 10 , 5}) at_location point(50,50,0)).location.x; // var1 equals 50.0

atan

Possible uses:

  • atan (int) ---> float
  • atan (float) ---> float

Result: Returns the value (in the interval [-90,90], in decimal degrees) of the arctan of the operand (which can be any real number).

Examples:

float var0 <- atan (1); // var0 equals 45.0

See also: acos, asin, atan2, tan,


atan2

Possible uses:

  • float atan2 float ---> float
  • atan2 (float , float) ---> float

Result: the atan2 value of the two operands.

Comment: The function atan2 is the arctangent function with two arguments. The purpose of using two arguments instead of one is to gather information on the signs of the inputs in order to return the appropriate quadrant of the computed angle, which is not possible for the single-argument arctangent function. Beware: the first argument is y and the second is x

Examples:

float var0 <- atan2 (0,0); // var0 equals 0.0 
float var1 <- atan2 (0,1); // var1 equals 0.0 
float var2 <- atan2 (0,-1); // var2 equals 180.0 
float var3 <- atan2 (1,0); // var3 equals 90.0 
float var4 <- atan2 (1,1); // var4 equals 45.0 
float var5 <- atan2 (1,-1); // var5 equals 135.0 
float var6 <- atan2 (-1,0); // var6 equals -90.0 
float var7 <- atan2 (-1,1); // var7 equals -45.0 
float var8 <- atan2 (-1,-1); // var8 equals -135.0

See also: acos, asin, atan, atan2_rad,


atan2_rad

Possible uses:

  • float atan2_rad float ---> float
  • atan2_rad (float , float) ---> float

Result: the atan2 value of the two operands, expressed in radians.

Examples:

float var0 <- atan2 (0,0); // var0 equals 0.0 
float var1 <- atan2 (0,1); // var1 equals 0.0 
float var2 <- atan2 (0,-1); // var2 equals #pi 
float var3 <- atan2 (1,0); // var3 equals #pi/2 
float var4 <- atan2 (1,1); // var4 equals #pi/4 
float var5 <- atan2 (1,-1); // var5 equals 3*#pi/4 
float var6 <- atan2 (-1,0); // var6 equals -#pi/2 
float var7 <- atan2 (-1,1); // var7 equals -#pi/4 
float var8 <- atan2 (-1,-1); // var8 equals -3*#pi/4

See also: atan2, cos_rad, sin_rad, tan_rad,


auto_correlation

Possible uses:

  • container auto_correlation int ---> float
  • auto_correlation (container , int) ---> float

Result: Returns the auto-correlation of a data sequence given some lag

Examples:

float var0 <- auto_correlation([1,0,1,0,1,0],2); // var0 equals 1 
float var1 <- auto_correlation([1,0,1,0,1,0],1); // var1 equals -1

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, connectivity_index, gamma_index, nb_cycles,


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 {@code true} if the first operand is strictly greater than the second operand and strictly less than the third operand. Both bounds are exclusive.

Special cases:

  • If {@code inf > sup} (inverted bounds), the operator always returns {@code false}.
  • If {@code a} equals {@code inf} or {@code sup} exactly, returns {@code false} (open interval).
  • If {@code inf > sup} (inverted bounds), the operator always returns {@code false}.
  • If {@code a} equals {@code inf} or {@code sup} exactly, returns {@code false} (open interval).
  • 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(1, 1, 10); // var5 equals false 
bool var6 <- between(10, 1, 10); // var6 equals false 
bool var7 <- between(0, 5, 1); // var7 equals false 
bool var8 <- between(5.0, 1.0, 10.0); // var8 equals true 
bool var9 <- between(1.0, 1.0, 10.0); // var9 equals false 
bool var10 <- between(10.0, 1.0, 10.0); // var10 equals false

See also: <, <=, >, >=, slice, sublist,


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

Special cases:

  • Returns 0 for all vertices in a disconnected graph that belong to isolated components: no shortest path from another component can pass through them.
  • Returns 0 for every vertex with degree 0 (isolated vertex), since no shortest path passes through it.
  • On a graph with a single vertex and no edges, returns a map with that vertex mapped to 0.

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.

Special cases:

  • If n is 0, always returns 0.
  • p must be in [0,1].

Examples:

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

See also: gamma_rnd, gauss, 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:

  • A ratio of 0.0 returns the second color (c2) unchanged.
  • A ratio of 1.0 returns the first color (c1) unchanged.
  • 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

See also: hsb, rgb,


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
  • image blurred int ---> image
  • blurred (image , int) ---> image

Result: Application of a blurrying filter to the image passed in parameter. This operation is applied multiple times if the last argument is > 0. The original image is left untouched

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. 
geometry var1 <- box({10, 5 , 5}); // var1 equals a geometry as a rectangle with width = 10, height = 5 depth= 5. 
float var2 <-  (box({10, 10 , 5}) at_location point(50,50,0)).location.y; // var2 equals 50.0

See also: around, circle, cone, cube, line, link, norm, point, polygon, polyline, sphere, square, 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/). The list of palettes can be obtained by calling brewer_palettes. This list can be safely modified afterwards (adding or removing colors)

Build a list of colors of a given type (see website http://colorbrewer2.org/) with a given number of classes

Examples:

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

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 of palettes with a given min number of classes and max number of classes)

Returns the list of palettes with a given min number of classes)

Examples:

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

See also: brewer_colors,


brighter

Possible uses:

  • brighter (image) ---> image
  • image brighter float ---> image
  • brighter (image , float) ---> 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.

Used to return an image brighter by a percentage (between 0 - no change - and 1 - 100% brighter). If the percentage is below zero or above 1, returns the image untouched


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

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

Special cases:

  • For negative non-integer values, ceil rounds towards zero: ceil(-4.7) = -4.
  • For exact integers, ceil returns the integer itself: ceil(3.0) = 3.

Examples:

int var0 <- ceil(3); // var0 equals 3.0 
int var1 <- ceil(3.5); // var1 equals 4.0 
int var2 <- ceil(-4.7); // var2 equals -4.0

See also: floor, round,


ceiling

Same signification as ceil


cell

Possible uses:

  • cell (dataframe, int, string) ---> unknown

Result: Returns the value at the specified row index and column name.

Special cases:

  • Get a specific cell value
unknown val <- cell(my_df, 0, "name");

See also: column_at, iloc, row_at,


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

Special cases:

  • Returns nil if the operand geometry is nil or has no inner JTS geometry.
  • For a point geometry, returns the point itself as the centroid.
  • For a line geometry, returns the midpoint weighted by segment lengths.

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, 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.
  • A radius ≤ 0 returns a point geometry at the agent's current location (or {0,0,0}).
  • The center is the location of the calling agent by default; use circle(r, pt) to specify an explicit center.
  • 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: arc, around, box, cone, cross, cube, curve, ellipse, elliptical_arc, geometry_collection, hexagon, line, link, norm, plan, point, polygon, polyhedron, polyline, pyramid, rectangle, square, squircle, 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, centroid, farthest_point_to, points_along, points_at, points_on,


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

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

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.

Special cases:

  • Returns nil if the container is empty or if the container itself is nil.
  • If multiple agents are equidistant from the source, one is returned non-deterministically.

Examples:

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

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


collect

Possible uses:

  • collect (string, container, any expression) ---> list
  • collect (string, matrix, any expression) ---> matrix
  • collect (string, field, any expression) ---> matrix

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

When applied to a matrix, collect returns a matrix of the same size, in which each element is the evaluation of the right-hand operand on the corresponding element in the left-hand operand

When applied to a field, collect returns a field of the same size if the right expression returns float values, in which each element is the evaluation of the right-hand operand on the corresponding element in the left-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"]

See also: row_at, rows_list,


column_at

Possible uses:

  • dataframe column_at int ---> list
  • column_at (dataframe , int) ---> list
  • dataframe column_at string ---> list
  • column_at (dataframe , string) ---> list

Result: Returns the values of the column at the given integer position as a list. Overloads the matrix 'column_at' operator for dataframes.

Returns the values of the named column of the dataframe as a list. Overloads the matrix 'column_at' operator to accept a column name.

Special cases:

  • Get the first column
my_df column_at 0
  • Get the 'name' column
my_df column_at "name"

See also: cell, columns_list, iloc, row_at,


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: as_list, row_at, rows_list,


columns_list

Possible uses:

  • columns_list (dataframe) ---> list

Result: Returns the list of the columns of the dataframe, each column being a list of its values. Overloads the matrix 'columns_list' operator for dataframes.

See also: column_at, 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.


compress

Possible uses:

  • compress (string) ---> string

Result: Returns a string that represents the compressed form (using gzip) of the argument

See also: uncompress,


concatenate

Possible uses:

  • concatenate (list<string>) ---> string
  • list<string> concatenate string ---> string
  • concatenate (list<string> , string) ---> string

Special cases:

  • If the list is empty, returns the empty string ''.
  • If the separator is empty, equivalent to concatenate/1.
  • If the list is empty, returns the empty string ''.
  • nil elements are converted to 'nil'.
  • concatenates a list of string into a string, inserting the separator between each. More efficient than looping over the list and adding the strings individually
string var0 <- concatenate(['a','bc', 'cd'], '--'); // var0 equals 'a--bc--cd'
  • concatenates a list of string into a string. More efficient than looping over the list and adding the strings individually
string var1 <- concatenate(['a','bc']); // var1 equals 'abc'

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: arc, around, box, circle, cone3D, cross, cube, curve, cylinder, ellipse, elliptical_arc, geometry_collection, hexagon, line, link, norm, plan, point, polygon, polyhedron, polyline, pyramid, rectangle, sphere, square, squircle, teapot, 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, main_connected_component, 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, connected_components_of, gamma_index, nb_cycles,


container

Possible uses:

  • container (any) ---> container

Result: casts the operand in a container object.


contains

Possible uses:

  • 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 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 var0 <- [1, 2, 3] contains 2; // var0 equals true 
bool var1 <- [{1,2}, {3,4}, {5,6}] contains {3,4}; // var1 equals true

See also: contains_all, contains_any, contains_key, one_of,


contains

Possible uses:

  • string contains string ---> bool
  • contains (string , string) ---> bool

Result: Returns true if the left-hand string contains the right-hand string.

Special cases:

  • if both operands are strings, returns true if the right-hand operand contains the right-hand pattern;
  • If the right operand is the empty string, returns true.

Examples:

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

contains_all

Possible uses:

  • string contains_all list ---> bool
  • contains_all (string , list) ---> bool
  • container contains_all container ---> bool
  • contains_all (container , container) ---> bool

Result: Returns true if the string contains all the elements of the list.

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 list is empty, returns true (vacuously true).
  • Non-string elements in the list cause the method to return false.
  • 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 var0 <- "abcabcabc" contains_all ["ca","xy"]; // var0 equals false

Examples:

bool var1 <- [1,2,3,4,5,6] contains_all [2,4]; // var1 equals true  
bool var2 <- [1,2,3,4,5,6] contains_all [2,8]; // var2 equals false 
bool var3 <- [1::2, 3::4, 5::6] contains_all [1,3]; // var3 equals false  
bool var4 <- [1::2, 3::4, 5::6] contains_all [2,4]; // var4 equals true

See also: at, contains, contains_any,


contains_any

Possible uses:

  • container contains_any container ---> bool
  • contains_any (container , container) ---> bool
  • string contains_any list ---> bool
  • contains_any (string , list) ---> bool

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

Returns true if the string contains at least one element of the list.

Comment: the definition of contains depends on the container

Special cases:

  • if the right operand is nil or empty, contains_any returns false
  • If the list is empty, returns false.
  • Non-string elements in the list are ignored.

Examples:

bool var0 <- [1,2,3,4,5,6] contains_any [2,4]; // var0 equals true  
bool var1 <- [1,2,3,4,5,6] contains_any [2,8]; // var1 equals true 
bool var2 <- [1::2, 3::4, 5::6] contains_any [1,3]; // var2 equals false 
bool var3 <- [1::2, 3::4, 5::6] contains_any [2,4]; // var3 equals true 
bool var4 <- "abcabcabc" contains_any ["ca","xy"]; // var4 equals true

See also: at, 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, contains_all, 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.

Special cases:

  • copy(nil) returns nil.
  • The copy is independent of the original; modifying one does not affect the other.

copy_between

Possible uses:

  • copy_between (string, int, int) ---> string
  • copy_between (list, int, int) ---> list

Result: Returns a copy of the first operand between the indices 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, returns an empty object of the same type
  • If the first operand is nil, raises an error

Examples:

string var0 <- copy_between("abcabcabc", 2,6); // var0 equals "cabc" 
list var1 <-  copy_between ([4, 1, 6, 9 ,7], 1, 3); // var1 equals [1, 6]

See also: slice, sublist, submatrix,


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 (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 Pearson 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]); // var0 equals 1.0 
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 (float) ---> float
  • cos (int) ---> 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.0); // var0 equals 1.0 
float var1 <- cos(360.0); // var1 equals 1.0 
float var2 <- cos(-720.0); // var2 equals 1.0 
float var3 <- cos (0); // var3 equals 1.0 
float var4 <- cos(360); // var4 equals 1.0 
float var5 <- cos(-720); // var5 equals 1.0

See also: acos, sin, tan,


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

See also: atan2_rad, sin, sin_rad, tan, tan_rad,


count

Possible uses:

  • string count string ---> int
  • count (string , string) ---> int
  • count (string, 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.

Counts the number of time a specific string appears in another one

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 
int var7 <- count("abcabc", "a"); // var7 equals 2

See also: all_match, group_by, none_matches, one_matches,


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: agent_closest_to, agents_inside, agents_overlapping, closest_to, inside, neighbors_at, neighbors_of, overlapping,


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: crosses, disjoint_from, equals, 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,2); // var0 equals a geometry as a cross of radius 10, and with a width of 2 for the lines  
geometry var1 <- cross(10); // var1 equals a geometry as a cross of radius 10

See also: around, circle, cone, ellipse, line, link, norm, point, polygon, polyline, rectangle, square, super_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: covers, disjoint_from, equals, 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: agent_closest_to, agents_inside, agents_overlapping, closest_to, inside, neighbors_at, neighbors_of, overlapping,


crs

Possible uses:

  • crs (file) ---> string

Result: the Coordinate Reference System (CRS) of the GIS file

Special cases:

  • Raises a runtime error if the file is not a GIS file (i.e. not a shapefile or similar spatial format).
  • Returns nil if the CRS cannot be determined from the file or if no projection information is embedded.

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 a copy of the geometry unchanged if no world projection is defined.
  • If the geometry is nil, a NullPointerException may be raised; always ensure the geometry is non-nil before applying this operator.
  • Raises a runtime error if either CRS code is not recognized as a valid EPSG identifier.
  • If the geometry is nil, returns nil without attempting the transformation.
  • Raises a runtime error if the CRS code is not recognized as a valid EPSG identifier.
  • If the geometry is nil, returns nil.
  • 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 var0 <- CRS_transform(shape); // var0 equals a geometry corresponding to the agent geometry transformed into the current 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 left operand CRS (Coordinate Reference System)
geometry var2 <- shape CRS_transform("EPSG:4326"); // var2 equals a geometry corresponding to the agent geometry transformed into the EPSG:4326 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, gaml_type) ---> file
  • csv_file (string, string, string, bool) ---> file
  • csv_file (string, string, string, gaml_type) ---> file
  • csv_file (string, string, gaml_type, bool) ---> file
  • csv_file (string, string, 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,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,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,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,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): 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, box, 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, float, int, float) ---> geometry
  • curve (point, point, float, bool, int) ---> geometry
  • curve (point, point, point, point, int) ---> geometry
  • curve (point, point, float, bool, int, float) ---> geometry
  • curve (point, point, float, int, float, float) ---> geometry

Result: The operator computes a Bezier curve geometry corresponding to control points provided in arguments, with a given number of points (default = 10).

Special cases:

  • if one of the operand is nil, returns nil
  • 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 var0 <- curve({0,0},{10,10}, 0.5); // var0 equals a cubic Bezier curve geometry composed of 10 points from p0 to p1.
  • When used with 4 points, it computes a cubic Bezier curve geometry built with the four given control 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 with control points p0, ..., p3.
  • 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 var2 <- curve({0,0},{10,10}, 0.5, 90); // var2 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.
  • When used with 3 points in argument, it computes a quadratic Bezier curve geometry with these three control points. It is composed of the default number of points.
geometry var3 <- curve({0,0}, {0,10}, {10,10}); // var3 equals a quadratic Bezier curve geometry composed of 10 points, with control points p0, p1 and p2.
  • 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 var4 <- curve({0,0},{10,10}, 0.5, 100, 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 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 var5 <- curve({0,0},{10,10}, 0.5, false); // var5 equals a cubic Bezier curve geometry composed of 10 points from p0 to p1 at the left side.
  • 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 var6 <- curve({0,0},{10,10}, 0.5, false, 100); // var6 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.
  • 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 var7 <- curve({0,0}, {0,10}, {10,10}); // var7 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, 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 var8 <- curve({0,0},{10,10}, 0.5, false, 100, 0.8); // var8 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, 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 var9 <- curve({0,0},{10,10}, 0.5, 100, 0.8, 90); // var9 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.
  • When used with 3 points p0, p1, p2 and an integer n, it computes a n-points quadratic Bezier curve geometry built from control points p0, p1, p2. If n is inferior to 2, returns nil.
geometry var10 <- curve({0,0}, {0,10}, {10,10}, 20); // var10 equals a quadratic Bezier curve geometry composed of 20 points with control points p0, p1 and p2.

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


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,


darker

Possible uses:

  • darker (image) ---> image
  • image darker float ---> image
  • darker (image , float) ---> image

Result: Used to return an image darker by a percentage (between 0 - no change - and 1 - 100% darker). If the percentage is below zero or above 1, returns the image untouched

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


dataframe

Possible uses:

  • dataframe (any) ---> dataframe

Result: casts the operand in a dataframe object.


dataframe_file

Possible uses:

  • dataframe_file (string) ---> file
  • string dataframe_file string ---> file
  • dataframe_file (string , string) ---> file
  • string dataframe_file dataframe ---> file
  • dataframe_file (string , dataframe) ---> file
  • dataframe_file (string, string, bool) ---> file
  • dataframe_file (string, string, bool, string) ---> file

Result: Constructs a file of type dataframe. Allowed extensions are limited to xlsx, parquet, avro

Special cases:

  • dataframe_file(string): Reads a dataframe from a file. The format is deduced from the extension (xlsx, parquet, avro, csv, tsv, json).
dataframe d <- dataframe_file("../includes/data.xlsx");
  • dataframe_file(string,string): Reads a dataframe from a CSV/TSV file with the given column separator.
dataframe d <- dataframe_file("../includes/data.csv", ";");
  • dataframe_file(string,string,bool): Reads a dataframe from a CSV/TSV file with a separator and a header flag.
dataframe d <- dataframe_file("../includes/data.csv", ";", true);
  • dataframe_file(string,string,bool,string): Reads a dataframe from a CSV/TSV file with a separator, header flag and character encoding.
dataframe d <- dataframe_file("../includes/data.csv", ";", false, "ISO-8859-1");
  • dataframe_file(string,dataframe): Stores a dataframe in a file object in memory (it does not save it). It can then be saved with the 'save' statement.
dataframe_file f <- dataframe_file("out.parquet", my_dataframe);

See also: is_dataframe,


dataframe_with

Possible uses:

  • list<string> dataframe_with list<list> ---> dataframe
  • dataframe_with (list<string> , list<list>) ---> dataframe

Result: Creates a dataframe from a list of column names and a list of rows (each row is a list of values).

Special cases:

  • Create a dataframe with column names and data rows
dataframe_with(["name","age"], [["Alice",30],["Bob",25]])

date

Possible uses:

  • date (any) ---> date

Result: casts the operand in a date object.


date

Possible uses:

  • string date string ---> date
  • date (string , string) ---> date
  • date (string, string, string) ---> date

Result: converts a string to a date 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 parse the date using one of the ISO date & time formats (similar to date('...') in that case). The pattern can also follow the pattern definition found here, which gives much more control over what will be parsed: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns. Different patterns are available by default as constant: #iso_local, #iso_simple, #iso_offset, #iso_zoned and #custom, which can be changed in the preferences

Special cases:

  • In addition to the date and pattern string operands, a specific locale (e.g. 'fr', 'en'...) can be added.
date d <- date("1999-january-30", 'yyyy-MMMM-dd', 'en');

Examples:

date den <- date("1999-12-30", 'yyyy-MM-dd');

dbscan

Possible uses:

  • dbscan (list, float, int) ---> list<list>

Result: returns the list of clusters (list of instance indices) computed with the dbscan (density-based spatial clustering of applications with noise) algorithm from the first operand data according to the maximum radius of the neighborhood to be considered (eps) and the minimum number of points needed for a cluster (minPts). Usage: dbscan(data,eps,minPoints)

Special cases:

  • if the lengths of two vectors in the right-hand aren't equal, returns 0

Examples:

list<list> var0 <- dbscan ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],10,2); // var0 equals [[0,1,2,3]]

dead

Possible uses:

  • dead (agent) ---> bool

Result: true if the agent is dead (or null), false otherwise.

Special cases:

  • dead(nil) returns true.
  • dead(simulation) returns false when called during a running simulation.

Examples:

bool var0 <- dead(agent_A); // var0 equals true or false

decompress

Same signification as uncompress


degree_of

Possible uses:

  • graph degree_of unknown ---> int
  • degree_of (graph , unknown) ---> int

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

Examples:

int var1 <- graphFromMap degree_of (node(3)); // var1 equals 3

See also: in_degree_of, out_degree_of,


delete_file

Possible uses:

  • delete_file (string) ---> bool

Result: delete a file or a folder

Examples:

bool delete_file_ok <- delete_file(["../includes/my_folder"];

deserialize

Possible uses:

  • deserialize (string) ---> unknown

Result: Deserializes an object precedently serialized using serialize or to_binary.It is safer to deserialize agents or simulations with the 'restore' or 'create' statements rather than with this operator.

See also: from_gaml, from_json,


det

Same signification as determinant


determinant

Possible uses:

  • determinant (matrix) ---> float

Result: The determinant of the given matrix

Examples:

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

diff

Possible uses:

  • float diff float ---> float
  • diff (float , float) ---> float

Result: A placeholder function for expressing equations


diff2

Possible uses:

  • float diff2 float ---> float
  • diff2 (float , float) ---> float

Result: A placeholder function for expressing equations


directed

Possible uses:

  • directed (graph) ---> graph

Result: the operand graph becomes a directed graph.

Comment: WARNING / side effect: this operator modifies the operand and does not create a new graph.

See also: undirected,


direction_between

Possible uses:

  • topology direction_between container<unknown,geometry> ---> float
  • direction_between (topology , container<unknown,geometry>) ---> float

Result: A direction (in degree) between a list of two geometries (geometries, agents, points) considering a topology.

Examples:

float var0 <- my_topology direction_between [ag1, ag2]; // var0 equals the direction between ag1 and ag2 considering the topology my_topology

See also: direction_to, distance_between, distance_to, path_between, path_to, towards,


direction_to

Same signification as towards


directory

Possible uses:

  • directory (any) ---> directory

Result: casts the operand in a directory object.


directory

Possible uses:

  • directory (string) ---> gama.api.types.file.GamaFolderFile

Result: opens an existing directory

Special cases:

  • If the specified string does not refer to an existing directory, an exception is risen.

Examples:

file dirT <- directory("../includes/"); 
				// dirT represents the directory "../includes/" 
				// dirT.contents here contains the list of the names of included files

See also: file, new_folder,


directory_exists

Same signification as folder_exists


disjoint_from

Possible uses:

  • geometry disjoint_from geometry ---> bool
  • disjoint_from (geometry , geometry) ---> bool

Result: A boolean, equal to true if the left-geometry (or agent/point) is disjoints from the right-geometry (or agent/point).

Special cases:

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

Examples:

bool var0 <- polyline([{10,10},{20,20}]) disjoint_from polyline([{15,15},{25,25}]); // var0 equals false 
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) disjoint_from polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals false 
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) disjoint_from {25,25}; // var2 equals true 
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) disjoint_from polygon([{35,35},{35,45},{45,45},{45,35}]); // var3 equals true

See also: covers, crosses, equals, intersects, overlaps, partially_overlaps, touches,


distance_between

Possible uses:

  • topology distance_between container<unknown,geometry> ---> float
  • distance_between (topology , container<unknown,geometry>) ---> float

Result: A distance between a list of geometries (geometries, agents, points) considering a topology.

Special cases:

  • Returns 0.0 if the list is empty or contains only one geometry.
  • Returns 0.0 if two consecutive geometries in the list are at the same location or one contains the other.

Examples:

float var0 <- my_topology distance_between [ag1, ag2, ag3]; // var0 equals the distance between ag1, ag2 and ag3 considering the topology my_topology

See also: direction_between, direction_to, distance_to, path_between, path_to, towards,


distance_to

Possible uses:

  • point distance_to point ---> float
  • distance_to (point , point) ---> float
  • geometry distance_to geometry ---> float
  • distance_to (geometry , geometry) ---> float

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

Special cases:

  • Returns 0.0 if the two geometries are equal or at the same location.
  • Returns 0.0 if one geometry contains the other (i.e. the topological distance between overlapping geometries is 0).

Examples:

float var0 <- ag1 distance_to ag2; // var0 equals the distance between ag1 and ag2 considering the topology of the agent applying the operator

See also: direction_between, direction_to, distance_between, path_between, path_to, towards,


distinct

Same signification as remove_duplicates


distribution_of

Possible uses:

  • distribution_of (container) ---> map
  • container distribution_of int ---> map
  • distribution_of (container , int) ---> map
  • distribution_of (container, int, float, float) ---> map

Result: Discretize a list of values into n bins (computes the bins from a numerical variable into n (default 10) bins. Returns a distribution map with the values (values key), the interval legends (legend key), the distribution parameters (params keys, for cumulative charts). Parameters can be (list), (list, nbbins) or (list,nbbins,valmin,valmax)

Examples:

map var0 <- distribution_of([1,1,2,12.5],10); // var0 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]]) 
map var1 <- distribution_of([1,1,2,12.5]); // var1 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]]) 
map var2 <- distribution_of([1,1,2,12.5]); // var2 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])

See also: as_map,


distribution2d_of

Possible uses:

  • container distribution2d_of container ---> map
  • distribution2d_of (container , container) ---> map
  • distribution2d_of (container, container, int, int) ---> map
  • distribution2d_of (container, container, int, float, float, int, float, float) ---> map

Result: Discretize two lists of values into n bins (computes the bins from a numerical variable into n (default 10) bins. Returns a distribution map with the values (values key), the interval legends (legend key), the distribution parameters (params keys, for cumulative charts). Parameters can be (list), (list, nbbins) or (list,nbbins,valmin,valmax)

Examples:

map var0 <- distribution2d_of([1,1,2,12.5]); // var0 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]]) 
map var1 <- distribution2d_of([1,1,2,12.5],10); // var1 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]]) 
map var2 <- distribution2d_of([1,1,2,12.5],10); // var2 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])

See also: as_map,


div

Possible uses:

  • float div float ---> int
  • div (float , float) ---> int
  • int div int ---> int
  • div (int , int) ---> int
  • int div float ---> int
  • div (int , float) ---> int
  • float div int ---> int
  • div (float , int) ---> int

Result: Returns the truncated integer division of the left-hand operand by the right-hand operand.

Special cases:

  • if the right-hand operand is equal to zero, raises an exception.
  • For a negative dividend or divisor, truncation is towards zero: (-7) div 2 = -3.
  • If the right-hand operand is equal to zero, a runtime exception is raised.

Examples:

int var0 <- 40.1 div 4.5; // var0 equals 8 
int var1 <- 40 div 3; // var1 equals 13 
int var2 <- (-7) div 2; // var2 equals -3 
int var3 <- 7 div 2; // var3 equals 3 
int var4 <- 40 div 4.1; // var4 equals 9 
int var5 <- 40.5 div 3; // var5 equals 13

See also: mod,


dnorm

Same signification as normal_density


dtw

Possible uses:

  • list dtw list ---> float
  • dtw (list , list) ---> float
  • dtw (list, list, int) ---> float

Result: returns the dynamic time warping between the two series of values (step pattern used: symetric1)

returns the dynamic time warping between the two series of values (step pattern used: symetric1) with Sakoe-Chiba band (radius: the window width of Sakoe-Chiba band)

Examples:

float var0 <- dtw([32.0,5.0,1.0,3.0],[1.0,10.0,5.0,1.0]); // var0 equals 38.0 
float var1 <- dtw([10.0,5.0,1.0, 3.0],[1.0,10.0,5.0,1.0], 2); // var1 equals 11.0

durbin_watson

Possible uses:

  • durbin_watson (container) ---> float

Result: Durbin-Watson computation

Examples:

float var0 <- durbin_watson([13,2,1,4,1,2]) with_precision(4); // var0 equals 0.7231

dxf_file

Possible uses:

  • dxf_file (string) ---> file
  • string dxf_file float ---> file
  • dxf_file (string , float) ---> file

Result: Constructs a file of type dxf. Allowed extensions are limited to dxf

Special cases:

  • dxf_file(string): This file constructor allows to read a dxf (.dxf) file
file f <- dxf_file("file.dxf");
  • dxf_file(string,float): This file constructor allows to read a dxf (.dxf) file and specify the unit (meter by default)
file f <- dxf_file("file.dxf",#m);

See also: is_dxf,


edge

Possible uses:

  • edge (pair) ---> unknown
  • edge (unknown) ---> unknown
  • unknown edge unknown ---> unknown
  • edge (unknown , unknown) ---> unknown
  • unknown edge int ---> unknown
  • edge (unknown , int) ---> unknown
  • pair edge int ---> unknown
  • edge (pair , int) ---> unknown
  • pair edge float ---> unknown
  • edge (pair , float) ---> unknown
  • unknown edge float ---> unknown
  • edge (unknown , float) ---> unknown
  • edge (pair, unknown, float) ---> unknown
  • edge (unknown, unknown, unknown) ---> unknown
  • edge (unknown, unknown, int) ---> unknown
  • edge (pair, unknown, int) ---> unknown
  • edge (unknown, unknown, float) ---> unknown
  • edge (unknown, unknown, unknown, float) ---> unknown
  • edge (unknown, unknown, unknown, int) ---> unknown

Result: Allows to create a wrapper (of type unknown) that wraps two objects and indicates they should be considered as the source and the target of a new edge of a graph. The third (omissible) parameter indicates which weight this edge should have in the graph

Comment: Useful only in graph-related operations (addition, removal of edges, creation of graphs)


edge_between

Possible uses:

  • graph edge_between pair ---> unknown
  • edge_between (graph , pair) ---> unknown

Result: returns the edge linking two nodes

Examples:

unknown var0 <- graphFromMap edge_between node1::node2; // var0 equals edge1

See also: in_edges_of, out_edges_of,


edge_betweenness

Possible uses:

  • edge_betweenness (graph) ---> map

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

Examples:

graph graphEpidemio <- graph([]); 
map var1 <- edge_betweenness(graphEpidemio); // var1 equals the edge betweenness index of the graph

edges

Possible uses:

  • edges (container) ---> container

Result: Allows to create a wrapper (of type list) that wraps a list of objects and indicates they should be considered as edges of a graph


eigenvalues

Possible uses:

  • eigenvalues (matrix) ---> list<float>

Result: The list of the eigen values of the given matrix

Examples:

list<float> var0 <- eigenvalues(matrix([[5,-3],[6,-4]])); // var0 equals [2.0000000000000004,-0.9999999999999998]

electre_DM

Possible uses:

  • electre_DM (list<list>, list<map<string,unknown>>, float) ---> int

Result: The index of the best candidate according to a method based on the ELECTRE methods. The principle of the ELECTRE methods is to compare the possible candidates by pair. These methods analyses the possible outranking relation existing between two candidates. A candidate outranks another if this one is at least as good as the other one. The ELECTRE methods are based on two concepts: the concordance and the discordance. The concordance characterizes the fact that, for an outranking relation to be validated, a sufficient majority of criteria should be in favor of this assertion. The discordance characterizes the fact that, for an outranking relation to be validated, none of the criteria in the minority should oppose too strongly this assertion. These two conditions must be true for validating the outranking assertion. More information about the ELECTRE methods can be found in Figueira, J., Mousseau, V., Roy, B.: ELECTRE Methods. In: Figueira, J., Greco, S., and Ehrgott, M., (Eds.), Multiple Criteria Decision Analysis: State of the Art Surveys, Springer, New York, 133--162 (2005). The first operand is the list of candidates (a candidate is a list of criterion values); the second operand the list of criterion: A criterion is a map that contains fives elements: a name, a weight, a preference value (p), an indifference value (q) and a veto value (v). The preference value represents the threshold from which the difference between two criterion values allows to prefer one vector of values over another. The indifference value represents the threshold from which the difference between two criterion values is considered significant. The veto value represents the threshold from which the difference between two criterion values disqualifies the candidate that obtained the smaller value; the last operand is the fuzzy cut.

Special cases:

  • Returns -1 if the candidate list is nil or empty.
  • All preference (p), indifference (q) and veto (v) thresholds must be non-negative values.

Examples:

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

See also: evidence_theory_DM, fuzzy_choquet_DM, promethee_DM, weighted_means_DM,


ellipse

Possible uses:

  • float ellipse float ---> geometry
  • ellipse (float , float) ---> geometry

Result: An ellipse geometry which x-radius is equal to the first operand and y-radius is equal to the second operand

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

Special cases:

  • returns a point if both operands are lower or equal to 0, a line if only one is.

Examples:

geometry var0 <- ellipse(10, 10); // var0 equals a geometry as an ellipse of width 10 and height 10.

See also: arc, around, circle, cone, cross, elliptical_arc, line, link, norm, point, polygon, polyline, rectangle, square, squircle, triangle,


elliptical_arc

Possible uses:

  • elliptical_arc (point, point, float, int) ---> geometry

Result: An elliptical arc from the first operand (point) to the second operand (point), which radius is equal to the third operand, and a int giving the number of points to use as a last operand

Examples:

geometry var0 <- elliptical_arc({0,0},{10,10},5.0, 20); // var0 equals a geometry from {0,0} to {10,10} considering a radius of 5.0 built using 20 points

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


emotion

Possible uses:

  • emotion (any) ---> emotion

Result: casts the operand in a emotion object.


empty

Possible uses:

  • empty (container<KeyType,ValueType>) ---> bool

Result: true if the operand is empty, false otherwise.

Comment: the empty operator behavior depends on the nature of the operand

Special cases:

  • if it is a map, empty returns true if the map contains no key-value mappings, and false otherwise
  • if it is a file, empty returns true if the content of the file (that is also a container) is empty, and false otherwise
  • if it is a population, empty returns true if there is no agent in the population, and false otherwise
  • if it is a graph, empty returns true if it contains no vertex and no edge, and false otherwise
  • if it is a matrix of int, float or object, it will return true if all elements are respectively 0, 0.0 or null, and false otherwise
  • if it is a matrix of geometry, it will return true if the matrix contains no cell, and false otherwise
  • if it is a list, empty returns true if there is no element in the list, and false otherwise
bool var0 <- empty([]); // var0 equals true

empty

Possible uses:

  • empty (string) ---> bool

Special cases:

  • if it is a string, empty returns true if the string does not contain any character, and false otherwise
bool var0 <- empty ('abced'); // var0 equals false

ends_with

Possible uses:

  • string ends_with string ---> bool
  • ends_with (string , string) ---> bool

Result: Returns true if the left-hand string ends with the right-hand string, false otherwise.

Special cases:

  • if both operands are strings, returns true if the left-hand string ends with the right-hand string
bool var0 <- "abcabcabc" ends_with "bc"; // var0 equals true

enlarged_by

Same signification as +


enter

Possible uses:

  • string enter gaml_type ---> unknown
  • enter (string , gaml_type) ---> unknown
  • string enter bool ---> unknown
  • enter (string , bool) ---> unknown
  • string enter float ---> unknown
  • enter (string , float) ---> unknown
  • string enter unknown ---> unknown
  • enter (string , unknown) ---> unknown
  • string enter int ---> unknown
  • enter (string , int) ---> unknown
  • string enter string ---> unknown
  • enter (string , string) ---> unknown
  • enter (string, gaml_type, unknown) ---> unknown
  • enter (string, float, float, float) ---> unknown
  • enter (string, int, int, int) ---> unknown
  • enter (string, float, float, float, float) ---> unknown
  • enter (string, int, int, int, int) ---> unknown

Result: Allows the user to enter a string by specifying a title and an initial value

Special cases:

  • When the second operand is the boolean type or a boolean value, the GUI is then a switch
map<string,unknown> m <- user_input(enter("Title",true)); 
map<string,unknown> m2 <- user_input(enter("Title",bool));
  • The GUI is then a slider when an init value, a min (int or float), a max (int or float) (and eventually a step (int or float) ) operands.
map resMinMax <- user_input([enter("Title",5,0)]) 
map resMinMax <- user_input([enter("Title",5,0,10)]) 
map resMMStepFF <- user_input([enter("Title",5,0.1,10.1,0.5)]);

envelope

Possible uses:

  • envelope (unknown) ---> geometry

Result: A 3D geometry that represents the box that surrounds the geometries or the surface described by the arguments. More general than geometry(arguments).envelope, as it allows to pass int, double, point, image files, shape files, asc files, or any list combining these arguments, in which case the envelope will be correctly expanded. If an envelope cannot be determined from the arguments, a default one of dimensions (0,100, 0, 100, 0, 100) is returned

Special cases:

  • This operator is often used to define the environment of simulation

Examples:

file road_shapefile <- file("../includes/roads.shp"); 
geometry shape <- envelope(road_shapefile); 
// shape is the system variable of  the environment 
geometry var3 <- polygon([{0,0}, {20,0}, {10,10}, {10,0}]); // var3 equals create a polygon to get the envolpe 
float var4 <- envelope(polygon([{0,0}, {20,0}, {10,10}, {10,0}])).area; // var4 equals 200.0

equals

Possible uses:

  • geometry equals geometry ---> bool
  • equals (geometry , geometry) ---> bool

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

Special cases:

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

Examples:

bool var0 <- square(5) equals (rectangle(10,5) rotated_by 90); // var0 equals true

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


eval_gaml

Same signification as from_gaml


eval_when

Possible uses:

  • eval_when (BDIPlan) ---> bool

Result: evaluate the facet when of a given plan

Examples:

eval_when(plan1)

evaluate_sub_model

Possible uses:

  • agent evaluate_sub_model string ---> unknown
  • evaluate_sub_model (agent , string) ---> unknown

Result: Load a submodel

Comment: loaded submodel


even

Possible uses:

  • even (int) ---> bool

Result: Returns true if the operand is even and false if it is odd.

Special cases:

  • if the operand is equal to 0, it returns true.
  • if the operand is a float, it is truncated before

Examples:

bool var0 <- even (3); // var0 equals false 
bool var1 <- even(-12); // var1 equals true

every

Possible uses:

  • every (any expression) ---> bool
  • every (int) ---> bool
  • any expression every bool ---> bool
  • every (any expression , bool) ---> bool
  • list every any expression ---> list<date>
  • every (list , any expression) ---> list<date>
  • bool every int ---> bool
  • every (bool , int) ---> bool
  • float every int ---> float
  • every (float , int) ---> float
  • int every int ---> int
  • every (int , int) ---> int
  • unknown every int ---> unknown
  • every (unknown , int) ---> unknown
  • list every int ---> list
  • every (list , int) ---> list

Result: expects a frequency (expressed in seconds of simulated time) as argument and a bool to use (default) the optimzied version (true) and the old one (false). Will return true every time the current_date matches with this frequency

expects a frequency (expressed in seconds of simulated time, or in calendar months/years) as argument. Will return true every time the current_date matches with this frequency

applies a step to an interval of dates defined by 'date1 to date2'.

returns the first bool operand every 2nd operand * cycle, false otherwise

returns the first float operand every 2nd operand * cycle, 0.0 otherwise

returns the first integer operand every 2nd operand * cycle, 0 otherwise

returns the first operand every 2nd operand * cycle, nil otherwise

true every operand * cycle, false otherwise

Retrieves elements from the first argument every step (second argument) elements. Raises an error if the step is negative or equal to zero

Comment: Used to do something at regular intervals of time. Can be used in conjunction with 'since', 'after', 'before', 'until' or 'between', so that this computation only takes place in the temporal segment defined by these operators. In all cases, the starting_date of the model is used as a reference starting pointUsed to do something at regular intervals of time. Can be used in conjunction with 'since', 'after', 'before', 'until' or 'between', so that this computation only takes place in the temporal segment defined by these operators. In all cases, the starting_date of the model is used as a reference starting point. When used with #month or #year, calendar-correct arithmetic is applied so that every(1#month) fires on the same day of each calendar month.the value of the every operator depends on the cycle. It can be used to return a value every x cycle. object every(10#cycle) is strictly equivalent to every(10#cycle) ? object : falsethe value of the every operator depends on the cycle. It can be used to return a value every x cycle. 1000.0 every(10#cycle) is strictly equivalent to every(10#cycle) ? 1000.0 : 0.0the value of the every operator depends on the cycle. It can be used to return a value every x cycle. 1000 every(10#cycle) is strictly equivalent to every(10#cycle) ? 1000 : 0the value of the every operator depends on the cycle. It can be used to return a value every x cycle. object every(10#cycle) is strictly equivalent to every(10#cycle) ? object : nilthe value of the every operator depends on the cycle. It can be used to do something every x cycle.

Special cases:

  • Returns true only on simulation cycles that are multiples of the given step.
  • The first call at step 0 returns true.

Examples:

reflex when: every(2#days, false) since date('2000-01-01') { .. } 
reflex when: every(2#days) since date('2000-01-01') { .. } 
reflex when: every(1#month) { .. } // fires on the same calendar day each month 
state a { transition to: b when: every(2#mn);} state b { transition to: a when: every(30#s);} // This oscillatory behavior will use the starting_date of the model as its starting point in time 
(date('2000-01-01') to date('2010-01-01')) every (#day) // builds an interval between these two dates which contains all the days starting from the beginning of the interval 
if (true every(2#cycle) != false) {write "this is true";} 
	     else {write "this is false";} 
if (1000.0 every(2#cycle) != 0) {write "this is a value";} 
	     else {write "this is 0.0";} 
if (1000 every(2#cycle) != 0) {write "this is a value";} 
	     else {write "this is 0";} 
if ({2000,2000} every(2#cycle) != nil) {write "this is a point";} 
	     else {write "this is nil";} 
if every(2#cycle) {write "the cycle number is even";} 
	     else {write "the cycle number is odd";}

See also: after, since, to,


every_cycle

Same signification as every


evidence_theory_DM

Possible uses:

  • list<list> evidence_theory_DM list<map<string,unknown>> ---> int
  • evidence_theory_DM (list<list> , list<map<string,unknown>>) ---> int
  • evidence_theory_DM (list<list>, list<map<string,unknown>>, bool) ---> int

Result: The index of the best candidate according to a method based on the Evidence theory. This theory, which was proposed by Shafer (Shafer G (1976) A mathematical theory of evidence, Princeton University Press), is based on the work of Dempster (Dempster A (1967) Upper and lower probabilities induced by multivalued mapping. Annals of Mathematical Statistics, vol. 38, pp. 325--339) on lower and upper probability distributions. The first operand is the list of candidates (a candidate is a list of criterion values); the second operand the list of criterion: A criterion is a map that contains seven elements: a name, a first threshold s1, a second threshold s2, a value for the assertion "this candidate is the best" at threshold s1 (v1p), a value for the assertion "this candidate is the best" at threshold s2 (v2p), a value for the assertion "this candidate is not the best" at threshold s1 (v1c), a value for the assertion "this candidate is not the best" at threshold s2 (v2c). v1p, v2p, v1c and v2c have to been defined in order that: v1p + v1c <= 1.0; v2p + v2c <= 1.0.; the last operand allows to use a simple version of this multi-criteria decision making method (simple if true)

Special cases:

  • if the operator is used with only 2 operands (the candidates and the criteria), the last parameter (use simple method) is set to true
  • Returns -1 if the candidate list is nil or empty.
  • Returns -1 if the candidate list is nil or empty.
  • The belief masses v1p, v2p, v1c, v2c must satisfy: v1p + v1c ≤ 1.0 and v2p + v2c ≤ 1.0.

Examples:

int var0 <- evidence_theory_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], [["name"::"utility", "s1" :: 0.0,"s2"::1.0, "v1p"::0.0, "v2p"::1.0, "v1c"::0.0, "v2c"::0.0, "maximize" :: true],["name"::"price",  "s1" :: 0.0,"s2"::1.0, "v1p"::0.0, "v2p"::1.0, "v1c"::0.0, "v2c"::0.0, "maximize" :: true]]); // var0 equals 0 
int var1 <- evidence_theory_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], [["name"::"utility", "s1" :: 0.0,"s2"::1.0, "v1p"::0.0, "v2p"::1.0, "v1c"::0.0, "v2c"::0.0, "maximize" :: true],["name"::"price",  "s1" :: 0.0,"s2"::1.0, "v1p"::0.0, "v2p"::1.0, "v1c"::0.0, "v2c"::0.0, "maximize" :: true]], false); // var1 equals 0

See also: electre_DM, fuzzy_choquet_DM, promethee_DM, weighted_means_DM,


exp

Possible uses:

  • exp (float) ---> float
  • exp (int) ---> float

Result: Returns Euler's number e raised to the power of the operand.

Special cases:

  • the operand is casted to a float before being evaluated.
  • exp(0) = 1.0
  • exp(1) = e ≈ 2.718281828459045
  • For negative operands, returns a small positive value approaching 0.

Examples:

float var0 <- exp (0.0); // var0 equals 1.0

See also: ln,


exp_density

Possible uses:

  • float exp_density float ---> float
  • exp_density (float , float) ---> float

Result: returns the probability density function (PDF) at the specified point x of the exponential distribution with the given rate.

Examples:

float var0 <- exp_density(5,3) ; // var0 equals 0.731

See also: binomial, gamma_density, gamma_rnd, gauss_rnd, lognormal_density, lognormal_rnd, poisson, rnd, skew_gauss,


exp_rnd

Possible uses:

  • exp_rnd (float) ---> float

Result: returns a random value from a exponential distribution with specified values of the scale parameters (1/lambda). See https://mathworld.wolfram.com/ExponentialDistribution.html for more details ).

Examples:

float var0 <- exp_rnd(5) ; // var0 equals 0.731

See also: binomial, gamma_rnd, gauss_rnd, lognormal_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_trunc_rnd,


fact

Possible uses:

  • fact (int) ---> float

Result: Returns the factorial of the operand.

Special cases:

  • if the operand is less than 0, fact returns 0.
  • If the operand is 0, returns 1.0 (by convention: 0! = 1).
  • If the operand is negative, returns 0.0.
  • For large values (e.g. n > 170), the result overflows to Infinity.

Examples:

float var0 <- fact(4); // var0 equals 24 
float var1 <- fact(0); // var1 equals 1.0 
float var2 <- fact(-1); // var2 equals 0.0

farthest_point_to

Possible uses:

  • geometry farthest_point_to point ---> point
  • farthest_point_to (geometry , point) ---> point

Result: the farthest point of the left-operand to the left-point.

Examples:

point var0 <- geom farthest_point_to(pt); // var0 equals the farthest point of geom to pt

See also: any_location_in, any_point_in, centroid, closest_points_with, points_along, points_at, points_on,


farthest_to

Possible uses:

  • container<unknown,geometry> farthest_to geometry ---> geometry
  • farthest_to (container<unknown,geometry> , geometry) ---> geometry

Result: An agent or a geometry among the left-operand list of agents, species or meta-population (addition of species), the farthest 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.

Examples:

geometry var0 <- [ag1, ag2, ag3] closest_to(self); // var0 equals return the farthest agent among ag1, ag2 and ag3 to the agent applying the operator. 
(species1 + species2) closest_to self

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


field

Possible uses:

  • unknown field float ---> field
  • field (unknown , float) ---> field
  • int field int ---> field
  • field (int , int) ---> field
  • field (int, int, float) ---> field
  • field (int, int, float, float) ---> field

field_with

Possible uses:

  • point field_with any expression ---> field
  • field_with (point , any expression) ---> field

Result: creates a field with a size provided by the first operand, and filled by the evaluation of the second operand for each cell

Comment: Note that both components of the right operand point should be positive, otherwise an exception is raised.

See also: as_matrix, matrix,


file

Possible uses:

  • file (any) ---> file

Result: casts the operand in a file object.


file_exists

Possible uses:

  • file_exists (string) ---> bool

Result: Test whether the parameter is the path to an existing file. False if it does not exist or if it is a folder

Special cases:

  • An empty or null path returns false without raising an error.
  • Paths are resolved relative to the simulation workspace root via FileUtils.constructAbsoluteFilePath.
  • Returns false for directories; use folder_exists to check directories.

Examples:

string file_name <-"../includes/buildings.shp"; 
if file_exists(file_name){ 
	write "File exists in the computer"; 
}

filter

Possible uses:

  • filter (dataframe, string, unknown) ---> dataframe

Result: Returns a new dataframe containing only the rows where the specified column equals the given value.

Special cases:

  • Filter rows where 'city' equals 'Paris'
dataframe df2 <- filter(my_df, "city", "Paris");

See also: iloc, pivot, remove_empty, select_columns,


first

Possible uses:

  • first (container<KeyType,ValueType>) ---> ValueType

Result: the first value of the operand

Comment: the first operator behavior depends on the nature of the operand

Special cases:

  • if it is a map, first returns the first value of the first pair (in insertion order)
  • if it is a file, first returns the first element of the content of the file (that is also a container)
  • if it is a population, first returns the first agent of the population
  • if it is a graph, first returns the first edge (in creation order)
  • if it is a matrix, first returns the element at {0,0} in the matrix
  • for a matrix of int or float, it will return 0 if the matrix is empty
  • for a matrix of object or geometry, it will return nil if the matrix is empty
  • if it is a list, first returns the first element of the list, or nil if the list is empty
int var0 <- first ([1, 2, 3]); // var0 equals 1

See also: last,


first

Possible uses:

  • first (string) ---> string
  • int first container ---> list
  • first (int , container) ---> list

Result: Returns the nth first elements of the container. If n is greater than the list size, a translation of the container to a list is returned. If it is equal or less than zero, returns an empty list

Special cases:

  • If the container is empty, returns an empty list.
  • If the container is nil, raises a runtime error.
  • If n is greater than the container size, returns all elements as a list.
  • if it is a string, first returns a string composed of its first character
string var0 <- first ('abce'); // var0 equals 'a'

first_of

Same signification as first


first_with

Possible uses:

  • first_with (string, container, any expression) ---> unknown

Result: the first element of the left-hand operand that makes 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 right-hand operand elements.

Special cases:

  • if the left-hand operand is nil, first_with throws an error. If there is no element that satisfies the condition, it returns nil
  • if the left-operand is a map, the keyword each will contain each value
int var4 <- [1::2, 3::4, 5::6] first_with (each >= 4); // var4 equals 4 
pair var5 <- [1::2, 3::4, 5::6].pairs first_with (each.value >= 4); // var5 equals (3::4)

Examples:

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

See also: group_by, last_with, where,


flatten

Possible uses:

  • flatten (field) ---> field
  • field flatten unknown ---> field
  • flatten (field , unknown) ---> field

flip

Possible uses:

  • flip (float) ---> bool

Result: true or false given the probability represented by the operand

Special cases:

  • flip 0 always returns false, flip 1 true
  • flip(0.0) always returns false.
  • flip(1.0) always returns true.

Examples:

bool var0 <- flip (0.66666); // var0 equals 2/3 chances to return true.

See also: rnd,


float

Possible uses:

  • float (any) ---> float

Result: casts the operand in a float object.


floor

Possible uses:

  • floor (float) ---> int

Result: Maps the operand to the largest previous following integer, i.e. the largest integer not greater than x.

Special cases:

  • For negative non-integer values, floor rounds towards negative infinity: floor(-4.7) = -5.
  • For exact integers, floor returns the integer itself: floor(3.0) = 3.

Examples:

int var0 <- floor(3); // var0 equals 3 
int var1 <- floor(3.5); // var1 equals 3 
int var2 <- floor(-4.7); // var2 equals -5

See also: ceil, round,


flush_all_files

Possible uses:

  • flush_all_files (agent) ---> bool

Result: Flushes all the pending save operations in the current simulation.

Special cases:

  • This operator is only useful in simulations that save files using a buffering strategy.
  • If a file writing fails it returns false, else it returns true.
  • If a file writing fails it still tries to write the others.

Examples:

full_all_files(simulation);  // simulation is the current simulation, this can be important to differentiate in case of multi-simulation experiments

See also: save,


folder

Same signification as directory


folder_exists

Possible uses:

  • folder_exists (string) ---> bool

Result: Test whether the parameter is the path to an existing folder. False if it doesnt exist or if it is a file

Special cases:

  • Returns false for regular file paths (non-directories); use file_exists to check plain files.
  • An empty or null path returns false without raising an error.
  • Paths are resolved relative to the simulation workspace root via FileUtils.constructAbsoluteFilePath.

Examples:

string file_name <-"../includes/"; 
if folder_exists(file_name){ 
	write "Folder exists in the computer"; 
}

font

Possible uses:

  • string font int ---> font
  • font (string , int) ---> font
  • font (string, int, int) ---> font

Result: Creates a new font, by specifying its name (either a font face name like 'Lucida Grande Bold' or 'Helvetica', or a logical name like 'Dialog', 'SansSerif', 'Serif', etc.), a size in points and a style, either #bold, #italic or #plain or a combination (addition) of them.

Examples:

font var0 <- font ('Helvetica Neue',12, #bold + #italic); // var0 equals a bold and italic face of the Helvetica Neue family

format

Possible uses:

  • string format list<unknown> ---> string
  • format (string , list<unknown>) ---> string

Result: Formats the given string by inserting values from the list into it

Examples:

string var0 <- format("Hello %s", ["world"]); // var0 equals "Hello world"

frequency_of

Possible uses:

  • frequency_of (string, container, any expression) ---> map

Result: Returns a map with keys equal to the application of the right-hand argument (like collect) and values equal to the frequency of this key (i.e. how many times it has been obtained)

Examples:

map var0 <- [1, 2, 3, 3, 4, 4, 5, 3, 3, 4] frequency_of each; // var0 equals map([1::1,2::1,3::4,4::3,5::1])

from

Same signification as since


from_binary

Same signification as deserialize


from_gaml

Possible uses:

  • from_gaml (string) ---> unknown

Result: Evaluates/deserialises the given GAML string into a value.

Examples:

unknown var0 <- eval_gaml("2+3"); // var0 equals 5

from_hsb

Same signification as hsb


from_json

Possible uses:

  • from_json (string) ---> unknown

Result: Deserializes an object precedently serialized using 'to_json' (or an arbitrary json string obtained elsewhere). Agents and populations are not supported yet (i.e. they will return maps)

See also: deserialize, from_binary, from_gaml,


fuzzy_choquet_DM

Possible uses:

  • fuzzy_choquet_DM (list<list>, list<string>, map) ---> int

Result: The index of the candidate that maximizes the Fuzzy Choquet Integral value. 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 string); the third operand the weights of each sub-set of criteria (map with list for key and float for value)

Special cases:

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

Examples:

int var0 <- fuzzy_choquet_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], ["utility", "price", "size"],[["utility"]::0.5,["size"]::0.1,["price"]::0.4,["utility", "price"]::0.55]); // var0 equals 0

See also: electre_DM, evidence_theory_DM, promethee_DM,


fuzzy_kappa

Possible uses:

  • fuzzy_kappa (container<int,agent>, list<unknown>, list<unknown>, list<float>, list<unknown>, matrix<float>, float) ---> float
  • fuzzy_kappa (container<int,agent>, list<unknown>, list<unknown>, list<float>, list<unknown>, matrix<float>, float, list<unknown>) ---> float

Result: fuzzy kappa indicator for 2 map comparisons: fuzzy_kappa(agents_list,list_vals1,list_vals2, output_similarity_per_agents,categories,fuzzy_categories_matrix, fuzzy_distance). Reference: Visser, H., and T. de Nijs, 2006. The map comparison kit, Environmental Modelling & Software, 21

fuzzy kappa indicator for 2 map comparisons: fuzzy_kappa(agents_list,list_vals1,list_vals2, output_similarity_per_agents,categories,fuzzy_categories_matrix, fuzzy_distance, weights). Reference: Visser, H., and T. de Nijs, 2006. The map comparison kit, Environmental Modelling & Software, 21

Examples:

fuzzy_kappa([ag1, ag2, ag3, ag4, ag5],[cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2], similarity_per_agents,[cat1,cat2,cat3],[[1,0,0],[0,1,0],[0,0,1]], 2) 
fuzzy_kappa([ag1, ag2, ag3, ag4, ag5],[cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2], similarity_per_agents,[cat1,cat2,cat3],[[1,0,0],[0,1,0],[0,0,1]], 2, [1.0,3.0,2.0,2.0,4.0])

fuzzy_kappa_sim

Possible uses:

  • fuzzy_kappa_sim (container<int,agent>, list<unknown>, list<unknown>, list<unknown>, list<float>, list<unknown>, matrix<float>, float) ---> float
  • fuzzy_kappa_sim (container<int,agent>, list<unknown>, list<unknown>, list<unknown>, list<float>, list<unknown>, matrix<float>, float, list<unknown>) ---> float

Result: fuzzy kappa simulation indicator for 2 map comparisons: fuzzy_kappa_sim(agents_list,list_vals1,list_vals2, output_similarity_per_agents,fuzzy_transitions_matrix, fuzzy_distance). Reference: Jasper van Vliet, Alex Hagen-Zanker, Jelle Hurkens, Hedwig van Delden, A fuzzy set approach to assess the predictive accuracy of land use simulations, Ecological Modelling, 24 July 2013, Pages 32-42, ISSN 0304-3800,

fuzzy kappa simulation indicator for 2 map comparisons: fuzzy_kappa_sim(agents_list,list_vals1,list_vals2, output_similarity_per_agents,fuzzy_transitions_matrix, fuzzy_distance, weights). Reference: Jasper van Vliet, Alex Hagen-Zanker, Jelle Hurkens, Hedwig van Delden, A fuzzy set approach to assess the predictive accuracy of land use simulations, Ecological Modelling, 24 July 2013, Pages 32-42, ISSN 0304-3800,

Examples:

fuzzy_kappa_sim([ag1, ag2, ag3, ag4, ag5], [cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2], similarity_per_agents,[cat1,cat2,cat3],[[1,0,0,0,0,0,0,0,0],[0,1,0,0,0,0,0,0,0],[0,0,1,0,0,0,0,0,0],[0,0,0,1,0,0,0,0,0],[0,0,0,0,1,0,0,0,0],[0,0,0,0,0,1,0,0,0],[0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,0],[0,0,0,0,0,0,0,0,1]], 2) 
fuzzy_kappa_sim([ag1, ag2, ag3, ag4, ag5], [cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2], similarity_per_agents,[cat1,cat2,cat3],[[1,0,0,0,0,0,0,0,0],[0,1,0,0,0,0,0,0,0],[0,0,1,0,0,0,0,0,0],[0,0,0,1,0,0,0,0,0],[0,0,0,0,1,0,0,0,0],[0,0,0,0,0,1,0,0,0],[0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,0],[0,0,0,0,0,0,0,0,1]], 2,[1.0,3.0,2.0,2.0,4.0])

gaml_file

Possible uses:

  • gaml_file (string) ---> file

Result: Constructs a file of type gaml. Allowed extensions are limited to gaml, experiment

Special cases:

  • gaml_file(string): This file constructor allows to read a gaml file (.gaml)
file f <- gaml_file("file.gaml");

See also: is_gaml,


gaml_type

Possible uses:

  • gaml_type (any) ---> gaml_type

Result: casts the operand in a gaml_type object.


gamma

Possible uses:

  • gamma (float) ---> float

Result: Returns the value of the Gamma function at x.

Examples:

float var0 <- gamma(5); // var0 equals 24.0

gamma_density

Possible uses:

  • gamma_density (float, float, float) ---> float

Result: gamma_density(x,shape,scale) returns the probability density function (PDF) at the specified point x of the Gamma distribution with the given shape and scale.

Examples:

float var0 <- gamma_density(1,9,0.5); // var0 equals 0.731

See also: binomial, exp_density, gauss_rnd, lognormal_density, lognormal_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_density, weibull_rnd,


gamma_distribution

Possible uses:

  • gamma_distribution (float, float, float) ---> float

Result: Returns the integral from zero to x of the gamma probability density function.

Comment: incomplete_gamma(a,x) is equal to pgamma(a,1,x).

Examples:

float var0 <- gamma_distribution(2,3,0.9) with_precision(3); // var0 equals 0.269

gamma_distribution_complemented

Possible uses:

  • gamma_distribution_complemented (float, float, float) ---> float

Result: Returns the integral from x to infinity of the gamma probability density function.

Examples:

float var0 <- gamma_distribution_complemented(2,3,0.9) with_precision(3); // var0 equals 0.731

gamma_index

Possible uses:

  • gamma_index (graph) ---> float

Result: returns the gamma index of the graph (A measure of connectivity that considers the relationship between the number of observed links and the number of possible links: gamma = e/(3 * (v - 2)) - for planar graph.

Examples:

graph graphEpidemio <- graph([]); 
float var1 <- gamma_index(graphEpidemio); // var1 equals the gamma index of the graph

See also: alpha_index, beta_index, connectivity_index, nb_cycles,


gamma_rnd

Possible uses:

  • float gamma_rnd float ---> float
  • gamma_rnd (float , float) ---> float

Result: returns a random value from a gamma distribution with specified values of the shape and scale parameters

Examples:

float var0 <- gamma_rnd(9,0.5); // var0 equals 0.731

See also: binomial, exp_density, exp_rnd, gamma_trunc_rnd, gauss_rnd, lognormal_density, lognormal_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_density, weibull_rnd,


gamma_trunc_rnd

Possible uses:

  • gamma_trunc_rnd (float, float, float, float) ---> float
  • gamma_trunc_rnd (float, float, float, bool) ---> float

Result: returns a random value from a truncated gamma distribution (in a range or given only one boundary) with specified values of the shape and scale parameters.

Special cases:

  • when 2 float operands are specified, they are taken as mininimum and maximum values for the result
gamma_trunc_rnd(2,3,0,5)
  • when 1 float and a boolean (isMax) operands are specified, the float value represents the single boundary (max if the boolean is true, min otherwise),
gamma_trunc_rnd(2,3,5,true)

See also: gamma_rnd, lognormal_trunc_rnd, truncated_gauss, weibull_trunc_rnd,


gauss

Possible uses:

  • gauss (point) ---> float
  • float gauss float ---> float
  • gauss (float , float) ---> float

Result: A value from a normally distributed random variable with expected value (mean as first operand) and variance (standardDeviation as second operand). The probability density function of such a variable is a Gaussian.

The operator can be used with an operand of type point {meand,standardDeviation}.

Special cases:

  • when standardDeviation value is 0.0, it always returns the mean value
  • If the standard deviation is 0, always returns the mean.
  • Returns any real number (unbounded distribution).
  • when the operand is a point, it is read as {mean, standardDeviation}
  • If the standard deviation is 0, always returns the mean.
  • Returns any real number (unbounded distribution).

Examples:

float var0 <- gauss(0,0.3); // var0 equals 0.22354 
float var1 <- gauss({0,0.3}); // var1 equals 0.22354

See also: binomial, gamma_rnd, lognormal_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_rnd,


gauss_rnd

Same signification as gauss


generate_barabasi_albert

Possible uses:

  • generate_barabasi_albert (int, int, int, bool) ---> graph
  • generate_barabasi_albert (container, int, int, bool) ---> graph
  • generate_barabasi_albert (int, int, int, bool, species) ---> graph
  • generate_barabasi_albert (int, int, int, bool, species, species) ---> graph

Result: returns a random scale-free network (following Barabasi-Albert (BA) model).

Comment: The Barabasi-Albert (BA) model is an algorithm for generating random scale-free networks using a preferential attachment mechanism. A scale-free network is a network whose degree distribution follows a power law, at least asymptotically.Such networks are widely observed in natural and human-made systems, including the Internet, the world wide web, citation networks, and some social networks. [From Wikipedia article]The map operand should includes following elements:The Barabasi-Albert (BA) model is an algorithm for generating random scale-free networks using a preferential attachment mechanism. A scale-free network is a network whose degree distribution follows a power law, at least asymptotically.Such networks are widely observed in natural and human-made systems, including the Internet, the world wide web, citation networks, and some social networks. [From Wikipedia article]The map operand should includes following elements:The Barabasi-Albert (BA) model is an algorithm for generating random scale-free networks using a preferential attachment mechanism. A scale-free network is a network whose degree distribution follows a power law, at least asymptotically.Such networks are widely observed in natural and human-made systems, including the Internet, the world wide web, citation networks, and some social networks. [From Wikipedia article]The map operand should includes following elements:The Barabasi-Albert (BA) model is an algorithm for generating random scale-free networks using a preferential attachment mechanism. A scale-free network is a network whose degree distribution follows a power law, at least asymptotically.Such networks are widely observed in natural and human-made systems, including the Internet, the world wide web, citation networks, and some social networks. [From Wikipedia article]The map operand should includes following elements:

Special cases:

  • "nbInitNodes": number of initial nodes; "nbEdgesAdded": number of edges of each new node added during the network growth; "nbNodes": final number of nodes; "directed": is the graph directed or not; "node_species": the species of vertices; "edges_species": the species of edges
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			60, 
			1, 
			100, 
		true, 
			myVertexSpecies);
  • "nbInitNodes": number of initial nodes; "nbEdgesAdded": number of edges of each new node added during the network growth; "nbNodes": final number of nodes; "directed": is the graph directed or not; "node_species": the species of vertices; "edges_species": the species of edges
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			60, 
			1, 
			100, 
		true, 
			myVertexSpecies, 
			myEdgeSpecies);
  • "nbInitNodes": number of initial nodes; "nbEdgesAdded": number of edges of each new node added during the network growth; "nbNodes": final number of nodes; "directed": is the graph directed or not;
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			60, 
			1, 
			100, 
		true);
  • "nbInitNodes": number of initial nodes; "nodes": list of existing nodes to connect (agents or geometries); "nbEdgesAdded": number of edges of each new node added during the network growth; "directed": is the graph directed or not;
graph myGraph <- generate_watts_strogatz(people, 10,1,false);

See also: generate_complete_graph, generate_random_graph, generate_watts_strogatz,


generate_complete_graph

Possible uses:

  • bool generate_complete_graph list ---> graph
  • generate_complete_graph (bool , list) ---> graph
  • int generate_complete_graph bool ---> graph
  • generate_complete_graph (int , bool) ---> graph
  • generate_complete_graph (bool, list, species) ---> graph
  • generate_complete_graph (int, bool, species) ---> graph
  • generate_complete_graph (int, bool, species, species) ---> graph

Result: returns a fully connected graph.

Special cases:

  • nbNodes: number of nodes to create;directed: is the graph directed or not;node_species: the species of nodes; edges_species: the species of edges
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph( 
100, 
true, 
node_species, 
edge_species);
  • "directed": is the graph has to be directed or not;"nodes": the list of existing nodes; "edges_species": the species of edges
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph( 
true, 
nodes, 
edge_species);
  • "directed": is the graph has to be directed or not;"nodes": the list of existing nodes
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph( 
			true, 
			nodes);
  • nbNodes: number of nodes to create;directed: is the graph directed or not;node_species: the species of nodes
graph myGraph <- generate_complete_graph( 
			100, 
			true, 
			node_species);
  • nbNodes: number of nodes to create;directed: is the graph directed or not
graph myGraph <- generate_complete_graph( 
			100, 
			true);

See also: generate_barabasi_albert, generate_watts_strogatz,


generate_pedestrian_network

Possible uses:

  • generate_pedestrian_network (list<container<unknown,geometry>>, container<unknown,geometry>, bool, bool, float, float, bool, float, float, float, float) ---> list<geometry>
  • generate_pedestrian_network (list<container<unknown,geometry>>, container<unknown,geometry>, container<unknown,geometry>, bool, bool, float, float, bool, float, float, float, float) ---> list<geometry>
  • generate_pedestrian_network (list<container<unknown,geometry>>, container<unknown,geometry>, bool, bool, float, float, bool, float, float, float, float, float) ---> list<geometry>
  • generate_pedestrian_network (list<container<unknown,geometry>>, container<unknown,geometry>, container<unknown,geometry>, bool, bool, float, float, bool, float, float, float, float, float) ---> list<geometry>

Result: The method allows to build a network of corridors to be used by pedestrian while traveling around a space made of obstacles and other users. It makes it possible to avoide collision with other agents (e.g. buildings) including other pedestrians and in the same time managing a path to a destination in a complex environment (e.g. a city). The method is highly customizable, with many parameters listed as below:

  1. obstacles : a list containing the lists of geometries or agents that are obstacles for pedestrians (e.g. walls, cars).
  2. bounds : a list of geometries that represent the spatial boundary of the network (i.e. the enclosing space of the network).
  3. open : a boolean expression that will add nodes in the network within open areas. More precisely, new invisible points are added to improve triangulation in areas with very few obstacles.
  4. randomDist : a boolean expression, related to the previous 'open' parameter, that allows to switch between a random (true) spatial distribution or a distribution (false) that build upon a equidistant repartition of points all around the area.
  5. open area : a float in meters representing the minimum distance for an area to be considered as an open area (i.e. euclidian distance between centroid and farest obstacle)
  6. density point : a float representing the density of points per meter within open areas.
  7. clean network : a boolean expression that allows to enhance the network (true) or living as it is generated (false). Enhancement includes filling very small gaps between edges and nodes.
  8. cliping : tolerance for the cliping in triangulation (float; distance) - see skeletonize operator
  9. tolerance : tolerance for the triangulation (float)
  10. min dist obstacle : minimal distance to obstacles to keep a path (float; if 0.0, no filtering)
  11. simplification : simplification distance for the final geometries
  12. square size : size of squares for decomposition (optimization)

Special cases:

  • The method allows to build a network of corridors to be used by pedestrian while traveling around a space made of obstacles and other users. It makes it possible to avoide collision with other agents (e.g. buildings) including other pedestrians and in the same time managing a path to a destination in a complex environment (e.g. a city). The method is highly customizable, with many parameters listed as below:

    1. obstacles : a list containing the lists of geometries or agents that are obstacles for pedestrians (e.g. walls, cars).
    2. bounds : a list of geometries that represent the spatial boundary of the network (i.e. the enclosing space of the network).
    3. open : a boolean expression that will add nodes in the network within open areas. More precisely, new invisible points are added to improve triangulation in areas with very few obstacles.
    4. randomDist : a boolean expression, related to the previous 'open' parameter, that allows to switch between a random (true) spatial distribution or a distribution (false) that build upon a equidistant repartition of points all around the area.
    5. open area : a float in meters representing the minimum distance for an area to be considered as an open area (i.e. euclidian distance between centroid and farest obstacle)
    6. density point : a float representing the density of points per meter within open areas.
    7. clean network : a boolean expression that allows to enhance the network (true) or living as it is generated (false). Enhancement includes filling very small gaps between edges and nodes.
    8. cliping : tolerance for the cliping in triangulation (float; distance) - see skeletonize operator
    9. tolerance : tolerance for the triangulation (float)
    10. min dist obstacle : minimal distance to obstacles to keep a path (float; if 0.0, no filtering)
    11. simplification : simplification distance for the final geometries
  • The method allows to build a network of corridors to be used by pedestrian while traveling around a space made of obstacles and other users. It makes it possible to avoide collision with other agents (e.g. buildings) including other pedestrians and in the same time managing a path to a destination in a complex environment (e.g. a city). The method is highly customizable, with many parameters listed as below:

    1. obstacles : a list containing the lists of geometries or agents that are obstacles for pedestrians (e.g. walls, cars).
    2. bounds : a list of geometries that represent the spatial boundary of the network (i.e. the enclosing space of the network).
    3. regular network : allows to combine the generated network with a simplified car user oriented network. More specifically, the network generated will combine enhance pedestrian oriented generated network with the given network: The property of the latter does not allows pedestrian to avoid collision (1D) when using its edges (while moving in 2D space and avoiding collision in the former).
    4. open : a boolean expression that will add nodes in the network within open areas. More precisely, new invisible points are added to improve triangulation in areas with very few obstacles.
    5. randomDist : a boolean expression, related to the previous 'open' parameter, that allows to switch between a random (true) spatial distribution or a distribution (false) that build upon a equidistant repartition of points all around the area.
    6. open area : a float in meters representing the minimum distance for an area to be considered as an open area (i.e. euclidian distance between centroid and farest obstacle)
    7. density point : a float representing the density of points per meter within open areas.
    8. clean network : a boolean expression that allows to enhance the network (true) or living as it is generated (false). Enhancement includes filling very small gaps between edges and nodes.
    9. cliping : tolerance for the cliping in triangulation (float; distance) - see skeletonize operator
    10. tolerance : tolerance for the triangulation (float)
    11. min dist obstacle : minimal distance to obstacles to keep a path (float; if 0.0, no filtering)
  • The method allows to build a network of corridors to be used by pedestrian while traveling around a space made of obstacles and other users. It makes it possible to avoide collision with other agents (e.g. buildings) including other pedestrians and in the same time managing a path to a destination in a complex environment (e.g. a city). The method is highly customizable, with many parameters listed as below:

    1. obstacles : a list containing the lists of geometries or agents that are obstacles for pedestrians (e.g. walls, cars).
    2. bounds : a list of geometries that represent the spatial boundary of the network (i.e. the enclosing space of the network).
    3. regular network : allows to combine the generated network with a simplified car user oriented network. More specifically, the network generated will combine enhance pedestrian oriented generated network with the given network: The property of the latter does not allows pedestrian to avoid collision (1D) when using its edges (while moving in 2D space and avoiding collision in the former).
    4. open : a boolean expression that will add nodes in the network within open areas. More precisely, new invisible points are added to improve triangulation in areas with very few obstacles.
    5. randomDist : a boolean expression, related to the previous 'open' parameter, that allows to switch between a random (true) spatial distribution or a distribution (false) that build upon a equidistant repartition of points all around the area.
    6. open area : a float in meters representing the minimum distance for an area to be considered as an open area (i.e. euclidian distance between centroid and farest obstacle)
    7. density point : a float representing the density of points per meter within open areas.
    8. clean network : a boolean expression that allows to enhance the network (true) or living as it is generated (false). Enhancement includes filling very small gaps between edges and nodes.
    9. cliping : tolerance for the cliping in triangulation (float; distance) - see skeletonize operator
    10. tolerance : tolerance for the triangulation (float)
    11. min dist obstacle : minimal distance to obstacles to keep a path (float; if 0.0, no filtering)
    12. simplification : simplification distance for the final geometries

Examples:

list<geometry> var0 <- generate_pedestrian_network([wall], [world],true,false,3.0,0.1, true,0.1,0.0,0.0,0.0,0.0); // var0 equals a list of polylines corresponding to the pedestrian paths 
list<geometry> var1 <- generate_pedestrian_network([wall], [world], [road], true,false,3.0,0.1, true,0.1,0.0,0.0,0.0); // var1 equals a list of polylines corresponding to the pedestrian paths 
list<geometry> var2 <- generate_pedestrian_network([wall], [world], [road], true,false,3.0,0.1, true,0.1,0.0,0.0,0.0,50.0); // var2 equals a list of polylines corresponding to the pedestrian paths 
list<geometry> var3 <- generate_pedestrian_network([wall], [world],true,false,3.0,0.1, true,0.1,0.0,0.0,0.0,50.0); // var3 equals a list of polylines corresponding to the pedestrian paths

generate_random_graph

Possible uses:

  • generate_random_graph (int, int, bool) ---> graph
  • generate_random_graph (int, int, bool, species) ---> graph
  • generate_random_graph (int, int, bool, species, species) ---> graph

Result: returns a random graph.

Special cases:

  • nbNodes: number of nodes to create;nbEdges: number of edges to create;directed: is the graph directed or not
graph myGraph <- generate_random_graph( 
50, 
100, 
true);
  • nbNodes: number of nodes to be created; nbEdges: number of edges to be created; directed: is the graph has to be directed or not;node_species: the species of nodes; edges_species: the species of edges
graph<node_species,edge_species> myGraph <- generate_random_graph( 
50, 
100, 
true, 
node_species, 
edge_species);
  • nbNodes: number of nodes to create;nbEdges: number of edges to create;directed: is the graph directed or not;node_species: the species of nodes
graph myGraph <- generate_random_graph( 
50, 
100, 
true, 
node_species);

See also: generate_barabasi_albert, generate_watts_strogatz,


generate_terrain

Possible uses:

  • generate_terrain (int, int, int, float, float, float) ---> field

Result: This operator allows to generate a pseudo-terrain using a simplex noise generator. Its usage is kept simple: it takes first a seed (random or not), then the dimensions (width and height) of the field to generate, then a level (between 0 and 1) of details (which actually determines the number of passes to make), then the value (between 0 and 1) of smoothess, with 0 being completely rought and 1 super smooth, and finally the value (between 0 and 1) of scattering, with 0 building maps in 'one piece' and 1 completely scattered ones.


generate_watts_strogatz

Possible uses:

  • generate_watts_strogatz (container, float, int, bool) ---> graph
  • generate_watts_strogatz (int, float, int, bool) ---> graph
  • generate_watts_strogatz (int, float, int, bool, species) ---> graph
  • generate_watts_strogatz (int, float, int, bool, species, species) ---> graph

Result: returns a random small-world network (following Watts-Strogatz model).

Comment: The Watts-Strogatz model is a random graph generation model that produces graphs with small-world properties, including short average path lengths and high clustering.A small-world network is a type of graph in which most nodes are not neighbors of one another, but most nodes can be reached from every other by a small number of hops or steps. [From Wikipedia article]The map operand should includes following elements:The Watts-Strogatz model is a random graph generation model that produces graphs with small-world properties, including short average path lengths and high clustering.A small-world network is a type of graph in which most nodes are not neighbors of one another, but most nodes can be reached from every other by a small number of hops or steps. [From Wikipedia article]The map operand should includes following elements:The Watts-Strogatz model is a random graph generation model that produces graphs with small-world properties, including short average path lengths and high clustering.A small-world network is a type of graph in which most nodes are not neighbors of one another, but most nodes can be reached from every other by a small number of hops or steps. [From Wikipedia article]The map operand should includes following elements:The Watts-Strogatz model is a random graph generation model that produces graphs with small-world properties, including short average path lengths and high clustering.A small-world network is a type of graph in which most nodes are not neighbors of one another, but most nodes can be reached from every other by a small number of hops or steps. [From Wikipedia article]The map operand should includes following elements:

Special cases:

  • "nodes": the list of nodes to connect; "p": probability to "rewire" an edge (so it must be between 0 and 1, the parameter is often called beta in the literature); "k": the base degree of each node (k must be greater than 2 and even); "directed": is the graph directed or not
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			people, 
			0.3, 
			5, 
		true);
  • "nbNodes": the graph will contain (size + 1) nodes (size must be greater than k); "p": probability to "rewire" an edge (so it must be between 0 and 1, the parameter is often called beta in the literature); "k": the base degree of each node (k must be greater than 2 and even); "directed": is the graph directed or not; "node_species": the species of vertices; "edges_species": the species of edges
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			100, 
			0.3, 
			5, 
		true, 
			myVertexSpecies, 
			myEdgeSpecies);
  • "nbNodes": the graph will contain (size + 1) nodes (size must be greater than k); "p": probability to "rewire" an edge (so it must be between 0 and 1, the parameter is often called beta in the literature); "k": the base degree of each node (k must be greater than 2 and even); "directed": is the graph directed or not; "node_species": the species of vertices
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			100, 
			0.3, 
			5, 
		true, 
			myVertexSpecies);
  • "nbNodes": the graph will contain (size + 1) nodes (size must be greater than k); "p": probability to "rewire" an edge (so it must be between 0 and 1, the parameter is often called beta in the literature); "k": the base degree of each node (k must be greater than 2 and even); "directed": is the graph directed or not
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			100, 
			0.3, 
			5, 
		true);

See also: generate_barabasi_albert, generate_complete_graph, generate_random_graph,


geojson_file

Possible uses:

  • geojson_file (string) ---> file
  • string geojson_file int ---> file
  • geojson_file (string , int) ---> file
  • string geojson_file string ---> file
  • geojson_file (string , string) ---> file
  • string geojson_file bool ---> file
  • geojson_file (string , bool) ---> file
  • geojson_file (string, int, bool) ---> file
  • geojson_file (string, string, bool) ---> file

Result: Constructs a file of type geojson. Allowed extensions are limited to json, geojson, geo.json

Special cases:

file f <- geojson_file("file.json");
  • geojson_file(string,int): This file constructor allows to read a geojson file and specifying the coordinates system code, as an int
file f <- geojson_file("file.json", 32648);
  • geojson_file(string,string): This file constructor allows to read a geojson file and specifying the coordinates system code (epg,...,), as a string
file f <- geojson_file("file.json", "EPSG:32648");
  • geojson_file(string,bool): This file constructor allows to read a geojson file and take a potential z value (not taken in account by default)
file f <- geojson_file("file.json", true);
  • geojson_file(string,int,bool): This file constructor allows to read a geojson file, specifying the coordinates system code, as an int and take a potential z value (not taken in account by default)
file f <- geojson_file("file.json",32648, true);
  • geojson_file(string,string,bool): This file constructor allows to read a geojson file, specifying the coordinates system code (epg,...,), as a string and take a potential z value (not taken in account by default
file f <- geojson_file("file.json", "EPSG:32648",true);

See also: is_geojson,


geometric_mean

Possible uses:

  • geometric_mean (container) ---> float

Result: the geometric mean of the elements of the operand. See Geometric_mean for more details.

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

Examples:

float var0 <- geometric_mean ([4.5, 3.5, 5.5, 7.0]); // var0 equals 4.962326343467649

See also: harmonic_mean, mean, median,


geometry

Possible uses:

  • geometry (any) ---> geometry

Result: casts the operand in a geometry object.


geometry_collection

Possible uses:

  • geometry_collection (container<unknown,geometry>) ---> geometry

Result: A geometry collection (multi-geometry) composed of the given list of geometries.

Special cases:

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

Examples:

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

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


get

Possible uses:

  • agent get string ---> unknown
  • get (agent , string) ---> unknown
  • geometry get string ---> unknown
  • get (geometry , string) ---> unknown

Result: Reads an attribute of the specified agent (or geometry) (left operand). The attribute name is specified by the right operand.

Special cases:

  • Reading the attribute of another agent
string agent_name <- an_agent get('name');     // reads then 'name' attribute of an_agent then assigns the returned value to the agent_name variable
  • Reading the attribute of a geometry
string geom_area <- a_geometry get('area');     // reads then 'area' attribute of 'a_geometry' variable then assigns the returned value to the geom_area variable

get_agent

Possible uses:

  • get_agent (social_link) ---> agent

Result: get the agent value of the given social link

Examples:

get_agent(social_link1)

get_belief_op

Possible uses:

  • agent get_belief_op predicate ---> mental_state
  • get_belief_op (agent , predicate) ---> mental_state

Result: get the belief in the belief base with the given predicate.

Examples:

mental_state var0 <- get_belief_op(self,predicate("has_water")); // var0 equals nil

get_belief_with_name_op

Possible uses:

  • agent get_belief_with_name_op string ---> mental_state
  • get_belief_with_name_op (agent , string) ---> mental_state

Result: get the belief in the belief base with the given name.

Examples:

mental_state var0 <- get_belief_with_name_op(self,"has_water"); // var0 equals nil

get_beliefs_op

Possible uses:

  • agent get_beliefs_op predicate ---> list<mental_state>
  • get_beliefs_op (agent , predicate) ---> list<mental_state>

Result: get the beliefs in the belief base with the given predicate.

Examples:

get_beliefs_op(self,predicate("has_water"))

get_beliefs_with_name_op

Possible uses:

  • agent get_beliefs_with_name_op string ---> list<mental_state>
  • get_beliefs_with_name_op (agent , string) ---> list<mental_state>

Result: get the list of beliefs in the belief base which predicate has the given name.

Examples:

get_beliefs_with_name_op(self,"has_water")

get_current_intention_op

Possible uses:

  • get_current_intention_op (agent) ---> mental_state

Result: get the current intention.

Examples:

mental_state var0 <- get_current_intention_op(self); // var0 equals nil

get_desire_op

Possible uses:

  • agent get_desire_op predicate ---> mental_state
  • get_desire_op (agent , predicate) ---> mental_state

Result: get the desire in the desire base with the given predicate.

Examples:

mental_state var0 <- get_belief_op(self,predicate("has_water")); // var0 equals nil

get_desire_with_name_op

Possible uses:

  • agent get_desire_with_name_op string ---> mental_state
  • get_desire_with_name_op (agent , string) ---> mental_state

Result: get the desire in the desire base with the given name.

Examples:

mental_state var0 <- get_desire_with_name_op(self,"has_water"); // var0 equals nil

get_desires_op

Possible uses:

  • agent get_desires_op predicate ---> list<mental_state>
  • get_desires_op (agent , predicate) ---> list<mental_state>

Result: get the desires in the desire base with the given predicate.

Examples:

get_desires_op(self,predicate("has_water"))

get_desires_with_name_op

Possible uses:

  • agent get_desires_with_name_op string ---> list<mental_state>
  • get_desires_with_name_op (agent , string) ---> list<mental_state>

Result: get the list of desires in the desire base which predicate has the given name.

Examples:

get_desires_with_name_op(self,"has_water")

get_ideal_op

Possible uses:

  • agent get_ideal_op predicate ---> mental_state
  • get_ideal_op (agent , predicate) ---> mental_state

Result: get the ideal in the ideal base with the given name.

Examples:

mental_state var0 <- get_ideal_op(self,predicate("has_water")); // var0 equals nil

get_ideal_with_name_op

Possible uses:

  • agent get_ideal_with_name_op string ---> mental_state
  • get_ideal_with_name_op (agent , string) ---> mental_state

Result: get the ideal in the ideal base with the given name.

Examples:

mental_state var0 <- get_ideal_with_name_op(self,"has_water"); // var0 equals nil

get_ideals_op

Possible uses:

  • agent get_ideals_op predicate ---> list<mental_state>
  • get_ideals_op (agent , predicate) ---> list<mental_state>

Result: get the ideal in the ideal base with the given name.

Examples:

get_ideals_op(self,predicate("has_water"))

get_ideals_with_name_op

Possible uses:

  • agent get_ideals_with_name_op string ---> list<mental_state>
  • get_ideals_with_name_op (agent , string) ---> list<mental_state>

Result: get the list of ideals in the ideal base which predicate has the given name.

Examples:

get_ideals_with_name_op(self,"has_water")

get_intention_op

Possible uses:

  • agent get_intention_op predicate ---> mental_state
  • get_intention_op (agent , predicate) ---> mental_state

Result: get the intention in the intention base with the given predicate.

Examples:

get_intention_op(self,predicate("has_water"))

get_intention_with_name_op

Possible uses:

  • agent get_intention_with_name_op string ---> mental_state
  • get_intention_with_name_op (agent , string) ---> mental_state

Result: get the intention in the intention base with the given name.

Examples:

get_intention_with_name_op(self,"has_water")

get_intentions_op

Possible uses:

  • agent get_intentions_op predicate ---> list<mental_state>
  • get_intentions_op (agent , predicate) ---> list<mental_state>

Result: get the intentions in the intention base with the given predicate.

Examples:

get_intentions_op(self,predicate("has_water"))

get_intentions_with_name_op

Possible uses:

  • agent get_intentions_with_name_op string ---> list<mental_state>
  • get_intentions_with_name_op (agent , string) ---> list<mental_state>

Result: get the list of intentions in the intention base which predicate has the given name.

Examples:

get_intentions_with_name_op(self,"has_water")

get_obligation_op

Possible uses:

  • agent get_obligation_op predicate ---> mental_state
  • get_obligation_op (agent , predicate) ---> mental_state

Result: get the obligation in the obligation base with the given predicate.

Examples:

mental_state var0 <- get_obligation_op(self,predicate("has_water")); // var0 equals nil

get_obligation_with_name_op

Possible uses:

  • agent get_obligation_with_name_op string ---> mental_state
  • get_obligation_with_name_op (agent , string) ---> mental_state

Result: get the obligation in the obligation base with the given name.

Examples:

mental_state var0 <- get_obligation_with_name_op(self,"has_water"); // var0 equals nil

get_obligations_op

Possible uses:

  • agent get_obligations_op predicate ---> list<mental_state>
  • get_obligations_op (agent , predicate) ---> list<mental_state>

Result: get the obligations in the obligation base with the given predicate.

Examples:

get_obligations_op(self,predicate("has_water"))

get_obligations_with_name_op

Possible uses:

  • agent get_obligations_with_name_op string ---> list<mental_state>
  • get_obligations_with_name_op (agent , string) ---> list<mental_state>

Result: get the list of obligations in the obligation base which predicate has the given name.

Examples:

get_obligations_with_name_op(self,"has_water")

get_plan_name

Possible uses:

  • get_plan_name (BDIPlan) ---> string

Result: get the name of a given plan

Examples:

get_plan_name(agent.current_plan)

get_uncertainties_op

Possible uses:

  • agent get_uncertainties_op predicate ---> list<mental_state>
  • get_uncertainties_op (agent , predicate) ---> list<mental_state>

Result: get the uncertainties in the uncertainty base with the given predicate.

Examples:

get_uncertainties_op(self,predicate("has_water"))

get_uncertainties_with_name_op

Possible uses:

  • agent get_uncertainties_with_name_op string ---> list<mental_state>
  • get_uncertainties_with_name_op (agent , string) ---> list<mental_state>

Result: get the list of uncertainties in the uncertainty base which predicate has the given name.

Examples:

get_uncertainties_with_name_op(self,"has_water")

get_uncertainty_op

Possible uses:

  • agent get_uncertainty_op predicate ---> mental_state
  • get_uncertainty_op (agent , predicate) ---> mental_state

Result: get the uncertainty in the uncertainty base with the given predicate.

Examples:

mental_state var0 <- get_uncertainty_op(self,predicate("has_water")); // var0 equals nil

get_uncertainty_with_name_op

Possible uses:

  • agent get_uncertainty_with_name_op string ---> mental_state
  • get_uncertainty_with_name_op (agent , string) ---> mental_state

Result: get the uncertainty in the uncertainty base with the given name.

Examples:

mental_state var0 <- get_uncertainty_with_name_op(self,"has_water"); // var0 equals nil

gif_file

Possible uses:

  • gif_file (string) ---> file
  • string gif_file matrix<int> ---> file
  • gif_file (string , matrix<int>) ---> file

Result: Constructs a file of type gif. Allowed extensions are limited to gif

Special cases:

  • gif_file(string): This file constructor allows to read a gif file
gif_file f <- gif_file("file.gif");
  • gif_file(string,matrix): This file constructor allows to store a matrix in a gif file (it does not save it - just store it in memory)
gif_file f <- gif_file("file.gif",matrix([10,10],[10,10]));

See also: is_gif,


gini

Possible uses:

  • gini (list<float>) ---> float

Special cases:

  • return the Gini Index of the given list of values (list of floats)
float var0 <- gini([1.0, 0.5, 2.0]); // var0 equals the gini index computed i.e. 0.2857143

girvan_newman_clustering

Possible uses:

  • graph girvan_newman_clustering int ---> list
  • girvan_newman_clustering (graph , int) ---> list

Result: The Girvan�Newman algorithm is a hierarchical method used to detect communities. It detects communities by progressively removing edges from the original network.It returns a list of list of vertices and takes as operand the graph and the number of clusters


glm

Possible uses:

  • glm (matrix) ---> regression

Result: Returns a Generalized Linear Model (GLM) built from the matrix data. Currently implemented using Ordinary Least Squares (OLS).

Examples:

glm(matrix([[1.0,2.0,3.0,4.0],[2.0,3.0,4.0,2.0]]))

gml_file

Possible uses:

  • gml_file (string) ---> file
  • string gml_file int ---> file
  • gml_file (string , int) ---> file
  • string gml_file string ---> file
  • gml_file (string , string) ---> file
  • string gml_file bool ---> file
  • gml_file (string , bool) ---> file
  • gml_file (string, int, bool) ---> file
  • gml_file (string, string, bool) ---> file

Result: Constructs a file of type gml. Allowed extensions are limited to gml

Special cases:

  • gml_file(string): This file constructor allows to read a gml file
file f <- gml_file("file.gml");
  • gml_file(string,int): This file constructor allows to read a gml file and specifying the coordinates system code, as an int (epsg code)
file f <- gml_file("file.gml", 32648);
  • gml_file(string,string): This file constructor allows to read a gml file and specifying the coordinates system code (epg,...,), as a string
file f <- gml_file("file.gml", "EPSG:32648");
  • gml_file(string,bool): This file constructor allows to read a gml file and take a potential z value (not taken in account by default)
file f <- gml_file("file.gml", true);
  • gml_file(string,int,bool): This file constructor allows to read a gml file, specifying the coordinates system code, as an int (epsg code) and take a potential z value (not taken in account by default)
file f <- gml_file("file.gml", 32648, true);
  • gml_file(string,string,bool): This file constructor allows to read a gml file, specifying the coordinates system code (epg,...,), as a string and take a potential z value (not taken in account by default
file f <- gml_file("file.gml", "EPSG:32648",true);

See also: is_gml,


gradient

Possible uses:

  • gradient (map<rgb,float>) ---> map<rgb,float>
  • gradient (list<rgb>) ---> map<rgb,float>
  • rgb gradient rgb ---> map<rgb,float>
  • gradient (rgb , rgb) ---> map<rgb,float>
  • gradient (rgb, rgb, float) ---> map<rgb,float>

Result: returns the definition of a linear gradient between two colors, with a ratio (between 0 and 1, otherwise clamped) represented internally as a color map [start::0.0,(startr+stop(1-r))::r, stop::1.0]

returns the definition of a linear gradient between two colors, represented internally as a color map [start::0.0,stop::1.0]

returns the definition of a linear gradient between n colors provided with their positions on a scale between 0 and 1. A similar color map is returned, in the same color order, with all the positions normalized (so that they are shifted and scaled to fit between 0 and 1). Throws an error if the number of colors is less than 2 or if the positions are not strictly ordered

returns the definition of a linear gradient between n colors, represented internally as a color map [c1::0,c2::1/n-1, ... cn::n-1/n-1]


graph

Possible uses:

  • graph (any) ---> graph

Result: casts the operand in a graph object.


graph6_file

Possible uses:

  • graph6_file (string) ---> file
  • string graph6_file species ---> file
  • graph6_file (string , species) ---> file
  • graph6_file (string, species, species) ---> file

Result: Constructs a file of type graph6. Allowed extensions are limited to graph6

Special cases:

  • graph6_file(string): References a graph6 file by its filename
  • graph6_file(string,species): References a graph6 file by its filename and the species to use to instantiate the nodes
  • graph6_file(string,species,species): References a graph6 file by its filename and the species to use to instantiate the nodes and the edges

See also: is_graph6,


graphdimacs_file

Possible uses:

  • graphdimacs_file (string) ---> file
  • string graphdimacs_file species ---> file
  • graphdimacs_file (string , species) ---> file
  • graphdimacs_file (string, species, species) ---> file

Result: Constructs a file of type graphdimacs. Allowed extensions are limited to dimacs

Special cases:

  • graphdimacs_file(string): References a dimacs file by its filename
  • graphdimacs_file(string,species): References a dimacs file by its filename and the species to use to instantiate the nodes
  • graphdimacs_file(string,species,species): References a dimacs file by its filename and the species to use to instantiate the nodes and the edges

See also: is_graphdimacs,


graphdot_file

Possible uses:

  • graphdot_file (string) ---> file
  • string graphdot_file species ---> file
  • graphdot_file (string , species) ---> file
  • graphdot_file (string, species, species) ---> file

Result: Constructs a file of type graphdot. Allowed extensions are limited to dot

Special cases:

  • graphdot_file(string): References a dot graph file by its filename
  • graphdot_file(string,species): References a dot graph file by its filename and the species to use to instantiate the nodes
  • graphdot_file(string,species,species): References a dot graph file by its filename and the 2 species to use to instantiate the nodes and the edges

See also: is_graphdot,


graphgexf_file

Possible uses:

  • graphgexf_file (string) ---> file
  • string graphgexf_file species ---> file
  • graphgexf_file (string , species) ---> file
  • graphgexf_file (string, species, species) ---> file

Result: Constructs a file of type graphgexf. Allowed extensions are limited to gexf

Special cases:

  • graphgexf_file(string): References a gexf graph file by its filename
  • graphgexf_file(string,species): References a gexf graph file by its filename and the species to use to instantiate the nodes
  • graphgexf_file(string,species,species): References a gexf graph file by its filename and the 2 species to use to instantiate the nodes and the edges

See also: is_graphgexf,


graphgml_file

Possible uses:

  • graphgml_file (string) ---> file
  • string graphgml_file species ---> file
  • graphgml_file (string , species) ---> file
  • graphgml_file (string, species, species) ---> file

Result: Constructs a file of type graphgml. Allowed extensions are limited to gml

Special cases:

  • graphgml_file(string): References a gml graph file by its filename
  • graphgml_file(string,species): References a gml graph file by its filename and the species to use to instantiate the nodes
  • graphgml_file(string,species,species): References a gml graph file by its filename and the 2 species to use to instantiate the nodes and the edges

See also: is_graphgml,


graphml_file

Possible uses:

  • graphml_file (string) ---> file
  • string graphml_file species ---> file
  • graphml_file (string , species) ---> file
  • graphml_file (string, species, species) ---> file
  • graphml_file (string, species, species, string, string) ---> file

Result: Constructs a file of type graphml. Allowed extensions are limited to graphml

Special cases:

  • graphml_file(string): References a graphml graph file by its filename
  • graphml_file(string,species): References a graphml graph file by its filename and the species to use to instantiate the nodes
  • graphml_file(string,species,species): References a graphml graph file by its filename and the 2 species to use to instantiate the nodes and the edges
  • graphml_file(string,species,species,string,string): References a graphml graph file by its filename and the 2 species to use to instantiate the nodes and the edges

See also: is_graphml,


graphtsplib_file

Possible uses:

  • graphtsplib_file (string) ---> file
  • string graphtsplib_file species ---> file
  • graphtsplib_file (string , species) ---> file
  • graphtsplib_file (string, species, species) ---> file

Result: Constructs a file of type graphtsplib. Allowed extensions are limited to tsplib

Special cases:

  • graphtsplib_file(string): References a tsplib graph file by its filename
  • graphtsplib_file(string,species): References a tsplib graph file by its filename and the species to use to instantiate the nodes
  • graphtsplib_file(string,species,species): References a tsplib graph file by its filename and the 2 species to use to instantiate the nodes and the edges

See also: is_graphtsplib,


grayscale

Possible uses:

  • grayscale (rgb) ---> rgb

Result: Converts rgb color to grayscale value

Comment: r=red, g=green, b=blue. Between 0 and 255 and gray = 0.299 * red + 0.587 * green + 0.114 * blue (Photoshop value)

Examples:

rgb var0 <- grayscale (rgb(255,0,0)); // var0 equals to a dark grey

See also: hsb, rgb,


grayscale

Possible uses:

  • grayscale (image) ---> image

Result: Used to convert any image to a grayscale color palette and return it. The original image is left untouched


grid_at

Possible uses:

  • species grid_at point ---> agent
  • grid_at (species , point) ---> agent

Result: returns the cell of the grid (right-hand operand) at the position given by the right-hand operand

Comment: If the left-hand operand is a point of floats, it is used as a point of ints.

Special cases:

  • if the left-hand operand is not a grid cell species, returns nil

Examples:

agent var0 <- grid_cell grid_at {1,2}; // var0 equals the agent grid_cell with grid_x=1 and grid_y = 2

grid_cells_to_graph

Possible uses:

  • grid_cells_to_graph (container) ---> graph
  • container grid_cells_to_graph species ---> graph
  • grid_cells_to_graph (container , species) ---> graph

Result: creates a graph from a list of cells (operand). An edge is created between neighbors.

Examples:

my_cell_graph <- grid_cells_to_graph(cells_list);

See also: as_edge_graph, as_intersection_graph,


grid_file

Possible uses:

  • grid_file (string) ---> file
  • string grid_file bool ---> file
  • grid_file (string , bool) ---> file
  • string grid_file int ---> file
  • grid_file (string , int) ---> file
  • string grid_file string ---> file
  • grid_file (string , string) ---> file
  • string grid_file field ---> file
  • grid_file (string , field) ---> file

Result: Constructs a file of type grid. Allowed extensions are limited to asc, tif

Special cases:

  • grid_file(string): This file constructor allows to read a asc file or a tif (geotif) file
file f <- grid_file("file.asc");
  • grid_file(string,bool): This file constructor allows to read a asc file or a tif (geotif) file, but without converting it into shapes. Only a matrix of float values is created
file f <- grid_file("file.asc", false);
  • grid_file(string,int): This file constructor allows to read a asc file or a tif (geotif) file specifying the coordinates system code, as an int (epsg code)
file f <- grid_file("file.asc", 32648);
  • grid_file(string,string): This file constructor allows to read a asc file or a tif (geotif) file specifying the coordinates system code (epg,...,), as a string
file f <- grid_file("file.asc","EPSG:32648");
  • grid_file(string,field): This allows to build a writable grid file from the values of a field
file f <- grid_file("file.tif",my_field); save f;

See also: is_grid,


group_by

Possible uses:

  • group_by (string, container, any expression) ---> map

Result: Returns a map, where the keys take the possible values of the right-hand operand and the map values are the list of elements of the left-hand operand associated to the key value

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

Special cases:

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

Examples:

map var0 <- [1,2,3,4,5,6,7,8] group_by (each > 3); // var0 equals [false::[1, 2, 3], true::[4, 5, 6, 7, 8]] 
map var1 <- g2 group_by (length(g2 out_edges_of each) ); // var1 equals [ 0::[node9, node7, node10, node8, node11], 1::[node6], 2::[node5], 3::[node4]] 
map var2 <- (list(node) group_by (round(node(each).location.x)); // var2 equals [32::[node5], 21::[node1], 4::[node0], 66::[node2], 96::[node3]] 
map<bool,list> var3 <- [1::2, 3::4, 5::6] group_by (each > 4); // var3 equals [false::[2, 4], true::[6]]

See also: count, first_with, last_with, sort_by, where,


harmonic_mean

Possible uses:

  • harmonic_mean (container) ---> float

Result: the harmonic mean of the elements of the operand. See Harmonic_mean for more details.

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

Examples:

float var0 <- harmonic_mean ([4.5, 3.5, 5.5, 7.0]); // var0 equals 4.804159445407279

See also: geometric_mean, mean, median,


has_belief_op

Possible uses:

  • agent has_belief_op predicate ---> bool
  • has_belief_op (agent , predicate) ---> bool

Result: indicates if there already is a belief about the given predicate.

Examples:

bool var0 <- has_belief_op(self,predicate("has_water")); // var0 equals false

has_belief_with_name_op

Possible uses:

  • agent has_belief_with_name_op string ---> bool
  • has_belief_with_name_op (agent , string) ---> bool

Result: indicates if there already is a belief about the given name.

Examples:

bool var0 <- has_belief_with_name_op(self,"has_water"); // var0 equals false

has_desire_op

Possible uses:

  • agent has_desire_op predicate ---> bool
  • has_desire_op (agent , predicate) ---> bool

Result: indicates if there already is a desire about the given predicate.

Examples:

bool var0 <- has_desire_op(self,predicate("has_water")); // var0 equals false

has_desire_with_name_op

Possible uses:

  • agent has_desire_with_name_op string ---> bool
  • has_desire_with_name_op (agent , string) ---> bool

Result: indicates if there already is a desire about the given name.

Examples:

bool var0 <- has_desire_with_name_op(self,"has_water"); // var0 equals false

has_ideal_op

Possible uses:

  • agent has_ideal_op predicate ---> bool
  • has_ideal_op (agent , predicate) ---> bool

Result: indicates if there already is an ideal about the given predicate.

Examples:

bool var0 <- has_ideal_op(self,predicate("has_water")); // var0 equals false

has_ideal_with_name_op

Possible uses:

  • agent has_ideal_with_name_op string ---> bool
  • has_ideal_with_name_op (agent , string) ---> bool

Result: indicates if there already is an ideal about the given name.

Examples:

bool var0 <- has_ideal_with_name_op(self,"has_water"); // var0 equals false

has_intention_op

Possible uses:

  • agent has_intention_op predicate ---> bool
  • has_intention_op (agent , predicate) ---> bool

Result: indicates if there already is an intention about the given predicate.

Examples:

bool var0 <- has_intention_op(self,predicate("has_water")); // var0 equals false

has_intention_with_name_op

Possible uses:

  • agent has_intention_with_name_op string ---> bool
  • has_intention_with_name_op (agent , string) ---> bool

Result: indicates if there already is an intention about the given name.

Examples:

bool var0 <- has_intention_with_name_op(self,"has_water"); // var0 equals false

has_obligation_op

Possible uses:

  • agent has_obligation_op predicate ---> bool
  • has_obligation_op (agent , predicate) ---> bool

Result: indicates if there already is an obligation about the given predicate.

Examples:

bool var0 <- has_obligation_op(self,predicate("has_water")); // var0 equals false

has_obligation_with_name_op

Possible uses:

  • agent has_obligation_with_name_op string ---> bool
  • has_obligation_with_name_op (agent , string) ---> bool

Result: indicates if there already is an obligation about the given name.

Examples:

bool var0 <- has_obligation_with_name_op(self,"has_water"); // var0 equals false

has_uncertainty_op

Possible uses:

  • agent has_uncertainty_op predicate ---> bool
  • has_uncertainty_op (agent , predicate) ---> bool

Result: indicates if there already is an uncertainty about the given predicate.

Examples:

bool var0 <- has_uncertainty_op(self,predicate("has_water")); // var0 equals false

has_uncertainty_with_name_op

Possible uses:

  • agent has_uncertainty_with_name_op string ---> bool
  • has_uncertainty_with_name_op (agent , string) ---> bool

Result: indicates if there already is an uncertainty about the given name.

Examples:

bool var0 <- has_uncertainty_with_name_op(self,"has_water"); // var0 equals false

hexagon

Possible uses:

  • hexagon (float) ---> geometry
  • hexagon (point) ---> geometry
  • float hexagon float ---> geometry
  • hexagon (float , float) ---> geometry

Result: A hexagon geometry which the given with and height

Comment: the center of the hexagon 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 <- hexagon(10,5); // var0 equals a geometry as a hexagon of width of 10 and height of 5. 
geometry var1 <- hexagon(10); // var1 equals a geometry as a hexagon of width of 10 and height of 10. 
geometry var2 <- hexagon({10,5}); // var2 equals a geometry as a hexagon of width of 10 and height of 5.

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


hierarchical_clustering

Possible uses:

  • container<unknown,agent> hierarchical_clustering float ---> list
  • hierarchical_clustering (container<unknown,agent> , float) ---> list

Result: A tree (list of list) contained groups of agents clustered by distance considering a distance min between two groups.

Comment: use of hierarchical clustering with Minimum for linkage criterion between two groups of agents.

Examples:

list var0 <- [ag1, ag2, ag3, ag4, ag5] hierarchical_clustering 20.0; // var0 equals for example, can return [[[ag1],[ag3]], [ag2], [[[ag4],[ag5]],[ag6]]

See also: simple_clustering_by_distance,


horizontal

Possible uses:

  • horizontal (map<unknown,int>) ---> unknown<string>

Result: Creates a horizontal layout node (a sash). Sashes can contain any number (> 1) of other elements: stacks, horizontal or vertical sashes, or display indices. Each element is represented by a pair in the map, where the key is the element and the value its weight within the sash

Special cases:

  • A minimum of 2 child elements is required.
  • If only 1 element is provided, behavior is undefined.
  • Weight values determine relative proportions; negative or zero weights lead to undefined layout behavior.

horizontal_flip

Possible uses:

  • horizontal_flip (image) ---> image

Result: Returns an image flipped horizontally by reflecting the original image around the y axis. The original image is left untouched


hsb

Possible uses:

  • hsb (float, float, float) ---> rgb
  • hsb (float, float, float, int) ---> rgb
  • hsb (float, float, float, float) ---> rgb

Result: Converts hsb (h=hue, s=saturation, b=brightness) value to Gama color

Comment: h,s and b components should be floating-point values between 0.0 and 1.0 and when used alpha should be an integer (between 0 and 255) or a float (between 0 and 1) . Examples: Red=(0.0,1.0,1.0), Yellow=(0.16,1.0,1.0), Green=(0.33,1.0,1.0), Cyan=(0.5,1.0,1.0), Blue=(0.66,1.0,1.0), Magenta=(0.83,1.0,1.0)

Examples:

rgb var0 <- hsb (0.0,1.0,1.0); // var0 equals rgb("red") 
rgb var1 <- hsb (0.5,1.0,1.0,0.0); // var1 equals rgb("cyan",0)

See also: blend, grayscale, rgb, rnd_color,


hsic

Possible uses:

  • list<float> hsic list<float> ---> float
  • hsic (list<float> , list<float>) ---> float

Result: Computes the normalized Hilbert-Schmidt Independence Criterion (HSIC) between two variables. HSIC is a kernel-based statistic to test the independence of two variables. Returns a value between 0 and 1, where 0 indicates independence.

Examples:

hsic([1.0, 2.0, 3.0], [1.0, 2.0, 3.0])

hsic_p_value

Possible uses:

  • hsic_p_value (list<float>, list<float>, int) ---> float

Result: Computes the p-value for the HSIC independence test between two variables using a permutation test. A small p-value (< 0.05) indicates strong evidence of dependence.

Examples:

hsic_p_value([1.0, 2.0, 3.0, 4.0, 5.0], [1.0, 2.0, 3.0, 4.0, 5.0], 100)

hypot

Possible uses:

  • hypot (float, float, float, float) ---> float

Result: Returns sqrt(x2 +y2) without intermediate overflow or underflow.

Special cases:

  • If either argument is infinite, then the result is positive infinity. If either argument is NaN and neither argument is infinite, then the result is NaN.

Examples:

float var0 <- hypot(0,1,0,1); // var0 equals sqrt(2)

IDW

Possible uses:

  • IDW (container<unknown,geometry>, map, int) ---> map<geometry,float>

Result: Inverse Distance Weighting (IDW) is a type of deterministic method for multivariate interpolation with a known scattered set of points. The assigned values to each geometry are calculated with a weighted average of the values available at the known points. See: http://en.wikipedia.org/wiki/Inverse_distance_weighting Usage: IDW (list of geometries, map of points (key: point, value: value), power parameter)

Examples:

map<geometry,float> var0 <- IDW([ag1, ag2, ag3, ag4, ag5],[{10,10}::25.0, {10,80}::10.0, {100,10}::15.0], 2); // var0 equals for example, can return [ag1::12.0, ag2::23.0,ag3::12.0,ag4::14.0,ag5::17.0]

iloc

Possible uses:

  • dataframe iloc list<int> ---> dataframe
  • iloc (dataframe , list<int>) ---> dataframe
  • dataframe iloc int ---> list<unknown>
  • iloc (dataframe , int) ---> list<unknown>
  • iloc (dataframe, list<int>, list<int>) ---> dataframe
  • iloc (dataframe, int, list<int>) ---> list<unknown>
  • iloc (dataframe, int, int) ---> unknown
  • iloc (dataframe, list<int>, int) ---> list<unknown>

Result: Pandas-style df.iloci, ...: returns a new dataframe containing only the rows at the given integer indices (in that order). All columns are kept. Negative indices are supported.

Pandas-style df.iloci, ...], [j, ...: returns a new dataframe containing only the rows and columns at the given integer indices, in the order of the input indices. Negative indices are supported on both axes.

Pandas-style df.iloc[i, [j, ...]]: returns the values of row i taken from the selected columns, in the order of the input column indices. Negative indices are supported.

Pandas-style df.iloc[i, j]: returns the cell value at integer (row, col) position. Negative indices are supported on both axes.

Pandas-style df.iloc[[i, ...], j]: returns the values of column j taken from the selected rows, in the order of the input row indices. Negative indices are supported.

Pandas-style df.iloc[i]: returns the row at integer position i as a list of values. Negative indices are supported (-1 is the last row).

Special cases:

  • Select rows 0 and 2
dataframe sub <- iloc(my_df, [0, 2]);
  • Select rows 0 and 2, columns 0 and 1
dataframe sub <- iloc(my_df, [0, 2], [0, 1]);
  • Get cells [0] and [2] of row 1
list values <- iloc(my_df, 1, [0, 2]);
  • Get the cell at row 1, column 0
unknown v <- iloc(my_df, 1, 0);
  • Get column 1 values at rows 0 and 2
list values <- iloc(my_df, [0, 2], 1);
  • Get the last row
list row <- iloc(my_df, -1);

See also: cell, column_at, filter, row_at, select_columns,


image

Possible uses:

  • int image int ---> image
  • image (int , int) ---> image
  • image (int, int, rgb) ---> image
  • image (file, int, int) ---> image
  • image (int, int, bool) ---> image

Result: Builds a new blank image of the specified dimensions, which does not accept transparency

Builds a new image with the specified dimensions and already filled with the given rgb color

Builds a new image from the specified file, passing the width and height in parameter

Builds a new blank image with the specified dimensions and indicates if it will support transparency or not


image_file

Possible uses:

  • image_file (string) ---> file
  • string image_file string ---> file
  • image_file (string , string) ---> file
  • string image_file matrix<int> ---> file
  • image_file (string , matrix<int>) ---> file
  • string image_file java.awt.image.BufferedImage ---> file
  • image_file (string , java.awt.image.BufferedImage) ---> file

Result: Constructs a file of type image. Allowed extensions are limited to tiff, jpg, jpeg, png, pict, bmp

Special cases:

  • image_file(string,java.awt.image.BufferedImage):
  • image_file(string): This file constructor allows to read an image file (tiff, jpg, jpeg, png, pict, bmp)
file f <-image_file("file.png");
  • image_file(string,string): This file constructor allows to read an image file (tiff, jpg, jpeg, png, pict, bmp) and to force the extension of the file (can be useful for images coming from URL)
file f <-image_file("http://my_url", "png");
  • image_file(string,matrix): This file constructor allows to store a matrix in a image file (it does not save it - just store it in memory)
file f <-image_file("file.png");

See also: is_image,


in

Possible uses:

  • unknown in container ---> bool
  • in (unknown , container) ---> bool
  • string in string ---> bool
  • in (string , string) ---> bool

Result: true if the right operand contains the left operand, false otherwise

Returns true if the left-hand string is contained in the right-hand string.

Comment: the definition of in depends on the container

Special cases:

  • if the right operand is nil or empty, in returns false
  • if both operands are strings, returns true if the left-hand operand patterns is included in to the right-hand string;
  • If the left operand is the empty string, returns true (the empty string is contained in any string).
  • The test is case-sensitive.

Examples:

bool var0 <- 2 in [1,2,3,4,5,6]; // var0 equals true 
bool var1 <- 7 in [1,2,3,4,5,6]; // var1 equals false 
bool var2 <- 3 in [1::2, 3::4, 5::6]; // var2 equals false 
bool var3 <- 6 in [1::2, 3::4, 5::6]; // var3 equals true 
bool var4 <-  'bc' in 'abcded'; // var4 equals true

See also: contains,


in_degree_of

Possible uses:

  • graph in_degree_of unknown ---> int
  • in_degree_of (graph , unknown) ---> int

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

Special cases:

  • Returns 0 for an isolated vertex (a vertex with no incoming edges).
  • On an undirected graph, both in_degree_of and out_degree_of return the total degree of the vertex (number of incident edges).
  • Returns 0 if the vertex is not present in the graph.

Examples:

int var1 <- graphFromMap in_degree_of (node(3)); // var1 equals 2

See also: degree_of, out_degree_of,


in_edges_of

Possible uses:

  • graph in_edges_of unknown ---> list
  • in_edges_of (graph , unknown) ---> list

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

Examples:

list var1 <- graphFromMap in_edges_of node({12,45}); // var1 equals [LineString]

See also: edge_between, out_edges_of,


incomplete_beta

Possible uses:

  • incomplete_beta (float, float, float) ---> float

Result: Returns the regularized integral of the beta function with arguments a and b, from zero to x.

Examples:

float var0 <- incomplete_beta(2,3,0.9) with_precision(3); // var0 equals 0.996

incomplete_gamma

Possible uses:

  • float incomplete_gamma float ---> float
  • incomplete_gamma (float , float) ---> float

Result: Returns the regularized integral of the Gamma function with argument a to the integration end point x.

Examples:

float var0 <- incomplete_gamma(1,5.3) with_precision(3); // var0 equals 0.995

incomplete_gamma_complement

Possible uses:

  • float incomplete_gamma_complement float ---> float
  • incomplete_gamma_complement (float , float) ---> float

Result: Returns the complemented regularized incomplete Gamma function of the argument a and integration start point x.

Comment: Is the complement to 1 of incomplete_gamma.

Examples:

float var0 <- incomplete_gamma_complement(1,5.3) with_precision(3); // var0 equals 0.005

indented_by

Possible uses:

  • string indented_by int ---> string
  • indented_by (string , int) ---> string

Result: Converts a (possibly multiline) string by indenting it by a number -- specified by the second operand -- of tabulations to the right

Examples:

string var0 <- "my" + indented_by("text", 1); // var0 equals "my	text"

index_by

Possible uses:

  • index_by (string, container, any expression) ---> map

Result: produces a new map from the evaluation of the right-hand operand for each element of the left-hand operand

Special cases:

  • if the left-hand operand is nil, index_by throws an error. If the operation results in duplicate keys, only the first value corresponding to the key is kept

Examples:

map var0 <- [1,2,3,4,5,6,7,8] index_by (each - 1); // var0 equals [0::1, 1::2, 2::3, 3::4, 4::5, 5::6, 6::7, 7::8]

index_of

Possible uses:

  • matrix index_of unknown ---> point
  • index_of (matrix , unknown) ---> point
  • string index_of string ---> int
  • index_of (string , string) ---> int
  • species index_of unknown ---> int
  • index_of (species , unknown) ---> int
  • list index_of unknown ---> int
  • index_of (list , unknown) ---> int
  • map<unknown,unknown> index_of unknown ---> unknown
  • index_of (map<unknown,unknown> , unknown) ---> unknown

Result: the index of the first occurence of the right operand in the left operand container, or -1 if this list does not contain the element

Comment: The definition of index_of and the type of the index depend on the container

Special cases:

  • If the pattern is not found, returns -1.
  • If the pattern is the empty string, returns 0.
  • if the left operator is a species, returns the index of an agent in a species. If the argument is not an agent of this species, returns -1. Use int(agent) instead
  • if the left operand is a map, index_of returns the index of a value or nil if the value is not mapped
  • if the left operand is a matrix, index_of returns the index as a point
point var0 <- matrix([[1,2,3],[4,5,6]]) index_of 4; // var0 equals {1.0,0.0}
  • if both operands are strings, returns the index within the left-hand string of the first occurrence of the given right-hand string
int var1 <- "abcabcabc" index_of "ca"; // var1 equals 2
  • if the left operand is a list, index_of returns the index as an integer
int var2 <- [1,2,3,4,5,6] index_of 4; // var2 equals 3 
int var3 <- [4,2,3,4,5,4] index_of 4; // var3 equals 0

Examples:

unknown var4 <- [1::2, 3::4, 5::6] index_of 4; // var4 equals 3

See also: all_indexes_of, at, last_index_of,


inside

Possible uses:

  • container<unknown,geometry> inside geometry ---> list<geometry>
  • inside (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), covered by the operand (casted as a geometry).

Examples:

list<geometry> var0 <- [ag1, ag2, ag3] inside(self); // var0 equals the agents among ag1, ag2 and ag3 that are covered by the shape of the right-hand argument. 
list<geometry> var1 <- (species1 + species2) inside (self); // var1 equals the agents among species species1 and species2 that are covered by the shape of the right-hand argument.

See also: 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, neighbors_at, neighbors_of, overlapping, partially_overlapping, touching,


int

Possible uses:

  • int (any) ---> int

Result: casts the operand in a int object.


inter

Possible uses:

  • container inter container ---> list
  • inter (container , container) ---> list
  • geometry inter geometry ---> geometry
  • inter (geometry , geometry) ---> geometry

Result: the intersection of the two operands

A geometry resulting from the intersection between the two geometries

Comment: both containers are transformed into sets (so without duplicated element, cf. remove_deplicates operator) before the set intersection is computed.

Special cases:

  • if an operand is a graph, it will be transformed into the set of its nodes
  • Returns nil if one of the operands is nil.
  • Returns an empty geometry (i.e. nil) if the two operands do not overlap.
  • if an operand is a map, it will be transformed into the set of its values
list var0 <- [1::2, 3::4, 5::6] inter [2,4]; // var0 equals [2,4] 
list var1 <- [1::2, 3::4, 5::6] inter [1,3]; // var1 equals []
  • if an operand is a matrix, it will be transformed into the set of the lines
list var2 <- matrix([[3,2,1],[4,5,4]]) inter [3,4]; // var2 equals [3,4]

Examples:

list var3 <- [1,2,3,4,5,6] inter [2,4]; // var3 equals [2,4] 
list var4 <- [1,2,3,4,5,6] inter [0,8]; // var4 equals [] 
geometry var5 <- square(10) inter circle(5); // var5 equals circle(5)

See also: -, +, remove_duplicates, union,


interleave

Possible uses:

  • interleave (container) ---> list

Result: Returns a new list containing the interleaved elements of the containers contained in the operand

Comment: the operand should be a list of lists of elements. The result is a list of elements.

Examples:

list var0 <- interleave([1,2,4,3,5,7,6,8]); // var0 equals [1,2,4,3,5,7,6,8] 
list var1 <- interleave([['e11','e12','e13'],['e21','e22','e23'],['e31','e32','e33']]); // var1 equals ['e11','e21','e31','e12','e22','e32','e13','e23','e33']

internal_integrated_value

Possible uses:

  • any expression internal_integrated_value any expression ---> list
  • internal_integrated_value (any expression , any expression) ---> list

Result: For internal use only. Corresponds to the implementation, for agents, of the access to containers with [index]


intersecting

Same signification as overlapping


intersection

Same signification as inter


intersects

Possible uses:

  • geometry intersects geometry ---> bool
  • intersects (geometry , geometry) ---> bool

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

Special cases:

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

Examples:

bool var0 <- square(5) intersects {10,10}; // var0 equals false

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


inverse

Possible uses:

  • inverse (matrix) ---> matrix<float>

Result: The inverse matrix of the given matrix. If no inverse exists, returns a matrix that has properties that resemble that of an inverse.

Examples:

matrix<float> var0 <- inverse(matrix([[4,3],[3,2]])); // var0 equals matrix([[-2.0,3.0],[3.0,-4.0]])

inverse_distance_weighting

Same signification as IDW


inverse_rotation

Possible uses:

  • inverse_rotation (pair<float,point>) ---> pair<float,point>

Result: The inverse rotation. It is a rotation around the same axis with the opposite angle.

Examples:

pair<float,point> var0 <- inverse_rotation(38.0::{1,1,1}); // var0 equals -38.0::{1,1,1}

See also: rotation_composition, [rotation_composition, normalized_rotation](OperatorsSZ#rotation_composition, normalized_rotation),


is

Possible uses:

  • unknown is any expression ---> bool
  • is (unknown , any expression) ---> bool

Result: Return true if the left operand is an instance of the specified type, false otherwise. Note that this operator only accepts simple types, object types and agent types (e.g., int, float, list, node, etc.). Parametric types such as list are not supported.


is_agent

Possible uses:

  • is_agent (any) ---> bool

Result: Tests whether the operand is a agent file.

See also: agent_file,


is_alpha

Possible uses:

  • is_alpha (string) ---> bool

Result: Returns true if the string is alphabetical

Examples:

bool var0 <- is_alpha("ab"); // var0 equals true

is_alphanum

Possible uses:

  • is_alphanum (string) ---> bool

Result: Returns true if the string is alphanumerical

Examples:

bool var0 <- is_alphanum("a1"); // var0 equals true

is_ascii

Possible uses:

  • is_ascii (string) ---> bool

Result: Returns true if the string contains only ASCII characters

Examples:

bool var0 <- is_ascii("ab"); // var0 equals true

is_csv

Possible uses:

  • is_csv (any) ---> bool

Result: Tests whether the operand is a csv file.

See also: csv_file,


is_dataframe

Possible uses:

  • is_dataframe (any) ---> bool

Result: Tests whether the operand is a dataframe file.

See also: dataframe_file,


is_decimal

Possible uses:

  • is_decimal (string) ---> bool

Result: Returns true if the string contains only decimal characters

Examples:

bool var0 <- is_decimal("12"); // var0 equals true

is_digit

Possible uses:

  • is_digit (string) ---> bool

Result: Returns true if the string contains only digit characters

Examples:

bool var0 <- is_digit("12"); // var0 equals true

is_dxf

Possible uses:

  • is_dxf (any) ---> bool

Result: Tests whether the operand is a dxf file.

See also: dxf_file,


is_error

Possible uses:

  • is_error (any expression) ---> bool

Result: Returns whether or not the argument raises an error when evaluated

Special cases:

  • is_error evaluates the expression in a try-catch manner; if an error is raised, it returns true without propagating the error.
  • is_error(1/0) = true (integer division by zero is an error in GAML).

is_finite

Possible uses:

  • is_finite (float) ---> bool

Result: Returns whether the argument is a finite number or not

Examples:

bool var0 <- is_finite(4.66); // var0 equals true 
bool var1 <- is_finite(#infinity); // var1 equals false

is_gaml

Possible uses:

  • is_gaml (any) ---> bool

Result: Tests whether the operand is a gaml file.

See also: gaml_file,


is_geojson

Possible uses:

  • is_geojson (any) ---> bool

Result: Tests whether the operand is a geojson file.

See also: geojson_file,


is_gif

Possible uses:

  • is_gif (any) ---> bool

Result: Tests whether the operand is a gif file.

See also: gif_file,


is_gml

Possible uses:

  • is_gml (any) ---> bool

Result: Tests whether the operand is a gml file.

See also: gml_file,


is_graph6

Possible uses:

  • is_graph6 (any) ---> bool

Result: Tests whether the operand is a graph6 file.

See also: graph6_file,


is_graphdimacs

Possible uses:

  • is_graphdimacs (any) ---> bool

Result: Tests whether the operand is a graphdimacs file.

See also: graphdimacs_file,


is_graphdot

Possible uses:

  • is_graphdot (any) ---> bool

Result: Tests whether the operand is a graphdot file.

See also: graphdot_file,


is_graphgexf

Possible uses:

  • is_graphgexf (any) ---> bool

Result: Tests whether the operand is a graphgexf file.

See also: graphgexf_file,


is_graphgml

Possible uses:

  • is_graphgml (any) ---> bool

Result: Tests whether the operand is a graphgml file.

See also: graphgml_file,


is_graphml

Possible uses:

  • is_graphml (any) ---> bool

Result: Tests whether the operand is a graphml file.

See also: graphml_file,


is_graphtsplib

Possible uses:

  • is_graphtsplib (any) ---> bool

Result: Tests whether the operand is a graphtsplib file.

See also: graphtsplib_file,


is_grid

Possible uses:

  • is_grid (any) ---> bool

Result: Tests whether the operand is a grid file.

See also: grid_file,


is_image

Possible uses:

  • is_image (any) ---> bool

Result: Tests whether the operand is a image file.

See also: image_file,


is_json

Possible uses:

  • is_json (any) ---> bool

Result: Tests whether the operand is a json file.

See also: json_file,


is_lower

Possible uses:

  • is_lower (string) ---> bool

Result: Returns true if the string is in all lowercase

Examples:

bool var0 <- is_lower("ab"); // var0 equals true

is_number

Possible uses:

  • is_number (string) ---> bool
  • is_number (float) ---> bool

Result: tests whether the operand represents a numerical value

Returns whether the argument is a real number or not

Comment: Note that the symbol . should be used for a float value (a string with , will not be considered as a numeric value). Symbols e and E are also accepted. A hexadecimal value should begin with #.

Examples:

bool var0 <- is_number("test"); // var0 equals false 
bool var1 <- is_number("123.56"); // var1 equals true 
bool var2 <- is_number("-1.2e5"); // var2 equals true 
bool var3 <- is_number("1,2"); // var3 equals false 
bool var4 <- is_number("#12FA"); // var4 equals true 
bool var5 <- is_number(4.66); // var5 equals true 
bool var6 <- is_number(#infinity); // var6 equals true 
bool var7 <- is_number(#nan); // var7 equals false

is_obj

Possible uses:

  • is_obj (any) ---> bool

Result: Tests whether the operand is a obj file.

See also: obj_file,


is_osm

Possible uses:

  • is_osm (any) ---> bool

Result: Tests whether the operand is a osm file.

See also: osm_file,


is_pgm

Possible uses:

  • is_pgm (any) ---> bool

Result: Tests whether the operand is a pgm file.

See also: pgm_file,


is_property

Possible uses:

  • is_property (any) ---> bool

Result: Tests whether the operand is a property file.

See also: property_file,


is_reachable

Possible uses:

  • string is_reachable int ---> bool
  • is_reachable (string , int) ---> bool
  • is_reachable (string, int, int) ---> bool

Result: Returns whether or not the given web address is reachable or not before a time_out time in milliseconds. Uses port 80 (HTTP) by default.

Returns whether or not the given web address is reachable or not before a time_out time in milliseconds

Special cases:

  • Uses port 80 (HTTP) by default for the TCP connection check.
  • Returns false if the host is unreachable, the port is closed, or the DNS lookup fails.
  • A timeout value in milliseconds is passed as the third argument to limit the connection attempt.
  • Returns false if the host is unreachable, the port is closed, or the DNS lookup fails.

Examples:

write sample(is_reachable("www.google.com", 200)); 
write sample(is_reachable("www.google.com", 200));

is_shape

Possible uses:

  • is_shape (any) ---> bool

Result: Tests whether the operand is a shape file.

See also: shape_file,


is_simulation

Possible uses:

  • is_simulation (any) ---> bool

Result: Tests whether the operand is a simulation file.

See also: simulation_file,


is_skill

Possible uses:

  • unknown is_skill string ---> bool
  • is_skill (unknown , string) ---> bool

Result: returns true if the left operand is an agent whose species implements the right-hand skill name


is_svg

Possible uses:

  • is_svg (any) ---> bool

Result: Tests whether the operand is a svg file.

See also: svg_file,


is_text

Possible uses:

  • is_text (any) ---> bool

Result: Tests whether the operand is a text file.

See also: text_file,


is_threeds

Possible uses:

  • is_threeds (any) ---> bool

Result: Tests whether the operand is a threeds file.

See also: threeds_file,


is_upper

Possible uses:

  • is_upper (string) ---> bool

Result: Returns true if the string is in all uppercase

Examples:

bool var0 <- is_upper("AB"); // var0 equals true

is_warning

Possible uses:

  • is_warning (any expression) ---> bool

Result: Returns whether or not the argument raises a warning when evaluated


is_whitespace

Same signification as whitespace


is_xml

Possible uses:

  • is_xml (any) ---> bool

Result: Tests whether the operand is a xml file.

See also: xml_file,


join

Same signification as concatenate

Possible uses:

  • join (dataframe, dataframe, list<string>) ---> dataframe
  • join (dataframe, dataframe, string) ---> dataframe
  • join (dataframe, dataframe, list<string>, string) ---> dataframe

Result: Inner-joins two dataframes on the given list of common key columns.

Inner-joins two dataframes on the given common key column: only the rows whose key matches in both dataframes are kept.

Joins two dataframes on the given key columns using an explicit join type: "inner" (default), "left", "right" or "full".

Special cases:

  • Join two dataframes on two key columns
join(df1, df2, ["country", "year"])
  • Join two dataframes on the 'id' column
join(df_people, df_scores, "id")
  • Left-join two dataframes on 'id' (keeps every row of the left dataframe)
join(df1, df2, ["id"], "left")

See also: +, join, pivot,


json_file

Possible uses:

  • json_file (string) ---> file
  • string json_file map<string,unknown> ---> file
  • json_file (string , map<string,unknown>) ---> file

Result: Constructs a file of type json. Allowed extensions are limited to json

Special cases:

  • json_file(string): This file constructor allows to read a json file
file f <-json_file("file.json");
  • json_file(string,map<string,unknown>): This constructor allows to store a map in a json file (it does not save it). The file can then be saved later using the save statement
file f <-json_file("file.json", map(["var1"::1.0, "var2"::3.0]));

See also: is_json,


k_nearest_neighbors

Possible uses:

  • k_nearest_neighbors (agent, map<agent,unknown>, int) ---> unknown

Result: This operator allows user to find the attribute of an agent basing on its k-nearest agents

Comment: In order to use this operator, users have to create a map which map the agents with one of their attributes (for example color or size,..). In the example below, 'map' is the map that I mention above, 'k' is the number of the nearest agents that we areconsidering

Examples:

unknown var0 <- self k_nearest_neighbors (map,k); // var0 equals this will return the attribute which has highest frequency in the k-nearest neighbors of our agent 

k_spanning_tree_clustering

Possible uses:

  • graph k_spanning_tree_clustering int ---> list
  • k_spanning_tree_clustering (graph , int) ---> list

Result: The algorithm finds a minimum spanning tree T using Prim's algorithm, then executes Kruskal's algorithm only on the edges of T until k trees are formed. The resulting trees are the final clusters.It returns a list of list of vertices and takes as operand the graph and the number of clusters


kappa

Possible uses:

  • kappa (list<unknown>, list<unknown>, list<unknown>) ---> float
  • kappa (list<unknown>, list<unknown>, list<unknown>, list<unknown>) ---> float

Result: kappa indicator for 2 map comparisons: kappa(list_vals1,list_vals2,categories, weights). Reference: Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20.

kappa indicator for 2 map comparisons: kappa(list_vals1,list_vals2,categories). Reference: Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20.

Examples:

float var0 <- kappa(["cat1","cat3","cat2","cat1","cat3"],["cat1","cat3","cat2","cat3","cat1"],["cat1","cat2","cat3"], [1.0, 2.0, 3.0, 1.0, 5.0]); // var0 equals 0.29411764705882354 
kappa([cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2],[cat1,cat2,cat3]) 
float var2 <- kappa([1,3,5,1,5],[1,1,1,1,5],[1,3,5]); // var2 equals 0.3333333333333334 
float var3 <- kappa([1,1,1,1,5],[1,1,1,1,5],[1,3,5]); // var3 equals 1.0

kappa_sim

Possible uses:

  • kappa_sim (list<unknown>, list<unknown>, list<unknown>, list<unknown>) ---> float
  • kappa_sim (list<unknown>, list<unknown>, list<unknown>, list<unknown>, list<unknown>) ---> float

Result: Kappa simulation indicator for 2 map comparisons. Reference: van Vliet, J., Bregt, A.K. & Hagen-Zanker, A. (2011). Revisiting Kappa to account for change in the accuracy assessment of land-use change models, Ecological Modelling 222(8).

Special cases:

  • kappa_sim can be used with an additional weights operand
float var1 <- kappa_sim(["cat1","cat1","cat2","cat2","cat2"],["cat1","cat3","cat2","cat1","cat3"],["cat1","cat3","cat2","cat3","cat1"],["cat1","cat2","cat3"], [1.0, 2.0, 3.0, 1.0, 5.0]); // var1 equals 0.2702702702702703

Examples:

float var0 <- kappa_sim(["cat1","cat1","cat2","cat2","cat2"],["cat1","cat3","cat2","cat1","cat3"],["cat1","cat3","cat2","cat3","cat1"],["cat1","cat2","cat3"]); // var0 equals 0.3333333333333335

kmeans

Possible uses:

  • list kmeans int ---> list<list>
  • kmeans (list , int) ---> list<list>
  • kmeans (list, int, int) ---> list<list>

Result: returns the list of clusters (list of instance indices) computed with the kmeans++ algorithm from the first operand data according to the number of clusters to split the data into (k) and the maximum number of iterations to run the algorithm.(If negative, no maximum will be used) (maxIt). Usage: kmeans(data,k,maxit)

Special cases:

  • The maximum number of (third operand) can be omitted.
list<list> var0 <- kmeans ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],2); // var0 equals [[0,2,3],[1]]

Examples:

list<list> var1 <- kmeans ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],2,10); // var1 equals [[0,2,3],[1]]

kml

Possible uses:

  • kml (any) ---> kml

Result: casts the operand in a kml object.


kurtosis

Possible uses:

  • kurtosis (list) ---> float
  • float kurtosis float ---> float
  • kurtosis (float , float) ---> float

Result: Returns the kurtosis from a moment and a standard deviation

Returns the kurtosis (aka excess) of a list of values (kurtosis = { [n(n+1) / (n -1)(n - 2)(n-3)] sum[(x_i - mean)^4] / std^4 } - [3(n-1)^2 / (n-2)(n-3)])

Special cases:

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

Examples:

float var0 <- kurtosis(3,12) with_precision(4); // var0 equals -2.9999 
float var1 <- kurtosis ([1,2,3,4,5]); // var1 equals -1.200000000000002 
float var2 <- kurtosis([13,2,1,4,1,2]) with_precision(4); // var2 equals 4.8083

label_propagation_clustering

Possible uses:

  • graph label_propagation_clustering int ---> list
  • label_propagation_clustering (graph , int) ---> list

Result: The algorithm is a near linear time algorithm capable of discovering communities in large graphs. It is described in detail in the following: Raghavan, U. N., Albert, R., and Kumara, S. (2007). Near linear time algorithm to detect

  • community structures in large-scale networks. Physical review E, 76(3), 036106.It returns a list of list of vertices and takes as operand the graph and maximal number of iteration

last

Possible uses:

  • last (container<KeyType,ValueType>) ---> ValueType

Result: the last element of the operand

Comment: the last operator behavior depends on the nature of the operand

Special cases:

  • if it is a map, last returns the value of the last pair (in insertion order)
  • if it is a file, last returns the last element of the content of the file (that is also a container)
  • if it is a population, last returns the last agent of the population
  • if it is a graph, last returns a list containing the last edge created
  • if it is a matrix, last returns the element at {length-1,length-1} in the matrix
  • for a matrix of int or float, it will return 0 if the matrix is empty
  • for a matrix of object or geometry, it will return nil if the matrix is empty
  • if it is a list, last returns the last element of the list, or nil if the list is empty
int var0 <- last ([1, 2, 3]); // var0 equals 3

See also: first,


last

Possible uses:

  • last (string) ---> string
  • int last container ---> list
  • last (int , container) ---> list

Result: Returns the nth last elements of the container. If n is greater than the list size, returns the container cast as a list. If it is equal or less than zero, returns an empty list

Special cases:

  • If the container is empty, returns an empty list.
  • If the container is nil, raises a runtime error.
  • If n is greater than the container size, returns all elements as a list.
  • if it is a string, last returns a string composed of its last character, or an empty string if the operand is empty
string var0 <- last ('abce'); // var0 equals 'e'

last_index_of

Possible uses:

  • species last_index_of unknown ---> int
  • last_index_of (species , unknown) ---> int
  • string last_index_of string ---> int
  • last_index_of (string , string) ---> int
  • map<unknown,unknown> last_index_of unknown ---> unknown
  • last_index_of (map<unknown,unknown> , unknown) ---> unknown
  • list last_index_of unknown ---> int
  • last_index_of (list , unknown) ---> int
  • matrix last_index_of unknown ---> point
  • last_index_of (matrix , unknown) ---> point

Result: the index of the last occurence of the right operand in the left operand container

Comment: The definition of last_index_of and the type of the index depend on the container

Special cases:

  • if the left operand is a species, the last index of an agent is the same as its index
  • if both operands are strings, returns the index within the left-hand string of the rightmost occurrence of the given right-hand string
int var0 <- "abcabcabc" last_index_of "ca"; // var0 equals 5
  • if the left operand is a map, last_index_of returns the index as an int (the key of the pair)
unknown var1 <- [1::2, 3::4, 5::4] last_index_of 4; // var1 equals 5
  • if the left operand is a list, last_index_of returns the index as an integer
int var2 <- [1,2,3,4,5,6] last_index_of 4; // var2 equals 3 
int var3 <- [4,2,3,4,5,4] last_index_of 4; // var3 equals 5
  • if the left operand is a matrix, last_index_of returns the index as a point
point var4 <- matrix([[1,2,3],[4,5,4]]) last_index_of 4; // var4 equals {1.0,2.0}

See also: all_indexes_of, at, index_of, last_index_of,


last_of

Same signification as last


last_with

Possible uses:

  • last_with (string, container, any expression) ---> unknown

Result: the last element of the left-hand operand that makes 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 right-hand operand elements.

Special cases:

  • if the left-hand operand is nil, last_with throws an error.
  • If there is no element that satisfies the condition, it returns nil
  • if the left-operand is a map, the keyword each will contain each value
unknown var4 <- [1::2, 3::4, 5::6] last_with (each >= 4); // var4 equals 6 
unknown var5 <- [1::2, 3::4, 5::6].pairs last_with (each.value >= 4); // var5 equals (5::6)

Examples:

int var0 <- [1,2,3,4,5,6,7,8] last_with (each > 3); // var0 equals 8 
unknown var2 <- g2 last_with (length(g2 out_edges_of each) = 0 ); // var2 equals a node 
unknown var3 <- (list(node) last_with (round(node(each).location.x) > 32); // var3 equals node3

See also: first_with, group_by, where,


layout_circle

Possible uses:

  • layout_circle (graph, geometry, bool) ---> graph

Result: layouts a Gama graph on a circle with equidistance between nodes. For now there is no optimization on node ordering.

Special cases:

  • Usage: layoutCircle(graph, bound, shuffle) => graph : the graph to layout, bound : the geometry to display the graph within, shuffle : if true shuffle the nodes, then render same ordering

Examples:

layout_circle(graph, world.shape, false);

layout_force

Possible uses:

  • layout_force (graph, geometry, float, float, int) ---> graph
  • layout_force (graph, geometry, float, float, int, float) ---> graph

Result: layouts a GAMA graph using Force model (in a given spatial bound and given coeff_force, cooling_rate, max_iteration, and equilibirum criterion parameters).

Special cases:

  • usage: layoutForce(graph, bounds, coeff_force, cooling_rate, max_iteration). graph is the graph to which applied the layout; bounds is the shape (geometry) in which the graph should be located; coeff_force is the coefficient used to compute the force, typical value is 0.4; cooling rate is the decreasing coefficient of the temperature, typical value is 0.01; max_iteration is the maximal number of iterationsdistance of displacement for a vertice to be considered as in equilibrium
  • usage: layoutForce(graph, bounds, coeff_force, cooling_rate, max_iteration, equilibirum criterion). graph is the graph to which applied the layout; bounds is the shape (geometry) in which the graph should be located; coeff_force is the coefficien use to compute the force, typical value is 0.4; cooling rate is the decreasing coefficient of the temperature, typical value is 0.01; max_iteration is the maximal number of iterations; equilibirum criterion is the maximaldistance of displacement for a vertice to be considered as in equilibrium

layout_force_FR

Possible uses:

  • layout_force_FR (graph, geometry, float, int) ---> graph

Result: layouts a GAMA graph using Fruchterman and Reingold Force-Directed Placement Algorithm (in a given spatial bound, normalization factor and max_iteration parameters).

Special cases:

  • usage: layoutForce(graph, bounds, normalization_factor, max_iteration, equilibirum criterion). graph is the graph to which applied the layout; bounds is the shape (geometry) in which the graph should be located; normalization_factor is the normalization factor for the optimal distance, typical value is 1.0; max_iteration is the maximal number of iterations

layout_force_FR_indexed

Possible uses:

  • layout_force_FR_indexed (graph, geometry, float, float, int) ---> graph

Result: layouts a GAMA graph using Fruchterman and Reingold Force-Directed Placement Algorithm with The Barnes-Hut indexing technique(in a given spatial bound, theta, normalization factor and max_iteration parameters).

Special cases:

  • usage: layoutForce(graph, bounds, normalization_factor, max_iteration, equilibirum criterion). graph is the graph to which applied the layout; bounds is the shape (geometry) in which the graph should be located; theta value for approximation using the Barnes-Hut technique, typical value is 0.5; normalization_factor is the normalization factor for the optimal distance, typical value is 1.0; max_iteration is the maximal number of iterations

layout_grid

Possible uses:

  • layout_grid (graph, geometry, float) ---> graph

Result: layouts a Gama graph based on a grid latice. usage: layoutForce(graph, bounds, coeff_nb_cells). graph is the graph to which the layout is applied; bounds is the shape (geometry) in which the graph should be located; coeff_nb_cellsthe coefficient for the number of cells to locate the vertices (nb of places = coeff_nb_cells * nb of vertices).

Examples:

layout_grid(graph, world.shape);

length

Possible uses:

  • length (container<KeyType,ValueType>) ---> int

Result: the number of elements contained in the operand

Comment: the length operator behavior depends on the nature of the operand

Special cases:

  • if it is a population, length returns number of agents of the population
  • if it is a graph, length returns the number of vertexes or of edges (depending on the way it was created)
  • if it is a list or a map, length returns the number of elements in the list or map
int var0 <- length([12,13]); // var0 equals 2 
int var1 <- length([]); // var1 equals 0
  • if it is a matrix, length returns the number of cells
int var2 <- length(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var2 equals 6

length

Possible uses:

  • length (string) ---> int

Special cases:

  • if it is a string, length returns the number of characters
int var0 <- length ("I am an agent"); // var0 equals 13

lgamma

Same signification as log_gamma


line

Possible uses:

  • line (container<unknown,geometry>) ---> geometry
  • container<unknown,geometry> line float ---> geometry
  • line (container<unknown,geometry> , float) ---> geometry

Result: A polyline geometry from the given list of points.

Special cases:

  • if the points list operand is nil, returns the point geometry {0,0}
  • if the points list operand is composed of a single point, returns a point geometry.
  • An empty list returns the point geometry {0,0,0}.
  • A single-point list returns a degenerate point geometry (not a line).
  • if a radius is added, the given list of points represented as a cylinder of radius r
geometry var0 <- polyline([{0,0}, {0,10}, {10,10}, {10,0}],0.2); // var0 equals a polyline geometry composed of the 4 points.

Examples:

geometry var1 <- polyline([{0,0}, {0,10}, {10,10}]); // var1 equals a polyline geometry composed of the 3 points. 
geometry var2 <- line([{10,10}, {10,0}]); // var2 equals a line from 2 points. 
string var3 <- string(polyline([{0,0}, {0,10}, {10,10}])+line([{10,10}, {10,0}])); // var3 equals "MULTILINESTRING ((0 0, 0 10, 10 10), (10 10, 10 0))"

See also: arc, around, box, circle, cone, cone3D, cross, cube, curve, cylinder, ellipse, elliptical_arc, geometry_collection, hexagon, link, norm, point, polygon, polygone, polyhedron, pyramid, rectangle, sphere, square, squircle, teapot, triangle,


link

Possible uses:

  • geometry link geometry ---> geometry
  • link (geometry , geometry) ---> geometry

Result: A dynamic line geometry between the location of the two operands

Comment: The geometry of the link is a line between the locations of the two operands, which is built and maintained dynamically

Special cases:

  • if one of the operands is nil, link returns a point geometry at the location of the other. If both are null, it returns a point geometry at {0,0}

Examples:

geometry var0 <- link (geom1,geom2); // var0 equals a link geometry between geom1 and geom2.

See also: arc, around, box, circle, cone, cone3D, cross, cube, curve, cylinder, ellipse, elliptical_arc, geometry_collection, hexagon, line, norm, plan, point, polygon, polyhedron, polyline, pyramid, rectangle, sphere, square, squircle, teapot, triangle,


list

Possible uses:

  • list (any) ---> list

Result: casts the operand in a list object.


list_with

Possible uses:

  • list_with (string, int, any expression) ---> list

Result: creates a list with a size provided by the first operand, and filled with the evaluation of the second operand. As with any iterator, the value of the current index can be retrieved with each or explicitly set using the (x: ... syntax

Comment: Note that the first operand should be positive, otherwise an empty list is returned, and that the second one is evaluated for each position in the list.

Examples:

list var0 <- list_with(5,2); // var0 equals [2,2,2,2,2]

See also: list,


ln

Possible uses:

  • ln (float) ---> float
  • ln (int) ---> float

Result: Returns the natural logarithm (base e) of the operand.

Special cases:

  • an exception is raised if the operand is less than zero.
  • ln(1) = 0.0
  • ln(e) = 1.0
  • If the operand is 0 or negative, a runtime warning is raised.
  • If the operand is 0 or negative, a runtime warning is raised.

Examples:

float var0 <- ln(exp(1)); // var0 equals 1.0 
float var1 <- ln(1); // var1 equals 0.0 
float var2 <- ln(10); // var2 equals 2.302585092994046

See also: exp, log,


load_shortest_paths

Possible uses:

  • graph load_shortest_paths matrix ---> graph
  • load_shortest_paths (graph , matrix) ---> graph

Result: put in the graph cache the computed shortest paths contained in the matrix (rows: source, columns: target)

Examples:

graph var0 <- load_shortest_paths(shortest_paths_matrix); // var0 equals return my_graph with all the shortest paths computed

load_sql

Possible uses:

  • load_sql (string, string, string, string) ---> dataframe

Result: Runs a SQL query on a database via JDBC and returns the result as a dataframe. Arguments: the JDBC URL, the user, the password, and the SQL query. Pass empty strings for user/password if the database does not require credentials. The corresponding JDBC driver must be available on the classpath.

Special cases:

  • Run a SQL query on a PostgreSQL database
dataframe df <- load_sql("jdbc:postgresql://localhost:5432/mydb", "user", "pwd", "SELECT name, age FROM people WHERE age > 18");

See also: load_table, save_table,


load_sub_model

Possible uses:

  • string load_sub_model string ---> agent
  • load_sub_model (string , string) ---> agent

Result: Load a submodel

Comment: loaded submodel


load_table

Possible uses:

  • load_table (string, string, string, string) ---> dataframe

Result: Loads a whole database table into a dataframe via JDBC. Arguments: the JDBC URL, the user, the password, and the table name. Pass empty strings for user/password if the database does not require credentials. The corresponding JDBC driver must be available on the classpath.

Special cases:

  • Load a PostgreSQL table
dataframe df <- load_table("jdbc:postgresql://localhost:5432/mydb", "user", "pwd", "people");

See also: load_sql, save_table,


log

Possible uses:

  • log (int) ---> float
  • log (float) ---> float
  • float log float ---> float
  • log (float , float) ---> float
  • float log int ---> float
  • log (float , int) ---> float
  • int log float ---> float
  • log (int , float) ---> float
  • int log int ---> float
  • log (int , int) ---> float

Result: Returns the logarithm (base 10) of the operand.

Special cases:

  • If the operand is 0 or negative, a runtime warning is raised.
  • an exception is raised if the operand is equals or less than zero.
  • log(1) = 0.0
  • If the operand is 0 or negative, a runtime warning is raised.
  • If x is 0 or negative, a runtime warning is raised.
  • If b equals 1, the result is ±Infinity (undefined).

Examples:

float var0 <- log(1); // var0 equals 0.0 
float var1 <- log(10); // var1 equals 1.0 
float var2 <- log(10); // var2 equals 1.0 
float var3 <- log(1); // var3 equals 0.0 
float var4 <- log(100); // var4 equals 2.0 
float var5 <- log(100.0, 100.0); // var5 equals 1.0 
float var6 <- log(100.0, 100); // var6 equals 1.0 
float var7 <- log(100, 100.0); // var7 equals 1.0 
float var8 <- log(100, 100); // var8 equals 1.0 
float var9 <- log(8, 2); // var9 equals 3.0 
float var10 <- log(1, 10); // var10 equals 0.0

See also: ln,


log_gamma

Possible uses:

  • log_gamma (float) ---> float

Result: Returns the log of the value of the Gamma function at x.

Examples:

float var0 <- log_gamma(0.6) with_precision(4); // var0 equals 0.3982

lognormal_density

Possible uses:

  • lognormal_density (float, float, float) ---> float

Result: lognormal_density(x,shape,scale) returns the probability density function (PDF) at the specified point x of the logNormal distribution with the given shape and scale.

Examples:

float var0 <- lognormal_density(1,2,3) ; // var0 equals 0.731

See also: binomial, exp_density, gamma_density, gamma_rnd, gauss_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_density, weibull_rnd,


lognormal_rnd

Possible uses:

  • float lognormal_rnd float ---> float
  • lognormal_rnd (float , float) ---> float

Result: returns a random value from a Log-Normal distribution with specified values of the expected value (or mean) of the variable's natural logarithm (shape) and the standard deviation of the variable's natural logarithm (scale) parameters. See https://en.wikipedia.org/wiki/Log-normal_distribution for more details.

Examples:

float var0 <- lognormal_rnd(2,3); // var0 equals 0.731

See also: binomial, exp_density, exp_rnd, gamma_density, gamma_rnd, gauss_rnd, lognormal_trunc_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_density, weibull_rnd,


lognormal_trunc_rnd

Possible uses:

  • lognormal_trunc_rnd (float, float, float, bool) ---> float
  • lognormal_trunc_rnd (float, float, float, float) ---> float

Result: returns a random value from a truncated Log-Normal distribution (in a range or given only one boundary) with specified values of the shape (alpha) and scale (beta) parameters. See https://en.wikipedia.org/wiki/Log-normal_distribution for more details.

Special cases:

  • when 1 float and a boolean (isMax) operands are specified, the float value represents the single boundary (max if the boolean is true, min otherwise),
lognormal_trunc_rnd(2,3,5,true)
  • when 2 float operands are specified, they are taken as mininimum and maximum values for the result
lognormal_trunc_rnd(2,3,0,5)

See also: gamma_trunc_rnd, lognormal_rnd, truncated_gauss, weibull_trunc_rnd,


lower_case

Possible uses:

  • lower_case (string) ---> string

Result: Converts all of the characters in the string operand to lower case

Examples:

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

See also: capitalize, upper_case,


main_connected_component

Possible uses:

  • main_connected_component (graph) ---> graph

Result: returns the sub-graph corresponding to the main connected components of the graph

Examples:

graph var0 <- main_connected_component(my_graph); // var0 equals the sub-graph corresponding to the main connected components of the graph

See also: connected_components_of,


map

Possible uses:

  • map (any) ---> map

Result: casts the operand in a map object.


map_with

Possible uses:

  • map_with (string, int, any expression) ---> map

Result: creates a map with a size provided by the first operand, and filled with the keys and values computed by the second pair operand. As any iterator, the second operand can make use of the index (obtained with each or explicitly set using the (x: ... syntax)

Comment: Note that the first operand should be positive, otherwise an empty map is returned, and that the second is reevaluated for each new pair in the map.

See also: map,


masked_by

Possible uses:

  • geometry masked_by container<unknown,geometry> ---> geometry
  • masked_by (geometry , container<unknown,geometry>) ---> geometry
  • masked_by (geometry, container<unknown,geometry>, int) ---> geometry

Examples:

geometry var0 <- perception_geom masked_by obstacle_list; // var0 equals the geometry representing the part of perception_geom visible from the agent position considering the list of obstacles obstacle_list. 
geometry var1 <- perception_geom masked_by obstacle_list; // var1 equals the geometry representing the part of perception_geom visible from the agent position considering the list of obstacles obstacle_list.

matrix

Possible uses:

  • matrix (any) ---> matrix

Result: casts the operand in a matrix object.


matrix

Possible uses:

  • matrix (image) ---> matrix

Result: Returns the matrix value of the image passed in parameter, where each pixel is represented by the RGB int value. The dimensions of the matrix are those of the image.


matrix_with

Possible uses:

  • matrix_with (string, point, any expression) ---> matrix

Result: creates a matrix with a size provided by the first operand, and filled with the second operand. The given expression, unless constant, is evaluated for each cell. As in any iterator, the value of 'each' represents the index of the current cell (a point (col, row)) and can be retrieved using 'each' or explicitly using the '(:x...' syntax

Comment: Note that both components of the right operand point should be positive, otherwise an exception is raised.

See also: as_matrix, matrix,


max

Possible uses:

  • max (container) ---> unknown

Result: the maximum element found in the operand

Comment: the max operator behavior depends on the nature of the operand

Special cases:

  • if it is a population of a list of other type: max transforms all elements into integer and returns the maximum of them
  • if it is a map, max returns the maximum among the list of all elements value
  • if it is a file, max returns the maximum of the content of the file (that is also a container)
  • if it is a graph, max returns the maximum of the list of the elements of the graph (that can be the list of edges or vertexes depending on the graph)
  • if it is a matrix of int, float or object, max returns the maximum of all the numerical elements (thus all elements for integer and float matrices)
  • if it is a matrix of geometry, max returns the maximum of the list of the geometries
  • if it is a matrix of another type, max returns the maximum of the elements transformed into float
  • if it is a list of int of float, max returns the maximum of all the elements
unknown var0 <- max ([100, 23.2, 34.5]); // var0 equals 100.0
  • if it is a list of points: max returns the maximum of all points as a point (i.e. the point with the greatest coordinate on the x-axis, in case of equality the point with the greatest coordinate on the y-axis is chosen. If all the points are equal, the first one is returned. )
unknown var1 <- max([{1.0,3.0},{3.0,5.0},{9.0,1.0},{7.0,8.0}]); // var1 equals {9.0,1.0}

See also: min,


max_flow_between

Possible uses:

  • max_flow_between (graph, unknown, unknown) ---> map<unknown,float>

Result: The max flow (map<edge,flow> in a graph between the source and the sink using Edmonds-Karp algorithm

Examples:

max_flow_between(my_graph, vertice1, vertice2)

max_of

Possible uses:

  • max_of (string, container, any expression) ---> unknown

Result: the maximum value of the right-hand expression evaluated on each of the elements of the left-hand operand

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

Special cases:

  • As of GAMA 1.6, if the left-hand operand is nil or empty, max_of throws an error
  • if the left-operand is a map, the keyword each will contain each value
unknown var4 <- [1::2, 3::4, 5::6] max_of (each + 3); // var4 equals 9

Examples:

unknown var0 <- [1,2,4,3,5,7,6,8] max_of (each * 100 ); // var0 equals 800 
graph g2 <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); 
unknown var2 <- g2.vertices max_of (g2 degree_of( each )); // var2 equals 2 
unknown var3 <- (list(node) max_of (round(node(each).location.x)); // var3 equals 96

See also: mean_of, min_of, product_of, variance_of,


maximal_cliques_of

Possible uses:

  • maximal_cliques_of (graph) ---> list<list>

Result: returns the maximal cliques of a graph using the Bron-Kerbosch clique detection algorithm: A clique is maximal if it is impossible to enlarge it by adding another vertex from the graph. Note that a maximal clique is not necessarily the biggest clique in the graph.

Special cases:

  • On an empty graph (no vertices), returns an empty list.
  • Every isolated vertex (degree 0) is itself a clique of size 1 and will appear as a singleton list in the result.

Examples:

graph my_graph <- graph([]); 
list<list> var1 <- maximal_cliques_of (my_graph); // var1 equals the list of all the maximal cliques as list

See also: biggest_cliques_of,


mean

Possible uses:

  • mean (container) ---> unknown

Result: the mean of all the elements of the operand

Comment: the elements of the operand are summed (see sum for more details about the sum of container elements ) and then the sum value is divided by the number of elements.

Special cases:

  • If the container contains points, the result will be a point. If the container contains rgb values, the result will be a rgb color
  • If the container is empty, the behavior depends on the element type: the sum step may raise a runtime error for untyped empty containers.
  • For numeric elements (int or float), the result is always a float.

Examples:

unknown var0 <- mean ([4.5, 3.5, 5.5, 7.0]); // var0 equals 5.125 

See also: sum,


mean_deviation

Possible uses:

  • mean_deviation (container) ---> float

Result: the deviation from the mean of all the elements of the operand. See Mean_deviation for more details.

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

Examples:

float var0 <- mean_deviation ([4.5, 3.5, 5.5, 7.0]); // var0 equals 1.125

See also: mean, standard_deviation,


mean_of

Possible uses:

  • mean_of (string, container, any expression) ---> unknown

Result: the mean of the right-hand expression evaluated on each of the elements of the left-hand operand

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

Special cases:

  • if the left-operand is a map, the keyword each will contain each value
unknown var1 <- [1::2, 3::4, 5::6] mean_of (each); // var1 equals 4

Examples:

unknown var0 <- [1,2] mean_of (each * 10 ); // var0 equals 15

See also: max_of, min_of, product_of, sum_of,


median

Possible uses:

  • median (container) ---> unknown

Result: the median of all the elements of the operand.

Special cases:

  • if the container contains points, the result will be a point. If the container contains rgb values, the result will be a rgb color

Examples:

unknown var0 <- median ([4.5, 3.5, 5.5, 3.4, 7.0]); // var0 equals 4.5

See also: geometric_mean, harmonic_mean, mean, variance,


mental_state

Possible uses:

  • mental_state (any) ---> mental_state

Result: casts the operand in a mental_state object.


message

Possible uses:

  • message (any) ---> message

Result: casts the operand in a message object.


milliseconds_between

Possible uses:

  • date milliseconds_between date ---> float
  • milliseconds_between (date , date) ---> float

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

Special cases:

  • If both dates are equal, returns 0.
  • If date1 is after date2, returns a negative value.

Examples:

float var0 <- milliseconds_between(date('2000-01-01'), date('2000-02-01')); // var0 equals 2.6784E9

min

Possible uses:

  • min (container) ---> unknown

Result: the minimum element found in the operand.

Comment: the min operator behavior depends on the nature of the operand

Special cases:

  • if it is a list of points: min returns the minimum of all points as a point (i.e. the point with the smallest coordinate on the x-axis, in case of equality the point with the smallest coordinate on the y-axis is chosen. If all the points are equal, the first one is returned. )
  • if it is a population of a list of other types: min transforms all elements into integer and returns the minimum of them
  • if it is a map, min returns the minimum among the list of all elements value
  • if it is a file, min returns the minimum of the content of the file (that is also a container)
  • if it is a graph, min returns the minimum of the list of the elements of the graph (that can be the list of edges or vertexes depending on the graph)
  • if it is a matrix of int, float or object, min returns the minimum of all the numerical elements (thus all elements for integer and float matrices)
  • if it is a matrix of geometry, min returns the minimum of the list of the geometries
  • if it is a matrix of another type, min returns the minimum of the elements transformed into float
  • if it is a list of int or float: min returns the minimum of all the elements
unknown var0 <- min ([100, 23.2, 34.5]); // var0 equals 23.2

See also: max,


min_of

Possible uses:

  • min_of (string, container, any expression) ---> unknown

Result: the minimum value of the right-hand expression evaluated on each of the elements of the left-hand operand

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

Special cases:

  • if the left-hand operand is nil or empty, min_of throws an error
  • if the left-operand is a map, the keyword each will contain each value
unknown var4 <- [1::2, 3::4, 5::6] min_of (each + 3); // var4 equals 5

Examples:

unknown var0 <- [1,2,4,3,5,7,6,8] min_of (each * 100 ); // var0 equals 100 
graph g2 <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); 
unknown var2 <- g2 min_of (length(g2 out_edges_of each) ); // var2 equals 0 
unknown var3 <- (list(node) min_of (round(node(each).location.x)); // var3 equals 4

See also: max_of, mean_of, product_of, variance_of,


minus_days

Possible uses:

  • date minus_days int ---> date
  • minus_days (date , int) ---> date

Result: Subtract a given number of days from a date

Examples:

date var0 <- date('2000-01-01') minus_days 20; // var0 equals date('1999-12-12')

minus_hours

Possible uses:

  • date minus_hours int ---> date
  • minus_hours (date , int) ---> date

Result: Remove a given number of hours from a date

Examples:

// equivalent to date1 - 15 #h 
date var1 <- date('2000-01-01') minus_hours 15 ; // var1 equals date('1999-12-31 09:00:00')

minus_minutes

Possible uses:

  • date minus_minutes int ---> date
  • minus_minutes (date , int) ---> date

Result: Subtract a given number of minutes from a date

Examples:

// date('2000-01-01') to date1 - 5#mn 
date var1 <- date('2000-01-01') minus_minutes 5 ; // var1 equals date('1999-12-31 23:55:00')

minus_months

Possible uses:

  • date minus_months int ---> date
  • minus_months (date , int) ---> date

Result: Subtract a given number of months from a date

Examples:

date var0 <- date('2000-01-01') minus_months 5; // var0 equals date('1999-08-01')

minus_ms

Possible uses:

  • date minus_ms int ---> date
  • minus_ms (date , int) ---> date

Result: Remove a given number of milliseconds from a date

Examples:

// equivalent to date1 - 15 #ms 
date var1 <- date('2000-01-01') minus_ms 1000 ; // var1 equals date('1999-12-31 23:59:59')

minus_seconds

Same signification as -


minus_weeks

Possible uses:

  • date minus_weeks int ---> date
  • minus_weeks (date , int) ---> date

Result: Subtract a given number of weeks from a date

Examples:

date var0 <- date('2000-01-01') minus_weeks 15; // var0 equals date('1999-09-18')

minus_years

Possible uses:

  • date minus_years int ---> date
  • minus_years (date , int) ---> date

Result: Subtract a given number of year from a date

Examples:

date var0 <- date('2000-01-01') minus_years 3; // var0 equals date('1997-01-01')

mod

Possible uses:

  • int mod int ---> int
  • mod (int , int) ---> int

Result: Returns the remainder of the integer division of the left-hand operand by the right-hand operand.

Special cases:

  • if operands are float, they are truncated
  • if the right-hand operand is equal to zero, raises an exception.
  • For a negative dividend, the result is negative: (-7) mod 3 = -1.
  • If the right-hand operand is equal to zero, a runtime exception is raised.

Examples:

int var0 <- 40 mod 3; // var0 equals 1 
int var1 <- (-7) mod 3; // var1 equals -1 
int var2 <- 7 mod 3; // var2 equals 1

See also: div,


moment

Possible uses:

  • moment (container, int, float) ---> float

Result: Returns the moment of k-th order with constant c of a data sequence

Examples:

float var0 <- moment([13,2,1,4,1,2], 2, 1.2) with_precision(4); // var0 equals 24.74

months_between

Possible uses:

  • date months_between date ---> int
  • months_between (date , date) ---> int

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

Special cases:

  • If both dates are equal, returns 0.
  • If date1 is after date2, returns a negative value.

Examples:

int var0 <- months_between(date('2000-01-01'), date('2000-02-01')); // var0 equals 1

moran

Possible uses:

  • list<float> moran matrix<float> ---> float
  • moran (list<float> , matrix<float>) ---> float

Special cases:

  • return the Moran Index of the given list of interest points (list of floats) and the weight matrix (matrix of float)
float var0 <- moran([1.0, 0.5, 2.0], weight_matrix); // var0 equals the Moran index is computed

morris_analysis

Possible uses:

  • morris_analysis (unknown, int, int) ---> string

Result: Return a string containing the Report of the morris analysis for the corresponding data (path, map or matrix)


mul

Possible uses:

  • mul (container) ---> unknown

Result: the product of all the elements of the operand

Comment: the mul operator behavior depends on the nature of the operand

Special cases:

  • if it is a list of points: mul returns the product of all points as a point (each coordinate is the product of the corresponding coordinate of each element)
  • if it is a list of other types: mul transforms all elements into integer and multiplies them
  • if it is a map, mul returns the product of the value of all elements
  • if it is a file, mul returns the product of the content of the file (that is also a container)
  • if it is a graph, mul returns the product of the list of the elements of the graph (that can be the list of edges or vertexes depending on the graph)
  • if it is a matrix of int, float or object, mul returns the product of all the numerical elements (thus all elements for integer and float matrices)
  • if it is a matrix of geometry, mul returns the product of the list of the geometries
  • if it is a matrix of other types: mul transforms all elements into float and multiplies them
  • if it is a list of int or float: mul returns the product of all the elements
unknown var0 <- mul ([100, 23.2, 34.5]); // var0 equals 80040.0

See also: sum,


multi_anova

Possible uses:

  • multi_anova (list<float>, list<unknown>, list<unknown>) ---> gama.extension.stats.analysis.GamaAnova

Result: Performs a two-way ANOVA test with interactions on a response variable and two factors. Uses Type III Sum of Squares (orthogonal to order).

Examples:

multi_anova([1.0, 2.0, 5.0, 6.0], ['a', 'a', 'b', 'b'], ['x', 'y', 'x', 'y'])

nb_cycles

Possible uses:

  • nb_cycles (graph) ---> int

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

Examples:

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

See also: alpha_index, beta_index, connected_components_of, connectivity_index, gamma_index,


neighbors_at

Possible uses:

  • geometry neighbors_at float ---> list
  • neighbors_at (geometry , float) ---> list

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

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

Examples:

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

See also: agent_closest_to, agent_farthest_to, agents_at_distance, agents_inside, agents_overlapping, at_distance, closest_to, covering, crossing, farthest_to, inside, neighbors_of, overlapping, partially_overlapping, touching,


neighbors_of

Possible uses:

  • graph neighbors_of unknown ---> list
  • neighbors_of (graph , unknown) ---> list
  • topology neighbors_of agent ---> list
  • neighbors_of (topology , agent) ---> list
  • field neighbors_of point ---> list<point>
  • neighbors_of (field , point) ---> list<point>
  • neighbors_of (topology, geometry, float) ---> list

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

Special cases:

  • Returns an empty list for an isolated vertex (a vertex with no incident edges).
  • Returns an empty list if the vertex is not present in the graph.
  • On a directed graph, returns all vertices connected by any edge (both incoming and outgoing), i.e. the union of predecessors and successors.
  • Returns an empty list if no neighbors are found within the default distance of 1.
  • The calling agent itself is excluded from the results.
  • Returns an empty list if no neighbors are found within the specified distance.
  • The calling agent itself is excluded from the results when the second argument is an agent.
  • a list, containing all the agents of the same species than the left argument (if it is an agent) located at a distance inferior or equal to the third argument to the second argument (agent, geometry or point) considering the first operand topology.
list var3 <- neighbors_of (topology(self), self,10); // var3 equals all the agents located at a distance lower or equal to 10 to the agent applying the operator considering its topology.

Examples:

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

See also: agent_closest_to, agent_farthest_to, agents_at_distance, agents_inside, agents_overlapping, at_distance, closest_to, covering, crossing, farthest_to, inside, neighbors_at, overlapping, partially_overlapping, predecessors_of, successors_of, touching,


new_emotion

Possible uses:

  • new_emotion (string) ---> emotion
  • string new_emotion predicate ---> emotion
  • new_emotion (string , predicate) ---> emotion
  • string new_emotion agent ---> emotion
  • new_emotion (string , agent) ---> emotion
  • string new_emotion float ---> emotion
  • new_emotion (string , float) ---> emotion
  • new_emotion (string, float, predicate) ---> emotion
  • new_emotion (string, float, float) ---> emotion
  • new_emotion (string, predicate, agent) ---> emotion
  • new_emotion (string, float, agent) ---> emotion
  • new_emotion (string, float, predicate, agent) ---> emotion
  • new_emotion (string, float, float, agent) ---> emotion
  • new_emotion (string, float, predicate, float) ---> emotion
  • new_emotion (string, float, predicate, float, agent) ---> emotion

Result: a new emotion with the given properties (at least its name, and eventually intensity, parameters...)

Special cases:

  • Various combinations are possible to create the emotion: (name,intensity,about), (name,about,cause), (name,intensity,cause)...
new_emotion("joy",12.3,eatFood) 
new_emotion("joy",eatFood,agent1) 
new_emotion("joy",12.3,agent1)
  • a new emotion with a given name and the predicate it is about
new_emotion("joy",estFood) 
new_emotion("joy",agent1)
  • A decay value value can be added to define a new emotion.
new_emotion("joy",12.3,4.0)
  • a new emotion with a given name and the agent which has caused this emotion
new_emotion("joy",agent1)
  • a new emotion with a name and an initial intensity:
new_emotion("joy",12.3)

Examples:

new_emotion("joy",12.3,eatFood,agent1) 
emotion("joy", 12.3, 4, agent1) 
new_emotion("joy") 
new_emotion("joy",12.3,eatFood,4.0) 
emotion("joy",12.3,eatFood,4,agent1)

new_folder

Possible uses:

  • new_folder (string) ---> gama.api.types.file.GamaFolderFile

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

Special cases:

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

Examples:

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

See also: directory, file, folder, folder_exists,


new_mental_state

Possible uses:

  • new_mental_state (string) ---> mental_state
  • string new_mental_state mental_state ---> mental_state
  • new_mental_state (string , mental_state) ---> mental_state
  • string new_mental_state predicate ---> mental_state
  • new_mental_state (string , predicate) ---> mental_state
  • string new_mental_state emotion ---> mental_state
  • new_mental_state (string , emotion) ---> mental_state
  • new_mental_state (string, emotion, agent) ---> mental_state
  • new_mental_state (string, predicate, float) ---> mental_state
  • new_mental_state (string, mental_state, int) ---> mental_state
  • new_mental_state (string, predicate, int) ---> mental_state
  • new_mental_state (string, emotion, float) ---> mental_state
  • new_mental_state (string, predicate, agent) ---> mental_state
  • new_mental_state (string, emotion, int) ---> mental_state
  • new_mental_state (string, mental_state, float) ---> mental_state
  • new_mental_state (string, mental_state, agent) ---> mental_state
  • new_mental_state (string, mental_state, float, int) ---> mental_state
  • new_mental_state (string, emotion, float, agent) ---> mental_state
  • new_mental_state (string, emotion, int, agent) ---> mental_state
  • new_mental_state (string, predicate, int, agent) ---> mental_state
  • new_mental_state (string, predicate, float, agent) ---> mental_state
  • new_mental_state (string, mental_state, int, agent) ---> mental_state
  • new_mental_state (string, predicate, float, int) ---> mental_state
  • new_mental_state (string, emotion, float, int) ---> mental_state
  • new_mental_state (string, mental_state, float, agent) ---> mental_state
  • new_mental_state (string, predicate, float, int, agent) ---> mental_state
  • new_mental_state (string, mental_state, float, int, agent) ---> mental_state
  • new_mental_state (string, emotion, float, int, agent) ---> mental_state

Result: creates a new mental state with a given modality (e.g. belief or desire) and various properties (a predicate it is about, a strength, a lifetime, an ower agent and an emotion it is about

Examples:

new_mental_state("belief", mental_state1, 12.3, 10) 
new_mental_state("belief", my_joy, agent1) 
new_mental_state("belief", raining, 0.5) 
new_mental_state("belief",raining, 12.3, 10, agent1) 
new_mental_state("belief", mental_state1) 
new_mental_state("belief", my_joy, 12.3, agent1) 
new_mental_state("belief", my_joy, 10, agent1) 
new_mental_state("belief", mental_state1, 12.3, 10, agent1) 
new_mental_state("belief", mental_state1, 10) 
new_mental_state("belief", raining, 10, agent1) 
new_mental_state("belief", raining, 10) 
new_mental_state("belief", my_joy, 12.3) 
new_mental_state("belief", raining) 
new_mental_state("belief", raining, agent1) 
new_mental_state("belief", raining, 12.3, agent1) 
new_mental_state("belief",  my_joy, 10) 
new_mental_state("belief", mental_state1, 10, agent1) 
new_mental_state("belief", mental_state1, 12.3) 
new_mental_state("belief") 
new_mental_state("belief", mental_state1, agent1) 
new_mental_state("belief", raining, 12.4, 10) 
new_mental_state("belief", my_joy, 12.3, 10) 
new_mental_state("belief", mental_state1, 12.2, agent1) 
new_mental_state("belief", my_joy, 12.3, 10, agent1) 
new_mental_state("belief", my_joy)

new_predicate

Possible uses:

  • new_predicate (string) ---> predicate
  • string new_predicate agent ---> predicate
  • new_predicate (string , agent) ---> predicate
  • string new_predicate map ---> predicate
  • new_predicate (string , map) ---> predicate
  • string new_predicate bool ---> predicate
  • new_predicate (string , bool) ---> predicate
  • new_predicate (string, map, agent) ---> predicate
  • new_predicate (string, map, bool) ---> predicate
  • new_predicate (string, map, bool, agent) ---> predicate

Result: creates a new predicate with a given name and adidtional properties (values, agent causing the predicate, whether it is true...)

Examples:

new_predicate("people to meet", ["time"::10], true, agentA) 
new_predicate("people to meet", agent1) 
new_predicate("people to meet", map(["val1"::23]) ) 
new_predicate("people to meet", ["time"::10], agentA) 
new_predicate("people to meet") 
new_predicate("people to meet", ["time"::10], true) 
new_predicate("hasWater", true)

new_social_link

Possible uses:

  • new_social_link (agent) ---> social_link
  • new_social_link (agent, float, float, float, float) ---> social_link

Result: creates a new social link with another agent (eventually given additional parameters such as the appreciation, dominance, solidarity, and familiarity values).

Examples:

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

node

Possible uses:

  • node (unknown) ---> unknown
  • unknown node float ---> unknown
  • node (unknown , float) ---> unknown

Result: Allows to create a wrapper (of type unknown) that wraps an actual object and indicates it should be considered as a node of a graph. The second (optional) parameter indicates which weight the node should have in the graph

Comment: Useful only in graph-related operations (addition, removal of nodes, creation of graphs)


nodes

Possible uses:

  • nodes (container) ---> container

Result: Allows to create a wrapper (of type list) that wraps a list of objects and indicates they should be considered as nodes of a graph


none_matches

Possible uses:

  • none_matches (string, container, any expression) ---> bool

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

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, none_matches throws an error.
  • If the left-hand operand is empty, none_matches returns true.

Examples:

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

See also: all_match, count, one_matches,


none_verifies

Same signification as none_matches


norm

Possible uses:

  • norm (point) ---> float

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

Examples:

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

Norm

Possible uses:

  • Norm (any) ---> Norm

Result: casts the operand in a Norm object.


normal_area

Possible uses:

  • normal_area (float, float, float) ---> float

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

Examples:

float var0 <- normal_area(0.9,0,1) with_precision(3); // var0 equals 0.816

normal_density

Possible uses:

  • normal_density (float, float, float) ---> float

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

Examples:

float var0 <- (normal_density(2,1,1)*100) with_precision 2; // var0 equals 24.2

normal_inverse

Possible uses:

  • normal_inverse (float, float, float) ---> float

Result: Returns the x in the normal distribution with the given mean and standard deviation, to the left of which lies the given area. normal.

Examples:

float var0 <- normal_inverse(0.98,0,1) with_precision(2); // var0 equals 2.05

normalized_rotation

Possible uses:

  • normalized_rotation (pair) ---> pair<float,point>

Result: The rotation normalized according to Euler formalism with a positive angle, such that each rotation has a unique set of parameters (positive angle, normalize axis rotation).

Examples:

pair<float,point> var0 <- normalized_rotation(-38.0::{1,1,1}); // var0 equals 38.0::{-0.5773502691896258,-0.5773502691896258,-0.5773502691896258}

See also: [rotation_composition, inverse_rotation](OperatorsSZ#rotation_composition, inverse_rotation),


not

Same signification as !


not

Possible uses:

  • not (predicate) ---> predicate

Result: create a new predicate with the inverse truth value

Examples:

not predicate1

obj_file

Possible uses:

  • obj_file (string) ---> file
  • string obj_file pair<float,point> ---> file
  • obj_file (string , pair<float,point>) ---> file
  • string obj_file string ---> file
  • obj_file (string , string) ---> file
  • obj_file (string, string, pair<float,point>) ---> file

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

Special cases:

  • obj_file(string): This file constructor allows to read an obj file. The associated mlt file have to have the same name as the file to be read.
file f <- obj_file("file.obj");
  • obj_file(string,pair<float,point>): This file constructor allows to read an obj file and apply an init rotation to it. The rotationis a pair angle::rotation vector. The associated mlt file have to have the same name as the file to be read.
file f <- obj_file("file.obj", 90.0::{-1,0,0});
  • obj_file(string,string): This file constructor allows to read an obj file, using a specific mlt file
file f <- obj_file("file.obj","file.mlt");
  • obj_file(string,string,pair<float,point>): This file constructor allows to read an obj file, using a specific mlt file, and apply an init rotation to it. The rotationis a pair angle::rotation vector
file f <- obj_file("file.obj","file.mlt", 90.0::{-1,0,0});

See also: is_obj,


object

Possible uses:

  • object (any) ---> object

Result: casts the operand in a object object.


of

Same signification as .


of_generic_species

Possible uses:

  • container of_generic_species species ---> list
  • of_generic_species (container , species) ---> list

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

Examples:

// species speciesA {} 
// species sub_speciesA parent: speciesA {} 
list var2 <- [sub_speciesA(0),sub_speciesA(1),speciesA(2),speciesA(3)] of_generic_species speciesA; // var2 equals [sub_speciesA0,sub_speciesA1,speciesA0,speciesA1] 
list var3 <- [sub_speciesA(0),sub_speciesA(1),speciesA(2),speciesA(3)] of_generic_species sous_test; // var3 equals [sub_speciesA0,sub_speciesA1] 
list var4 <- [sub_speciesA(0),sub_speciesA(1),speciesA(2),speciesA(3)] of_species speciesA; // var4 equals [speciesA0,speciesA1] 
list var5 <- [sub_speciesA(0),sub_speciesA(1),speciesA(2),speciesA(3)] of_species sous_test; // var5 equals [sub_speciesA0,sub_speciesA1]

See also: of_species,


of_species

Possible uses:

  • container of_species species ---> list
  • of_species (container , species) ---> list

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

Special cases:

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

Examples:

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

See also: of_generic_species,


one_matches

Possible uses:

  • one_matches (string, container, any expression) ---> bool

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

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, one_matches throws an error

Examples:

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

See also: all_match, count, none_matches,


one_of

Possible uses:

  • one_of (container<KeyType,ValueType>) ---> ValueType

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

Comment: the one_of operator behavior depends on the nature of the operand

Special cases:

  • if the operand is empty, one_of returns nil
  • if it is a graph, one_of returns one of the lists of edges
  • if it is a file, one_of returns one of the elements of the content of the file (that is also a container)
  • if it is a list or a matrix, one_of returns one of the values of the list or of the matrix
inti <- any ([1,2,3]);  // i equals 1, 2 or 3 
string sMat <- one_of(matrix([["c11","c12","c13"],["c21","c22","c23"]])); 	// sMat equals "c11","c12","c13", "c21","c22" or "c23"
  • if it is a map, one_of returns one the value of a random pair of the map
int im <- one_of ([2::3, 4::5, 6::7]);	// im equals 3, 5 or 7 
bool var3 <- [2::3, 4::5, 6::7].values contains im; // var3 equals true
  • if it is a population, one_of returns one of the agents of the population
bug b <- one_of(bug);  	// Given a previously defined species bug, b is one of the created bugs, e.g. bug3

See also: contains,


one_verifies

Same signification as one_matches


or

Possible uses:

  • bool or any expression ---> bool
  • or (bool , any expression) ---> bool

Result: Returns the logical OR of the two boolean operands.

Comment: Both operands are cast to {@code bool} before the operator is applied. An expression like {@code 1 or 0} is therefore accepted and returns {@code true}. The operator uses short-circuit evaluation: if the left operand is already {@code true}, the right operand is not evaluated.

Special cases:

  • If the left operand is {@code nil}, it is treated as {@code false} and the right operand is evaluated.
  • If the right operand is {@code nil}, it is cast to {@code false}.

Examples:

bool var0 <- true or false; // var0 equals true 
bool var1 <- false or true; // var1 equals true 
bool var2 <- false or false; // var2 equals false 
bool var3 <- true or true; // var3 equals true 
 int a <- 3 ; int b <- 4; int c <- 7; 
bool var5 <- ((a+b) = c ) or ((a+b) > c ); // var5 equals true

See also: !, and, bool, xor,


or

Possible uses:

  • predicate or predicate ---> predicate
  • or (predicate , predicate) ---> predicate

Result: create a new predicate from two others by including them as subintentions. It's an exclusive "or"

Examples:

predicate1 or predicate2

osm_file

Possible uses:

  • osm_file (string) ---> file
  • string osm_file map<string,list> ---> file
  • osm_file (string , map<string,list>) ---> file

Result: Constructs a file of type osm. Allowed extensions are limited to osm, pbf, bz2, gz

Special cases:

  • osm_file(string): This file constructor allows to read a osm (.osm, .pbf, .bz2, .gz) file (using WGS84 coordinate system for the data)
file f <- osm_file("file");
  • osm_file(string,map<string,list>): This file constructor allows to read an osm (.osm, .pbf, .bz2, .gz) file (using WGS84 coordinate system for the data)The map is used to filter the objects in the file according their attributes: for each key (string) of the map, only the objects that have a value for the attribute contained in the value set are kept. For an exhaustive list of the attibute of OSM data, see: http://wiki.openstreetmap.org/wiki/Map_Features
void var1 <- file f <- osm_file("file", map(["highway"::["primary", "secondary"], "building"::["yes"], "amenity"::[]]));; // var1 equals f will contain all the objects of file that have the attibute 'highway' with the value 'primary' or 'secondary', and the objects that have the attribute 'building' with the value 'yes', and all the objects that have the attribute 'aminity' (whatever the value).

See also: is_osm,


out_degree_of

Possible uses:

  • graph out_degree_of unknown ---> int
  • out_degree_of (graph , unknown) ---> int

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

Special cases:

  • Returns 0 for an isolated vertex (a vertex with no outgoing edges).
  • On an undirected graph, both out_degree_of and in_degree_of return the total degree of the vertex (number of incident edges).
  • Returns 0 if the vertex is not present in the graph.

Examples:

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

See also: degree_of, in_degree_of,


out_edges_of

Possible uses:

  • graph out_edges_of unknown ---> list
  • out_edges_of (graph , unknown) ---> list

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

Examples:

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

See also: edge_between, in_edges_of,


overlapping

Possible uses:

  • container<unknown,geometry> overlapping geometry ---> list<geometry>
  • overlapping (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), overlapping the operand (casted as a geometry).

Examples:

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

See also: 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, partially_overlapping, touching,


overlaps

Possible uses:

  • geometry overlaps geometry ---> bool
  • overlaps (geometry , geometry) ---> bool

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

Special cases:

  • if one of the operand is null, returns false.
  • if one operand is a point, returns true if the point is included in the geometry
  • Note: unlike the strict JTS {@code overlaps} predicate, this GAML operator uses intersection semantics (equivalent to {@code intersects}): two geometries that only touch at a boundary point or line will still return true.

Examples:

bool var0 <- polyline([{10,10},{20,20}]) overlaps polyline([{15,15},{25,25}]); // var0 equals true 
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals true 
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polyline([{10,10},{20,20}]); // var2 equals true 
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps {15,15}; // var3 equals true

See also: covers, crosses, disjoint_from, equals, intersects, partially_overlaps, touches,


pair

Possible uses:

  • pair (any) ---> pair

Result: casts the operand in a pair object.


pair

Same signification as ::


palette

Possible uses:

  • palette (list<rgb>) ---> list<rgb>

Result: transforms a list of n colors into a palette (necessary for some layers)


parallel_list_with

Possible uses:

  • int parallel_list_with any expression ---> list
  • parallel_list_with (int , any expression) ---> list

Result: Creates a list with a size provided by the first operand, and filled with the second operand, the list is filled in parallel.

Comment: Note that the first operand should be positive, and that the second one is evaluated for each position in the list.\nSome exception can happen in case the expression uses a random number generator that doesn't support parallel execution like mersenne.

Examples:

list var0 <- parallel_list_with(5,2); // var0 equals [2,2,2,2,2]

See also: list,


parallel_matrix_with

Possible uses:

  • any expression parallel_matrix_with point ---> matrix
  • parallel_matrix_with (any expression , point) ---> matrix

Result: Creates a matrix with a size provided by the first operand, and filled with the second operand. The given expression, unless constant, is evaluated for each cell and is done in parallel.

Comment: Note that both components of the right operand point should be positive, otherwise an exception is raised.

If run in parallel, some exception can happen in case the expression uses a random number generator that doesn't support parallel execution like mersenne.

See also: as_matrix, matrix,


partially_overlapping

Possible uses:

  • container<unknown,geometry> partially_overlapping geometry ---> list<geometry>
  • partially_overlapping (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), partially_overlapping the operand (casted as a geometry).

Examples:

list<geometry> var0 <- [ag1, ag2, ag3] partially_overlapping(self); // var0 equals the agents among ag1, ag2 and ag3 that partially_overlap the shape of the right-hand argument. 
list<geometry> var1 <- (species1 + species2) partially_overlapping (self); // var1 equals the agents among species species1 and species2 that partially_overlap the shape of the right-hand argument.

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


partially_overlaps

Possible uses:

  • geometry partially_overlaps geometry ---> bool
  • partially_overlaps (geometry , geometry) ---> bool

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

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

Special cases:

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

Examples:

bool var0 <- polyline([{10,10},{20,20}]) partially_overlaps polyline([{15,15},{25,25}]); // var0 equals true 
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals true 
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps {25,25}; // var2 equals false 
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polyline([{10,10},{20,20}]); // var3 equals false

See also: covers, crosses, disjoint_from, equals, intersects, overlaps, touches,


path

Possible uses:

  • path (any) ---> path

Result: casts the operand in a path object.

Special cases:

  • if the operand is a path, returns this path
  • if the operand is a geometry of an agent, returns a path from the list of points of the geometry
  • if the operand is a list, cast each element of the list as a point and create a path from these points
path p <- path([{12,12},{30,30},{50,50}]);

path_between

Possible uses:

  • topology path_between container<unknown,geometry> ---> path
  • path_between (topology , container<unknown,geometry>) ---> path
  • list<agent> path_between container<unknown,geometry> ---> path
  • path_between (list<agent> , container<unknown,geometry>) ---> path
  • map<agent,unknown> path_between container<unknown,geometry> ---> path
  • path_between (map<agent,unknown> , container<unknown,geometry>) ---> path
  • path_between (list<agent>, geometry, geometry) ---> path
  • path_between (graph, unknown, unknown) ---> path
  • path_between (map<agent,unknown>, geometry, geometry) ---> path
  • path_between (topology, geometry, geometry) ---> path

Result: The shortest path between two objects according to set of cells

The shortest path between a list of two objects in a graph

The shortest path between two objects according to set of cells with corresponding weights

The shortest path between several objects according to set of cells

The shortest path between several objects according to set of cells with corresponding weights

Special cases:

  • Returns nil if no path exists between the two nodes (e.g. the graph is disconnected and source/target belong to different components).
  • Returns nil if either the source or the target node is not present in the graph.
  • On an empty graph (no vertices, no edges), always returns nil.

Examples:

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

See also: direction_between, direction_to, distance_between, distance_to, path_to, towards, use_cache,


path_to

Possible uses:

  • geometry path_to geometry ---> path
  • path_to (geometry , geometry) ---> path
  • point path_to point ---> path
  • path_to (point , point) ---> path

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

Examples:

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

See also: direction_between, direction_to, distance_between, distance_to, path_between, towards,


paths_between

Possible uses:

  • paths_between (gama.api.types.graph.IGraphEventProvider, pair, int) ---> list<path>

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

Examples:

list<path> var0 <- paths_between(my_graph, ag1:: ag2, 2); // var0 equals the 2 shortest paths (ordered by length) between ag1 and ag2

pbinom

Same signification as binomial_sum


pchisq

Same signification as chi_square


percent_absolute_deviation

Possible uses:

  • list<float> percent_absolute_deviation list<float> ---> float
  • percent_absolute_deviation (list<float> , list<float>) ---> float

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

Examples:

float var0 <- percent_absolute_deviation([200,300,150,150,200],[250,250,100,200,200]); // var0 equals 20.0

percentile

Same signification as quantile_inverse


pgamma

Same signification as gamma_distribution


pgm_file

Possible uses:

  • pgm_file (string) ---> file

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

Special cases:

  • pgm_file(string): This file constructor allows to read a pgm file
file f <-pgm_file("file.pgm");

See also: is_pgm,


pivot

Possible uses:

  • pivot (dataframe, string, string, string) ---> dataframe

Result: Pivots the dataframe: the index column becomes row labels, the pivot column values become new column names, and the value column provides the cell values. When multiple values exist for a combination, the first is kept.

Special cases:

  • Pivot a sales dataframe
dataframe pivoted <- pivot(sales_df, "product", "quarter", "revenue");

See also: filter, join, select_columns,


plan

Possible uses:

  • container<unknown,geometry> plan float ---> geometry
  • plan (container<unknown,geometry> , float) ---> geometry

Result: A polyline geometry from the given list of points.

Special cases:

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

Examples:

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

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


play_sound

Possible uses:

  • play_sound (string) ---> bool

Result: Play a wave file

Examples:

bool sound_ok <- play_sound('beep.wav');

plus_days

Possible uses:

  • date plus_days int ---> date
  • plus_days (date , int) ---> date

Result: Add a given number of days to a date

Examples:

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

plus_hours

Possible uses:

  • date plus_hours int ---> date
  • plus_hours (date , int) ---> date

Result: Add a given number of hours to a date

Examples:

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

plus_minutes

Possible uses:

  • date plus_minutes int ---> date
  • plus_minutes (date , int) ---> date

Result: Add a given number of minutes to a date

Examples:

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

plus_months

Possible uses:

  • date plus_months int ---> date
  • plus_months (date , int) ---> date

Result: Add a given number of months to a date

Examples:

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

plus_ms

Possible uses:

  • date plus_ms int ---> date
  • plus_ms (date , int) ---> date

Result: Add a given number of milliseconds to a date

Examples:

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

plus_seconds

Same signification as +


plus_weeks

Possible uses:

  • date plus_weeks int ---> date
  • plus_weeks (date , int) ---> date

Result: Add a given number of weeks to a date

Examples:

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

plus_years

Possible uses:

  • date plus_years int ---> date
  • plus_years (date , int) ---> date

Result: Add a given number of years to a date

Examples:

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

pnorm

Same signification as normal_area


point

Possible uses:

  • point (any) ---> point

Result: casts the operand in a point object.


points_along

Possible uses:

  • geometry points_along list<float> ---> list
  • points_along (geometry , list<float>) ---> list

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

Examples:

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

See also: closest_points_with, farthest_point_to, points_at, points_on,


points_at

Possible uses:

  • int points_at float ---> list<point>
  • points_at (int , float) ---> list<point>

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

Examples:

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

See also: any_location_in, any_point_in, centroid, closest_points_with, farthest_point_to, points_along, points_on,


points_in

Possible uses:

  • field points_in geometry ---> list<point>
  • points_in (field , geometry) ---> list<point>

points_on

Possible uses:

  • geometry points_on float ---> list
  • points_on (geometry , float) ---> list

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

Examples:

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

See also: closest_points_with, farthest_point_to, points_along, points_at,


poisson

Possible uses:

  • poisson (float) ---> int

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

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

Special cases:

  • The expected value (lambda) must be positive. If lambda is 0 or negative, behavior is undefined.
  • Returns a non-negative integer.

Examples:

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

See also: binomial, gamma_rnd, gauss, gauss_rnd, lognormal_rnd, rnd, skew_gauss, truncated_gauss, weibull_rnd,


polygon

Possible uses:

  • polygon (container<unknown,geometry>) ---> geometry

Result: A polygon geometry from the given list of points.

Special cases:

  • if the operand is nil, returns the point geometry {0,0}
  • if the operand is composed of a single point, returns a point geometry
  • if the operand is composed of 2 points, returns a polyline geometry.
  • An empty list returns a point at {0,0,0}.
  • A list with fewer than 3 distinct points may return a line or a point geometry.
  • Duplicate consecutive points are removed before the polygon is built.

Examples:

geometry var0 <- polygon([{0,0}, {0,10}, {10,10}, {10,0}]); // var0 equals a polygon geometry composed of the 4 points. 
float var1 <- polygon([{0,0}, {0,10}, {10,10}, {10,0}]).area; // var1 equals 100.0 
point var2 <- polygon([{0,0}, {0,10}, {10,10}, {10,0}]).location; // var2 equals point(5.0,5.0,0.0)

See also: arc, around, box, circle, cone, cone3D, cross, cube, cylinder, ellipse, elliptical_arc, hexagon, line, link, norm, point, polyline, pyramid, rectangle, sphere, square, squircle, teapot, triangle,


polyhedron

Possible uses:

  • container<unknown,geometry> polyhedron float ---> geometry
  • polyhedron (container<unknown,geometry> , float) ---> geometry

Result: A polyhedron geometry from the given list of points.

Special cases:

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

Examples:

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

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


polyline

Same signification as line


polyplan

Same signification as plan


power_test

Possible uses:

  • power_test (list<float>, float, float, float) ---> int

Result: Return the number of observation to satisfy power test given a critical effect size, tAlpha and tBeta.see reference: https://rseri.me/publication/b016/B016.pdf (accessible as of 04/2026).


predecessors_of

Possible uses:

  • graph predecessors_of unknown ---> list
  • predecessors_of (graph , unknown) ---> list

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

Special cases:

  • Returns an empty list for a vertex with no incoming edges (in-degree 0).
  • Returns an empty list if the vertex is not present in the graph.
  • On an undirected graph, predecessors_of is equivalent to neighbors_of (all adjacent vertices are returned).

Examples:

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

See also: neighbors_of, successors_of,


predicate

Possible uses:

  • predicate (any) ---> predicate

Result: casts the operand in a predicate object.


predict

Possible uses:

  • regression predict list ---> float
  • predict (regression , list) ---> float

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

Examples:

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

pretty_print

Possible uses:

  • pretty_print (dataframe) ---> string
  • pretty_print (dataframe, int, int, int) ---> string

Result: Creates a string representing the dataframe in a human readable format. The number of rows and columns is limited to 10 and the number of characters per cell to 50.

Creates a string representing the dataframe in a human readable format. The maximum number of rows, columns and the number of characters per cell to print is defined by the parameters.


product

Same signification as mul


product_of

Possible uses:

  • product_of (string, container, any expression) ---> unknown

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

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

Special cases:

  • if the left-operand is a map, the keyword each will contain each value
unknown var1 <- [1::2, 3::4, 5::6] product_of (each); // var1 equals 48

Examples:

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

See also: max_of, mean_of, min_of, sum_of, variance_of,


promethee_DM

Possible uses:

  • list<list> promethee_DM list<map<string,unknown>> ---> int
  • promethee_DM (list<list> , list<map<string,unknown>>) ---> int

Result: The index of the best candidate according to the Promethee II method. This method is based on a comparison per pair of possible candidates along each criterion: all candidates are compared to each other by pair and ranked. More information about this method can be found in Behzadian, M., Kazemzadeh, R., Albadvi, A., M., A.: PROMETHEE: A comprehensive literature review on methodologies and applications. European Journal of Operational Research(2010). The first operand is the list of candidates (a candidate is a list of criterion values); the second operand the list of criterion: A criterion is a map that contains fours elements: a name, a weight, a preference value (p) and an indifference value (q). The preference value represents the threshold from which the difference between two criterion values allows to prefer one vector of values over another. The indifference value represents the threshold from which the difference between two criterion values is considered significant.

Special cases:

  • Returns -1 if the candidate list is nil or empty.

Examples:

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

See also: electre_DM, evidence_theory_DM, fuzzy_choquet_DM, weighted_means_DM,


property_file

Possible uses:

  • property_file (string) ---> file
  • string property_file map<string,string> ---> file
  • property_file (string , map<string,string>) ---> file

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

Special cases:

  • property_file(string): This file constructor allows to read a property file (.properties)
file f <-property_file("file.properties");
  • property_file(string,map<string,string>): This file constructor allows to store a map in a property file (it does not save it - just store it in memory)
file f <-property_file("file.properties", map(["param1"::1.0,"param3"::10.0 ]));

See also: is_property,


pValue_for_fStat

Possible uses:

  • pValue_for_fStat (float, int, int) ---> float

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

Examples:

float var0 <- pValue_for_fStat(1.9,10,12) with_precision(3); // var0 equals 0.145

pValue_for_tStat

Possible uses:

  • float pValue_for_tStat int ---> float
  • pValue_for_tStat (float , int) ---> float

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

Examples:

float var0 <- pValue_for_tStat(0.9,10) with_precision(3); // var0 equals 0.389

pyramid

Possible uses:

  • pyramid (float) ---> geometry

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

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

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


quantile

Possible uses:

  • container quantile float ---> float
  • quantile (container , float) ---> float

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

Examples:

float var0 <- quantile([1,3,5,6,9,11,12,13,19,21,22,32,35,36,45,44,55,68,79,80,81,88,90,91,92,100], 0.5); // var0 equals 35.5

quantile_inverse

Possible uses:

  • container quantile_inverse float ---> float
  • quantile_inverse (container , float) ---> float

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

Examples:

float var0 <- quantile_inverse([1,3,5,6,9,11,12,13,19,21,22,32,35,36,45,44,55,68,79,80,81,88,90,91,92,100], 35.5) with_precision(2); // var0 equals 0.52

range

Possible uses:

  • range (int) ---> list
  • int range int ---> list
  • range (int , int) ---> list
  • range (int, int, int) ---> list

Result: builds a list of int representing all contiguous values from zero to the argument included. The range can be increasing or decreasing.

Special cases:

  • Passing 0 will return a singleton list with 0.
  • When used with 3 operands, it returns a list of int representing all contiguous values from the first to the second argument, using the step represented by the third argument. The range can be increasing or decreasing. Passing the same value for both will return a singleton list with this value. Passing a step of 0 will result in an exception. Attempting to build infinite ranges (e.g. end > start with a negative step) will similarly not be accepted and yield an exception
list var3 <- range(0,6,2); // var3 equals [0,2,4,6]
  • When passing the same value for both arguments the operator will return a list containing only this value
list var4 <- range(0,2); // var4 equals [0,1,2] 
list var5 <- range(2,0); // var5 equals [2,1,0] 
list var6 <- range(0,0); // var6 equals [0]

Examples:

list var0 <- range(2); // var0 equals [0,1,2] 
list var1 <- range(-2); // var1 equals [0,-1,-2] 
list var2 <- range(1) collect(i: range(1) collect(j: i + j)); // var2 equals [[0,1],[1,2]]

rank_interpolated

Possible uses:

  • container rank_interpolated float ---> float
  • rank_interpolated (container , float) ---> float

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

Examples:

float var0 <- rank_interpolated([1,3,5,6,9,11,12,13,19,21,22,32,35,36,45,44,55,68,79,80,81,88,90,91,92,100], 35); // var0 equals 13.0

read

Possible uses:

  • read (string) ---> unknown

Result: Reads an attribute of the agent. The attribute's name is specified by the operand.

Examples:

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

rectangle

Possible uses:

  • rectangle (point) ---> geometry
  • point rectangle point ---> geometry
  • rectangle (point , point) ---> geometry
  • float rectangle float ---> geometry
  • rectangle (float , float) ---> geometry

Result: A rectangle geometry, computed from the operands values (e.g. the 2 side sizes).

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

Special cases:

  • returns nil if the operand is nil.
  • If either dimension is ≤ 0, the resulting geometry degenerates (width or height of 0 produces a line; both ≤ 0 produces a point).

Examples:

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

See also: arc, around, circle, cone, cone3D, cross, cube, curve, cylinder, ellipse, elliptical_arc, geometry_collection, hexagon, line, link, norm, plan, point, polygon, polyhedron, polyline, pyramid, sphere, square, squircle, teapot, triangle,


reduced_by

Same signification as -


regex_matches

Possible uses:

  • string regex_matches string ---> list<string>
  • regex_matches (string , string) ---> list<string>

Result: Returns the list of sub-strings of the first operand that match the regular expression provided in the second operand

Examples:

list<string> var0 <- regex_matches("colour, color", "colou?r"); // var0 equals ['colour','color']

See also: replace_regex,


regression

Possible uses:

  • regression (any) ---> regression

Result: casts the operand in a regression object.


remove_duplicates

Possible uses:

  • remove_duplicates (container) ---> list

Result: produces a set from the elements of the operand (i.e. a list without duplicated elements)

Special cases:

  • if the operand is a graph, remove_duplicates returns the set of nodes
  • If the container has no duplicates, returns an equivalent copy.
  • If the container is empty, returns an empty list.
  • Order of first occurrences is preserved.
  • if the operand is empty, remove_duplicates returns an empty list
list var1 <- remove_duplicates([]); // var1 equals []
  • if the operand is a map, remove_duplicates returns the set of values without duplicate
list var2 <- remove_duplicates([1::3,2::4,3::3,5::7]); // var2 equals [3,4,7]
  • if the operand is a matrix, remove_duplicates returns a list containing all the elments with duplicated.
list var3 <- remove_duplicates([["c11","c12","c13","c13"],["c21","c22","c23","c23"]]); // var3 equals [["c11","c12","c13","c21","c22","c23"]]

Examples:

list var0 <- remove_duplicates([3,2,5,1,2,3,5,5,5]); // var0 equals [3,2,5,1]

remove_empty

Possible uses:

  • dataframe remove_empty string ---> dataframe
  • remove_empty (dataframe , string) ---> dataframe

Result: Returns a new dataframe with rows removed where the specified column has null or empty values.

Special cases:

  • Remove rows with empty 'name' values
dataframe df2 <- remove_empty(my_df, "name");

See also: filter, select_columns,


remove_node_from

Possible uses:

  • geometry remove_node_from graph ---> graph
  • remove_node_from (geometry , graph) ---> graph

Result: removes a node from a graph.

Comment: WARNING / side effect: this operator modifies the operand and does not create a new graph. All the edges containing this node are also removed.

Examples:

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

rename_file

Possible uses:

  • string rename_file string ---> bool
  • rename_file (string , string) ---> bool

Result: rename/move a file or a folder

Examples:

bool rename_file_ok <- rename_file("../includes/my_folder","../includes/my_new_folder");

replace

Possible uses:

  • replace (string, string, string) ---> string

Result: Returns the string obtained by replacing by the third operand, in the first operand, all the sub-strings equal to the second operand

Examples:

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

See also: replace_regex,


replace_first

Possible uses:

  • replace_first (string, string, string) ---> string

Result: Returns a string where the first occurrence of the right-hand string is replaced by the third one

Examples:

string var0 <- replace_first("abcabc", "a", "d"); // var0 equals "dbcabc"

replace_regex

Possible uses:

  • replace_regex (string, string, string) ---> string

Result: Returns the string obtained by replacing by the third operand, in the first operand, all the sub-strings that match the regular expression of the second operand

Examples:

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

See also: regex_matches, replace,


residuals

Possible uses:

  • residuals (regression) ---> list<float>

Result: Return the list of residuals for a given regression model

Examples:

residuals(my_regression)

reverse

Possible uses:

  • reverse (map<K,V>) ---> map
  • reverse (container<KeyType,ValueType>) ---> container<unknown,unknown>

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

Comment: the reverse operator behavior depends on the nature of the operand

Special cases:

  • if it is a file, reverse returns a copy of the file with a reversed content
  • if it is a population, reverse returns a copy of the population with elements in the reversed order
  • if it is a graph, reverse returns a copy of the graph (with all edges and vertexes), with all of the edges reversed
  • if it is a list, reverse returns a copy of the operand list with elements in the reversed order
list<int> var2 <- reverse ([10,12,14]); // var2 equals [14, 12, 10]
  • if it is a map, reverse returns a copy of the operand map with each pair in the reversed order (i.e. all keys become values and values become keys)
map<int,string> var3 <- reverse (['k1'::44, 'k2'::32, 'k3'::12]); // var3 equals [44::'k1', 32::'k2', 12::'k3']
  • if it is a matrix, reverse returns a new matrix containing the transpose of the operand.
matrix<string> var4 <- reverse(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var4 equals matrix([["c11","c21"],["c12","c22"],["c13","c23"]])

Examples:

map<int,int> m <- [1::111,2::222, 3::333, 4::444]; 
map var1 <- reverse(m); // var1 equals map([111::1,222::2,333::3,444::4])

reverse

Possible uses:

  • reverse (string) ---> string

Special cases:

  • if it is a string, reverse returns a new string with characters in the reversed order
string var0 <- reverse ('abcd'); // var0 equals 'dcba'

rewire_n

Possible uses:

  • graph rewire_n int ---> graph
  • rewire_n (graph , int) ---> graph

Result: rewires the given count of edges.

Comment: WARNING / side effect: this operator modifies the operand and does not create a new graph. If there are too many edges, all the edges will be rewired.

Examples:

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

rgb

Possible uses:

  • rgb (any) ---> rgb

Result: casts the operand in a rgb object.


rgb

Possible uses:

  • rgb rgb int ---> rgb
  • rgb (rgb , int) ---> rgb
  • rgb rgb float ---> rgb
  • rgb (rgb , float) ---> rgb
  • string rgb int ---> rgb
  • rgb (string , int) ---> rgb
  • rgb (int, int, int) ---> rgb
  • rgb (int, int, int, int) ---> rgb
  • rgb (int, int, int, float) ---> rgb

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

Special cases:

  • It can be used with a color and an alpha between 0 and 255
  • It can be used with r=red, g=green, b=blue (each between 0 and 255), a=alpha (between 0 and 255)
  • It can be used with r=red, g=green, b=blue, each between 0 and 255
  • rgb(0,0,0) produces black (#black).
  • rgb(255,255,255) produces white (#white).
  • rgb(255,0,0) produces red (#red).
  • It can be used with r=red, g=green, b=blue (each between 0 and 255), a=alpha (between 0.0 and 1.0)
  • It can be used with a color and an alpha between 0 and 1
  • It can be used with a name of color and alpha (between 0 and 255)

Examples:

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

See also: blend, grayscale, hsb, rnd_color,


rms

Possible uses:

  • int rms float ---> float
  • rms (int , float) ---> float

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

Examples:

 list<float> data_sequence <- [6.0, 7.0, 8.0, 9.0];  
 list<float> squares <- data_sequence collect (each*each);  
float var2 <-  rms(length(data_sequence),sum(squares)) with_precision(4) ; // var2 equals 7.5829

rnd

Possible uses:

  • rnd (float) ---> float
  • rnd (point) ---> point
  • rnd (int) ---> int
  • float rnd float ---> float
  • rnd (float , float) ---> float
  • point rnd point ---> point
  • rnd (point , point) ---> point
  • int rnd int ---> int
  • rnd (int , int) ---> int
  • rnd (point, point, float) ---> point
  • rnd (int, int, int) ---> int
  • rnd (float, float, float) ---> float

Result: returns a random value in a range (the type value depends on the operand type): when called with an integer, it returns a random integer in the interval [0, operand]

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

Special cases:

  • If min equals max, always returns that value.
  • If min equals max, always returns that value.
  • if the operand is a float, returns an uniformly distributed float random number in [0.0, to]
  • If max is 0.0, returns 0.0.
  • if the operand is a point, returns a point with three random float ordinates, each in the interval [0, ordinate of argument]
  • If min equals max, always returns that value.
  • If min equals max, always returns that value.
  • If the max is 0, returns 0.
  • If max is negative, raises a runtime error.
  • If min equals max, always returns that value.
  • If min equals max, always returns that value.

Examples:

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

See also: binomial, flip, gamma_rnd, gauss, gauss_rnd, lognormal_rnd, poisson, rnd_choice, skew_gauss, truncated_gauss, weibull_rnd,


rnd_choice

Possible uses:

  • rnd_choice (list) ---> int
  • rnd_choice (map<unknown,float>) ---> unknown

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

returns a key from the map with a probability following the (normalized) distribution described in map values (a form of lottery)

Special cases:

  • The list of weights must not be empty.
  • All weights are assumed to be non-negative; negative weights lead to undefined behavior.
  • The weight list is normalized automatically.

Examples:

int var0 <- rnd_choice([0.2,0.5,0.3]); // var0 equals 2/10 chances to return 0, 5/10 chances to return 1, 3/10 chances to return 2 
unknown var1 <- rnd_choice(["toto"::0.2,"tata"::0.5,"tonton"::0.3]); // var1 equals 2/10 chances to return "toto", 5/10 chances to return "tata", 3/10 chances to return "tonton"

See also: rnd,


rnd_color

Possible uses:

  • rnd_color (int) ---> rgb
  • int rnd_color int ---> rgb
  • rnd_color (int , int) ---> rgb

Result: rgb color

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

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

Examples:

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

See also: hsb, rgb,


rolling_se

Possible uses:

  • rolling_se (list<float>) ---> list<float>

Result: Return the list of standard error according to the number of observations, i.e. value at index i is the standard error for the first i observations.


rolling_vc

Possible uses:

  • rolling_vc (list<float>) ---> list<float>

Result: Return the list of rolling coefficient of variance according to the number of observations, i.e. value at index i is the coefficient of variance for the first i observations.


rotated_by

Possible uses:

  • geometry rotated_by float ---> geometry
  • rotated_by (geometry , float) ---> geometry
  • point rotated_by pair ---> point
  • rotated_by (point , pair) ---> point
  • geometry rotated_by pair ---> geometry
  • rotated_by (geometry , pair) ---> geometry
  • geometry rotated_by int ---> geometry
  • rotated_by (geometry , int) ---> geometry
  • rotated_by (geometry, float, point) ---> geometry

Result: A geometry resulting from the application of a rotation by the right-hand operand angle (degree) to the left-hand operand (geometry, agent, point)

A geometry resulting from the application of a rotation by the operand angles (degree) along the operand axis (last operand) to the left-hand operand (geometry, agent, point)

Special cases:

  • When used with a point and a pair angle::point, it returns a point resulting from the application of the right-hand rotation operand (angles in degree) to the left-hand operand point
  • the right-hand operand representing the angle can be a float or an integer

Examples:

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

See also: transformed_by, translated_by,


rotated_by

Possible uses:

  • image rotated_by float ---> image
  • rotated_by (image , float) ---> image

Result: Returns the image rotated using the angle in degrees passed in parameter. A positive angle means a clockwise rotation, and a negative one a counter-clockwise. The original image is left untouched


rotation_composition

Possible uses:

  • rotation_composition (list<pair>) ---> pair<float,point>

Result: The rotation resulting from the composition of the rotations in the list. Rotations will be applied in the order of the list: if R=[R1,...,Rn], Rx = Rn...R1x. Angles are in degrees.

Examples:

pair<float,point> var0 <- rotation_composition([38.0::{1,1,1},90.0::{1,0,0}]); // var0 equals 115.22128507898105::{0.9491582126366207,0.31479943993669307,-0.0}

See also: inverse_rotation,


round

Possible uses:

  • round (point) ---> point

Result: Returns the rounded value of the operand.

Examples:

point var0 <- {12345.78943,  12345.78943, 12345.78943} with_precision 2; // var0 equals {12345.79,12345.79,12345.79}

See also: round, with_precision,


round

Possible uses:

  • round (float) ---> int
  • round (int) ---> int

Result: Returns the nearest integer value of the operand, rounding half-up (away from zero for negative values).

Special cases:

  • round(0.5) = 1 (half-up convention).
  • round(-0.5) = -1 (half-away-from-zero: -0.5 rounds down to -1).
  • round(0.0) = 0.
  • if the operand is an int, round returns it unchanged.

Examples:

int var0 <- round (0.51); // var0 equals 1 
int var1 <- round (100.2); // var1 equals 100 
int var2 <- round(-0.51); // var2 equals -1

See also: ceil, floor, int, with_precision,


row_at

Possible uses:

  • matrix<unknown> row_at int ---> list<unknown>
  • row_at (matrix<unknown> , int) ---> list<unknown>

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

Examples:

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

See also: column_at, columns_list,


row_at

Possible uses:

  • dataframe row_at int ---> list
  • row_at (dataframe , int) ---> list

Result: Returns the row of the dataframe at the given index as a list of values. Overloads the matrix 'row_at' operator for dataframes.

Special cases:

  • Get the row at index 1
my_df row_at 1

See also: cell, column_at, iloc, rows_list,


rows_list

Possible uses:

  • rows_list (matrix<unknown>) ---> list<list<unknown>>

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

Examples:

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

See also: as_list, column_at, columns_list,


rows_list

Possible uses:

  • rows_list (dataframe) ---> list

Result: Returns the list of the rows of the dataframe, each row being a list of its cell values. Overloads the matrix 'rows_list' operator for dataframes.

See also: columns_list, row_at,


rSquare

Possible uses:

  • rSquare (regression) ---> float

Result: Return the value of the adjusted R square for a given regression model

Examples:

rSquare(my_regression)

sample

Possible uses:

  • 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

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

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

Examples:

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

Sanction

Possible uses:

  • Sanction (any) ---> Sanction

Result: casts the operand in a Sanction object.


save_table

Possible uses:

  • save_table (dataframe, string, string, string, string) ---> bool

Result: Saves a dataframe to a database table via JDBC. Arguments: the dataframe, the JDBC URL, the user, the password, and the destination table name. The table must already exist with a compatible schema. Pass empty strings for user/password if the database does not require credentials. The corresponding JDBC driver must be available on the classpath. Returns true on success.

Special cases:

  • Save a dataframe to a PostgreSQL table
bool ok <- save_table(my_df, "jdbc:postgresql://localhost:5432/mydb", "user", "pwd", "people");

See also: load_sql, load_table,


scale

Possible uses:

  • scale (map<rgb,unknown>) ---> map<float,rgb>
  • scale (map<rgb,unknown>, float, float) ---> map<float,rgb>

Result: Similar to gradient(map<rgb, float>) but reorders the colors based on their weight and does not normalize them, so as to effectively represent a color scale (i.e. a correspondance between a range of value and a color that implicitly begins with the lowest value). For instance scale([#red::10, #green::0, #blue::30]) would produce the reverse map and associate #green to the interval 0-10, #red to 10-30, and #blue above 30. The main difference in usages is that, for instance in the definition of a mesh to display, a gradient will produce interpolated colors to accomodate for the intermediary values, while a scale will stick to the colors defined.

Expects a gradient, i.e. a map<rgb,float>, where values represent the different stops of the colors. First normalizes the passed gradient, and then applies the resulting weights to the interval represented by min and max, so as to return a scale (i.e. absolute values instead of the stops)

See also: gradient,


scaled_by

Same signification as *


scaled_to

Possible uses:

  • geometry scaled_to point ---> geometry
  • scaled_to (geometry , point) ---> geometry

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

Examples:

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


select_columns

Possible uses:

  • dataframe select_columns list<string> ---> dataframe
  • select_columns (dataframe , list<string>) ---> dataframe

Result: Returns a new dataframe containing only the specified columns.

Special cases:

  • Select only 'name' and 'age' columns
dataframe df2 <- select_columns(my_df, ["name", "age"]);

See also: add_column, filter, iloc, pivot, remove_empty,


send_image_to_websocket

Possible uses:

  • send_image_to_websocket (image) ---> image
  • image send_image_to_websocket string ---> image
  • send_image_to_websocket (image , string) ---> image

Result: Send the given image to the websocket using Base64 assuming the format is png.

Send

⚠️ **GitHub.com Fallback** ⚠️