#Operators (D to M)
This file is automatically generated from java files. Do Not Edit It.
Operators in the GAML language are used to compose complex expressions. An operator performs a function on one, two, or n operands (which are other expressions and thus may be themselves composed of operators) and returns the result of this function.
Most of them use a classical prefixed functional syntax (i.e. operator_name(operand1, operand2, operand3), see below), with the exception of arithmetic (e.g. +, /), logical (and, or), comparison (e.g. >, <), access (., [..]) and pair (::) operators, which require an infixed notation (i.e. operand1 operator_symbol operand1).
The ternary functional if-else operator, ? :, uses a special infixed syntax composed with two symbols (e.g. operand1 ? operand2 : operand3). Two unary operators (- and !) use a traditional prefixed syntax that does not require parentheses unless the operand is itself a complex expression (e.g. ` - 10, ! (operand1 or operand2)`).
Finally, special constructor operators ({...} for constructing points, [...] for constructing lists and maps) will require their operands to be placed between their two symbols (e.g. {1,2,3}, [operand1, operand2, ..., operandn] or [key1::value1, key2::value2... keyn::valuen]).
With the exception of these special cases above, the following rules apply to the syntax of operators:
operator_name(operand1))operator_name(operand1, operand2)) or the infixed syntax (e.g. operand1 operator_name operand2) can be used.operator_name(operand1, operand2, ..., operand)) or a special infixed syntax with the first operand on the left-hand side of the operator name (e.g. operand1 operator_name(operand2, ..., operand)) can be used.All of these alternative syntaxes are completely equivalent.
Operators in GAML are purely functional, i.e. they are guaranteed to not have any side effects on their operands. For instance, the shuffle operator, which randomizes the positions of elements in a list, does not modify its list operand but returns a new shuffled list.
The priority of operators determines, in the case of complex expressions composed of several operators, which one(s) will be evaluated first.
GAML follows in general the traditional priorities attributed to arithmetic, boolean, comparison operators, with some twists. Namely:
::, 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.?: operator, the functional if-else (e.g. ` a > b ? a + 10 : a - 10` will return the result of the if-else).and and or (e.g. a > b or b > c will return the value of the test)>, <, <=, >=, =, !=)- and !. 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)Actions defined in species can be used as operators, provided they are called on the correct agent. The syntax is that of normal functional operators, but the agent that will perform the action must be added as the first operand.
For instance, if the following species is defined:
species spec1 {
int min(int x, int y) {
return x > y ? x : y;
}
}
Any agent instance of spec1 can use min as an operator (if the action conflicts with an existing operator, a warning will be emitted). For instance, in the same model, the following line is perfectly acceptable:
global {
init {
create spec1;
spec1 my_agent <- spec1[0];
int the_min <- my_agent min(10,20); // or min(my_agent, 10, 20);
}
}
If the action doesn’t have any operands, the syntax to use is my_agent the_action(). Finally, if it does not return a value, it might still be used but is considering as returning a value of type unknown (e.g. unknown result <- my_agent the_action(op1, op2);).
Note that due to the fact that actions are written by modelers, the general functional contract is not respected in that case: actions might perfectly have side effects on their operands (including the agent).
box, cone3D, cube, cylinder, dem, hexagon, pyramid, rgb_to_xyz, set_z, sphere, teapot,
-, /, [^](OperatorsAC#^), [](OperatorsAC#), +, abs, acos, asin, atan, atan2, ceil, cos, cos_rad, div, even, exp, fact, floor, hypot, is_finite, is_number, ln, log, mod, round, signum, sin, sin_rad, sqrt, tan, tan_rad, tanh, with_precision,
and, eval_when, get_about, get_agent, get_agent_cause, get_decay, get_dominance, get_familiarity, get_intensity, get_lifetime, get_liking, get_praiseworthiness, get_priority, get_solidarity, get_super_intention, new_emotion, new_predicate, new_social_link, or, set_about, set_agent, set_agent_cause, set_decay, set_dominance, set_familiarity, set_intensity, set_liking, set_solidarity, set_truth, with_lifetime, with_praiseworthiness, with_priority, with_values,
as, as_int, as_matrix, font, is, is_skill, list_with, matrix_with, species, to_gaml, topology,
-, /, [](OperatorsAC#), +, blend, brewer_colors, brewer_palettes, grayscale, hsb, mean, median, rgb, rnd_color, sum,
-, ::, +, accumulate, among, at, collect, contains, contains_all, contains_any, count, distinct, empty, every, first, first_with, get, group_by, in, index_by, inter, interleave, internal_at, internal_integrated_value, last, last_with, length, max, max_of, mean, mean_of, median, min, min_of, mul, one_of, product_of, range, reverse, shuffle, sort_by, 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,
diff, diff2, internal_zero_order_equation,
crs, file, file_exists, folder, get, new_folder, osm_file, read, writable,
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, 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, successors_of, sum, target_of, undirected, use_cache, weight_of, with_optimizer_type, with_weights,
as_4_grid, as_grid, as_hexagonal_grid, grid_at, path_between,
accumulate, as_map, collect, count, distribution_of, distribution_of, distribution_of, distribution2d_of, distribution2d_of, distribution2d_of, first_with, frequency_of, group_by, index_by, last_with, max_of, mean_of, min_of, product_of, sort_by, sum_of, variance_of, where, with_max_of, with_min_of,
copy_between, index_of, last_index_of,
fuzzy_kappa, fuzzy_kappa_sim, kappa, kappa_sim, percent_absolute_deviation,
as_map, index_of, last_index_of,
-, /, ., [](OperatorsAC#), +, append_horizontally, append_vertically, column_at, columns_list, determinant, eigenvalues, index_of, inverse, last_index_of, row_at, rows_list, shuffle, trace, transpose,
electre_DM, evidence_theory_DM, promethee_DM, weighted_means_DM,
agent_from_geometry, all_pairs_shortest_path, as_path, load_shortest_paths, path_between, path_to, paths_between, use_cache,
-, /, [](OperatorsAC#), +, <, <=, >, >=, add_point, angle_between, any_location_in, centroid, closest_points_with, farthest_point_to, grid_at, norm, point, points_along, points_at, points_on,
binomial, flip, gauss, poisson, rnd, rnd_choice, sample, shuffle, skew_gauss, truncated_gauss,
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,
-, [](OperatorsAC#), +, 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, closest_points_with, closest_to, cone, cone3D, convex_hull, covers, cross, crosses, crs, CRS_transform, cube, curve, cylinder, dem, direction_between, disjoint_from, distance_between, distance_to, ellipse, envelope, farthest_point_to, farthest_to, geometry_collection, gini, hexagon, hierarchical_clustering, IDW, inside, inter, intersects, line, link, masked_by, moran, neighbors_at, neighbors_of, overlapping, overlaps, partially_overlaps, path_between, path_to, plan, points_along, points_at, points_on, polygon, polyhedron, pyramid, rectangle, rgb_to_xyz, rotated_by, round, scaled_to, set_z, simple_clustering_by_distance, simplification, skeletonize, smooth, sphere, split_at, split_geometry, split_lines, square, squircle, teapot, to_GAMA_CRS, to_rectangles, to_squares, touches, towards, transformed_by, translated_by, triangle, triangulate, union, using, voronoi, with_precision, without_holes,
covers, crosses, intersects, partially_overlaps, touches,
agent_closest_to, agent_farthest_to, agents_at_distance, agents_inside, agents_overlapping, at_distance, closest_to, farthest_to, inside, neighbors_at, neighbors_of, overlapping,
direction_between, distance_between, distance_to, path_between, path_to, towards,
hierarchical_clustering, simple_clustering_by_distance,
-, [](OperatorsAC#), +, as_4_grid, as_grid, as_hexagonal_grid, at_location, clean, convex_hull, CRS_transform, rotated_by, scaled_to, simplification, skeletonize, smooth, split_geometry, split_lines, to_GAMA_CRS, to_rectangles, to_squares, transformed_by, translated_by, triangulate, voronoi, without_holes,
index_of, last_index_of, of_generic_species, of_species,
build, corR, dbscan, distribution_of, distribution2d_of, 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, standard_deviation, sum, variance,
+, <, <=, >, >=, at, char, contains, contains_all, contains_any, copy_between, date, empty, first, in, indented_by, index_of, is_number, last, last_index_of, length, lower_case, replace, replace_regex, reverse, sample, shuffle, split_with, string, upper_case,
., command, copy, dead, eval_gaml, every, user_input,
datestring date string —> datedate (string , string) —> dateconverts 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
date("1999-12-30", 'yyyy-MM-dd')
dbscandbscan (list, float, int) —> list<list>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)
dbscan ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],10,2)
deaddead (agent) —> booltrue if the agent is dead (or null), false otherwise.
bool var0 <- dead(agent_A); // var0 equals true or false
degree_ofgraph degree_of unknown —> intdegree_of (graph , unknown) —> intreturns the degree (in+out) of a vertex (right-hand operand) in the graph given as left-hand operand.
int var1 <- graphFromMap degree_of (node(3)); // var1 equals 3
demdem (file) —> geometryfile dem file —> geometrydem (file , file) —> geometryfile dem float —> geometrydem (file , float) —> geometrydem (file, file, float) —> geometryA polygon that is equivalent to the surface of the texture
geometry var0 <- dem(dem,texture,z_factor); // var0 equals a geometry as a rectangle of width and height equal to the texture.
geometry var1 <- dem(dem,texture); // var1 equals a geometry as a rectangle of weight and height equal to the texture.
geometry var2 <- dem(dem,z_factor); // var2 equals a geometry as a rectangle of weight and height equal to the texture.
geometry var3 <- dem(dem); // var3 equals returns a geometry as a rectangle of width and height equal to the texture.
detSame signification as determinant
determinantdeterminant (matrix) —> floatThe determinant of the given matrix
float var0 <- determinant(matrix([[1,2],[3,4]])); // var0 equals -2
difffloat diff float —> floatdiff (float , float) —> floatdiff2float diff2 float —> floatdiff2 (float , float) —> floatdirecteddirected (graph) —> graphthe operand graph becomes a directed graph.
the operator alters the operand graph, it does not create a new one.
direction_betweentopology direction_between container<geometry> —> intdirection_between (topology , container<geometry>) —> intA direction (in degree) between a list of two geometries (geometries, agents, points) considering a topology.
int var0 <- my_topology direction_between [ag1, ag2]; // var0 equals the direction between ag1 and ag2 considering the topology my_topology
towards, direction_to, distance_to, distance_between, path_between, path_to,
direction_toSame signification as towards
disjoint_fromgeometry disjoint_from geometry —> booldisjoint_from (geometry , geometry) —> boolA boolean, equal to true if the left-geometry (or agent/point) is disjoints from the right-geometry (or agent/point).
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 {15,15}; // var2 equals false
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) disjoint_from {25,25}; // var3 equals true
bool var4 <- polygon([{10,10},{10,20},{20,20},{20,10}]) disjoint_from polygon([{35,35},{35,45},{45,45},{45,35}]); // var4 equals true
intersects, crosses, overlaps, partially_overlaps, touches,
distance_betweentopology distance_between container<geometry> —> floatdistance_between (topology , container<geometry>) —> floatA distance between a list of geometries (geometries, agents, points) considering a topology.
float var0 <- my_topology distance_between [ag1, ag2, ag3]; // var0 equals the distance between ag1, ag2 and ag3 considering the topology my_topology
towards, direction_to, distance_to, direction_between, path_between, path_to,
distance_togeometry distance_to geometry —> floatdistance_to (geometry , geometry) —> floatpoint distance_to point —> floatdistance_to (point , point) —> floatA distance between two geometries (geometries, agents or points) considering the topology of the agent applying the operator.
float var0 <- ag1 distance_to ag2; // var0 equals the distance between ag1 and ag2 considering the topology of the agent applying the operator
towards, direction_to, distance_between, direction_between, path_between, path_to,
distinctdistinct (container) —> containerproduces a set from the elements of the operand (i.e. a list without duplicated elements)
container var1 <- remove_duplicates([1::3,2::4,3::3,5::7]); // var1 equals [3,4,7]
container var0 <- remove_duplicates([3,2,5,1,2,3,5,5,5]); // var0 equals [3,2,5,1]
distribution_ofdistribution_of (container) —> mapcontainer distribution_of int —> mapdistribution_of (container , int) —> mapdistribution_of (container, int, float, float) —> mapDiscretize 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)
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]])
distribution2d_ofcontainer distribution2d_of container —> mapdistribution2d_of (container , container) —> mapdistribution2d_of (container, container, int, int) —> mapdistribution2d_of (container, container, int, float, float, int, float, float) —> mapDiscretize 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)
map var0 <- distribution_of([1,1,2,12.5],10); // var0 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
map var1 <- distribution2d_of([1,1,2,12.5]); // var1 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
map var2 <- distribution_of([1,1,2,12.5],10); // var2 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
divfloat div float —> intdiv (float , float) —> intint div int —> intdiv (int , int) —> intfloat div int —> intdiv (float , int) —> intint div float —> intdiv (int , float) —> intReturns the truncation of the division of the left-hand operand by the right-hand operand.
int var0 <- 40.1 div 4.5; // var0 equals 8
int var1 <- 40 div 3; // var1 equals 13
int var2 <- 40.5 div 3; // var2 equals 13
int var3 <- 40 div 4.1; // var3 equals 9
mod,
dxf_filedxf_file (string) —> fileConstructs a file of type dxf. Allowed extensions are limited to dxf
edgeedge (pair) —> unknownedge (unknown) —> unknownunknown edge unknown —> unknownedge (unknown , unknown) —> unknownpair edge float —> unknownedge (pair , float) —> unknownunknown edge float —> unknownedge (unknown , float) —> unknownedge (unknown, unknown, unknown) —> unknownedge (unknown, unknown, float) —> unknownedge (pair, unknown, float) —> unknownedge (unknown, unknown, unknown, float) —> unknownedge_betweengraph edge_between pair —> unknownedge_between (graph , pair) —> unknownreturns the edge linking two nodes
unknown var0 <- graphFromMap edge_between node1::node2; // var0 equals edge1
edge_betweennessedge_betweenness (graph) —> mapreturns a map containing for each edge (key), its betweenness centrality (value): number of shortest paths passing through each edge
graph graphEpidemio <- graph([]);
map var1 <- edge_betweenness(graphEpidemio); // var1 equals the edge betweenness index of the graph
edgesedges (container) —> containereigenvalueseigenvalues (matrix) —> list<float>The eigen values (matrix) of the given matrix
list<float> var0 <- eigenvalues(matrix([[5,-3],[6,-4]])); // var0 equals [2.0000000000000004,-0.9999999999999998]
electre_DMelectre_DM (list<list>, list<map<string,object>>, float) —> intThe 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. An 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 [http://www.springerlink.com/content/g367r44322876223/ 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.
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]]); // var0 equals 0
weighted_means_DM, promethee_DM, evidence_theory_DM,
ellipsefloat ellipse float —> geometryellipse (float , float) —> geometryAn ellipse geometry which x-radius is equal to the first operand and y-radius is equal to the second operand
the center of the ellipse is by default the location of the current agent in which has been called this operator.
geometry var0 <- ellipse(10, 10); // var0 equals a geometry as an ellipse of width 10 and height 10.
around, cone, line, link, norm, point, polygon, polyline, rectangle, square, circle, squircle, triangle,
emotionemotion (any) —> emotionCasts the operand into the type emotion
emptyempty (container<KeyType,ValueType>) —> boolempty (string) —> booltrue if the operand is empty, false otherwise.
the empty operator behavior depends on the nature of the operand
bool var0 <- empty([]); // var0 equals true
bool var1 <- empty ('abced'); // var1 equals false
enlarged_bySame signification as +
envelopeenvelope (unknown) —> geometryA 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
eval_gamleval_gaml (string) —> unknownevaluates the given GAML string.
unknown var0 <- eval_gaml("2+3"); // var0 equals 5
eval_wheneval_when (BDIPlan) —> boolevaluate the facet when of a given plan
eval_when(plan1)
eveneven (int) —> boolReturns true if the operand is even and false if it is odd.
bool var0 <- even (3); // var0 equals false
bool var1 <- even(-12); // var1 equals true
everyevery (int) —> boolevery (any expression) —> boolmsi.gama.util.GamaDateInterval every any expression —> msi.gama.util.IList<msi.gama.util.GamaDate>every (msi.gama.util.GamaDateInterval , any expression) —> msi.gama.util.IList<msi.gama.util.GamaDate>container every int —> containerevery (container , int) —> containertrue every operand * cycle, false otherwise
applies a step to an interval of dates defined by ‘date1 to date2’
expects a frequency (expressed in seconds of simulated time) as argument. Will return true every time the current_date matches with this frequency
Retrieves elements from the first argument every step (second argument) elements. Raises an error if the step is negative or equal to zero
the value of the every operator depends on the cycle. It can be used to do something every x cycle.Used to do something at regular intervals of time. Can be used in conjunction with ‘since’, ‘after’, ‘before’, ‘until’ or ‘between’, so that this computation only takes place in the temporal segment defined by these operators. In all cases, the starting_date of the model is used as a reference starting point
if every(2) {write "the cycle number is even";}
else {write "the cycle number is odd";}
(date('2000-01-01') to date('2010-01-01')) every (#month) // builds an interval between these two dates which contains all the monthly dates starting from the beginning of the interval
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
every_cycleSame signification as every
evidence_theory_DMlist<list> evidence_theory_DM list<map<string,object>> —> intevidence_theory_DM (list<list> , list<map<string,object>>) —> intevidence_theory_DM (list<list>, list<map<string,object>>, bool) —> intThe index of the best candidate according to a method based on the Evidence theory. This theory, which was proposed by Shafer ([http://www.glennshafer.com/books/amte.html Shafer G (1976) A mathematical theory of evidence, Princeton University Press]), is based on the work of Dempster ([http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.aoms/1177698950 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)
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]], true); // var0 equals 0
weighted_means_DM, electre_DM,
expexp (float) —> floatexp (int) —> floatReturns Euler’s number e raised to the power of the operand.
float var0 <- exp (0); // var0 equals 1.0
ln,
factfact (int) —> floatReturns the factorial of the operand.
float var0 <- fact(4); // var0 equals 24
farthest_point_togeometry farthest_point_to point —> pointfarthest_point_to (geometry , point) —> pointthe farthest point of the left-operand to the left-point.
point var0 <- geom farthest_point_to(pt); // var0 equals the farthest point of geom to pt
any_location_in, any_point_in, closest_points_with, points_at,
farthest_tocontainer<agent> farthest_to geometry —> geometryfarthest_to (container<agent> , geometry) —> geometryAn 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).
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.
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
neighbors_at, neighbors_of, inside, overlapping, agents_overlapping, agents_inside, agent_closest_to, closest_to, agent_farthest_to,
filefile (string) —> filestring file container —> filefile (string , container) —> fileopens a file in read only mode, creates a GAML file object, and tries to determine and store the file content in the contents attribute. Creates a file in read/write mode, setting its contents to the container passed in parameter
The file should have a supported extension, see file type definition for supported file extensions.The type of container to pass will depend on the type of file (see the management of files in the documentation). Can be used to copy files since files are considered as containers. For example: save file(‘image_copy.png’, file(‘image.png’)); will copy image.png to image_copy.png
let fileT type: file value: file("../includes/Stupid_Cell.Data");
// fileT represents the file "../includes/Stupid_Cell.Data"
// fileT.contents here contains a matrix storing all the data of the text file
file_existsfile_exists (string) —> boolTest whether the parameter is the path to an existing file.
firstfirst (string) —> stringfirst (container<KeyType,ValueType>) —> ValueTypeint first container —> containerfirst (int , container) —> containerthe first value of the operand
the first operator behavior depends on the nature of the operand
string var0 <- first ('abce'); // var0 equals 'a'
int var1 <- first ([1, 2, 3]); // var1 equals 1
last,
first_ofSame signification as first
first_withcontainer first_with any expression —> unknownfirst_with (container , any expression) —> unknownthe first element of the left-hand operand that makes the right-hand operand evaluate to true.
in the right-hand operand, the keyword each can be used to represent, in turn, each of the right-hand operand elements.
unknown var4 <- [1::2, 3::4, 5::6] first_with (each >= 4); // var4 equals 4
unknown var5 <- [1::2, 3::4, 5::6].pairs first_with (each.value >= 4); // var5 equals 3::4
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
flipflip (float) —> booltrue or false given the probability represented by the operand
bool var0 <- flip (0.66666); // var0 equals 2/3 chances to return true.
rnd,
floatfloat (any) —> floatCasts the operand into the type float
floorfloor (float) —> floatMaps the operand to the largest previous following integer, i.e. the largest integer not greater than x.
float var0 <- floor(3); // var0 equals 3.0
float var1 <- floor(3.5); // var1 equals 3.0
float var2 <- floor(-4.7); // var2 equals -5.0
folderfolder (string) —> fileopens an existing repository
folder("../includes/")
file dirT <- folder("../includes/");
// dirT represents the repository "../includes/"
// dirT.contents here contains the list of the names of included files
fontfont (string, int, int) —> fontCreates 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.
font var0 <- font ('Helvetica Neue',12, #bold + #italic); // var0 equals a bold and italic face of the Helvetica Neue family
frequency_ofcontainer frequency_of any expression —> mapfrequency_of (container , any expression) —> mapReturns 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)
map var0 <- [ag1, ag2, ag3, ag4] frequency_of each.size; // var0 equals the different sizes as keys and the number of agents of this size as values
fromSame signification as since
fuzzy_kappafuzzy_kappa (list<agent>, list, list, list<float>, list, matrix<float>, float) —> floatfuzzy_kappa (list<agent>, list, list, list<float>, list, matrix<float>, float, list) —> floatfuzzy 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 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([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([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_simfuzzy_kappa_sim (list<agent>, list, list, list, list<float>, list, matrix<float>, float) —> floatfuzzy_kappa_sim (list<agent>, list, list, list, list<float>, list, matrix<float>, float, list) —> floatfuzzy 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,
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_filegaml_file (string) —> fileConstructs a file of type gaml. Allowed extensions are limited to gaml, experiment
gamma_indexgamma_index (graph) —> floatreturns 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.
graph graphEpidemio <- graph([]);
float var1 <- gamma_index(graphEpidemio); // var1 equals the gamma index of the graph
alpha_index, beta_index, nb_cycles, connectivity_index,
gamma_rndfloat gamma_rnd float —> floatgamma_rnd (float , float) —> floatreturns a random value from a gamma distribution with specified values of the shape and scale parameters
gamma_rnd(10.0,5.0)
gaussgauss (point) —> floatfloat gauss float —> floatgauss (float , float) —> floatA value from a normally distributed random variable with expected value (mean) and variance (standardDeviation). The probability density function of such a variable is a Gaussian. A value from a normally distributed random variable with expected value (mean) and variance (standardDeviation). The probability density function of such a variable is a Gaussian.
float var0 <- gauss(0,0.3); // var0 equals 0.22354
float var1 <- gauss(0,0.3); // var1 equals -0.1357
float var2 <- gauss({0,0.3}); // var2 equals 0.22354
float var3 <- gauss({0,0.3}); // var3 equals -0.1357
skew_gauss, truncated_gauss, poisson,
generate_barabasi_albertgenerate_barabasi_albert (container<agent>, species, int, bool) —> graphgenerate_barabasi_albert (species, species, int, int, bool) —> graphreturns a random scale-free network (following Barabasi-Albert (BA) model). returns a random scale-free network (following Barabasi-Albert (BA) model).
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:
graph<yourNodeSpecy,yourEdgeSpecy> graphEpidemio <- generate_barabasi_albert(
yourNodeSpecy,
yourEdgeSpecy,
3,
5,
true);
graph<yourNodeSpecy,yourEdgeSpecy> graphEpidemio <- generate_barabasi_albert(
yourListOfNodes,
yourEdgeSpecy,
3,
5,
true);
generate_complete_graphgenerate_complete_graph (container<agent>, species, bool) —> graphgenerate_complete_graph (container<agent>, species, float, bool) —> graphgenerate_complete_graph (species, species, int, bool) —> graphgenerate_complete_graph (species, species, int, float, bool) —> graphreturns a fully connected graph. returns a fully connected graph. returns a fully connected graph. returns a fully connected graph.
Arguments should include following elements:Arguments should include following elements:Arguments should include following elements:Arguments should include following elements:
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph(
myListOfNodes,
myEdgeSpecy,
25,
true);
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph(
myVertexSpecy,
myEdgeSpecy,
10, 25,
true);
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph(
myVertexSpecy,
myEdgeSpecy,
10,
true);
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_complete_graph(
myListOfNodes,
myEdgeSpecy,
true);
generate_barabasi_albert, generate_watts_strogatz,
generate_watts_strogatzgenerate_watts_strogatz (container<agent>, species, float, int, bool) —> graphgenerate_watts_strogatz (species, species, int, float, int, bool) —> graphreturns a random small-world network (following Watts-Strogatz model). returns a random small-world network (following Watts-Strogatz model).
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:
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz(
myVertexSpecy,
myEdgeSpecy,
2,
0.3,
2,
true);
graph<myVertexSpecy,myEdgeSpecy> myGraph <- generate_watts_strogatz(
myListOfNodes,
myEdgeSpecy,
0.3,
2,
true);
geojson_filegeojson_file (string) —> fileConstructs a file of type geojson. Allowed extensions are limited to json, geojson, geo.json
geometric_meangeometric_mean (container) —> floatthe geometric mean of the elements of the operand. See Geometric_mean for more details.
The operator casts all the numerical element of the list into float. The elements that are not numerical are discarded.
float var0 <- geometric_mean ([4.5, 3.5, 5.5, 7.0]); // var0 equals 4.962326343467649
geometrygeometry (any) —> geometryCasts the operand into the type geometry
geometry_collectiongeometry_collection (container<geometry>) —> geometryA geometry collection (multi-geometry) composed of the given list of geometries.
geometry var0 <- geometry_collection([{0,0}, {0,10}, {10,10}, {10,0}]); // var0 equals a geometry composed of the 4 points (multi-point).
around, circle, cone, link, norm, point, polygone, rectangle, square, triangle, line,
getgeometry get string —> unknownget (geometry , string) —> unknownagent get string —> unknownget (agent , string) —> unknownReads an attribute of the specified geometry (left operand). The attribute name is specified by the right operand. Reads an attribute of the specified agent (left operand). The attribute name is specified by the right operand.
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
string agent_name <- an_agent get('name'); // reads then 'name' attribute of an_agent then assigns the returned value to the agent_name variable
get_aboutget_about (emotion) —> predicateget the about value of the given emotion
get_about(emotion)
get_agentget_agent (msi.gaml.architecture.simplebdi.SocialLink) —> agentget the agent value of the given social link
get_agent(social_link1)
get_agent_causeget_agent_cause (emotion) —> agentget_agent_cause (predicate) —> agentget the agent cause value of the given emotion
get_agent_cause(emotion)
get_decayget_decay (emotion) —> floatget the decay value of the given emotion
get_decay(emotion)
get_dominanceget_dominance (msi.gaml.architecture.simplebdi.SocialLink) —> floatget the dominance value of the given social link
get_dominance(social_link1)
get_familiarityget_familiarity (msi.gaml.architecture.simplebdi.SocialLink) —> floatget the familiarity value of the given social link
get_familiarity(social_link1)
get_intensityget_intensity (emotion) —> floatget the intensity value of the given emotion
emotion set_intensity 12
get_lifetimeget_lifetime (predicate) —> intget_likingget_liking (msi.gaml.architecture.simplebdi.SocialLink) —> floatget the liking value of the given social link
get_liking(social_link1)
get_praiseworthinessget_praiseworthiness (predicate) —> floatget_priorityget_priority (predicate) —> floatget_solidarityget_solidarity (msi.gaml.architecture.simplebdi.SocialLink) —> floatget the solidarity value of the given social link
get_solidarity(social_link1)
get_super_intentionget_super_intention (predicate) —> predicategif_filegif_file (string) —> fileConstructs a file of type gif. Allowed extensions are limited to gif
ginigini (list<float>) —> floatfloat var0 <- gini([1.0, 0.5, 2.0]); // var0 equals the gini index computed
graphgraph (any) —> graphCasts the operand into the type graph
grayscalegrayscale (rgb) —> rgbConverts rgb color to grayscale value
r=red, g=green, b=blue. Between 0 and 255 and gray = 0.299 * red + 0.587 * green + 0.114 * blue (Photoshop value)
rgb var0 <- grayscale (rgb(255,0,0)); // var0 equals to a dark grey
grid_atspecies grid_at point —> agentgrid_at (species , point) —> agentreturns the cell of the grid (right-hand operand) at the position given by the right-hand operand
If the left-hand operand is a point of floats, it is used as a point of ints.
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_graphgrid_cells_to_graph (container) —> graphcreates a graph from a list of cells (operand). An edge is created between neighbors.
my_cell_graph<-grid_cells_to_graph(cells_list)
grid_filegrid_file (string) —> fileConstructs a file of type grid. Allowed extensions are limited to asc, tif
group_bycontainer group_by any expression —> mapgroup_by (container , any expression) —> mapReturns 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
in the right-hand operand, the keyword each can be used to represent, in turn, each of the right-hand operand elements.
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 var3 <- [1::2, 3::4, 5::6] group_by (each > 4); // var3 equals [false::[2, 4], true::[6]]
harmonic_meanharmonic_mean (container) —> floatthe harmonic mean of the elements of the operand. See Harmonic_mean for more details.
The operator casts all the numerical element of the list into float. The elements that are not numerical are discarded.
float var0 <- harmonic_mean ([4.5, 3.5, 5.5, 7.0]); // var0 equals 4.804159445407279
hexagonhexagon (point) —> geometryhexagon (float) —> geometryA hexagon geometry which the given with and height
the center of the hexagon is by default the location of the current agent in which has been called this operator.the center of the hexagon is by default the location of the current agent in which has been called this operator.
geometry var0 <- hexagon({10,5}); // var0 equals a geometry as a hexagon of width of 10 and height of 5.
geometry var1 <- hexagon(10); // var1 equals a geometry as a hexagon of width of 10 and height of 10.
around, circle, cone, line, link, norm, point, polygon, polyline, rectangle, triangle,
hierarchical_clusteringcontainer<agent> hierarchical_clustering float —> containerhierarchical_clustering (container<agent> , float) —> containerA tree (list of list) contained groups of agents clustered by distance considering a distance min between two groups.
use of hierarchical clustering with Minimum for linkage criterion between two groups of agents.
container var0 <- [ag1, ag2, ag3, ag4, ag5] hierarchical_clustering 20.0; // var0 equals for example, can return [[[ag1],[ag3]], [ag2], [[[ag4],[ag5]],[ag6]]
simple_clustering_by_distance,
hsbhsb (float, float, float) —> rgbhsb (float, float, float, int) —> rgbhsb (float, float, float, float) —> rgbConverts hsb (h=hue, s=saturation, b=brightness) value to Gama color
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)
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")
rgb,
hypothypot (float, float, float, float) —> floatReturns sqrt(x2 +y2) without intermediate overflow or underflow.
float var0 <- hypot(0,1,0,1); // var0 equals sqrt(2)
image_fileimage_file (string) —> fileConstructs a file of type image. Allowed extensions are limited to tiff, jpg, jpeg, png, pict, bmp
inunknown in container —> boolin (unknown , container) —> boolstring in string —> boolin (string , string) —> booltrue if the right operand contains the left operand, false otherwise
the definition of in depends on the container
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
in_degree_ofgraph in_degree_of unknown —> intin_degree_of (graph , unknown) —> intreturns the in degree of a vertex (right-hand operand) in the graph given as left-hand operand.
int var1 <- graphFromMap in_degree_of (node(3)); // var1 equals 2
in_edges_ofgraph in_edges_of unknown —> containerin_edges_of (graph , unknown) —> containerreturns the list of the in-edges of a vertex (right-hand operand) in the graph given as left-hand operand.
container var1 <- graphFromMap in_edges_of node({12,45}); // var1 equals [LineString]
indented_bystring indented_by int —> stringindented_by (string , int) —> stringConverts a (possibly multiline) string by indenting it by a number – specified by the second operand – of tabulations to the right
index_bycontainer index_by any expression —> mapindex_by (container , any expression) —> mapproduces a new map from the evaluation of the right-hand operand for each element of the left-hand operand
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_ofcontainer index_of unknown —> intindex_of (container , unknown) —> intmap index_of unknown —> unknownindex_of (map , unknown) —> unknownmatrix index_of unknown —> pointindex_of (matrix , unknown) —> pointstring index_of string —> intindex_of (string , string) —> intspecies index_of unknown —> intindex_of (species , unknown) —> intthe 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
The definition of index_of and the type of the index depend on the container
int var1 <- [1,2,3,4,5,6] index_of 4; // var1 equals 3
int var2 <- [4,2,3,4,5,4] index_of 4; // var2 equals 0
point var3 <- matrix([[1,2,3],[4,5,6]]) index_of 4; // var3 equals {1.0,0.0}
int var4 <- "abcabcabc" index_of "ca"; // var4 equals 2
unknown var0 <- [1::2, 3::4, 5::6] index_of 4; // var0 equals 3
insidecontainer<agent> inside geometry —> list<geometry>inside (container<agent> , geometry) —> list<geometry>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).
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.
neighbors_at, neighbors_of, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to,
intint (any) —> intCasts the operand into the type int
intercontainer inter container —> containerinter (container , container) —> containergeometry inter geometry —> geometryinter (geometry , geometry) —> geometrythe intersection of the two operands A geometry resulting from the intersection between the two geometries
both containers are transformed into sets (so without duplicated element, cf. remove_deplicates operator) before the set intersection is computed.
container var0 <- [1::2, 3::4, 5::6] inter [2,4]; // var0 equals [2,4]
container var1 <- [1::2, 3::4, 5::6] inter [1,3]; // var1 equals []
container var2 <- matrix([[1,2,3],[4,5,4]]) inter [3,4]; // var2 equals [3,4]
container var3 <- [1,2,3,4,5,6] inter [2,4]; // var3 equals [2,4]
container var4 <- [1,2,3,4,5,6] inter [0,8]; // var4 equals []
geometry var5 <- square(10) inter circle(5); // var5 equals circle(5)
remove_duplicates, union, +, -,
interleaveinterleave (container) —> containera new list containing the interleaved elements of the containers contained in the operand
the operand should be a list of lists of elements. The result is a list of elements.
container var0 <- interleave([1,2,4,3,5,7,6,8]); // var0 equals [1,2,4,3,5,7,6,8]
container var1 <- interleave([['e11','e12','e13'],['e21','e22','e23'],['e31','e32','e33']]); // var1 equals ['e11','e21','e31','e12','e22','e32','e13','e23','e33']
internal_atagent internal_at container —> unknowninternal_at (agent , container) —> unknowngeometry internal_at container —> unknowninternal_at (geometry , container) —> unknowncontainer<KeyType,ValueType> internal_at list<KeyType> —> ValueTypeinternal_at (container<KeyType,ValueType> , list<KeyType>) —> ValueTypeFor internal use only. Corresponds to the implementation, for agents, of the access to containers with [index] 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 of the access to containers with [index]
at,
internal_integrated_valueany expression internal_integrated_value any expression —> containerinternal_integrated_value (any expression , any expression) —> containerFor internal use only. Corresponds to the implementation, for agents, of the access to containers with [index]
internal_zero_order_equationinternal_zero_order_equation (any expression) —> floatintersectionSame signification as inter
intersectsgeometry intersects geometry —> boolintersects (geometry , geometry) —> boolA boolean, equal to true if the left-geometry (or agent/point) intersects the right-geometry (or agent/point).
bool var0 <- square(5) intersects {10,10}; // var0 equals false
disjoint_from, crosses, overlaps, partially_overlaps, touches,
inverseinverse (matrix) —> matrix<float>The inverse matrix of the given matrix. If no inverse exists, returns a matrix that has properties that resemble that of an inverse.
matrix<float> var0 <- inverse(matrix([[5,-3],[6,-4]])); // var0 equals [2.0000000000000004,-0.9999999999999998]
inverse_distance_weightingSame signification as IDW
isunknown is any expression —> boolis (unknown , any expression) —> boolreturns true if the left operand is of the right operand type, false otherwise
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_csvis_csv (any) —> boolTests whether the operand is a csv file.
is_dxfis_dxf (any) —> boolTests whether the operand is a dxf file.
is_finiteis_finite (float) —> boolReturns whether the argument is a finite number or not
bool var0 <- is_finite(4.66); // var0 equals true
bool var1 <- is_finite(#infinity); // var1 equals false
is_gamlis_gaml (any) —> boolTests whether the operand is a gaml file.
is_geojsonis_geojson (any) —> boolTests whether the operand is a geojson file.
is_gifis_gif (any) —> boolTests whether the operand is a gif file.
is_gridis_grid (any) —> boolTests whether the operand is a grid file.
is_imageis_image (any) —> boolTests whether the operand is a image file.
is_jsonis_json (any) —> boolTests whether the operand is a json file.
is_numberis_number (string) —> boolis_number (float) —> booltests whether the operand represents a numerical value Returns whether the argument is a real number or not
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 #.
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_objis_obj (any) —> boolTests whether the operand is a obj file.
is_osmis_osm (any) —> boolTests whether the operand is a osm file.
is_pgmis_pgm (any) —> boolTests whether the operand is a pgm file.
is_propertyis_property (any) —> boolTests whether the operand is a property file.
is_Ris_R (any) —> boolTests whether the operand is a R file.
is_shapeis_shape (any) —> boolTests whether the operand is a shape file.
is_skillunknown is_skill string —> boolis_skill (unknown , string) —> boolreturns true if the left operand is an agent whose species implements the right-hand skill name
bool var0 <- agentA is_skill 'moving'; // var0 equals true
is_svgis_svg (any) —> boolTests whether the operand is a svg file.
is_textis_text (any) —> boolTests whether the operand is a text file.
is_threedsis_threeds (any) —> boolTests whether the operand is a threeds file.
is_URLis_URL (any) —> boolTests whether the operand is a URL file.
is_xmlis_xml (any) —> boolTests whether the operand is a xml file.
json_filejson_file (string) —> fileConstructs a file of type json. Allowed extensions are limited to json
kappakappa (list, list, list) —> floatkappa (list, list, list, list) —> floatkappa 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.
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 the similarity between 0 and 1
float var2 <- kappa([1,1,1,1,5],[1,1,1,1,5],[1,3,5]); // var2 equals 1.0
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_simkappa_sim (list, list, list, list) —> floatkappa_sim (list, list, list, list, list) —> floatkappa 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). 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([cat1,cat1,cat2,cat2,cat2],[cat2,cat1,cat2,cat1,cat3],[cat2,cat1,cat2,cat3,cat3], [cat1,cat2,cat3])
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])
kmeanslist kmeans int —> list<list>kmeans (list , int) —> list<list>kmeans (list, int, int) —> list<list>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)
kmeans ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],2,10)
kmeans ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],2)
kurtosiskurtosis (list) —> floatreturns kurtosis value computed from the operand list of values
kurtosis ([1,2,3,4,5])
lastlast (string) —> stringlast (container<KeyType,ValueType>) —> ValueTypeint last container —> containerlast (int , container) —> containerthe last element of the operand
the last operator behavior depends on the nature of the operand
string var0 <- last ('abce'); // var0 equals 'e'
int var1 <- last ([1, 2, 3]); // var1 equals 3
last_index_ofmap last_index_of unknown —> unknownlast_index_of (map , unknown) —> unknownstring last_index_of string —> intlast_index_of (string , string) —> intspecies last_index_of unknown —> intlast_index_of (species , unknown) —> intcontainer last_index_of unknown —> intlast_index_of (container , unknown) —> intmatrix last_index_of unknown —> pointlast_index_of (matrix , unknown) —> pointthe index of the last occurence of the right operand in the left operand container
The definition of last_index_of and the type of the index depend on the container
unknown var0 <- [1::2, 3::4, 5::4] last_index_of 4; // var0 equals 5
int var1 <- "abcabcabc" last_index_of "ca"; // var1 equals 5
int var2 <- [1,2,3,4,5,6] last_index_of 4; // var2 equals 3
int var3 <- [4,2,3,4,5,4] last_index_of 4; // var3 equals 5
point var4 <- matrix([[1,2,3],[4,5,4]]) last_index_of 4; // var4 equals {1.0,2.0}
last_ofSame signification as last
last_withcontainer last_with any expression —> unknownlast_with (container , any expression) —> unknownthe last element of the left-hand operand that makes the right-hand operand evaluate to true.
in the right-hand operand, the keyword each can be used to represent, in turn, each of the right-hand operand elements.
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
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
layoutgraph layout string —> graphlayout (graph , string) —> graphlayout (graph, string, int) —> graphlayout (graph, string, int, map<string,unknown>) —> graphlayouts a GAMA graph.
lengthlength (string) —> intlength (container<KeyType,ValueType>) —> intthe number of elements contained in the operand
the length operator behavior depends on the nature of the operand
int var0 <- length ('I am an agent'); // var0 equals 13
int var1 <- length([12,13]); // var1 equals 2
int var2 <- length([]); // var2 equals 0
int var3 <- length(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var3 equals 6
lineline (container<geometry>) —> geometrycontainer<geometry> line float —> geometryline (container<geometry> , float) —> geometryA polyline geometry from the given list of points represented as a cylinder of radius r. A polyline geometry from the given list of points.
geometry var0 <- polyline([{0,0}, {0,10}, {10,10}, {10,0}],0.2); // var0 equals a polyline geometry composed of the 4 points.
geometry var1 <- polyline([{0,0}, {0,10}, {10,10}, {10,0}]); // var1 equals a polyline geometry composed of the 4 points.
around, circle, cone, link, norm, point, polygone, rectangle, square, triangle,
linkgeometry link geometry —> geometrylink (geometry , geometry) —> geometryA dynamic line geometry between the location of the two operands
The geometry of the link is a line between the locations of the two operands, which is built and maintained dynamically
geometry var0 <- link (geom1,geom2); // var0 equals a link geometry between geom1 and geom2.
around, circle, cone, line, norm, point, polygon, polyline, rectangle, square, triangle,
listlist (any) —> listCasts the operand into the type list
list_withint list_with any expression —> containerlist_with (int , any expression) —> containercreates a list with a size provided by the first operand, and filled with the second operand
Note that the right operand should be positive, and that the second one is evaluated for each position in the list.
list,
lnln (int) —> floatln (float) —> floatReturns the natural logarithm (base e) of the operand.
float var0 <- ln(1); // var0 equals 0.0
float var1 <- ln(exp(1)); // var1 equals 1.0
exp,
load_graph_from_fileload_graph_from_file (string) —> graphstring load_graph_from_file file —> graphload_graph_from_file (string , file) —> graphstring load_graph_from_file string —> graphload_graph_from_file (string , string) —> graphload_graph_from_file (string, species, species) —> graphload_graph_from_file (string, file, species, species) —> graphload_graph_from_file (string, string, species, species) —> graphload_graph_from_file (string, string, species, species, bool) —> graphloads a graph from a file 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
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:
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file(
"pajek",
"example_of_Pajek_file",
myVertexSpecy,
myEdgeSpecy );
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file(
"pajek",
"./example_of_Pajek_file",
myVertexSpecy,
myEdgeSpecy );
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file(
"pajek",
"example_of_Pajek_file");
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file(
"pajek",
"example_of_Pajek_file");
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file(
"pajek",
"example_of_Pajek_file");
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file(
"pajek",
"./example_of_Pajek_file",
myVertexSpecy,
myEdgeSpecy);
graph<myVertexSpecy,myEdgeSpecy> myGraph <- load_graph_from_file(
"pajek",
"./example_of_Pajek_file",
myVertexSpecy,
myEdgeSpecy , true);
load_shortest_pathsgraph load_shortest_paths matrix —> graphload_shortest_paths (graph , matrix) —> graphput in the graph cache the computed shortest paths contained in the matrix (rows: source, columns: target)
graph var0 <- load_shortest_paths(shortest_paths_matrix); // var0 equals return my_graph with all the shortest paths computed
loglog (float) —> floatlog (int) —> floatReturns the logarithm (base 10) of the operand.
float var0 <- log(10); // var0 equals 1.0
float var1 <- log(1); // var1 equals 0.0
ln,
lower_caselower_case (string) —> stringConverts all of the characters in the string operand to lower case
string var0 <- lower_case("Abc"); // var0 equals 'abc'
mapmap (any) —> mapCasts the operand into the type map
masked_bygeometry masked_by container<geometry> —> geometrymasked_by (geometry , container<geometry>) —> geometrymasked_by (geometry, container<geometry>, int) —> geometrygeometry 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.
materialfloat material float —> msi.gama.util.GamaMaterialmaterial (float , float) —> msi.gama.util.GamaMaterialReturns
matrixmatrix (any) —> matrixCasts the operand into the type matrix
matrix_withpoint matrix_with any expression —> matrixmatrix_with (point , any expression) —> matrixcreates a matrix with a size provided by the first operand, and filled with the second operand
Note that both components of the right operand point should be positive, otherwise an exception is raised.
maxmax (container) —> unknownthe maximum element found in the operand
the max operator behavior depends on the nature of the operand
unknown var0 <- max ([100, 23.2, 34.5]); // var0 equals 100.0
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}
min,
max_ofcontainer max_of any expression —> unknownmax_of (container , any expression) —> unknownthe maximum value of the right-hand expression evaluated on each of the elements of the left-hand operand
in the right-hand operand, the keyword each can be used to represent, in turn, each of the right-hand operand elements.
unknown var5 <- [1::2, 3::4, 5::6] max_of (each + 3); // var5 equals 6
unknown var1 <- [1,2,4,3,5,7,6,8] max_of (each * 100 ); // var1 equals 800
graph g2 <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
unknown var3 <- g2.vertices max_of (g2 degree_of( each )); // var3 equals 2
unknown var4 <- (list(node) max_of (round(node(each).location.x)); // var4 equals 96
maximal_cliques_ofmaximal_cliques_of (graph) —> list<list>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.
graph my_graph <- graph([]);
list<list> var1 <- maximal_cliques_of (my_graph); // var1 equals the list of all the maximal cliques as list
meanmean (container) —> unknownthe mean of all the elements of the operand
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.
unknown var0 <- mean ([4.5, 3.5, 5.5, 7.0]); // var0 equals 5.125
sum,
mean_deviationmean_deviation (container) —> floatthe deviation from the mean of all the elements of the operand. See Mean_deviation for more details.
The operator casts all the numerical element of the list into float. The elements that are not numerical are discarded.
float var0 <- mean_deviation ([4.5, 3.5, 5.5, 7.0]); // var0 equals 1.125
mean_ofcontainer mean_of any expression —> unknownmean_of (container , any expression) —> unknownthe mean of the right-hand expression evaluated on each of the elements of the left-hand operand
in the right-hand operand, the keyword each can be used to represent, in turn, each of the right-hand operand elements.
unknown var2 <- [1::2, 3::4, 5::6] mean_of (each); // var2 equals 4
unknown var1 <- [1,2] mean_of (each * 10 ); // var1 equals 15
min_of, max_of, sum_of, product_of,
meanRmeanR (container) —> unknownreturns the mean value of given vector (right-hand operand) in given variable (left-hand operand).
list<int> X <- [2, 3, 1];
int var1 <- meanR(X); // var1 equals 2
medianmedian (container) —> unknownthe median of all the elements of the operand.
unknown var0 <- median ([4.5, 3.5, 5.5, 3.4, 7.0]); // var0 equals 5.0
mean,
messagemessage (unknown) —> msi.gama.extensions.messaging.GamaMessageto be added
milliseconds_betweendate milliseconds_between date —> floatmilliseconds_between (date , date) —> floatProvide 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)
milliseconds_between(d1, d2) -: 10
minmin (container) —> unknownthe minimum element found in the operand.
the min operator behavior depends on the nature of the operand
unknown var0 <- min ([100, 23.2, 34.5]); // var0 equals 23.2
max,
min_ofcontainer min_of any expression —> unknownmin_of (container , any expression) —> unknownthe minimum value of the right-hand expression evaluated on each of the elements of the left-hand operand
in the right-hand operand, the keyword each can be used to represent, in turn, each of the right-hand operand elements.
unknown var5 <- [1::2, 3::4, 5::6] min_of (each + 3); // var5 equals 5
unknown var1 <- [1,2,4,3,5,7,6,8] min_of (each * 100 ); // var1 equals 100
graph g2 <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
unknown var3 <- g2 min_of (length(g2 out_edges_of each) ); // var3 equals 0
unknown var4 <- (list(node) min_of (round(node(each).location.x)); // var4 equals 4
minus_daysdate minus_days int —> dateminus_days (date , int) —> dateSubtract a given number of days from a date
date1 minus_days 20
minus_hoursdate minus_hours int —> dateminus_hours (date , int) —> dateRemove a given number of hours from a date
date1 minus_hours 15 // equivalent to date1 - 15 #h
minus_minutesdate minus_minutes int —> dateminus_minutes (date , int) —> dateSubtract a given number of minutes from a date
date1 minus_minutes 5 // equivalent to date1 - 5#mn
minus_monthsdate minus_months int —> dateminus_months (date , int) —> dateSubtract a given number of months from a date
date1 minus_months 5
minus_msdate minus_ms int —> dateminus_ms (date , int) —> dateRemove a given number of milliseconds from a date
date1 minus_ms 15 // equivalent to date1 - 15 #ms
minus_secondsSame signification as -
minus_weeksdate minus_weeks int —> dateminus_weeks (date , int) —> dateSubtract a given number of weeks from a date
date1 minus_weeks 15
minus_yearsdate minus_years int —> dateminus_years (date , int) —> dateSubtract a given number of year from a date
date1 minus_years 3
modint mod int —> intmod (int , int) —> intReturns the remainder of the integer division of the left-hand operand by the right-hand operand.
int var0 <- 40 mod 3; // var0 equals 1
div,
months_betweendate months_between date —> intmonths_between (date , date) —> intProvide 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)
months_between(d1, d2) -: 10
moranlist<float> moran matrix<float> —> floatmoran (list<float> , matrix<float>) —> floatfloat var0 <- moran([1.0, 0.5, 2.0], weight_matrix); // var0 equals the Moran index computed
mulmul (container) —> unknownthe product of all the elements of the operand
the mul operator behavior depends on the nature of the operand
unknown var0 <- mul ([100, 23.2, 34.5]); // var0 equals 80040.0
sum,