Documentation Tutorials Download Contribute



#Operators (I to M)


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, dem, hexagon, pyramid, rgb_to_xyz, set_z, sphere, teapot,


Arithmetic operators

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


BDI

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


Casting operators

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


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


Comparison operators

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


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


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


Dates


DescriptiveStatistics

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


Displays

horizontal, stack, vertical,


Distributions

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


Driving operators

as_driving_graph,


edge

edge_between, strahler,


diff, diff2, internal_zero_order_equation,


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


conversation, message,


GamaMetaType

type_of,


GammaFunction

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


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


as_4_grid, as_grid, as_hexagonal_grid, grid_at, path_between,


Iterator operators

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


copy_between, index_of, last_index_of,


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,


as_map, create_map, index_of, last_index_of,


Material

material,


-, /, ., [](OperatorsAA#), +, append_horizontally, append_vertically, column_at, columns_list, determinant, eigenvalues, 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,


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


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


Random operators

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


ReverseOperators

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


Shape

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


Spatial operators

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


Spatial properties operators

covers, crosses, intersects, partially_overlaps, touches,


Spatial queries operators

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


Spatial relations operators

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


Spatial statistical operators

hierarchical_clustering, simple_clustering_by_distance,


Spatial transformations operators

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


index_of, last_index_of, of_generic_species, of_species,


Statistical operators

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


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


System

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


date, string,



User control operators

user_input,


Operators


IDW

Possible use:

  • IDW (container<agent>, map<point,float>, int) —> map<agent,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<agent,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_file

Possible use:

  • image_file (string) —> file

Result:

Constructs a file of type image. Allowed extensions are limited to tiff, jpg, jpeg, png, pict, bmp


improved_generator

Possible use:

  • improved_generator (float, float, float, float) —> float

Result:

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

Examples:

 
float var0 <- improved_generator(2,3,4,253); // var0 equals 10.2


in

Possible use:

  • string in string —> bool
  • in (string , string) —> bool
  • unknown in container —> bool
  • in (unknown , container) —> 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 both operands are strings, returns true if the left-hand operand patterns is included in to the right-hand string;
  • if the right operand is nil or empty, in returns false

Examples:

 
bool var0 <-  'bc' in 'abcded'; // var0 equals true 
bool var1 <- 2 in [1,2,3,4,5,6]; // var1 equals true 
bool var2 <- 7 in [1,2,3,4,5,6]; // var2 equals false 
bool var3 <- 3 in [1::2, 3::4, 5::6]; // var3 equals false 
bool var4 <- 6 in [1::2, 3::4, 5::6]; // var4 equals true

See also:

contains,


in_degree_of

Possible use:

  • 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 use:

  • 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 use:

  • incomplete_beta (float, float, float) —> float

Result:

Returns the regularized integral of the beta function with arguments a and b, from zero to x.


incomplete_gamma

Possible use:

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


incomplete_gamma_complement

Possible use:

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


indented_by

Possible use:

  • 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


index_by

Possible use:

  • 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 use:

  • string index_of string —> int
  • index_of (string , string) —> int
  • species index_of unknown —> int
  • index_of (species , unknown) —> int
  • list index_of unknown —> int
  • index_of (list , unknown) —> int
  • map index_of unknown —> unknown
  • index_of (map , unknown) —> unknown
  • matrix index_of unknown —> point
  • index_of (matrix , unknown) —> point

Result:

the index of the first occurence of the right operand in the left operand container 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 both operands are strings, returns the index within the left-hand string of the first occurrence of the given right-hand string
 
int var1 <-  "abcabcabc" index_of "ca"; // var1 equals 2
  • if the left operand is a list, index_of returns the index as an integer
 
int var2 <- [1,2,3,4,5,6] index_of 4; // var2 equals 3 
int var3 <- [4,2,3,4,5,4] index_of 4; // var3 equals 0
  • if the left operand is a matrix, index_of returns the index as a point
 
point var4 <- matrix([[1,2,3],[4,5,6]]) index_of 4; // var4 equals {1.0,0.0}

Examples:

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

See also:

at, last_index_of,


inside

Possible use:

  • container<agent> inside geometry —> list<geometry>
  • inside (container<agent> , 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 use:

  • int (any) —> int

Result:

Casts the operand into the type int


inter

Possible use:

  • 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 use:

  • interleave (container) —> list

Result:

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_at

Possible use:

  • geometry internal_at list —> unknown
  • internal_at (geometry , list) —> unknown
  • agent internal_at list —> unknown
  • internal_at (agent , list) —> unknown
  • container<KeyType,ValueType> internal_at list<KeyType> —> ValueType
  • internal_at (container<KeyType,ValueType> , list<KeyType>) —> ValueType

Result:

For internal use only. Corresponds to the implementation, for geometries, of the access to containers with [index] For internal use only. Corresponds to the implementation, for agents, of the access to containers with [index] For internal use only. Corresponds to the implementation of the access to containers with [index]

See also:

at,


internal_integrated_value

Possible use:

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


internal_zero_order_equation

Possible use:

  • internal_zero_order_equation (any expression) —> float

Result:

An internal placeholder function


intersection

Same signification as inter


intersects

Possible use:

  • 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 use:

  • 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


is

Possible use:

  • 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_csv

Possible use:

  • is_csv (any) —> bool

Result:

Tests whether the operand is a csv file.


is_dxf

Possible use:

  • is_dxf (any) —> bool

Result:

Tests whether the operand is a dxf file.


is_error

Possible use:

  • is_error (any expression) —> bool

Result:

Returns whether or not the argument raises an error when evaluated


is_finite

Possible use:

  • 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 use:

  • is_gaml (any) —> bool

Result:

Tests whether the operand is a gaml file.


is_geojson

Possible use:

  • is_geojson (any) —> bool

Result:

Tests whether the operand is a geojson file.


is_gif

Possible use:

  • is_gif (any) —> bool

Result:

Tests whether the operand is a gif file.


is_gml

Possible use:

  • is_gml (any) —> bool

Result:

Tests whether the operand is a gml file.


is_grid

Possible use:

  • is_grid (any) —> bool

Result:

Tests whether the operand is a grid file.


is_image

Possible use:

  • is_image (any) —> bool

Result:

Tests whether the operand is a image file.


is_json

Possible use:

  • is_json (any) —> bool

Result:

Tests whether the operand is a json file.


is_number

Possible use:

  • is_number (float) —> bool
  • is_number (string) —> bool

Result:

Returns whether the argument is a real number or not tests whether the operand represents a numerical value

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(4.66); // var0 equals true 
bool var1 <- is_number(#infinity); // var1 equals true 
bool var2 <- is_number(#nan); // var2 equals false 
bool var3 <- is_number("test"); // var3 equals false 
bool var4 <- is_number("123.56"); // var4 equals true 
bool var5 <- is_number("-1.2e5"); // var5 equals true 
bool var6 <- is_number("1,2"); // var6 equals false 
bool var7 <- is_number("#12FA"); // var7 equals true


is_obj

Possible use:

  • is_obj (any) —> bool

Result:

Tests whether the operand is a obj file.


is_osm

Possible use:

  • is_osm (any) —> bool

Result:

Tests whether the operand is a osm file.


is_pgm

Possible use:

  • is_pgm (any) —> bool

Result:

Tests whether the operand is a pgm file.


is_property

Possible use:

  • is_property (any) —> bool

Result:

Tests whether the operand is a property file.


is_R

Possible use:

  • is_R (any) —> bool

Result:

Tests whether the operand is a R file.


is_saved_simulation

Possible use:

  • is_saved_simulation (any) —> bool

Result:

Tests whether the operand is a saved_simulation file.


is_shape

Possible use:

  • is_shape (any) —> bool

Result:

Tests whether the operand is a shape file.


is_skill

Possible use:

  • 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 use:

  • is_svg (any) —> bool

Result:

Tests whether the operand is a svg file.


is_text

Possible use:

  • is_text (any) —> bool

Result:

Tests whether the operand is a text file.


is_threeds

Possible use:

  • is_threeds (any) —> bool

Result:

Tests whether the operand is a threeds file.


is_URL

Possible use:

  • is_URL (any) —> bool

Result:

Tests whether the operand is a URL file.


is_warning

Possible use:

  • is_warning (any expression) —> bool

Result:

Returns whether or not the argument raises a warning when evaluated


is_xml

Possible use:

  • is_xml (any) —> bool

Result:

Tests whether the operand is a xml file.


json_file

Possible use:

  • json_file (string) —> file

Result:

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


kappa

Possible use:

  • kappa (list, list, list) —> float
  • kappa (list, list, list, list) —> float

Result:

kappa indicator for 2 map comparisons: kappa(list_vals1,list_vals2,categories, weights). Reference: Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20. kappa indicator for 2 map comparisons: kappa(list_vals1,list_vals2,categories). Reference: Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20.

Examples:

kappa([cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2],[cat1,cat2,cat3], [1.0, 2.0, 3.0, 1.0, 5.0]) kappa([cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2],[cat1,cat2,cat3])  
float var2 <- kappa([1,3,5,1,5],[1,1,1,1,5],[1,3,5]); // var2 equals the similarity between 0 and 1 
float var3 <- kappa([1,1,1,1,5],[1,1,1,1,5],[1,3,5]); // var3 equals 1.0


kappa_sim

Possible use:

  • kappa_sim (list, list, list, list) —> float
  • kappa_sim (list, list, list, list, list) —> float

Result:

kappa simulation indicator for 2 map comparisons: kappa(list_valsInits,list_valsObs,list_valsSim, categories, weights). 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) kappa simulation indicator for 2 map comparisons: kappa(list_valsInits,list_valsObs,list_valsSim, categories). 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).

Examples:

kappa([cat1,cat1,cat2,cat2,cat2],[cat2,cat1,cat2,cat1,cat3],[cat2,cat1,cat2,cat3,cat3], [cat1,cat2,cat3],[1.0, 2.0, 3.0, 1.0, 5.0]) kappa([cat1,cat1,cat2,cat2,cat2],[cat2,cat1,cat2,cat1,cat3],[cat2,cat1,cat2,cat3,cat3], [cat1,cat2,cat3]) 


kmeans

Possible use:

  • 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 for (If negative, no maximum will be used) (maxIt). Usage: kmeans(data,k,maxit) 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). Usage: kmeans(data,k)

Special cases:

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

Examples:

kmeans ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],2,10)  
list<list> var1 <- kmeans ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],2); // var1 equals []


