Skip to content

OperatorsSplitted

GAMA Bot edited this page May 25, 2024 · 15 revisions

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, ceil, cos, cos_rad, div, even, exp, fact, floor, hypot, is_finite, is_number, ln, log, mod, round, signum, sin, sin_rad, sqrt, tan, tan_rad, tanh, with_precision,


BDI

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


Casting operators

as, as_int, as_matrix, deserialize, field_with, font, from_gaml, from_json, is, is_skill, list_with, matrix_with, serialize, species_of, to_gaml, to_geojson, to_json, to_list, with_size, with_style,


Color-related operators

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


Comparison operators

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


Containers-related operators

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


Date-related operators

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


Dates


Displays

horizontal, stack, vertical,


edge

edge_between, strahler,


EDP-related operators

diff, diff2,


Files-related operators

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


GamaMetaType

type_of,


GamaSVGFile

image,


Graphs-related operators

add_edge, add_node, adjacency, agent_from_geometry, all_pairs_shortest_path, alpha_index, as_distance_graph, as_edge_graph, as_intersection_graph, as_path, as_spatial_graph, beta_index, betweenness_centrality, biggest_cliques_of, connected_components_of, connectivity_index, contains_edge, contains_vertex, degree_of, directed, edge, edge_between, edge_betweenness, edges, gamma_index, generate_barabasi_albert, generate_complete_graph, generate_random_graph, generate_watts_strogatz, girvan_newman_clustering, grid_cells_to_graph, in_degree_of, in_edges_of, k_spanning_tree_clustering, label_propagation_clustering, layout_circle, layout_force, layout_force_FR, layout_force_FR_indexed, layout_grid, load_shortest_paths, main_connected_component, max_flow_between, maximal_cliques_of, nb_cycles, neighbors_of, node, nodes, out_degree_of, out_edges_of, path_between, paths_between, predecessors_of, remove_node_from, rewire_n, source_of, spatial_graph, strahler, successors_of, sum, target_of, undirected, use_cache, weight_of, with_k_shortest_path_algorithm, with_shortest_path_algorithm, with_weights,


Grid-related operators

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


ImageOperators

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


Iterator operators

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


List-related operators

all_indexes_of, copy_between, index_of, last_index_of,


Logical operators

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


Map comparaison operators

fuzzy_kappa, fuzzy_kappa_sim, kappa, kappa_sim, percent_absolute_deviation,


Map-related operators

as_map, create_map, index_of, last_index_of,


Matrix-related operators

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


multicriteria operators

electre_DM, evidence_theory_DM, fuzzy_choquet_DM, promethee_DM, weighted_means_DM,


Path-related operators

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


Pedestrian

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,


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,


Spatial operators

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


Spatial properties operators

covers, crosses, intersects, partially_overlaps, touches,


Spatial queries operators

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


Spatial relations operators

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


Spatial statistical operators

hierarchical_clustering, k_nearest_neighbors, simple_clustering_by_distance,


Spatial transformations operators

-, *, +, as_4_grid, as_grid, as_hexagonal_grid, at_location, clean, clean_network, convex_hull, CRS_transform, inverse_rotation, normalized_rotation, rotated_by, rotation_composition, scaled_to, simplification, skeletonize, smooth, split_geometry, split_lines, to_GAMA_CRS, to_rectangles, to_segments, to_squares, to_sub_geometries, transformed_by, translated_by, triangulate, voronoi, with_precision, without_holes,


Species-related operators

index_of, last_index_of, of_generic_species, of_species,


Statistical operators

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


Strings-related operators

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


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, agent, BDIPlan, bool, container, conversation, directory, emotion, file, float, gaml_type, geometry, graph, int, kml, list, map, matrix, mental_state, message, Norm, pair, path, point, predicate, regression, rgb, Sanction, skill, social_link, species, topology, unknown,


User control operators

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


Operators


-

Possible uses:

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

Result:

If it is used as an unary operator, it returns the opposite of the operand. Returns the difference of the two operands.

Comment:

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

Special cases:

  • if both operands are containers and the right operand is empty, - returns the left operand
  • 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 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 var0 <- date('2000-01-01') - 86400; // var0 equals date('1999-12-31')
  • 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 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> var2 <- [1,2,3,4,5,6] - [2,4,9]; // var2 equals [1,3,5,6] 
list<int> var3 <- [1,2,3,4,5,6] - [0,8]; // var3 equals [1,2,3,4,5,6]
  • 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 var4 <- date('2000-01-02') - date('2000-01-01'); // var4 equals 86400
  • 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 var5 <- 3.5 - matrix([[2,5],[3,4]]); // var5 equals matrix([[1.5,-1.5],[0.5,-0.5]])
  • 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 var6 <- rgb([255, 128, 32]) - 3; // var6 equals rgb([252,125,29])
  • 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 var7 <- {1, 2} - 4.5; // var7 equals {-3.5, -2.5, -4.5} 
point var8 <- {1, 2} - 4; // var8 equals {-3.0,-2.0,-4.0}
  • if both operands are numbers, performs a normal arithmetic difference and returns a float if one of them is a float.
int var9 <- 1 - 1; // var9 equals 0
  • 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> var10 <- [1,2,3,4,5,6,2] - 2; // var10 equals [1,3,4,5,6,2] 
list<int> var11 <- [1,2,3,4,5,6] - 0; // var11 equals [1,2,3,4,5,6]
  • if both operands are colors, returns a new color resulting from the subtraction of the two operands, component by component
rgb var12 <- rgb([255, 128, 32]) - rgb('red'); // var12 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 var13 <- shape - 5; // var13 equals a geometry corresponding to the geometry of the agent applying the operator reduced by a distance of 5
  • if both operands are points, returns their difference (coordinates per coordinates).
point var14 <- {1, 2} - {4, 5}; // var14 equals {-3.0, -3.0}
  • 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 var15 <- rectangle(10,10) - [circle(2), square(2)]; // var15 equals rectangle(10,10) - (circle(2) + square(2))

Examples:

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

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


:

Possible uses:

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

Result:

It is used in combination with the ? operator. If the left-hand of ? operand evaluates to true, returns the value of the left-hand operand of the :, otherwise that of the right-hand operand of the :

Examples:

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

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:

opposite boolean value.

Special cases:

  • if the parameter is not boolean, it is casted to a boolean value.

Examples:

bool var0 <- ! (true); // var0 equals false

See also: bool, and, or,


!=

Possible uses:

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

Result:

true if both operands are different, false otherwise

Examples:

bool var0 <- 3.0 != 3.0; // var0 equals false 
bool var1 <- 4.0 != 4.7; // var1 equals true 
bool var2 <- 3.0 != 3; // var2 equals false 
bool var3 <- 4.7 != 4; // var3 equals true 
bool var4 <- [2,3] != [2,3]; // var4 equals false 
bool var5 <- [2,4] != [2,3]; // var5 equals true 
bool var6 <- 3 != 3.0; // var6 equals false 
bool var7 <- 4 != 4.7; // var7 equals true 
bool var8 <- #now != #now minus_hours 1; // var8 equals true

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


?

Possible uses:

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

Result:

It is used in combination with the : operator: if the left-hand operand evaluates to true, returns the value of the left-hand operand of the :, otherwise that of the right-hand operand of the :

Comment:

These functional tests can be combined together.

Examples:

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

See also: :,


/

Possible uses:

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

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
  • 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}
  • if both operands are numbers (float or int), performs a normal arithmetic division and returns a float.
float var2 <- 3 / 5.0; // var2 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 var3 <- rgb([255, 128, 32]) / 2.5; // var3 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 var4 <- rgb([255, 128, 32]) / 2; // var4 equals rgb([127,64,16])

See also: *, +, -,


.

Possible uses:

  • agent . any expression ---> unknown
  • . (agent , any expression) ---> unknown

Result:

It has two different uses: it can be the dot product between 2 matrices or return an evaluation of the expression (right-hand operand) in the scope the given agent.

Special cases:

  • if the agent is nil or dead, throws an exception
  • if the left operand is an agent, it evaluates of the expression (right-hand operand) in the scope the given agent
unknown var0 <- agent1.location; // var0 equals the location of the agent agent1

.

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:

  • int ^ float ---> float
  • ^ (int , float) ---> float
  • float ^ int ---> float
  • ^ (float , int) ---> 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.
  • 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:

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

Result:

Returns the product of the two operands.

Special cases:

  • 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 var1 <- rgb([255, 128, 32]) * 2; // var1 equals rgb([255,255,64])
  • 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 both operands are points, returns their scalar product
float var3 <- {2,5} * {4.5, 5}; // var3 equals 34.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) scaled by the right-hand operand coefficient
geometry var4 <- circle(10) * 2; // var4 equals circle(20) 
geometry var5 <- (circle(10) * 2).location with_precision 9; // var5 equals (circle(20)).location with_precision 9 
float var6 <- (circle(10) * 2).height with_precision 9; // var6 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 var7 <- rgb([255, 128, 32]) * 2.0; // var7 equals rgb([255,255,64])
  • if the left-hand operator is a point and the right-hand a number, returns a point with coordinates multiplied by the number
point var8 <- {2,5} * 4; // var8 equals {8.0, 20.0} 
point var9 <- {2, 4} * 2.5; // var9 equals {5.0, 10.0}
  • 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 var10 <- shape * {0.5,0.5,2}; // var10 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
  • 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 var11 <- 1 * 1; // var11 equals 1

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:

  • field + matrix ---> field
  • + (field , matrix) ---> field
  • point + float ---> point
  • + (point , float) ---> point
  • matrix<unknown> + float ---> matrix
  • + (matrix<unknown> , float) ---> matrix
  • point + int ---> point
  • + (point , int) ---> point
  • float + float ---> float
  • + (float , float) ---> float
  • int + int ---> int
  • + (int , int) ---> int
  • rgb + rgb ---> rgb
  • + (rgb , rgb) ---> rgb
  • geometry + float ---> geometry
  • + (geometry , float) ---> geometry
  • geometry + geometry ---> geometry
  • + (geometry , geometry) ---> geometry
  • string + unknown ---> string
  • + (string , unknown) ---> string
  • string + string ---> string
  • + (string , string) ---> string
  • date + int ---> date
  • + (date , int) ---> date
  • map + map ---> map
  • + (map , map) ---> map
  • rgb + int ---> rgb
  • + (rgb , int) ---> rgb
  • container + container ---> container
  • + (container , container) ---> container
  • field + int ---> field
  • + (field , int) ---> field
  • field + float ---> field
  • + (field , float) ---> field
  • map + pair ---> map
  • + (map , pair) ---> map
  • int + matrix ---> matrix
  • + (int , matrix) ---> matrix
  • container + unknown ---> list
  • + (container , unknown) ---> list
  • matrix<unknown> + matrix ---> matrix
  • + (matrix<unknown> , matrix) ---> matrix
  • float + matrix ---> matrix
  • + (float , matrix) ---> matrix
  • float + int ---> float
  • + (float , int) ---> float
  • date + float ---> date
  • + (date , float) ---> date
  • point + point ---> point
  • + (point , point) ---> point
  • matrix<unknown> + int ---> matrix
  • + (matrix<unknown> , int) ---> matrix
  • date + string ---> string
  • + (date , string) ---> string
  • int + float ---> float
  • + (int , float) ---> float
  • + (geometry, float, bool) ---> geometry
  • + (geometry, float, int) ---> 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:

  • if one of the operands is nil, + throws an error
  • if both operands are species, returns a special type of list called meta-population
  • 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 var0 <- line([{10,10}, {50,50}]) + (5, true); // var0 equals A ploygon corresponding to the buffer generated
  • 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 var1 <- {1, 2} + 4.5; // var1 equals {5.5, 6.5,4.5}
  • 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 var2 <- 1 + 1; // var2 equals 2
  • if both operands are colors, returns a new color resulting from the sum of the two operands, component by component
rgb var3 <- rgb([255, 128, 32]) + rgb('red'); // var3 equals rgb([255,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) enlarged by the right-hand operand distance. The number of segments used by default is 8 and the end cap style is #round
geometry var4 <- circle(5) + 5; // var4 equals circle(10)
  • if the right-operand is a point, a geometry or an agent, returns the geometry resulting from the union between both geometries