kml

Possible use:

  • kml (any) —> kml

Result:

Casts the operand into the type kml


kurtosis

Possible use:

  • kurtosis (list) —> float

Result:

returns kurtosis 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 <- kurtosis ([1,2,3,4,5]); // var0 equals 1.0


kurtosis

Possible use:

  • kurtosis (container) —> float
  • float kurtosis float —> float
  • kurtosis (float , float) —> float

Result:

Returns the kurtosis (aka excess) of a data sequence Returns the kurtosis (aka excess) of a data sequence


last

Possible use:

  • 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 use:

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

See also:

at, last_index_of, index_of,


last_of

Same signification as last


last_with

Possible use:

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

 
unknown 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 node11 
unknown var3 <- (list(node) last_with (round(node(each).location.x) > 32); // var3 equals node3

See also:

group_by, first_with, where,


layout

Possible use:

  • graph layout string —> graph
  • layout (graph , string) —> graph
  • layout (graph, string, int) —> graph
  • layout (graph, string, int, map<string,unknown>) —> graph

Result:

layouts a GAMA graph.


length

Possible use:

  • length (string) —> int
  • length (container<KeyType,ValueType>) —> int

Result:

the number of elements contained in the operand

Comment:

the length operator behavior depends on the nature of the operand

Special cases:

  • if it is a population, length returns number of agents of the population
  • if it is a graph, length returns the number of vertexes or of edges (depending on the way it was created)
  • if it is a string, length returns the number of characters
 
int var0 <- length ('I am an agent'); // var0 equals 13
  • if it is a list or a map, length returns the number of elements in the list or map
 
int var1 <- length([12,13]); // var1 equals 2 
int var2 <- length([]); // var2 equals 0
  • if it is a matrix, length returns the number of cells
 
int var3 <- length(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var3 equals 6

lgamma

Same signification as log_gamma


line

Possible use:

  • line (container<geometry>) —> geometry
  • container<geometry> line float —> geometry
  • line (container<geometry> , float) —> geometry

Result:

A polyline geometry from the given list of points. A polyline geometry from the given list of points represented as a cylinder of radius r.

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 nil, returns the point geometry {0,0}
  • if the 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 var1 <- polyline([{0,0}, {0,10}, {10,10}, {10,0}],0.2); // var1 equals a polyline geometry composed of the 4 points.

Examples:

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

See also:

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


Possible use:

  • 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 use:

  • list (any) —> list

Result:

Casts the operand into the type list


list_with

Possible use:

  • 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 right operand should be positive, and that the second one is evaluated for each position in the list.

See also:

list,


ln

Possible use:

  • 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_graph_from_file

Possible use:

  • load_graph_from_file (string) —> graph
  • string load_graph_from_file file —> graph
  • load_graph_from_file (string , file) —> graph
  • string load_graph_from_file string —> graph
  • load_graph_from_file (string , string) —> graph
  • load_graph_from_file (string, species, species) —> graph
  • load_graph_from_file (string, file, species, species) —> graph
  • load_graph_from_file (string, string, species, species) —> graph
  • load_graph_from_file (string, string, species, species, bool) —> graph

Result:

returns a graph loaded from a given file encoded into a given format. The last boolean parameter indicates whether the resulting graph will be considered as spatial or not by GAMA loads a graph from a file

Comment:

Available formats: “pajek”: Pajek (Slovene word for Spider) is a program, for Windows, for analysis and visualization of large networks. See: http://pajek.imfm.si/doku.php?id=pajek for more details.”lgl”: LGL is a compendium of applications for making the visualization of large networks and trees tractable. See: http://lgl.sourceforge.net/ for more details.”dot”: DOT is a plain text graph description language. It is a simple way of describing graphs that both humans and computer programs can use. See: http://en.wikipedia.org/wiki/DOT_language for more details.”edge”: This format is a simple text file with numeric vertex ids defining the edges.”gexf”: GEXF (Graph Exchange XML Format) is a language for describing complex networks structures, their associated data and dynamics. Started in 2007 at Gephi project by different actors, deeply involved in graph exchange issues, the gexf specifications are mature enough to claim being both extensible and open, and suitable for real specific applications. See: http://gexf.net/format/ for more details.”graphml”: GraphML is a comprehensive and easy-to-use file format for graphs based on XML. See: http://graphml.graphdrawing.org/ for more details.”tlp” or “tulip”: TLP is the Tulip software graph format. See: http://tulip.labri.fr/TulipDrupal/?q=tlp-file-format for more details. “ncol”: This format is used by the Large Graph Layout progra. It is simply a symbolic weighted edge list. It is a simple text file with one edge per line. An edge is defined by two symbolic vertex names separated by whitespace. (The symbolic vertex names themselves cannot contain whitespace.) They might followed by an optional number, this will be the weight of the edge. See: http://bioinformatics.icmb.utexas.edu/lgl for more details.The map operand should includes following elements:Available formats: “pajek”: Pajek (Slovene word for Spider) is a program, for Windows, for analysis and visualization of large networks. See: http://pajek.imfm.si/doku.php?id=pajek for more details.”lgl”: LGL is a compendium of applications for making the visualization of large networks and trees tractable. See: http://lgl.sourceforge.net/ for more details.”dot”: DOT is a plain text graph description language. It is a simple way of describing graphs that both humans and computer programs can use. See: http://en.wikipedia.org/wiki/DOT_language for more details.”edge”: This format is a simple text file with numeric vertex ids defining the edges.”gexf”: GEXF (Graph Exchange XML Format) is a language for describing complex networks structures, their associated data and dynamics. Started in 2007 at Gephi project by different actors, deeply involved in graph exchange issues, the gexf specifications are mature enough to claim being both extensible and open, and suitable for real specific applications. See: http://gexf.net/format/ for more details.”graphml”: GraphML is a comprehensive and easy-to-use file format for graphs based on XML. See: http://graphml.graphdrawing.org/ for more details.”tlp” or “tulip”: TLP is the Tulip software graph format. See: http://tulip.labri.fr/TulipDrupal/?q=tlp-file-format for more details. “ncol”: This format is used by the Large Graph Layout progra. It is simply a symbolic weighted edge list. It is a simple text file with one edge per line. An edge is defined by two symbolic vertex names separated by whitespace. (The symbolic vertex names themselves cannot contain whitespace.) They might followed by an optional number, this will be the weight of the edge. See: http://bioinformatics.icmb.utexas.edu/lgl for more details.The map operand should includes following elements:

Special cases:

  • “format”: the format of the file
  • “filename”: the filename of the file containing the network
  • “edges_species”: the species of edges
  • “vertices_specy”: the species of vertices
  • “format”: the format of the file
  • “filename”: the filename of the file containing the network
  • “edges_species”: the species of edges
  • “vertices_specy”: the species of vertices
  • “format”: the format of the file, “file”: the file containing the network, “edges_species”: the species of edges, “vertices_specy”: the species of vertices
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file( 			"pajek", 			"example_of_Pajek_file", 			myVertexSpecy, 			myEdgeSpecy ); 
  • “file”: the file containing the network
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file( 			"pajek", 			"example_of_Pajek_file"); 
  • “filename”: the filename of the file containing the network, “edges_species”: the species of edges, “vertices_specy”: the species of vertices
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file( 			"pajek", 			"./example_of_Pajek_file", 			myVertexSpecy, 			myEdgeSpecy ); 
  • “format”: the format of the file, “file”: the file containing the network
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file( 			"pajek", 			"example_of_Pajek_file"); 
  • “format”: the format of the file, “filename”: the filename of the file containing the network
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file( 			"pajek", 			"example_of_Pajek_file"); 

Examples:

graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file( 			"pajek", 			"./example_of_Pajek_file", 			myVertexSpecy, 			myEdgeSpecy , true); graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file( 			"pajek", 			"./example_of_Pajek_file", 			myVertexSpecy, 			myEdgeSpecy); 


load_shortest_paths

Possible use:

  • 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 use:

  • string load_sub_model string —> msi.gama.kernel.experiment.IExperimentAgent
  • load_sub_model (string , string) —> msi.gama.kernel.experiment.IExperimentAgent

Result:

Load a submodel

Comment:

loaded submodel


log

Possible use:

  • 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 use:

  • log_gamma (float) —> float

Result:

Returns the log of the value of the Gamma function at x.


lower_case

Possible use:

  • 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 use:

  • 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 use:

  • map (any) —> map

Result:

Casts the operand into the type map


masked_by

Possible use:

  • geometry masked_by container<geometry> —> geometry
  • masked_by (geometry , container<geometry>) —> geometry
  • masked_by (geometry, container<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.


material

Possible use:

  • float material float —> msi.gama.util.GamaMaterial
  • material (float , float) —> msi.gama.util.GamaMaterial

Result:

Returns

Examples:

 

See also:

,


material

Possible use:

  • material (any) —> material

Result:

Casts the operand into the type material


matrix

Possible use:

  • matrix (any) —> matrix

Result:

Casts the operand into the type matrix


matrix_with

Possible use:

  • 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

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

  • 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 use:

  • max_flow_between (graph, unknown, unknown) —> msi.gama.util.GamaMap<java.lang.Object,java.lang.Double>

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

  • 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 800graph 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 use:

  • 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 use:

  • 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 use:

  • 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 use:

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


meanR

Possible use:

  • meanR (container) —> unknown

Result:

returns the mean value of given vector (right-hand operand) in given variable (left-hand operand).

Examples:

list<int> X <- [2, 3, 1];  
int var1 <- meanR(X); // var1 equals 2


median

Possible use:

  • 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 use:

  • mental_state (any) —> mental_state

Result:

Casts the operand into the type mental_state


message

Possible use:

  • message (unknown) —> msi.gama.extensions.messaging.GamaMessage

Result:

to be added


milliseconds_between

Possible use:

  • 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 use:

  • 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 use:

  • 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 100graph 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 use:

  • 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 use:

  • 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 use:

  • 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 use:

  • 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 use:

  • 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 use:

  • 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 use:

  • 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 use:

  • 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 use:

  • moment (container, int, float) —> float

Result:

Returns the moment of k-th order with constant c of a data sequence


months_between

Possible use:

  • 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 use:

  • 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 computed

mul

Possible use:

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