geometry var5 <- geom1 + geom2; // var5 equals a geometry corresponding to union between geom1 and geom2
  • 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 var6 <- "hello " + 12; // var6 equals "hello 12"
  • 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 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 var8 <- date('2000-01-01') + 86400; // var8 equals date('2000-01-02')
  • 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 var9 <- line([{10,10}, {50,50}]) + (5,32,#round, true); // var9 equals A ploygon corresponding to the buffer generated
  • 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 var10 <- rgb([255, 128, 32]) + 3; // var10 equals rgb([255,131,35])
  • if both operands are list, +returns the concatenation of both lists.
list<int> var11 <- [1,2,3,4,5,6] + [2,4,9]; // var11 equals [1,2,3,4,5,6,2,4,9] 
list<int> var12 <- [1,2,3,4,5,6] + [0,8]; // var12 equals [1,2,3,4,5,6,0,8]
  • 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 var13 <- circle(5) + (5,32); // var13 equals circle(10)
  • 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 var14 <- circle(5) + (5,32,#round); // var14 equals circle(10)
  • 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 var15 <- 3.5 + matrix([[2,5],[3,4]]); // var15 equals matrix([[5.5,8.5],[6.5,7.5]])
  • 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> var16 <- [1,2,3,4,5,6] + 2; // var16 equals [1,2,3,4,5,6,2] 
list<int> var17 <- [1,2,3,4,5,6] + 0; // var17 equals [1,2,3,4,5,6,0]
  • if both operands are points, returns their sum.
point var18 <- {1, 2} + {4, 5}; // var18 equals {5.0, 7.0}

Examples:

point var19 <- {1, 2} + 4; // var19 equals {5.0, 6.0,4.0} 
map var20 <- ['a'::1,'b'::2] + ['c'::3]; // var20 equals ['a'::1,'b'::2,'c'::3] 
map var21 <- ['a'::1,'b'::2] + [5::3.0]; // var21 equals ['a'::1,'b'::2,5::3.0] 
map var22 <- ['a'::1,'b'::2] + ('c'::3); // var22 equals ['a'::1,'b'::2,'c'::3] 
map var23 <- ['a'::1,'b'::2] + ('c'::3); // var23 equals ['a'::1,'b'::2,'c'::3] 
float var24 <- 1.0 + 1; // var24 equals 2.0 
float var25 <- 1.0 + 2.5; // var25 equals 3.5 
date var26 <- date('2016-01-01 00:00:01') + 86400; // var26 equals date('2016-01-02 00:00:01') 
string var27 <- date('2000-01-01 00:00:00') + '_Test'; // var27 equals '2000-01-01 00:00:00_Test'

See also: -, *, /,


<

Possible uses:

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

Result:

true if the left-hand operand is less than the right-hand operand, false otherwise.

Special cases:

  • if one of the operands is nil, returns false
  • if both operands are points, returns true if and only if the left component (x) of the left operand if less than or equal to x of the right one and if the right component (y) of the left operand is greater than or equal to y of the right one.
bool var0 <- {5,7} < {4,6}; // var0 equals false 
bool var1 <- {5,7} < {4,8}; // var1 equals false
  • if both operands are String, uses a lexicographic comparison of two strings
bool var2 <- 'abc' < 'aeb'; // var2 equals true

Examples:

bool var3 <- 3.5 < 7; // var3 equals true 
bool var4 <- 3.5 < 7.6; // var4 equals true 
bool var5 <- 3 < 7; // var5 equals true 
bool var6 <- 3 < 2.5; // var6 equals false 
bool var7 <- #now < #now minus_hours 1; // var7 equals false

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


<=

Possible uses:

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

Result:

true if the left-hand operand is less or equal than the right-hand operand, false otherwise.

Special cases:

  • if one of the operands is nil, returns false
  • if both operands are points, returns true if and only if the left component (x) of the left operand if less than or equal to x of the right one and if the right component (y) of the left operand is greater than or equal to y of the right one.
bool var0 <- {5,7} <= {4,6}; // var0 equals false 
bool var1 <- {5,7} <= {4,8}; // var1 equals false
  • if both operands are String, uses a lexicographic comparison of two strings
bool var2 <- 'abc' <= 'aeb'; // var2 equals true

Examples:

bool var3 <- (#now <= (#now minus_hours 1)); // var3 equals false 
bool var4 <- 3 <= 7; // var4 equals true 
bool var5 <- 3 <= 2.5; // var5 equals false 
bool var6 <- 3.5 <= 3.5; // var6 equals true 
bool var7 <- 7.0 <= 7; // var7 equals true

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


=

Possible uses:

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

Result:

returns true if both operands are equal, false otherwise returns true if both operands are equal, false otherwise

Special cases:

  • 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

Examples:

bool var1 <- 3 = 3.0; // var1 equals true 
bool var2 <- 4 = 4.7; // var2 equals false 
bool var3 <- 4.7 = 4; // var3 equals false 
bool var4 <- 4 = 5; // var4 equals false 
bool var5 <- #now = #now minus_hours 1; // var5 equals false 
bool var6 <- 4.5 = 4.7; // var6 equals false

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


>

Possible uses:

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

Result:

true if the left-hand operand is greater than the right-hand operand, false otherwise.

Special cases:

  • if one of the operands is nil, returns false
  • if both operands are String, uses a lexicographic comparison of two strings
bool var5 <- 'abc' > 'aeb'; // var5 equals false
  • if both operands are points, returns true if and only if the left component (x) of the left operand if greater than x of the right one and if the right component (y) of the left operand is greater than y of the right one.
bool var6 <- {5,7} > {4,6}; // var6 equals true 
bool var7 <- {5,7} > {4,8}; // var7 equals false

Examples:

bool var0 <- 3.5 > 7.6; // var0 equals false 
bool var1 <- 3.5 > 7; // var1 equals false 
bool var2 <- 13.0 > 7.0; // var2 equals true 
bool var3 <- 3 > 2.5; // var3 equals true 
bool var4 <- (#now > (#now minus_hours 1)); // var4 equals true

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


>=

Possible uses:

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

Result:

true if the left-hand operand is greater or equal than the right-hand operand, false otherwise.

Special cases:

  • if one of the operands is nil, returns false
  • if both operands are points, returns true if and only if the left component (x) of the left operand if greater or equal than x of the right one and if the right component (y) of the left operand is greater than or equal to y of the right one.
bool var0 <- {5,7} >= {4,6}; // var0 equals true 
bool var1 <- {5,7} >= {4,8}; // var1 equals false
  • if both operands are string, uses a lexicographic comparison of the two strings
bool var2 <- 'abc' >= 'aeb'; // var2 equals false 
bool var3 <- 'abc' >= 'abc'; // var3 equals true

Examples:

bool var4 <- 3 >= 7; // var4 equals false 
bool var5 <- #now >= #now minus_hours 1; // var5 equals true 
bool var6 <- 3 >= 2.5; // var6 equals true 
bool var7 <- 3.5 >= 7; // var7 equals false 
bool var8 <- 3.5 >= 3.5; // var8 equals true

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


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:

  • container accumulate any expression ---> list
  • accumulate (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 (float) ---> float
  • acos (int) ---> 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 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, cos,


action

Possible uses:

  • action (any) ---> action

Result:

casts the operand in a action object.


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

See also: add_geometry, add_icon, add_label,


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, float, rgb) ---> kml
  • add_geometry (kml, geometry, rgb, 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

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

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

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


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


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


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, agents_overlapping, closest_to, inside, overlapping,


agents_overlapping

Possible uses:

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

Result:

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

Examples:

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

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


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:

  • container all_match any expression ---> bool
  • all_match (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

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: none_matches, one_matches, count,


all_pairs_shortest_path

Possible uses:

  • all_pairs_shortest_path (graph) ---> matrix<int>

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


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:

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

Comment:

both operands are always casted to bool before applying the operator. Thus, an expression like (1 and 0) is accepted and returns 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, !,


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)

Examples:

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

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.

Examples:

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

See also: 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, cone, line, link, norm, point, polygon, polyline, super_ellipse, rectangle, square, circle, 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: circle, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,


as

Possible uses:

  • unknown as any GAML type ---> unknown
  • as (unknown , any 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_intersection_graph, as_edge_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_intersection_graph, as_distance_graph, as_edge_graph,


as_edge_graph

Possible uses:

  • as_edge_graph (container) ---> graph
  • as_edge_graph (map) ---> 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 list, the graph will be built with elements of the list as edges
graph var0 <- as_edge_graph([line([{1,5},{12,45}]),line([{12,45},{34,56}])]); // var0 equals a graph with two edges and three vertices
  • 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 map, the graph will be built by creating edges from pairs of the map
graph var2 <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); // var2 equals a graph with these three vertices and two edges

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


as_map

Possible uses:

  • container as_map any expression ---> map
  • as_map (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: matrix,


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) ---> msi.gama.metamodel.topology.graph.ISpatialGraph

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, sin,


at

Possible uses:

  • species at int ---> agent
  • at (species , int) ---> agent
  • string at int ---> string
  • at (string , int) ---> string
  • matrix at point ---> unknown
  • at (matrix , point) ---> unknown
  • container at unknown ---> unknown
  • at (container , unknown) ---> unknown
  • list at int ---> unknown
  • at (list , int) ---> 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 it is a list or a matrix, at returns the element at the index specified by the right operand
int var1 <- [1, 2, 3] at 2; // var1 equals 3 
point var2 <- [{1,2}, {3,4}, {5,6}] at 0; // var2 equals {1.0,2.0}

Examples:

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

See also: contains_all, contains_any,


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: neighbors_at, neighbors_of, agent_closest_to, agents_inside, closest_to, inside, 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 (float) ---> float
  • atan (int) ---> 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, 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: atan, acos, asin,


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


between

Possible uses:

  • date between date ---> bool
  • between (date , date) ---> bool
  • between (float, float, float) ---> bool
  • between (date, date, date) ---> bool
  • between (int, int, int) ---> bool
  • between (any expression, date, date) ---> bool

Result:

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

Special cases:

  • returns true if the first operand is between the two dates passed in arguments (both exclusive). Can be combined with 'every' to express a frequency between two dates
bool var2 <- (date('2016-01-01') between(date('2000-01-01'), date('2020-02-02'))); // var2 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 var5 <- between(date('2000-01-01'), date('2020-02-02')); // var5 equals false

Examples:

bool var0 <- between(5.0, 1.0, 10.0); // var0 equals true 
bool var1 <- between(5, 1, 10); // var1 equals true

betweenness_centrality

Possible uses:

  • betweenness_centrality (graph) ---> map

Result:

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

Examples:

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

biggest_cliques_of

Possible uses:

  • biggest_cliques_of (graph) ---> list<list>

Result:

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

Examples:

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

See also: maximal_cliques_of,


binomial

Possible uses:

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

Result:

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

Comment:

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

Examples:

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

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


binomial_coeff

Possible uses:

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

Result:

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

Examples:

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

binomial_complemented

Possible uses:

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

Result:

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

Examples:

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

binomial_sum

Possible uses:

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

Result:

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

Examples:

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

blend

Possible uses:

  • rgb blend rgb ---> rgb
  • blend (rgb , rgb) ---> rgb
  • blend (rgb, rgb, float) ---> rgb

Result:

Blend two colors with an optional ratio (c1 * r + c2 * (1 - r)) between 0 and 1

Special cases:

  • If the ratio is omitted, an even blend is done
rgb var0 <- blend(#red, #blue); // var0 equals to a color very close to the purple

Examples:

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

See also: rgb, hsb,


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 can be applied multiple times. The original image is left untouched 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


bool

Possible uses:

  • bool (any) ---> bool

Result:

casts the operand in a bool object.


box

Possible uses:

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

Result:

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

Comment:

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

Special cases:

  • returns nil if the operand is nil.
  • returns nil if the operand is nil.

Examples:

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

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


brewer_colors

Possible uses:

  • brewer_colors (string) ---> list<rgb>
  • string brewer_colors int ---> list<rgb>
  • brewer_colors (string , int) ---> list<rgb>

Result:

Build a list of colors of a given type (see website http://colorbrewer2.org/). 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

Result:

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


buffer

Same signification as +


build

Possible uses:

  • build (matrix) ---> regression

Result:

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

Examples:

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

capitalize

Possible uses:

  • capitalize (string) ---> string

Result:

Returns a string where the first letter is capitalized

Examples:

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

See also: lower_case, upper_case,


cartesian_product

Possible uses:

  • cartesian_product (list) ---> unknown

ceil

Possible uses:

  • ceil (float) ---> float

Result:

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

Examples:

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

See also: floor, round,


cell_at

Possible uses:

  • field cell_at point ---> geometry
  • cell_at (field , point) ---> geometry
  • cell_at (field, int, int) ---> geometry

cells_in

Possible uses:

  • field cells_in geometry ---> list<geometry>
  • cells_in (field , geometry) ---> list<geometry>

cells_overlapping

Possible uses:

  • field cells_overlapping geometry ---> list<geometry>
  • cells_overlapping (field , geometry) ---> list<geometry>

centroid

Possible uses:

  • centroid (geometry) ---> point

Result:

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

Examples:

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

See also: any_location_in, closest_points_with, farthest_point_to, points_at,


char

Possible uses:

  • char (int) ---> string

Special cases:

  • converts ACSII integer value to character
string var0 <- char (34); // var0 equals '"'

chi_square

Possible uses:

  • float chi_square float ---> float
  • chi_square (float , float) ---> float

Result:

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

Examples:

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

chi_square_complemented

Possible uses:

  • float chi_square_complemented float ---> float
  • chi_square_complemented (float , float) ---> float

Result:

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

Examples:

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

choose

Possible uses:

  • choose (string, any GAML type, unknown, list) ---> unknown

Result:

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


circle

Possible uses:

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

Result:

A circle geometry which radius is equal to the operand.

Comment:

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

Special cases:

  • returns a point if the radius operand is lower or equal to 0.
  • When circle is used with 2 operands, the second one is the center of the created circle.
geometry var0 <- circle(10,{80,30}); // var0 equals a geometry as a circle of radius 10, the center will be in the location {80,30}.

Examples:

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

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


clean

Possible uses:

  • clean (geometry) ---> geometry

Result:

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

Comment:

The cleaning corresponds to a buffer with a distance of 0.0

Examples:

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

clean_network

Possible uses:

  • clean_network (list<geometry>, float, bool, bool) ---> list<geometry>

Result:

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

Comment:

The cleaned set of polylines

Examples:

list<geometry> var0 <- clean_network(my_road_shapefile.contents, 1.0, true, false); // var0 equals returns the list of polulines resulting from the cleaning of the geometry of the agent applying the operator with a tolerance of 1m, and splitting the lines at their intersections. 
list<geometry> var1 <- clean_network([line({10,10}, {20,20}), line({10,20},{20,10})],3.0,true,false); // var1 equals [line({10.0,20.0,0.0},{15.0,15.0,0.0}),line({15.0,15.0,0.0},{20.0,10.0,0.0}), line({10.0,10.0,0.0},{15.0,15.0,0.0}), line({15.0,15.0,0.0},{20.0,20.0,0.0})]

clipped_with

Possible uses:

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

Result:

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


closest_points_with

Possible uses:

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

Result:

A list of two closest points between the two geometries.

Examples:

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

See also: any_location_in, any_point_in, farthest_point_to, points_at,


closest_to

Possible uses:

  • container<unknown,geometry> closest_to geometry ---> geometry
  • closest_to (container<unknown,geometry> , geometry) ---> geometry
  • closest_to (container<unknown,geometry>, geometry, int) ---> list<geometry>

Result:

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.

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


collect

Possible uses:

  • container collect any expression ---> list
  • collect (container , any expression) ---> list

Result:

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

Comment:

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

Special cases:

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

Examples:

list var0 <- [1,2,4] collect (each *2); // var0 equals [2,4,8] 
list var1 <- [1,2,4] collect ([2,4]); // var1 equals [[2,4],[2,4],[2,4]] 
list var2 <- [1::2, 3::4, 5::6] collect (each + 2); // var2 equals [4,6,8] 
list var3 <- (list(node) collect (node(each).location.x * 2); // var3 equals the list of nodes with their x multiplied by 2

See also: accumulate,


column_at

Possible uses:

  • matrix<unknown> column_at int ---> list<unknown>
  • column_at (matrix<unknown> , int) ---> list<unknown>

Result:

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

Examples:

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

See also: row_at, rows_list,


columns_list

Possible uses:

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

Result:

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

Examples:

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

See also: rows_list,


command

Possible uses:

  • command (string) ---> string
  • string command string ---> string
  • command (string , string) ---> string
  • command (string, string, map<string,string>) ---> string

Result:

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


compress

Possible uses:

  • compress (string) ---> string

Result:

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

See also: uncompress,


cone

Possible uses:

  • cone (point) ---> geometry
  • int cone int ---> geometry
  • cone (int , int) ---> geometry

Result:

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

Comment:

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

Special cases:

  • returns nil if the operand is nil.

Examples:

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

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


cone3D

Possible uses:

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

Result:

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

Comment:

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

Special cases:

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

Examples:

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

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


connected_components_of

Possible uses:

  • connected_components_of (graph) ---> list<list>
  • graph connected_components_of bool ---> list<list>
  • connected_components_of (graph , bool) ---> list<list>

Result:

returns the connected components of a graph, i.e. the list of all edges (if the boolean is true) or vertices (if the boolean is false) that are in the connected components. 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.

Examples:

graph my_graph2 <- graph([]); 
list<list> var1 <- connected_components_of (my_graph2, true); // var1 equals the list of all the components as list 
graph my_graph <- graph([]); 
list<list> var3 <- connected_components_of (my_graph); // var3 equals the list of all the components as list

See also: alpha_index, connectivity_index, nb_cycles,


connectivity_index

Possible uses:

  • connectivity_index (graph) ---> float

Result:

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

Examples:

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

See also: alpha_index, beta_index, gamma_index, nb_cycles,


container

Possible uses:

  • container (any) ---> container

Result:

casts the operand in a container object.


contains

Possible uses:

  • container<KeyType,ValueType> contains unknown ---> bool
  • contains (container<KeyType,ValueType> , unknown) ---> bool
  • string contains string ---> bool
  • contains (string , string) ---> 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 both operands are strings, returns true if the right-hand operand contains the right-hand pattern;
  • 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

Examples:

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

See also: contains_all, contains_any, contains_key,


contains_all

Possible uses:

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

Result:

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

Comment:

the definition of contains depends on the container

Special cases:

  • if the right operand is nil or empty, contains_all returns true
  • if the left-operand is a string, test whether the string contains all the element of the list;
bool var4 <- "abcabcabc" contains_all ["ca","xy"]; // var4 equals false

Examples:

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

See also: contains, contains_any,


contains_any

Possible uses:

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

Result:

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

Comment:

the definition of contains depends on the container

Special cases:

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

Examples:

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

See also: contains, contains_all,


contains_edge

Possible uses:

  • graph contains_edge pair ---> bool
  • contains_edge (graph , pair) ---> bool
  • graph contains_edge unknown ---> bool
  • contains_edge (graph , unknown) ---> bool

Result:

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

Special cases:

  • if the left-hand operand is nil, returns false
  • if the right-hand operand is a pair, returns true if it exists an edge between the two elements of the pair in the graph
bool var0 <- graphEpidemio contains_edge (node(0)::node(3)); // var0 equals true

Examples:

graph graphFromMap <-  as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); 
bool var2 <- graphFromMap contains_edge link({1,5},{12,45}); // var2 equals true

See also: contains_vertex,


contains_key

Possible uses:

  • container<KeyType,ValueType> contains_key unknown ---> bool
  • contains_key (container<KeyType,ValueType> , unknown) ---> bool

Result:

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

Comment:

the behavior of contains_key depends on the nature of the container

Special cases:

  • if it is a map, contains_key returns true if the operand is a key of the map
  • if it is a pair, contains_key returns true if the operand is equal to the key of the pair
  • if it is a matrix, contains_key returns true if the point operand is a valid index of the matrix (i.e. >= {0,0} and < {rows, col})
  • if it is a file, contains_key is applied to the file contents -- a container
  • if it is a graph, contains_key returns true if the graph contains the corresponding vertex
  • if it is a list, contains_key returns true if the right-hand operand is an integer and if it is a valid index (i.e. >= 0 and < length)
bool var0 <- [1, 2, 3] contains_key 3; // var0 equals false 
bool var1 <- [{1,2}, {3,4}, {5,6}] contains_key 0; // var1 equals true

See also: contains_all, contains, contains_any,


contains_node

Same signification as contains_key


contains_value

Same signification as contains


contains_vertex

Possible uses:

  • graph contains_vertex unknown ---> bool
  • contains_vertex (graph , unknown) ---> bool

Result:

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

Special cases:

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

Examples:

graph graphFromMap<-  as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); 
bool var1 <- graphFromMap contains_vertex {1,5}; // var1 equals true

See also: contains_edge,


conversation

Possible uses:

  • conversation (any) ---> conversation

Result:

casts the operand in a conversation object.


convex_hull

Possible uses:

  • convex_hull (geometry) ---> geometry

Result:

A geometry corresponding to the convex hull of the operand.

Examples:

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

copy

Possible uses:

  • copy (unknown) ---> unknown

Result:

returns a copy of the operand.


copy_between

Possible uses:

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

Result:

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

Special cases:

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

Examples:

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]

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",true); 
bool copy_file_ok <- copy_file("../includes/my_folder","../includes/my_new_folder");

copy_from_clipboard

Possible uses:

  • copy_from_clipboard (any GAML type) ---> unknown

Result:

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

Examples:

string copied  <- copy_from_clipboard(string);

copy_to_clipboard

Possible uses:

  • copy_to_clipboard (string) ---> bool

Result:

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

Examples:

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

copy_to_clipboard

Possible uses:

  • copy_to_clipboard (image) ---> bool

Result:

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

Examples:

bool copied  <- copy_to_clipboard(img);

correlation

Possible uses:

  • container correlation container ---> float
  • correlation (container , container) ---> float

Result:

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

Examples:

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

cos

Possible uses:

  • cos (int) ---> float
  • cos (float) ---> float

Result:

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

Special cases:

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

Examples:

float var0 <- cos (0); // var0 equals 1.0 
float var1 <- cos(360); // var1 equals 1.0 
float var2 <- cos(-720); // var2 equals 1.0 
float var3 <- cos (0.0); // var3 equals 1.0 
float var4 <- cos(360.0); // var4 equals 1.0 
float var5 <- cos(-720.0); // var5 equals 1.0

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


count

Possible uses:

  • container count any expression ---> int
  • count (container , any expression) ---> int

Result:

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

Comment:

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

Special cases:

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

Examples:

int var0 <- [1,2,3,4,5,6,7,8] count (each > 3); // var0 equals 5 
// Number of nodes of graph g2 without any out edge 
graph g2 <- graph([]); 
int var3 <- g2 count (length(g2 out_edges_of each) = 0  ) ; // var3 equals the total number of out edges 
// Number of agents node with x > 32 
int n <- (list(node) count (round(node(each).location.x) > 32); 
int var6 <- [1::2, 3::4, 5::6] count (each > 4); // var6 equals 1

See also: group_by,


covariance

Possible uses:

  • container covariance container ---> float
  • covariance (container , container) ---> float

Result:

Returns the covariance of two data sequences

Examples:

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

covering

Possible uses:

  • container<unknown,geometry> covering geometry ---> list<geometry>
  • covering (container<unknown,geometry> , geometry) ---> list<geometry>

Result:

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

Examples:

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

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


covers

Possible uses:

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

Result:

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

Special cases:

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

Examples:

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

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


create_map

Possible uses:

  • list create_map list ---> map
  • create_map (list , list) ---> map

Result:

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

Special cases:

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

Examples:

map<int,string> var0 <- create_map([0,1,2],['a','b','c']); // var0 equals [0::'a',1::'b',2::'c'] 
map<int,float> var1 <- create_map([0,1],[0.1,0.2,0.3]); // var1 equals [0::0.1,1::0.2] 
map<string,float> var2 <- create_map(['a','b','c','d'],[1.0,2.0,3.0]); // var2 equals ['a'::1.0,'b'::2.0,'c'::3.0]

cropped_to

Same signification as clipped_with


cross

Possible uses:

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

Result:

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

Examples:

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

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


crosses

Possible uses:

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

Result:

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

Special cases:

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

Examples:

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

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


crossing

Possible uses:

  • container<unknown,geometry> crossing geometry ---> list<geometry>
  • crossing (container<unknown,geometry> , geometry) ---> list<geometry>

Result:

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

Examples:

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

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


crs

Possible uses:

  • crs (file) ---> string

Result:

the Coordinate Reference System (CRS) of the GIS file

Examples:

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

CRS_transform

Possible uses:

  • CRS_transform (geometry) ---> geometry
  • geometry CRS_transform string ---> geometry
  • CRS_transform (geometry , string) ---> geometry
  • CRS_transform (geometry, string, string) ---> geometry

Special cases:

  • returns the geometry corresponding to the transformation of the given geometry by the 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, any GAML type) ---> file
  • csv_file (string, string, string, bool) ---> file
  • csv_file (string, string, string, any GAML type) ---> file
  • csv_file (string, string, any GAML type, bool) ---> file
  • csv_file (string, string, any GAML type, point) ---> file

Result:

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

Special cases:

  • csv_file(string): This file constructor allows to read a CSV file with the default separator (coma), no header, and no assumption on the type of data. No text qualifier will be used
csv_file f <- csv_file("file.csv");
  • csv_file(string,bool): This file constructor allows to read a CSV file with the default separator (coma), with specifying if the model has a header or not (boolean), and no assumption on the type of data. No text qualifier will be used
csv_file f <- csv_file("file.csv",true);
  • csv_file(string,string): This file constructor allows to read a CSV file and specify the separator used, without making any assumption on the type of data. Headers should be detected automatically if they exist. No text qualifier will be used
csv_file f <- csv_file("file.csv", ";");
  • csv_file(string,string,bool): This file constructor allows to read a CSV file and specify (1) the separator used; (2) if the model has a header or not, without making any assumption on the type of data. No text qualifier will be used
csv_file f <- csv_file("file.csv", ";",true);
  • csv_file(string,string,string,bool): This file constructor allows to read a CSV file and specify (1) the separator used; (2) the text qualifier used; (3) if the model has a header or not, without making any assumption on the type of data
csv_file f <- csv_file("file.csv", ';', '"', true);
  • csv_file(string,string,any GAML type): This file constructor allows to read a CSV file with a given separator, no header, and the type of data. No text qualifier will be used
csv_file f <- csv_file("file.csv", ";",int);
  • csv_file(string,string,string,any GAML type): This file constructor allows to read a CSV file and specify the separator, text qualifier to use, and the type of data to read. Headers should be detected automatically if they exist.
csv_file f <- csv_file("file.csv", ';', '"', int);
  • csv_file(string,string,any GAML type,bool): This file constructor allows to read a CSV file with a given separator, the type of data, with specifying if the model has a header or not (boolean). No text qualifier will be used
csv_file f <- csv_file("file.csv", ";",int,true);
  • csv_file(string,string,any GAML type,point): This file constructor allows to read a CSV file with a given separator, the type of data, with specifying the number of cols and rows taken into account. No text qualifier will be used
csv_file f <- csv_file("file.csv", ";",int,true, {5, 100});
  • csv_file(string,matrix): This file constructor allows to store a matrix in a CSV file (it does not save it - just store it in memory),
csv_file f <- csv_file("file.csv", matrix([10,10],[10,10]));

See also: is_csv,


cube

Possible uses:

  • cube (float) ---> geometry

Result:

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

Comment:

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

Special cases:

  • returns nil if the operand is nil.

Examples:

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

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


curve

Possible uses:

  • curve (point, point, point) ---> geometry
  • curve (point, point, float) ---> geometry
  • curve (point, point, float, bool) ---> geometry
  • curve (point, point, point, int) ---> geometry
  • curve (point, point, point, point) ---> geometry
  • curve (point, point, float, float) ---> geometry
  • curve (point, point, float, int, float) ---> geometry
  • curve (point, point, point, point, int) ---> geometry
  • curve (point, point, float, bool, 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 between the given operators, with 10 or a given number of points, and from left to rigth or right to left.

Special cases:

  • if one of the operand is nil, returns nil
  • When used with 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 var0 <- curve({0,0},{10,10}, 0.5, 100, 90); // var0 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.
  • When used with 2 points, a float coefficient, a boolean, an integer number of points, and a float proportion, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of the given number of points - the boolean is used to specified if it is the right side and the last value to indicate where is the inflection point (between 0.0 and 1.0 - default 0.5).
geometry var1 <- curve({0,0},{10,10}, 0.5, false, 100, 0.8); // var1 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 var2 <- curve({0,0}, {0,10}, {10,10}); // var2 equals a cubic Bezier curve geometry composed of 10 points from p0 to p3.
  • 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 var3 <- curve({0,0},{10,10}, 0.5, false); // var3 equals a cubic Bezier curve geometry composed of 10 points from p0 to p1 at the left side.
  • When used with 3 points and an integer, it computes a quadratic Bezier curve geometry built from the three given points. If the last operand (number of points) is inferior to 2, returns nil
geometry var4 <- curve({0,0}, {0,10}, {10,10}, 20); // var4 equals a quadratic Bezier curve geometry composed of 20 points from p0 to p2.
  • When used with 2 points, a float coefficient, a boolean, and an integer number of points, it computes a cubic Bezier curve geometry built from the two given points with the given coefficient for the radius and composed of the given number of points - the boolean is used to specified if it is the right side.
geometry var5 <- curve({0,0},{10,10}, 0.5, false, 100); // var5 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 var6 <- curve({0,0},{10,10}, 0.5, 100, 0.8, 90); // var6 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.
  • When used with 4 points, it computes, it computes a cubic Bezier curve geometry built from the four given points and composed of 10 points.
geometry 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 3 points, it computes a quadratic Bezier curve geometry built from the three given points and composed of 10 points.
geometry var8 <- curve({0,0}, {0,10}, {10,10}); // var8 equals a quadratic Bezier curve geometry composed of 10 points from p0 to p2.
  • 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 var9 <- curve({0,0},{10,10}, 0.5); // var9 equals a cubic Bezier curve geometry composed of 10 points from p0 to p1.
  • 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 var10 <- curve({0,0},{10,10}, 0.5, 90); // var10 equals a cubic Bezier curve geometry composed of 100 points from p0 to p1 at the right side.

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


cylinder

Possible uses:

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

Result:

A cylinder geometry which radius is equal to the operand.

Comment:

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

Special cases:

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

Examples:

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

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


darker

Possible uses:

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

Result:

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. Used to return an image darker by a percentage (between 0 - no change - and 1 - 100% darker). If the percentage is below zero or abovde 1, returns the image untouched


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.

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: towards, direction_to, distance_to, distance_between, path_between, path_to,


direction_to

Same signification as towards


directory

Possible uses:

  • directory (any) ---> directory

Result:

casts the operand in a directory object.


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: intersects, crosses, 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.

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: towards, direction_to, distance_to, direction_between, path_between, path_to,


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.

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: towards, direction_to, distance_between, direction_between, path_between, path_to,


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]); // 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],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 <- 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],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 <- 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]); // 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:

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

Result:

Returns the truncation of the 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.

Examples:

int var0 <- 40 div 3; // var0 equals 13 
int var1 <- 40.1 div 4.5; // var1 equals 8 
int var2 <- 40 div 4.1; // var2 equals 9 
int var3 <- 40.5 div 3; // var3 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
  • pair edge int ---> unknown
  • edge (pair , int) ---> unknown
  • pair edge float ---> unknown
  • edge (pair , float) ---> unknown
  • unknown edge unknown ---> unknown
  • edge (unknown , unknown) ---> unknown
  • unknown edge int ---> unknown
  • edge (unknown , int) ---> unknown
  • unknown edge float ---> unknown
  • edge (unknown , float) ---> unknown
  • edge (pair, unknown, float) ---> unknown
  • edge (unknown, unknown, int) ---> unknown
  • edge (unknown, unknown, float) ---> unknown
  • edge (pair, unknown, int) ---> unknown
  • edge (unknown, unknown, unknown) ---> 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: out_edges_of, in_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 is the list of candidates is nil or empty

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: weighted_means_DM, promethee_DM, evidence_theory_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: around, cone, line, link, norm, point, polygon, polyline, rectangle, square, circle, 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, cone, line, link, norm, point, polygon, polyline, super_ellipse, rectangle, square, circle, ellipse, triangle,


emotion

Possible uses:

  • emotion (any) ---> emotion

Result:

casts the operand in a emotion object.


empty

Possible uses:

  • empty (container<KeyType,ValueType>) ---> bool
  • empty (string) ---> 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
  • if it is a string, empty returns true if the string does not contain any character, and false otherwise
bool var1 <- empty ('abced'); // var1 equals false

enlarged_by

Same signification as +


enter

Possible uses:

  • string enter string ---> unknown
  • enter (string , string) ---> unknown
  • string enter unknown ---> unknown
  • enter (string , unknown) ---> unknown
  • string enter bool ---> unknown
  • enter (string , bool) ---> unknown
  • string enter int ---> unknown
  • enter (string , int) ---> unknown
  • string enter any GAML type ---> unknown
  • enter (string , any GAML type) ---> unknown
  • string enter float ---> unknown
  • enter (string , float) ---> unknown
  • enter (string, any GAML type, unknown) ---> unknown
  • enter (string, float, float, float) ---> unknown
  • enter (string, int, int, int) ---> unknown
  • enter (string, int, int, int, int) ---> unknown
  • enter (string, float, float, float, float) ---> unknown

Result:

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

Special cases:

  • 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)]);
  • 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));

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

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
  • bool every int ---> bool
  • every (bool , int) ---> bool
  • float every int ---> float
  • every (float , int) ---> float
  • unknown every int ---> unknown
  • every (unknown , int) ---> unknown
  • int every int ---> int
  • every (int , int) ---> int
  • list every any expression ---> list<date>
  • every (list , any expression) ---> list<date>
  • list every int ---> list
  • every (list , int) ---> list

Result:

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 operand every 2nd operand * cycle, nil otherwise expects a frequency (expressed in seconds of simulated time) as argument. Will return true every time the current_date matches with this frequency returns the first integer operand every 2nd operand * cycle, 0 otherwise true every operand * cycle, false otherwise applies a step to an interval of dates defined by 'date1 to date2'. Beware that using every with #month or #year will produce odd results,as these pseudo-constants are not constant; only the first value will be used to compute the intervals, so, for instance, if current_date is set to February#month will only represent 28 or 29 days. Retrieves elements from the first argument every step (second argument) elements. Raises an error if the step is negative or equal to zero

Comment:

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. object every(10#cycle) is strictly equivalent to every(10#cycle) ? object : nilUsed 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 pointthe 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 do something every x cycle.

Examples:

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 ({2000,2000} every(2#cycle) != nil) {write "this is a point";} 
	     else {write "this is nil";} 
reflex when: every(2#days) since date('2000-01-01') { .. } 
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 
if (1000 every(2#cycle) != 0) {write "this is a value";} 
	     else {write "this is 0";} 
if every(2#cycle) {write "the cycle number is even";} 
	     else {write "the cycle number is odd";} 
(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

See also: since, after, 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 is the list of candidates is nil or empty

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: weighted_means_DM, electre_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.

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_rnd, gauss_rnd, lognormal_rnd, poisson, rnd, skew_gauss, lognormal_density, gamma_density,


exp_rnd

Possible uses:

  • exp_rnd (float) ---> float

Result:

returns a random value from a exponential distribution with specified values of the rate (lambda) parameters. 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.

Examples:

float var0 <- fact(4); // var0 equals 24

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, closest_points_with, points_at,


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


field

Possible uses:

  • int field int ---> field
  • field (int , int) ---> field
  • unknown field float ---> field
  • field (unknown , float) ---> 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: matrix, as_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 of if it is a folder

Examples:

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

first

Possible uses:

  • first (container<KeyType,ValueType>) ---> ValueType
  • first (string) ---> string
  • int first container ---> list
  • first (int , container) ---> list

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
  • if it is a string, first returns a string composed of its first character
string var1 <- first ('abce'); // var1 equals 'a'

See also: last,


first_of

Same signification as first


first_with

Possible uses:

  • container first_with any expression ---> unknown
  • first_with (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

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.

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,


folder

Possible uses:

  • folder (string) ---> file

Result:

opens an existing repository

Special cases:

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

Examples:

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

See also: file, new_folder,


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

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

frequency_of

Possible uses:

  • container frequency_of any expression ---> map
  • frequency_of (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_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: from_gaml, from_binary,


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: promethee_DM, electre_DM, evidence_theory_DM,


fuzzy_kappa

Possible uses:

  • fuzzy_kappa (list<agent>, list<unknown>, list<unknown>, list<float>, list<unknown>, matrix<float>, float) ---> float
  • fuzzy_kappa (list<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 (list<agent>, list<unknown>, list<unknown>, list<unknown>, list<float>, list<unknown>, matrix<float>, float) ---> float
  • fuzzy_kappa_sim (list<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, gauss_rnd, lognormal_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_rnd, weibull_density, lognormal_density,


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


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, gauss_rnd, lognormal_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_rnd, gamma_trunc_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, weibull_trunc_rnd, lognormal_trunc_rnd, truncated_gauss,


gauss

Possible uses:

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

Result:

The operator can be used with an operand of type point {meand,standardDeviation}. 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.

Special cases:

  • when the operand is a point, it is read as {mean, standardDeviation}
  • when standardDeviation value is 0.0, it always returns the mean value

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 (container, int, int, bool) ---> graph
  • generate_barabasi_albert (int, 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; "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);
  • "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);

See also: generate_watts_strogatz,


generate_complete_graph

Possible uses:

  • int generate_complete_graph bool ---> graph
  • generate_complete_graph (int , bool) ---> graph
  • bool generate_complete_graph list ---> graph
  • generate_complete_graph (bool , list) ---> 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
graph myGraph <- generate_complete_graph( 
			100, 
			true);
  • "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; edges_species: the species of edges
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph( 
100, 
true, 
node_species, 
edge_species);
  • 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);

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

Examples:

list<geometry> var0 <- generate_pedestrian_network([wall], [world],true,false,3.0,0.1, true,0.1,0.0,0.0,0.0,50.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,0.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 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);
  • 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);

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 (int, float, int, bool) ---> graph
  • generate_watts_strogatz (container, 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:

  • "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
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			100, 
			0.3, 
			5, 
		true);
  • "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
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz( 
			100, 
			0.3, 
			5, 
		true, 
			myVertexSpecies);

See also: generate_barabasi_albert,


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: mean, median, harmonic_mean,


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, link, norm, point, polygone, rectangle, square, triangle, line,


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_about

Possible uses:

  • get_about (emotion) ---> predicate

Result:

get the about value of the given emotion

Examples:

get_about(emotion)

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_agent_cause

Possible uses:

  • get_agent_cause (predicate) ---> agent
  • get_agent_cause (emotion) ---> agent

Result:

evaluate the agent_cause value of a predicate get the agent cause value of the given emotion

Examples:

get_agent_cause(pred1) 
get_agent_cause(emotion)

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_decay

Possible uses:

  • get_decay (emotion) ---> float

Result:

get the decay value of the given emotion

Examples:

get_decay(emotion)

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_dominance

Possible uses:

  • get_dominance (social_link) ---> float

Result:

get the dominance value of the given social link

Examples:

get_dominance(social_link1)

get_familiarity

Possible uses:

  • get_familiarity (social_link) ---> float

Result:

get the familiarity value of the given social link

Examples:

get_familiarity(social_link1)

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_intensity

Possible uses:

  • get_intensity (emotion) ---> float

Result:

get the intensity value of the given emotion

Examples:

get_intensity(emo1)

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_lifetime

Possible uses:

  • get_lifetime (mental_state) ---> int

Result:

get the lifetime value of the given mental state

Examples:

get_lifetime(mental_state1)

get_liking

Possible uses:

  • get_liking (social_link) ---> float

Result:

get the liking value of the given social link

Examples:

get_liking(social_link1)

get_modality

Possible uses:

  • get_modality (mental_state) ---> string

Result:

get the modality value of the given mental state

Examples:

get_modality(mental_state1)

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_predicate

Possible uses:

  • get_predicate (mental_state) ---> predicate

Result:

get the predicate value of the given mental state

Examples:

get_predicate(mental_state1)

get_solidarity

Possible uses:

  • get_solidarity (social_link) ---> float

Result:

get the solidarity value of the given social link

Examples:

get_solidarity(social_link1)

get_strength

Possible uses:

  • get_strength (mental_state) ---> float

Result:

get the strength value of the given mental state

Examples:

get_strength(mental_state1)

get_super_intention

Possible uses:

  • get_super_intention (predicate) ---> mental_state

Result:

get the super intention linked to a mental state

Examples:

get_super_intention(get_belief(pred1))

get_trust

Possible uses:

  • get_trust (social_link) ---> float

Result:

get the familiarity value of the given social link

Examples:

get_familiarity(social_link1)

get_truth

Possible uses:

  • get_truth (predicate) ---> bool

Result:

evaluate the truth value of a predicate

Examples:

get_truth(pred1)

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

get_values

Possible uses:

  • get_values (predicate) ---> map<string,unknown>

Result:

return the map values of a predicate

Examples:

get_values(pred1)

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


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, 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] 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]


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: rgb, hsb,


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_intersection_graph, as_edge_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:

  • container group_by any expression ---> map
  • group_by (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: first_with, last_with, 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: mean, median, geometric_mean,


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 (point) ---> geometry
  • hexagon (float) ---> 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,5}); // var1 equals a geometry as a hexagon of width of 10 and height of 5. 
geometry var2 <- hexagon(10); // var2 equals a geometry as a hexagon of width of 10 and height of 10.

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


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, float) ---> rgb
  • hsb (float, float, float, int) ---> 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.5,1.0,1.0,0.0); // var0 equals rgb("cyan",0) 
rgb var1 <- hsb (0.0,1.0,1.0); // var1 equals rgb("red")

See also: rgb,


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]

image

Possible uses:

  • int image int ---> image
  • image (int , int) ---> image
  • image (file, int, int) ---> image
  • image (int, int, bool) ---> image
  • image (int, int, rgb) ---> image

Result:

Builds a new blank image of the specified dimensions, which does not accept transparency Builds a new image from the specified file, p assing the width and height in parameter Builds a new blank image with the specified dimensions and indicates if it will support transparency or not Builds a new image with the specified dimensions and already filled with the given rgb color


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

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;

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.

Examples:

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

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

  • container index_by any expression ---> map
  • index_by (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:

  • list index_of unknown ---> int
  • index_of (list , unknown) ---> int
  • 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
  • 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

Comment:

The definition of index_of and the type of the index depend on the container

Special cases:

  • 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 list, index_of returns the index as an integer
int var0 <- [1,2,3,4,5,6] index_of 4; // var0 equals 3 
int var1 <- [4,2,3,4,5,4] index_of 4; // var1 equals 0
  • if the left operand is a matrix, index_of returns the index as a point
point var2 <- matrix([[1,2,3],[4,5,6]]) index_of 4; // var2 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 var3 <- "abcabcabc" index_of "ca"; // var3 equals 2

Examples:

unknown var4 <- [1::2, 3::4, 5::6] index_of 4; // var4 equals 3

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


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
  • 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: disjoint_from, crosses, 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, normalized_rotation](OperatorsSZ#rotation_composition, normalized_rotation),


is

Possible uses:

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

Result:

returns true if the left operand is of the right operand type, false otherwise

Examples:

bool var0 <- 0 is int; // var0 equals true 
bool var1 <- an_agent is node; // var1 equals true 
bool var2 <- 1 is float; // var2 equals false

is_agent

Possible uses:

  • is_agent (any) ---> bool

Result:

Tests whether the operand is a agent file.

See also: agent_file,


is_csv

Possible uses:

  • is_csv (any) ---> bool

Result:

Tests whether the operand is a csv file.

See also: csv_file,


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


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_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 Returns whether or not the given web address is reachable or not before a time_out time in milliseconds

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

Examples:

bool var0 <- agentA is_skill 'moving'; // var0 equals true

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_warning

Possible uses:

  • is_warning (any expression) ---> bool

Result:

Returns whether or not the argument raises a warning when evaluated


is_xml

Possible uses:

  • is_xml (any) ---> bool

Result:

Tests whether the operand is a xml file.

See also: xml_file,


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). 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, weights). Reference: Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20.

Examples:

kappa([cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2],[cat1,cat2,cat3]) 
float var1 <- kappa([1,3,5,1,5],[1,1,1,1,5],[1,3,5]); // var1 equals 0.3333333333333334 
float var2 <- kappa([1,1,1,1,5],[1,1,1,1,5],[1,3,5]); // var2 equals 1.0 
float var3 <- kappa(["cat1","cat3","cat2","cat1","cat3"],["cat1","cat3","cat2","cat3","cat1"],["cat1","cat2","cat3"], [1.0, 2.0, 3.0, 1.0, 5.0]); // var3 equals 0.29411764705882354

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 (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)]) Returns the kurtosis from a moment and a standard deviation

Special cases:

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

Examples:

float var0 <- kurtosis ([1,2,3,4,5]); // var0 equals -1.200000000000002 
float var1 <- kurtosis([13,2,1,4,1,2]) with_precision(4); // var1 equals 4.8083 
float var2 <- kurtosis(3,12) with_precision(4); // var2 equals -2.9999

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 (string) ---> string
  • last (container<KeyType,ValueType>) ---> ValueType
  • int last container ---> list
  • last (int , container) ---> list

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 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'
  • if it is a list, last returns the last element of the list, or nil if the list is empty
int var1 <- last ([1, 2, 3]); // var1 equals 3

See also: first,


last_index_of

Possible uses:

  • list last_index_of unknown ---> int
  • last_index_of (list , unknown) ---> int
  • species last_index_of unknown ---> int
  • last_index_of (species , unknown) ---> int
  • matrix last_index_of unknown ---> point
  • last_index_of (matrix , unknown) ---> point
  • map<unknown,unknown> last_index_of unknown ---> unknown
  • last_index_of (map<unknown,unknown> , unknown) ---> unknown
  • string last_index_of string ---> int
  • last_index_of (string , string) ---> int

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 the left operand is a list, last_index_of returns the index as an integer
int var0 <- [1,2,3,4,5,6] last_index_of 4; // var0 equals 3 
int var1 <- [4,2,3,4,5,4] last_index_of 4; // var1 equals 5
  • if the left operand is a matrix, last_index_of returns the index as a point
point var2 <- matrix([[1,2,3],[4,5,4]]) last_index_of 4; // var2 equals {1.0,2.0}
  • if the left operand is a map, last_index_of returns the index as an int (the key of the pair)
unknown var3 <- [1::2, 3::4, 5::4] last_index_of 4; // var3 equals 5
  • if both operands are strings, returns the index within the left-hand string of the rightmost occurrence of the given right-hand string
int var4 <- "abcabcabc" last_index_of "ca"; // var4 equals 5

See also: at, last_index_of, index_of,


last_of

Same signification as last


last_with

Possible uses:

  • container last_with any expression ---> unknown
  • last_with (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: group_by, first_with, 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
  • length (string) ---> 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
  • if it is a string, length returns the number of characters
int var3 <- length ("I am an agent"); // var3 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.
  • 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: around, circle, cone, link, norm, point, polygone, rectangle, square, 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: around, circle, cone, line, norm, point, polygon, polyline, rectangle, square, triangle,


list

Possible uses:

  • list (any) ---> list

Result:

casts the operand in a list object.


list_with

Possible uses:

  • int list_with any expression ---> list
  • list_with (int , any expression) ---> list

Result:

creates a list with a size provided by the first operand, and filled with the second operand

Comment:

Note that the first operand should be positive, 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.

Examples:

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

See also: exp,


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_sub_model

Possible uses:

  • string load_sub_model string ---> agent
  • load_sub_model (string , string) ---> agent

Result:

Load a submodel

Comment:

loaded submodel


log

Possible uses:

  • log (float) ---> float
  • log (int) ---> float

Result:

Returns the logarithm (base 10) of the operand.

Special cases:

  • an exception is raised if the operand is equals or less than zero.

Examples:

float var0 <- log(10); // var0 equals 1.0 
float var1 <- log(1); // var1 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, gamma_rnd, gauss_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_rnd, weibull_density, gamma_density,


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 shape (alpha) and scale (beta) 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, gamma_rnd, gauss_rnd, poisson, rnd, skew_gauss, truncated_gauss, weibull_rnd, lognormal_trunc_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: lognormal_rnd, gamma_trunc_rnd, weibull_trunc_rnd, truncated_gauss,


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


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:

  • point matrix_with any expression ---> matrix
  • matrix_with (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

Comment:

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

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

  • container max_of any expression ---> unknown
  • max_of (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: min_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.

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

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:

  • container mean_of any expression ---> unknown
  • mean_of (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: min_of, max_of, sum_of, product_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: mean,


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)

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:

  • container min_of any expression ---> unknown
  • min_of (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,


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.

Examples:

int var0 <- 40 mod 3; // var0 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)

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

morrisAnalysis

Possible uses:

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

Result:

Return a string containing the Report of the morris analysis for the corresponding CSV file


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,


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, gamma_index, connectivity_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: neighbors_of, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to, at_distance,


neighbors_of

Possible uses:

  • graph neighbors_of unknown ---> list
  • neighbors_of (graph , unknown) ---> list
  • field neighbors_of point ---> list<point>
  • neighbors_of (field , point) ---> list<point>
  • topology neighbors_of agent ---> list
  • neighbors_of (topology , agent) ---> list
  • 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:

  • a list, containing all the agents of the same species than the left argument (if it is an agent) located at a distance inferior or equal to the third argument to the second argument (agent, geometry or point) considering the first operand topology.
list var0 <- neighbors_of (topology(self), self,10); // var0 equals all the agents located at a distance lower or equal to 10 to the agent applying the operator considering its topology.

Examples:

list var1 <- graphEpidemio neighbors_of (node(3)); // var1 equals [node0,node2] 
list var2 <- graphFromMap neighbors_of node({12,45}); // var2 equals [{1.0,5.0},{34.0,56.0}] 
list var3 <- topology(self) neighbors_of self; // var3 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: predecessors_of, successors_of, neighbors_at, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to,


new_emotion

Possible uses:

  • new_emotion (string) ---> emotion
  • string new_emotion float ---> emotion
  • new_emotion (string , float) ---> emotion
  • string new_emotion agent ---> emotion
  • new_emotion (string , agent) ---> emotion
  • string new_emotion predicate ---> emotion
  • new_emotion (string , predicate) ---> emotion
  • new_emotion (string, predicate, agent) ---> emotion
  • new_emotion (string, float, agent) ---> emotion
  • new_emotion (string, float, predicate) ---> emotion
  • new_emotion (string, float, float) ---> emotion
  • new_emotion (string, float, float, agent) ---> emotion
  • new_emotion (string, float, predicate, float) ---> emotion
  • new_emotion (string, float, predicate, agent) ---> 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:

  • a new emotion with a name and an initial intensity:
new_emotion("joy",12.3)
  • a new emotion with a given name and the agent which has caused this emotion
new_emotion("joy",agent1)
  • a new emotion with a given name and the predicate it is about
new_emotion("joy",estFood) 
new_emotion("joy",agent1)
  • 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 decay value value can be added to define a new emotion.
new_emotion("joy",12.3,4.0)

Examples:

new_emotion("joy") 
emotion("joy", 12.3, 4, agent1) 
new_emotion("joy",12.3,eatFood,4.0) 
emotion("joy",12.3,eatFood,4,agent1) 
new_emotion("joy",12.3,eatFood,agent1)

new_folder

Possible uses:

  • new_folder (string) ---> file

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: folder, file, 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, float) ---> mental_state
  • new_mental_state (string, predicate, int) ---> mental_state
  • new_mental_state (string, emotion, agent) ---> mental_state
  • new_mental_state (string, emotion, int) ---> mental_state
  • new_mental_state (string, predicate, agent) ---> mental_state
  • new_mental_state (string, mental_state, float) ---> mental_state
  • new_mental_state (string, predicate, float) ---> mental_state
  • new_mental_state (string, mental_state, agent) ---> mental_state
  • new_mental_state (string, mental_state, int) ---> mental_state
  • new_mental_state (string, emotion, float, agent) ---> mental_state
  • new_mental_state (string, predicate, int, agent) ---> mental_state
  • new_mental_state (string, predicate, float, int) ---> mental_state
  • new_mental_state (string, mental_state, float, agent) ---> mental_state
  • new_mental_state (string, mental_state, int, agent) ---> mental_state
  • new_mental_state (string, predicate, float, agent) ---> mental_state
  • new_mental_state (string, emotion, float, int) ---> mental_state
  • new_mental_state (string, emotion, int, agent) ---> mental_state
  • new_mental_state (string, mental_state, float, int) ---> mental_state
  • new_mental_state (string, emotion, float, int, agent) ---> mental_state
  • new_mental_state (string, mental_state, float, int, agent) ---> mental_state
  • new_mental_state (string, predicate, 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", my_joy, 12.3, 10, agent1) 
new_mental_state("belief", mental_state1) 
new_mental_state("belief", mental_state1, 12.3, 10, agent1) 
new_mental_state("belief", my_joy, 12.3) 
new_mental_state("belief", my_joy, 12.3, agent1) 
new_mental_state("belief", raining, 10) 
new_mental_state("belief", my_joy, agent1) 
new_mental_state("belief", raining) 
new_mental_state("belief", raining, 10, agent1) 
new_mental_state("belief",  my_joy, 10) 
new_mental_state("belief", raining, 12.4, 10) 
new_mental_state("belief") 
new_mental_state("belief", mental_state1, 12.2, agent1) 
new_mental_state("belief",raining, 12.3, 10, agent1) 
new_mental_state("belief", mental_state1, 10, agent1) 
new_mental_state("belief", my_joy) 
new_mental_state("belief", raining, agent1) 
new_mental_state("belief", raining, 12.3, agent1) 
new_mental_state("belief", my_joy, 12.3, 10) 
new_mental_state("belief", mental_state1, 12.3) 
new_mental_state("belief", raining, 0.5) 
new_mental_state("belief", my_joy, 10, agent1) 
new_mental_state("belief", mental_state1, 12.3, 10) 
new_mental_state("belief", mental_state1, agent1) 
new_mental_state("belief", mental_state1, 10)

new_predicate

Possible uses:

  • new_predicate (string) ---> predicate
  • string new_predicate map ---> predicate
  • new_predicate (string , map) ---> predicate
  • string new_predicate agent ---> predicate
  • new_predicate (string , agent) ---> predicate
  • string new_predicate bool ---> predicate
  • new_predicate (string , bool) ---> predicate
  • new_predicate (string, map, bool) ---> predicate
  • new_predicate (string, map, agent) ---> 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") 
new_predicate("people to meet", map(["val1"::23]) ) 
new_predicate("people to meet", ["time"::10], true) 
new_predicate("people to meet", ["time"::10], true, agentA) 
new_predicate("people to meet", agent1) 
new_predicate("hasWater", true) 
new_predicate("people to meet", ["time"::10], agentA)

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,0.0,-0.1,0.2,0.1) 
new_social_link(agentA)

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:

  • container none_matches any expression ---> bool
  • none_matches (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: one_matches, all_match, count,


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,


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:

  • container one_matches any expression ---> bool
  • one_matches (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: none_matches, all_match, count,


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:

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

Comment:

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

Examples:

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

See also: bool, and, !,


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.

Examples:

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

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


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

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: disjoint_from, crosses, intersects, partially_overlaps, touches,


pair

Same signification as ::


pair

Possible uses:

  • pair (any) ---> pair

Result:

casts the operand in a pair object.


palette

Possible uses:

  • palette (list<rgb>) ---> list<rgb>

Result:

transforms a list of n colors into a palette (necessary for some layers)


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


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: disjoint_from, crosses, overlaps, intersects, 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:

  • list<agent> path_between container<unknown,geometry> ---> path
  • path_between (list<agent> , container<unknown,geometry>) ---> path
  • topology path_between container<unknown,geometry> ---> path
  • path_between (topology , 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 (map<agent,unknown>, geometry, geometry) ---> path
  • path_between (topology, geometry, geometry) ---> path
  • path_between (graph, unknown, unknown) ---> path

Result:

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 The shortest path between two objects according to set of cells The shortest path between two objects according to set of cells with corresponding weights The shortest path between a list of two objects in a graph

Examples:

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

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


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: towards, direction_to, distance_between, direction_between, path_between, distance_to,


paths_between

Possible uses:

  • paths_between (graph, 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,


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, closest_points_with, farthest_point_to,


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

Examples:

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

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

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: around, circle, cone, line, link, norm, point, polyline, rectangle, square, 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


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)

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

product

Same signification as mul


product_of

Possible uses:

  • container product_of any expression ---> unknown
  • product_of (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: min_of, max_of, sum_of, mean_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 list of candidates 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: weighted_means_DM, electre_DM, evidence_theory_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. 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 var0 <- range(0,6,2); // var0 equals [0,2,4,6]
  • When used with 2 operands, it returns the list of int representing all contiguous values from the first to the second argument. Passing the same value for both will return a singleton list with this value
list var1 <- range(0,2); // var1 equals [0,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
  • float rectangle float ---> geometry
  • rectangle (float , float) ---> geometry
  • point rectangle point ---> geometry
  • rectangle (point , point) ---> 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.

Examples:

geometry var0 <- rectangle({10, 5}); // var0 equals a geometry as a rectangle with width = 10 and height = 5. 
geometry var1 <- rectangle(10, 5); // var1 equals a geometry as a rectangle with width = 10 and height = 5. 
geometry var2 <- rectangle({0.0,0.0}, {10.0,10.0}); // var2 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.

See also: around, circle, cone, line, link, norm, point, polygon, polyline, square, 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 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_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_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: 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>
  • reverse (string) ---> string

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"]])
  • if it is a string, reverse returns a new string with characters in the reversed order
string var5 <- reverse ('abcd'); // var5 equals 'dcba'

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

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:

  • string rgb int ---> rgb
  • rgb (string , int) ---> rgb
  • rgb rgb int ---> rgb
  • rgb (rgb , int) ---> rgb
  • rgb rgb float ---> rgb
  • rgb (rgb , float) ---> 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 r=red, g=green, b=blue (each between 0 and 255), a=alpha (between 0 and 255)
  • It can be used with a name of color and alpha (between 0 and 255)
  • It can be used with r=red, g=green, b=blue (each between 0 and 255), a=alpha (between 0.0 and 1.0)
  • 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
  • It can be used with a color and an alpha between 0 and 1

Examples:

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

See also: hsb,


rgb

Possible uses:

  • rgb (any) ---> rgb

Result:

casts the operand in a rgb object.


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 (int) ---> int
  • rnd (point) ---> point
  • rnd (float) ---> float
  • float rnd float ---> float
  • rnd (float , float) ---> float
  • int rnd int ---> int
  • rnd (int , int) ---> int
  • point rnd point ---> point
  • rnd (point , point) ---> point
  • rnd (float, float, float) ---> float
  • rnd (int, int, int) ---> int
  • rnd (point, point, float) ---> point

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 the operand is a point, returns a point with three random float ordinates, each in the interval [0, ordinate of argument]
  • if the operand is a float, returns an uniformly distributed float random number in [0.0, to]

Examples:

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

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


rnd_choice

Possible uses:

  • rnd_choice (map<unknown,unknown>) ---> unknown
  • rnd_choice (list) ---> int

Result:

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

Examples:

unknown var0 <- rnd_choice(["toto"::0.2,"tata"::0.5,"tonton"::0.3]); // var0 equals 2/10 chances to return "toto", 5/10 chances to return "tata", 3/10 chances to return "tonton" 
int var1 <- rnd_choice([0.2,0.5,0.3]); // var1 equals 2/10 chances to return 0, 5/10 chances to return 1, 3/10 chances to return 2

See also: rnd,


rnd_color

Possible uses:

  • rnd_color (int) ---> rgb
  • int rnd_color int ---> rgb
  • rnd_color (int , int) ---> rgb

Result:

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

Comment:

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

Examples:

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

See also: rgb, hsb,


rotated_by

Possible uses:

  • geometry rotated_by int ---> geometry
  • rotated_by (geometry , int) ---> geometry
  • geometry rotated_by float ---> geometry
  • rotated_by (geometry , float) ---> geometry
  • geometry rotated_by pair ---> geometry
  • rotated_by (geometry , pair) ---> geometry
  • point rotated_by pair ---> point
  • rotated_by (point , pair) ---> point
  • 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:

  • the right-hand operand representing the angle can be a float or an integer
  • 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

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, from left to right. Angles are in degrees.

Examples:

pair<float,point> var0 <- rotation_composition([38.0::{1,1,1},90.0::{1,0,0}]); // var0 equals 115.22128507898108::{0.9491582126366207,0.31479943993669307,-0.0}

See also: inverse_rotation,


round

Possible uses:

  • round (int) ---> int
  • round (point) ---> point
  • round (float) ---> int

Result:

Returns the rounded value of the operand.

Special cases:

  • if the operand is an int, round returns it

Examples:

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

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


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: columns_list,


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.


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


serialize

Possible uses:

  • serialize (unknown) ---> string

Result:

Serializes any object/agent/simulation into a string, using the 'binary' formatThe result of this operator can be then used in the from: facet of restore or create statements in case of agents, or using deserialize for other items

See also: to_json, to_gaml,


set_about

Possible uses:

  • emotion set_about predicate ---> emotion
  • set_about (emotion , predicate) ---> emotion

Result:

change the about value of the given emotion

Examples:

emotion set_about predicate1

set_agent

Possible uses:

  • social_link set_agent agent ---> social_link
  • set_agent (social_link , agent) ---> social_link

Result:

change the agent value of the given social link

Examples:

social_link set_agent agentA

set_agent_cause

Possible uses:

  • predicate set_agent_cause agent ---> predicate
  • set_agent_cause (predicate , agent) ---> predicate
  • emotion set_agent_cause agent ---> emotion
  • set_agent_cause (emotion , agent) ---> emotion

Result:

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

Examples:

predicate set_agent_cause agentA 
new_emotion set_agent_cause agentA

set_decay

Possible uses:

  • emotion set_decay float ---> emotion
  • set_decay (emotion , float) ---> emotion

Result:

change the decay value of the given emotion

Examples:

emotion set_decay 12

set_dominance

Possible uses:

  • social_link set_dominance float ---> social_link
  • set_dominance (social_link , float) ---> social_link

Result:

change the dominance value of the given social link

Examples:

social_link set_dominance 0.4

set_familiarity

Possible uses:

  • social_link set_familiarity float ---> social_link
  • set_familiarity (social_link , float) ---> social_link

Result:

change the familiarity value of the given social link

Examples:

social_link set_familiarity 0.4

set_intensity

Possible uses:

  • emotion set_intensity float ---> emotion
  • set_intensity (emotion , float) ---> emotion

Result:

change the intensity value of the given emotion

Examples:

emotion set_intensity 12

set_lifetime

Possible uses:

  • mental_state set_lifetime int ---> mental_state
  • set_lifetime (mental_state , int) ---> mental_state

Result:

change the lifetime value of the given mental state

Examples:

mental state set_lifetime 1

set_liking

Possible uses:

  • social_link set_liking float ---> social_link
  • set_liking (social_link , float) ---> social_link

Result:

change the liking value of the given social link

Examples:

social_link set_liking 0.4

set_modality

Possible uses:

  • mental_state set_modality string ---> mental_state
  • set_modality (mental_state , string) ---> mental_state

Result:

change the modality value of the given mental state

Examples:

mental state set_modality belief

set_predicate

Possible uses:

  • mental_state set_predicate predicate ---> mental_state
  • set_predicate (mental_state , predicate) ---> mental_state

Result:

change the predicate value of the given mental state

Examples:

mental state set_predicate pred1

set_solidarity

Possible uses:

  • social_link set_solidarity float ---> social_link
  • set_solidarity (social_link , float) ---> social_link

Result:

change the solidarity value of the given social link

Examples:

social_link set_solidarity 0.4

set_strength

Possible uses:

  • mental_state set_strength float ---> mental_state
  • set_strength (mental_state , float) ---> mental_state

Result:

change the strength value of the given mental state

Examples:

mental state set_strength 1.0

set_trust

Possible uses:

  • social_link set_trust float ---> social_link
  • set_trust (social_link , float) ---> social_link

Result:

change the trust value of the given social link

Examples:

social_link set_familiarity 0.4

set_truth

Possible uses:

  • predicate set_truth bool ---> predicate
  • set_truth (predicate , bool) ---> predicate

Result:

change the is_true value of the given predicate

Examples:

predicate set_truth false

set_z

Possible uses:

  • geometry set_z container<unknown,float> ---> geometry
  • set_z (geometry , container<unknown,float>) ---> geometry
  • set_z (geometry, int, float) ---> geometry

Result:

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

Examples:

set_z (triangle(3), 1, 3.0) 
triangle(3) set_z [5,10,14]

shape_file

Possible uses:

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

Result:

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

Special cases:

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

See also: is_shape,


sharpened

Possible uses:

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

Result:

Application of a sharpening filter to the image passed in parameter. This operation can be applied multiple times. The original image is left untouched Application of a sharpening 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


shuffle

Possible uses:

  • shuffle (matrix) ---> matrix
  • shuffle (container) ---> list
  • shuffle (string) ---> string

Result:

Returns a new matrix of the same size as the operand, with randomly shuffled elements Returns a new list containing the randomly shuffled elements of the container. Returns a new string with randomly shuffled letters

Special cases:

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

Examples:

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

See also: reverse,


signum

Possible uses:

  • signum (float) ---> int
  • signum (int) ---> int

Result:

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

Examples:

int var0 <- signum(-12.8); // var0 equals -1 
int var1 <- signum(14.5); // var1 equals 1 
int var2 <- signum(0.0); // var2 equals 0 
int var3 <- signum(-12); // var3 equals -1 
int var4 <- signum(14); // var4 equals 1 
int var5 <- signum(0); // var5 equals 0

simple_clustering_by_distance

Possible uses:

  • container<unknown,agent> simple_clustering_by_distance float ---> list<list<agent>>
  • simple_clustering_by_distance (container<unknown,agent> , float) ---> list<list<agent>>

Result:

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

Examples:

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

See also: hierarchical_clustering,


simple_clustering_by_envelope_distance

Same signification as simple_clustering_by_distance


simplification

Possible uses:

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

Result:

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

Comment:

The algorithm used for the simplification is Douglas-Peucker

Examples:

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

simulation_file

Possible uses:

  • simulation_file (string) ---> file

Result:

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

Special cases:

  • simulation_file(string): File containing a saved simulation in the java binary serialisation protocol

See also: is_simulation,


sin

Possible uses:

  • sin (float) ---> float
  • sin (int) ---> float

Result:

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

Special cases:

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

Examples:

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

See also: cos, tan,


sin_rad

Possible uses:

  • sin_rad (float) ---> float

Result:

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

Examples:

float var0 <- sin_rad(0); // var0 equals 0.0 
float var1 <- sin_rad(#pi/2); // var1 equals 1.0

See also: cos_rad, tan_rad,


since

Possible uses:

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

Result:

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

Examples:

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

skeletonize

Possible uses:

  • skeletonize (geometry) ---> list<geometry>
  • geometry skeletonize float ---> list<geometry>
  • skeletonize (geometry , float) ---> list<geometry>
  • skeletonize (geometry, float, float) ---> list<geometry>
  • skeletonize (geometry, float, float, bool) ---> list<geometry>

Result:

A list of geometries (polylines) corresponding to the skeleton of the operand geometry (geometry, agent)

Special cases:

  • It can be used with 1 additional float operand: the tolerance for the clipping.
  • It can be used with 3 additional float operands: the tolerance for the clipping, the tolerance for the triangulation, and the approximation for the clipping.
  • It can be used with 2 additional float operands: the tolerances for the clipping and for the triangulation

Examples:

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

skew

Same signification as skewness


skew_gauss

Possible uses:

  • skew_gauss (float, float, float, float) ---> float

Result:

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

Examples:

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

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


skewness

Possible uses:

  • skewness (list) ---> float

Result:

returns skewness value computed from the operand list of values

Special cases:

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

Examples:

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

skill

Possible uses:

  • skill (any) ---> skill

Result:

casts the operand in a skill object.


smooth

Possible uses:

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

Result:

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

Examples:

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

snapshot

Possible uses:

  • snapshot (string) ---> image
  • agent snapshot string ---> image
  • snapshot (agent , string) ---> image
  • snapshot (agent, string, point) ---> image

Result:

Takes a snapshot of the display whose name is passed in parameter and returns the image. The search for the display begins in the agent passed in parameter and, if not found, its experiment. A custom size (a point representing width x height) can be given Returns nil if no display can be found or the snapshot cannot be taken. Takes a snapshot of the display whose name is passed in parameter and returns the image. The search for the display begins in the agent passed in parameter and, if not found, its experiment. The size of the snapshot will be that of the viewReturns nil if no display can be found or the snapshot cannot be taken. Takes a snapshot of the display whose name is passed in parameter and returns the image. The search for the display begins in the current agent's simulation and, if not found, its experiment. Returns nil if no display can be found or the snapshot cannot be taken.


sobolAnalysis

Possible uses:

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

Result:

Return a string containing the Report of the sobol analysis for the corresponding .csv file and save this report in a txt/csv file.


social_link

Possible uses:

  • social_link (any) ---> social_link

Result:

casts the operand in a social_link object.


solid

Same signification as without_holes


sort

Same signification as sort_by


sort_by

Possible uses:

  • container sort_by any expression ---> list
  • sort_by (container , any expression) ---> list

Result:

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

Comment:

the left-hand operand is casted to a list before applying the operator. In the right-hand operand, the keyword each can be used to represent, in turn, each of the elements.

Special cases:

  • if the left-hand operand is nil, sort_by throws an error. If the sorting function returns values that cannot be compared, an error will be thrown as well

Examples:

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

See also: group_by,


source_of

Possible uses:

  • graph source_of unknown ---> unknown
  • source_of (graph , unknown) ---> unknown

Result:

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

Special cases:

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

Examples:

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

See also: target_of,


spatial_graph

Possible uses:

  • spatial_graph (container) ---> graph

Result:

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

See also: graph,


species

Possible uses:

  • species (any) ---> species

Result:

casts the operand in a species object.

Special cases:

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

Examples:

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

species_of

Possible uses:

  • species_of (unknown) ---> species

Result:

casting of the operand to a species.

Special cases:

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

Examples:

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

sphere

Possible uses:

  • sphere (float) ---> geometry

Result:

A sphere geometry which radius is equal to the operand.

Comment:

the centre of the sphere 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 <- sphere(10); // var0 equals a geometry as a circle of radius 10 but displays a sphere.

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


split

Possible uses:

  • split (list<unknown>) ---> list<list<unknown>>

Result:

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

Examples:

list<list<unknown>> var0 <- split([1.0,2.0,1.0,3.0,1.0,2.0]); // var0 equals [[1.0,1.0,1.0],[2.0,2.0],[3.0]]

See also: split_in, split_using,


split_at

Possible uses:

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

Result:

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

Special cases:

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

Examples:

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

split_geometry

Possible uses:

  • geometry split_geometry point ---> list<geometry>
  • split_geometry (geometry , point) ---> list<geometry>
  • geometry split_geometry float ---> list<geometry>
  • split_geometry (geometry , float) ---> list<geometry>
  • split_geometry (geometry, int, int) ---> list<geometry>

Result:

A list of geometries that result from the decomposition of the geometry by square cells of the given side size (geometry, size). It can be used to split in rectangles by giving a point or 2 integer values as operand.

Examples:

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

split_in

Possible uses:

  • list<unknown> split_in int ---> list<list<unknown>>
  • split_in (list<unknown> , int) ---> list<list<unknown>>
  • split_in (list<unknown>, int, bool) ---> list<list<unknown>>

Result:

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

Examples:

list<float> li <- [1.0,3.1,5.2,6.0,9.2,11.1,12.0,13.0,19.9,35.9,40.0]; 
list<list<unknown>> var1 <- split_in(li,3); // var1 equals [[1.0,3.1,5.2,6.0,9.2,11.1,12.0,13.0],[19.9],[35.9,40.0]] 
list<float> l <- [1.0,3.1,5.2,6.0,9.2,11.1,12.0,13.0,19.9,35.9,40.0]; 
list<list<unknown>> var3 <- split_in(l,3, true); // var3 equals [[1.0,3.1,5.2,6.0,9.2,11.1,12.0,13.0],[19.9],[35.9,40.0]]

See also: split, split_using,


split_lines

Possible uses:

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

Result:

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

Examples:

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

split_using

Possible uses:

  • list<unknown> split_using list<unknown> ---> list<list<unknown>>
  • split_using (list<unknown> , list<unknown>) ---> list<list<unknown>>
  • split_using (list<unknown>, list<unknown>, bool) ---> list<list<unknown>>

Result:

Splits a list of numbers into n+1 bins using a set of n bounds passed as the second argument. The splitting is strict (i.e. elements are in the ith bin if they are strictly smaller than the ith bound), when no boolean attribute is specified.

Examples:

list<float> li <- [1.0,3.1,5.2,6.0,9.2,11.1,12.0,13.0,19.9,35.9,40.0]; 
list<list<unknown>> var1 <- split_using(li,[1.0,3.0,4.2]); // var1 equals [[],[1.0],[3.1],[5.2,6.0,9.2,11.1,12.0,13.0,19.9,35.9,40.0]] 
list<float> l <- [1.0,3.1,5.2,6.0,9.2,11.1,12.0,13.0,19.9,35.9,40.0]; 
list<list<unknown>> var3 <- split_using(l,[1.0,3.0,4.2], true); // var3 equals [[],[1.0],[3.1],[5.2,6.0,9.2,11.1,12.0,13.0,19.9,35.9,40.0]]

See also: split, split_in,


split_with

Possible uses:

  • string split_with string ---> list
  • split_with (string , string) ---> list
  • split_with (string, string, bool) ---> list

Result:

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

Comment:

Delimiters themselves are excluded from the resulting list.

Special cases:

  • when used with an additional boolean operand, it returns a list containing the sub-strings (tokens) of the left-hand operand delimited either by each of the characters of the right-hand operand (false) or by the whole right-hand operand (true).

Examples:

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

sqrt

Possible uses:

  • sqrt (float) ---> float
  • sqrt (int) ---> float

Result:

Returns the square root of the operand.

Special cases:

  • if the operand is negative, an exception is raised

Examples:

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

square

Possible uses:

  • square (float) ---> geometry

Result:

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

Comment:

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

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


squircle

Possible uses:

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

Result:

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

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 the side operand is lower or equal to 0.

Examples:

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

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


stack

Possible uses:

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

Result:

Creates a stack layout node. Accepts the same argument as horizontal or vertical (a map of display indices and weights) but the weights are not taken into account Creates a stack layout node. Stacks can only contain one or several indices of displays (without weight)


standard_deviation

Possible uses:

  • standard_deviation (container) ---> float

Result:

the standard deviation on the elements of the operand. See Standard_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 <- standard_deviation ([4.5, 3.5, 5.5, 7.0]); // var0 equals 1.2930100540985752

See also: mean, mean_deviation,


step_sub_model

Possible uses:

  • step_sub_model (agent) ---> int

Result:

Load a submodel

Comment:

loaded submodel


strahler

Possible uses:

  • strahler (graph) ---> map

Result:

retur for each edge, its strahler number


string

Possible uses:

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

Result:

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

Examples:

string(#now, 'yyyy-MM-dd') 
string(#now, 'yyyy-MM-dd', 'en')

student_area

Possible uses:

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

Result:

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

Examples:

float var0 <- student_area(1.64,3) with_precision(2); // var0 equals 0.9

student_t_inverse

Possible uses:

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

Result:

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

Examples:

float var0 <- student_t_inverse(0.9,3) with_precision(2); // var0 equals 1.64

subtract_days

Same signification as minus_days


subtract_hours

Same signification as minus_hours


subtract_minutes

Same signification as minus_minutes


subtract_months

Same signification as minus_months


subtract_ms

Same signification as minus_ms


subtract_seconds

Same signification as -


subtract_weeks

Same signification as minus_weeks


subtract_years

Same signification as minus_years


successors_of

Possible uses:

  • graph successors_of unknown ---> list
  • successors_of (graph , unknown) ---> list

Result:

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

Examples:

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

See also: predecessors_of, neighbors_of,


sum

Possible uses:

  • sum (container) ---> unknown
  • sum (graph) ---> float

Result:

the sum of all the elements of the operand

Comment:

the behavior depends on the nature of the operand

Special cases:

  • if it is a population or a list of other types: sum transforms all elements into float and sums them
  • if it is a map, sum returns the sum of the value of all elements
  • if it is a file, sum returns the sum of the content of the file (that is also a container)
  • if it is a graph, sum returns the total weight of the graph
  • if it is a matrix of int, float or object, sum returns the sum of all the numerical elements (i.e. all elements for integer and float matrices)
  • if it is a matrix of other types: sum transforms all elements into float and sums them
  • if it is a list of colors: sum will sum them and return the blended resulting color
  • if it is a list of int or float: sum returns the sum of all the elements
int var0 <- sum ([12,10,3]); // var0 equals 25
  • if it is a list of points: sum returns the sum of all points as a point (each coordinate is the sum of the corresponding coordinate of each element)
unknown var1 <- sum([{1.0,3.0},{3.0,5.0},{9.0,1.0},{7.0,8.0}]); // var1 equals {20.0,17.0}

See also: mul,


sum_of

Possible uses:

  • container sum_of any expression ---> unknown
  • sum_of (container , any expression) ---> unknown

Result:

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

Examples:

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

See also: min_of, max_of, product_of, mean_of,


svg_file

Possible uses:

  • svg_file (string) ---> file

Result:

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

Special cases:

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

See also: is_svg,


t_test

Possible uses:

  • list t_test list ---> float
  • t_test (list , list) ---> float

Result:

Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the two input lists.The number returned is the smallest significance level at which one can reject the null hypothesis

Examples:

float var0 <- t_test([10.0,5.0,1.0, 3.0],[1.0,10.0,5.0,1.0]); // var0 equals 0.01

tan

Possible uses:

  • tan (int) ---> float
  • tan (float) ---> float

Result:

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

Special cases:

  • Operand values out of the range [0-359] are normalized. Notice that tan(360) does not return 0.0 but -2.4492935982947064E-16
  • The tangent is only defined for any real number except 90 + k * 180 (k an positive or negative integer). Nevertheless notice that tan(90) returns 1.633123935319537E16 (whereas we could except infinity).

Examples:

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

See also: cos, sin,


tan_rad

Possible uses:

  • tan_rad (float) ---> float

Result:

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

Examples:

float var0 <- tan_rad(0); // var0 equals 0.0

See also: cos_rad, sin_rad,


tanh

Possible uses:

  • tanh (float) ---> float
  • tanh (int) ---> float

Result:

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

Examples:

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

target_of

Possible uses:

  • graph target_of unknown ---> unknown
  • target_of (graph , unknown) ---> unknown

Result:

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

Special cases:

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

Examples:

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

See also: source_of,


teapot

Possible uses:

  • teapot (float) ---> geometry

Result:

A teapot geometry which radius is equal to the operand.

Comment:

the centre of the teapot 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 <- teapot(10); // var0 equals a geometry as a circle of radius 10 but displays a teapot.

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


text_file

Possible uses:

  • text_file (string) ---> file
  • string text_file list<string> ---> file
  • text_file (string , list<string>) ---> file

Result:

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

Special cases:

  • text_file(string): This file constructor allows to read a text file (.txt, .data, .text)
file f <-text_file("file.txt");
  • text_file(string,list): This file constructor allows to store a list of string in a text file (it does not save it - just store it in memory)
file f <-text_file("file.txt", ["item1","item2","item3"]);

See also: is_text,


TGauss

Same signification as truncated_gauss


threeds_file

Possible uses:

  • threeds_file (string) ---> file

Result:

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

Special cases:

  • threeds_file(string): This file constructor allows to read a 3DS Max file. Only loads vertices and faces
threeds_file f <- threeds_file("file");

See also: is_threeds,


tinted_with

Possible uses:

  • image tinted_with rgb ---> image
  • tinted_with (image , rgb) ---> image
  • tinted_with (image, rgb, float) ---> image

Result:

Returns the image tinted using the color passed in parameter and a factor between 0 and 1, determining the transparency of the dyeing to apply. The original image is left untouched Returns the image tinted using the color passed in parameter. This effectively multiplies the colors of the image by it. The original image is left untouched


to

Same signification as until

Possible uses:

  • date to date ---> list<date>
  • to (date , date) ---> list<date>

Result:

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

Comment:

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

Examples:

date('2000-01-01') to date('2010-01-01') // builds an interval between these two dates 
(date('2000-01-01') to date('2010-01-01')) every (#day) // builds an interval between these two dates which contains all the days starting from the beginning of the interval. Beware that using every with #month or #year will produce odd results, as these pseudo-constants are not constant; only the first value will be used to compute the intervals (if current_date is set to a month of February, #month will only represent 28 or 29 days depending on whether it is a leap year or not !). If such intervals need to be built, it is recommended to usea generative way, for instance a loop using the 'plus_years' or 'plus_months' operators to build a list of dates

See also: every,


to_binary

Same signification as serialize


to_GAMA_CRS

Possible uses:

  • to_GAMA_CRS (geometry) ---> geometry
  • geometry to_GAMA_CRS string ---> geometry
  • to_GAMA_CRS (geometry , string) ---> geometry

Special cases:

  • returns the geometry corresponding to the transformation of the given geometry to the GAMA CRS (Coordinate Reference System) assuming the given geometry is referenced by given CRS
geometry var0 <- to_GAMA_CRS({121,14}, "EPSG:4326"); // var0 equals a geometry corresponding to the agent geometry transformed into the GAMA CRS
  • returns the geometry corresponding to the transformation of the given geometry to the GAMA CRS (Coordinate Reference System) assuming the given geometry is referenced by the current CRS, the one corresponding to the world's agent one
geometry var1 <- to_GAMA_CRS({121,14}); // var1 equals a geometry corresponding to the agent geometry transformed into the GAMA CRS

to_gaml

Possible uses:

  • to_gaml (unknown) ---> string

Result:

Returns the literal description of an expression in gaml, in a format suitable to be reinterpreted and return a similar object

Examples:

string var0 <- to_gaml(0); // var0 equals '0' 
string var1 <- to_gaml(3.78); // var1 equals '3.78' 
string var2 <- to_gaml({23, 4.0}); // var2 equals '{23.0,4.0,0.0}' 
string var3 <- to_gaml(rgb(255,0,125)); // var3 equals 'rgb (255, 0, 125,255)' 
string var4 <- to_gaml('hello'); // var4 equals "'hello'" 
string var5 <- to_gaml(a_graph); // var5 equals ([((1 as node)::(3 as node))::(5 as edge),((0 as node)::(3 as node))::(3 as edge),((1 as node)::(2 as node))::(1 as edge),((0 as node)::(2 as node))::(2 as edge),((0 as node)::(1 as node))::(0 as edge),((2 as node)::(3 as node))::(4 as edge)] as map ) as graph 
string var6 <- to_gaml(node1); // var6 equals  1 as node

to_geojson

Possible uses:

  • to_geojson (any expression, string, any expression) ---> string

Result:

Returns a geojson representation of a population, a list of agents/geometries or an agent/geometry, provided with a CRS and a list of attributes to save

Examples:

string var0 <- to_geojson(boat,"EPSG:4326",["color"]); // var0 equals {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[100.51155642068785,3.514781609095577E-4,0.0]},"properties":{},"id":"0"}]}

to_hsb

Possible uses:

  • to_hsb (rgb) ---> list<float>

Result:

Converts a Gama color to hsb (h=hue, s=saturation, b=brightness) value

Examples:

list<float> var0 <- to_hsb (#cyan); // var0 equals [0.5,1.0,1.0]

to_json

Possible uses:

  • to_json (unknown) ---> string
  • unknown to_json bool ---> string
  • to_json (unknown , bool) ---> string

Result:

Serializes any object/agent/simulation into a string, using the json format. A flag can be passed to enable/disable pretty printing (false by default).The format used by GAMA follows simple rules. int, float, bool, string values are outputted as they are. nil is outputted as 'null'. A list is outputted as a json array. Any other object or agent is outputted as a json object. If this object possesses the "gaml_type" attribute, it is an instance of the corresponding type, and the members that follow contain the attributes and the values necessary to reconstruct it. If it has the "agent_reference" attribute, its value represent the reference to an agent. If any reference to an agent is found, the json string returned will be an object with two attributes: "gama_object", the object containing the references, and "reference_table" a dictionary mapping the references to the json description of the agents (their species, name, index, and list of attributes). This choice allows to manage cross references between agents Serializes any object/agent/simulation into a string, using the json format and no pretty printing.The format used by GAMA follows simple rules. int, float, bool, string values are outputted as they are. nil is outputted as 'null'. A list is outputted as a json array. Any other object or agent is outputted as a json object. If this object possesses the "gaml_type" attribute, it is an instance of the corresponding type, and the members that follow contain the attributes and the values necessary to reconstruct it. If it has the "agent_reference" attribute, its value represent the reference to an agent. If any reference to an agent is found, the json string returned will be an object with two attributes: "gama_object", the object containing the references, and "reference_table" a dictionary mapping the references to the json description of the agents (their species, name, index, and list of attributes). This choice allows to manage cross references between agents

See also: serialize, to_gaml,


to_list

Possible uses:

  • to_list (unknown) ---> list

Result:

casts the operand to a list, making an explicit copy if it is already a list or a subtype of list (interval, population, etc.)

See also: list,


to_rectangles

Same signification as split_geometry

Possible uses:

  • to_rectangles (geometry, point, bool) ---> list<geometry>
  • to_rectangles (geometry, int, int, bool) ---> list<geometry>

Result:

A list of rectangles of the size corresponding to the given dimension that result from the decomposition of the geometry into rectangles (geometry, dimension, overlaps), if overlaps = true, add the rectangles that overlap the border of the geometry

Examples:

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

to_segments

Possible uses:

  • to_segments (geometry) ---> list<geometry>

Result:

A list of a segments resulting from the decomposition of the geometry (or its contours for polygons) into sgements

Examples:

list<geometry> var0 <- to_segments(line([{10,10},{80,10},{80,80}])); // var0 equals [line([{10,10},{80,10}]), line([{80,10},{80,80}])]

to_squares

Possible uses:

  • to_squares (geometry, float, bool) ---> list<geometry>
  • to_squares (geometry, int, bool) ---> list<geometry>
  • to_squares (geometry, int, bool, float) ---> list<geometry>

Result:

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

Examples:

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

to_sub_geometries

Possible uses:

  • geometry to_sub_geometries list<float> ---> list<geometry>
  • to_sub_geometries (geometry , list<float>) ---> list<geometry>
  • to_sub_geometries (geometry, list<float>, float) ---> list<geometry>

Result:

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

Examples:

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

to_triangles

Same signification as triangulate


tokenize

Same signification as split_with


topology

Possible uses:

  • topology (any) ---> topology

Result:

casts the operand in a topology object.

Special cases:

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

Examples:

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

See also: geometry,


touches

Possible uses:

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

Result:

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

Comment:

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

Special cases:

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

Examples:

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

See also: disjoint_from, crosses, overlaps, partially_overlaps, intersects,


touching

Possible uses:

  • container<unknown,geometry> touching geometry ---> list<geometry>
  • touching (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), touching the operand (casted as a geometry).

Examples:

list<geometry> var0 <- [ag1, ag2, ag3] toucing(self); // var0 equals the agents among ag1, ag2 and ag3 that touch the shape of the right-hand argument. 
list<geometry> var1 <- (species1 + species2) touching (self); // var1 equals the agents among species species1 and species2 that touch the shape of the right-hand argument.

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


towards

Possible uses:

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

Result:

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

Examples:

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

See also: distance_between, distance_to, direction_between, path_between, path_to,


trace

Possible uses:

  • trace (matrix) ---> float

Result:

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

Examples:

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

transformed_by

Possible uses:

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

Result:

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

Examples:

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

See also: rotated_by, translated_by,


translated_by

Possible uses:

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

Result:

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

Examples:

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

See also: rotated_by, transformed_by,


translated_to

Same signification as at_location


transpose

Possible uses:

  • transpose (matrix) ---> matrix

Result:

The transposition of the given matrix

Examples:

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

triangle

Possible uses:

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

Result:

A triangle geometry which the base and height size are given by the operand. A triangle geometry which side size is given by the operand.

Comment:

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

Special cases:

  • returns nil if one of the operand is nil.
  • returns nil if the operand is nil.

Examples:

geometry var0 <- triangle(5, 10); // var0 equals a geometry as a triangle with a base of 5m and a height of 10m. 
geometry var1 <- triangle(5); // var1 equals a geometry as a triangle with side_size = 5.

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


triangulate

Possible uses:

  • triangulate (geometry) ---> list<geometry>
  • triangulate (list<geometry>) ---> list<geometry>
  • geometry triangulate float ---> list<geometry>
  • triangulate (geometry , float) ---> list<geometry>
  • triangulate (geometry, float, float) ---> list<geometry>
  • triangulate (geometry, float, float, bool) ---> list<geometry>

Result:

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

Examples:

list<geometry> var0 <- triangulate(self,0.1, 1.0); // var0 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator. 
list<geometry> var1 <- triangulate(self, 0.1); // var1 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator. 
list<geometry> var2 <- triangulate(self,0.1, 1.0, true); // var2 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator. 
list<geometry> var3 <- triangulate(self); // var3 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator. 
list<geometry> var4 <- triangulate([line([{0,50},{100,5
  1. What's new (Changelog)
  1. Installation and Launching
    1. Installation
    2. Launching GAMA
    3. Updating GAMA
    4. Installing Plugins
  2. Workspace, Projects and Models
    1. Navigating in the Workspace
    2. Changing Workspace
    3. Importing Models
  3. Editing Models
    1. GAML Editor (Generalities)
    2. GAML Editor Tools
    3. Validation of Models
  4. Running Experiments
    1. Launching Experiments
    2. Experiments User interface
    3. Controls of experiments
    4. Parameters view
    5. Inspectors and monitors
    6. Displays
    7. Batch Specific UI
    8. Errors View
  5. Running Headless
    1. Headless Batch
    2. Headless Server
    3. Headless Legacy
  6. Preferences
  7. Troubleshooting
  1. Introduction
    1. Start with GAML
    2. Organization of a Model
    3. Basic programming concepts in GAML
  2. Manipulate basic Species
  3. Global Species
    1. Regular Species
    2. Defining Actions and Behaviors
    3. Interaction between Agents
    4. Attaching Skills
    5. Inheritance
  4. Defining Advanced Species
    1. Grid Species
    2. Graph Species
    3. Mirror Species
    4. Multi-Level Architecture
  5. Defining GUI Experiment
    1. Defining Parameters
    2. Defining Displays Generalities
    3. Defining 3D Displays
    4. Defining Charts
    5. Defining Monitors and Inspectors
    6. Defining Export files
    7. Defining User Interaction
  6. Exploring Models
    1. Run Several Simulations
    2. Batch Experiments
    3. Exploration Methods
  7. Optimizing Model Section
    1. Runtime Concepts
    2. Optimizing Models
  8. Multi-Paradigm Modeling
    1. Control Architecture
    2. Defining Differential Equations
  1. Manipulate OSM Data
  2. Diffusion
  3. Using Database
  4. Using FIPA ACL
  5. Using BDI with BEN
  6. Using Driving Skill
  7. Manipulate dates
  8. Manipulate lights
  9. Using comodel
  10. Save and restore Simulations
  11. Using network
  12. Headless mode
  13. Using Headless
  14. Writing Unit Tests
  15. Ensure model's reproducibility
  16. Going further with extensions
    1. Calling R
    2. Using Graphical Editor
    3. Using Git from GAMA
  1. Built-in Species
  2. Built-in Skills
  3. Built-in Architecture
  4. Statements
  5. Data Type
  6. File Type
  7. Expressions
    1. Literals
    2. Units and Constants
    3. Pseudo Variables
    4. Variables And Attributes
    5. Operators [A-A]
    6. Operators [B-C]
    7. Operators [D-H]
    8. Operators [I-M]
    9. Operators [N-R]
    10. Operators [S-Z]
  8. Exhaustive list of GAMA Keywords
  1. Installing the GIT version
  2. Developing Extensions
    1. Developing Plugins
    2. Developing Skills
    3. Developing Statements
    4. Developing Operators
    5. Developing Types
    6. Developing Species
    7. Developing Control Architectures
    8. Index of annotations
  3. Introduction to GAMA Java API
    1. Architecture of GAMA
    2. IScope
  4. Using GAMA flags
  5. Creating a release of GAMA
  6. Documentation generation

  1. Predator Prey
  2. Road Traffic
  3. 3D Tutorial
  4. Incremental Model
  5. Luneray's flu
  6. BDI Agents

  1. Team
  2. Projects using GAMA
  3. Scientific References
  4. Training Sessions

Resources

  1. Videos
  2. Conferences
  3. Code Examples
  4. Pedagogical materials
Clone this wiki locally