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,
-, /, [^](#^), [](#), +, 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,
-, /, [](#), +, 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,
-, /, ., [](#), +, 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,
-, /, [](#), +, <, <=, >, >=, 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,
-, [](#), +, 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,
-, [](#), +, 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,
-
-
(int
) —> int
-
(point
) —> point
-
(float
) —> float
int
-
float
—> float
-
(int
, float
) —> float
int
-
int
—> int
-
(int
, int
) —> int
matrix
-
float
—> matrix
-
(matrix
, float
) —> matrix
float
-
matrix
—> matrix
-
(float
, matrix
) —> matrix
date
-
float
—> date
-
(date
, float
) —> date
species
-
agent
—> container
-
(species
, agent
) —> container
date
-
date
—> float
-
(date
, date
) —> float
matrix
-
matrix
—> matrix
-
(matrix
, matrix
) —> matrix
point
-
int
—> point
-
(point
, int
) —> point
date
-
int
—> date
-
(date
, int
) —> date
point
-
float
—> point
-
(point
, float
) —> point
float
-
float
—> float
-
(float
, float
) —> float
rgb
-
rgb
—> rgb
-
(rgb
, rgb
) —> rgb
int
-
matrix
—> matrix
-
(int
, matrix
) —> matrix
container
-
container
—> container
-
(container
, container
) —> container
rgb
-
int
—> rgb
-
(rgb
, int
) —> rgb
container
-
unknown
—> container
-
(container
, unknown
) —> container
point
-
point
—> point
-
(point
, point
) —> point
float
-
int
—> float
-
(float
, int
) —> float
geometry
-
geometry
—> geometry
-
(geometry
, geometry
) —> geometry
matrix
-
int
—> matrix
-
(matrix
, int
) —> matrix
geometry
-
float
—> geometry
-
(geometry
, float
) —> geometry
map
-
map
—> map
-
(map
, map
) —> map
map
-
pair
—> map
-
(map
, pair
) —> map
geometry
-
container<geometry>
—> geometry
-
(geometry
, container<geometry>
) —> geometry
Returns the difference of the two operands. If it is used as an unary operator, it returns the opposite of the operand.
The behavior of the operator depends on the type of the operands.
int var7 <- 1 - 1; // var7 equals 0
int var8 <- 1.0 - 1; // var8 equals 0.0
int var9 <- 3.7 - 1.2; // var9 equals 2.5
int var10 <- 3 - 1.2; // var10 equals 1.8
float var11 <- date1 - date2; // var11 equals 598
date1 - 200
point var13 <- {1, 2} - 4.5; // var13 equals {-3.5, -2.5, -4.5}
point var14 <- {1, 2} - 4; // var14 equals {-3.0,-2.0,-4.0}
rgb var15 <- rgb([255, 128, 32]) - rgb('red'); // var15 equals rgb([0,128,32])
matrix var16 <- 3.5 - matrix([[2,5],[3,4]]); // var16 equals matrix([[1.5,-1.5],[0.5,-0.5]])
list<int> var17 <- [1,2,3,4,5,6] - [2,4,9]; // var17 equals [1,3,5,6]
list<int> var18 <- [1,2,3,4,5,6] - [0,8]; // var18 equals [1,2,3,4,5,6]
rgb var19 <- rgb([255, 128, 32]) - 3; // var19 equals rgb([252,125,29])
list<int> var20 <- [1,2,3,4,5,6] - 2; // var20 equals [1,3,4,5,6]
list<int> var21 <- [1,2,3,4,5,6] - 0; // var21 equals [1,2,3,4,5,6]
point var22 <- {1, 2} - {4, 5}; // var22 equals {-3.0, -3.0}
geometry var23 <- geom1 - geom2; // var23 equals a geometry corresponding to difference between geom1 and geom2
geometry var24 <- shape - 5; // var24 equals a geometry corresponding to the geometry of the agent applying the operator reduced by a distance of 5
geometry var25 <- rectangle(10,10) - [circle(2), square(2)]; // var25 equals rectangle(10,10) - (circle(2) + square(2))
int var0 <- - (-56); // var0 equals 56
point var1 <- -{3.0,5.0}; // var1 equals {-3.0,-5.0}
point var2 <- -{1.0,6.0,7.0}; // var2 equals {-1.0,-6.0,-7.0}
map var3 <- ['a'::1,'b'::2] - ['b'::2]; // var3 equals ['a'::1]
map var4 <- ['a'::1,'b'::2] - ['b'::2,'c'::3]; // var4 equals ['a'::1]
map var5 <- ['a'::1,'b'::2] - ('b'::2); // var5 equals ['a'::1]
map var6 <- ['a'::1,'b'::2] - ('c'::3); // var6 equals ['a'::1,'b'::2]
+, [](#), /, milliseconds_between, -,
:
unknown
:
unknown
—> unknown
:
(unknown
, unknown
) —> unknown
?,
::
any expression
::
any expression
—> pair
::
(any expression
, any expression
) —> pair
produces a new pair combining the left and the right operands
!
!
(bool
) —> bool
opposite boolean value.
bool var0 <- ! (true); // var0 equals false
!=
float
!=
float
—> bool
!=
(float
, float
) —> bool
unknown
!=
unknown
—> bool
!=
(unknown
, unknown
) —> bool
date
!=
date
—> bool
!=
(date
, date
) —> bool
float
!=
int
—> bool
!=
(float
, int
) —> bool
int
!=
float
—> bool
!=
(int
, float
) —> bool
true if both operands are different, false otherwise
bool var0 <- 3.0 != 3.0; // var0 equals false
bool var1 <- 4.0 != 4.7; // var1 equals true
bool var2 <- [2,3] != [2,3]; // var2 equals false
bool var3 <- [2,4] != [2,3]; // var3 equals true
#now != #now minus_hours 1 :- true
bool var5 <- 3.0 != 3; // var5 equals false
bool var6 <- 4.7 != 4; // var6 equals true
bool var7 <- 3 != 3.0; // var7 equals false
bool var8 <- 4 != 4.7; // var8 equals true
?
bool
?
any expression
—> unknown
?
(bool
, any expression
) —> unknown
It is used in combination with the : operator: if the left-hand operand evaluates to true, returns the value of the left-hand operand of the :, otherwise that of the right-hand operand of the :
These functional tests can be combined together.
list<string> var0 <- [10, 19, 43, 12, 7, 22] collect ((each > 20) ? 'above' : 'below'); // var0 equals ['below', 'below', 'above', 'below', 'below', 'above']
rgb color <- (flip(0.3) ? #red : (flip(0.9) ? #blue : #green));
:,
/
rgb
/
float
—> rgb
/
(rgb
, float
) —> rgb
float
/
int
—> float
/
(float
, int
) —> float
point
/
float
—> point
/
(point
, float
) —> point
int
/
int
—> float
/
(int
, int
) —> float
int
/
float
—> float
/
(int
, float
) —> float
matrix
/
float
—> matrix
/
(matrix
, float
) —> matrix
point
/
int
—> point
/
(point
, int
) —> point
matrix
/
matrix
—> matrix
/
(matrix
, matrix
) —> matrix
matrix
/
int
—> matrix
/
(matrix
, int
) —> matrix
float
/
float
—> float
/
(float
, float
) —> float
rgb
/
int
—> rgb
/
(rgb
, int
) —> rgb
Returns the division of the two operands.
rgb var0 <- rgb([255, 128, 32]) / 2.5; // var0 equals rgb([102,51,13])
point var1 <- {5, 7.5} / 2.5; // var1 equals {2, 3}
point var2 <- {2,5} / 4; // var2 equals {0.5,1.25}
float var3 <- 3 / 5.0; // var3 equals 0.6
rgb var4 <- rgb([255, 128, 32]) / 2; // var4 equals rgb([127,64,16])
.
matrix
.
matrix
—> matrix
.
(matrix
, matrix
) —> matrix
agent
.
any expression
—> unknown
.
(agent
, any expression
) —> unknown
It has two different uses: it can be the dot product between 2 matrices or return an evaluation of the expression (right-hand operand) in the scope the given agent.
matrix var0 <- matrix([[1,1],[1,2]]) . matrix([[1,1],[1,2]]); // var0 equals matrix([[2,3],[3,5]])
unknown var1 <- agent1.location; // var1 equals the location of the agent agent1
map(nil).keys
^
int
^
float
—> float
^
(int
, float
) —> float
float
^
float
—> float
^
(float
, float
) —> float
int
^
int
—> float
^
(int
, int
) —> float
float
^
int
—> float
^
(float
, int
) —> float
Returns the value (always a float) of the left operand raised to the power of the right operand.
float var1 <- 2 ^ 3; // var1 equals 8.0
float var0 <- 4.84 ^ 0.5; // var0 equals 2.2
[](#), sqrt,
@
Same signification as at
*
int
*
int
—> int
*
(int
, int
) —> int
matrix
*
int
—> matrix
*
(matrix
, int
) —> matrix
point
*
point
—> float
*
(point
, point
) —> float
int
*
float
—> float
*
(int
, float
) —> float
float
*
float
—> float
*
(float
, float
) —> float
matrix
*
matrix
—> matrix
*
(matrix
, matrix
) —> matrix
point
*
int
—> point
*
(point
, int
) —> point
float
*
matrix
—> matrix
*
(float
, matrix
) —> matrix
geometry
*
point
—> geometry
*
(geometry
, point
) —> geometry
point
*
float
—> point
*
(point
, float
) —> point
int
*
matrix
—> matrix
*
(int
, matrix
) —> matrix
float
*
int
—> float
*
(float
, int
) —> float
rgb
*
int
—> rgb
*
(rgb
, int
) —> rgb
matrix
*
float
—> matrix
*
(matrix
, float
) —> matrix
geometry
*
float
—> geometry
*
(geometry
, float
) —> geometry
Returns the product of the two operands.
int var1 <- 1 * 1; // var1 equals 1
float var2 <- {2,5} * {4.5, 5}; // var2 equals 34.0
point var3 <- {2,5} * 4; // var3 equals {8.0, 20.0}
point var4 <- {2, 4} * 2.5; // var4 equals {5.0, 10.0}
geometry var5 <- shape * {0.5,0.5,2}; // var5 equals a geometry corresponding to the geometry of the agent applying the operator scaled by a coefficient of 0.5 in x, 0.5 in y and 2 in z
matrix<float> m <- (3.5 * matrix([[2,5],[3,4]])); //m equals matrix([[7.0,17.5],[10.5,14]])
rgb var7 <- rgb([255, 128, 32]) * 2; // var7 equals rgb([255,255,64])
geometry var8 <- circle(10) * 2; // var8 equals circle(20)
float var0 <- 2.5 * 2; // var0 equals 5.0
+
string
+
string
—> string
+
(string
, string
) —> string
date
+
float
—> date
+
(date
, float
) —> date
map
+
pair
—> map
+
(map
, pair
) —> map
int
+
matrix
—> matrix
+
(int
, matrix
) —> matrix
point
+
int
—> point
+
(point
, int
) —> point
rgb
+
rgb
—> rgb
+
(rgb
, rgb
) —> rgb
geometry
+
float
—> geometry
+
(geometry
, float
) —> geometry
matrix
+
float
—> matrix
+
(matrix
, float
) —> matrix
geometry
+
geometry
—> geometry
+
(geometry
, geometry
) —> geometry
map
+
map
—> map
+
(map
, map
) —> map
float
+
float
—> float
+
(float
, float
) —> float
float
+
int
—> float
+
(float
, int
) —> float
matrix
+
matrix
—> matrix
+
(matrix
, matrix
) —> matrix
date
+
string
—> string
+
(date
, string
) —> string
matrix
+
int
—> matrix
+
(matrix
, int
) —> matrix
int
+
int
—> int
+
(int
, int
) —> int
string
+
unknown
—> string
+
(string
, unknown
) —> string
point
+
point
—> point
+
(point
, point
) —> point
float
+
matrix
—> matrix
+
(float
, matrix
) —> matrix
int
+
float
—> float
+
(int
, float
) —> float
point
+
float
—> point
+
(point
, float
) —> point
rgb
+
int
—> rgb
+
(rgb
, int
) —> rgb
date
+
int
—> date
+
(date
, int
) —> date
container
+
container
—> container
+
(container
, container
) —> container
container
+
unknown
—> container
+
(container
, unknown
) —> container
+
(geometry
, float
, int
) —> geometry
+
(geometry
, float
, int
, int
) —> geometry
Returns the sum, union or concatenation of the two operands.
geometry var4 <- circle(5) + (5,32); // var4 equals circle(10)
matrix var5 <- 3.5 + matrix([[2,5],[3,4]]); // var5 equals matrix([[5.5,8.5],[6.5,7.5]])
rgb var6 <- rgb([255, 128, 32]) + rgb('red'); // var6 equals rgb([255,128,32])
geometry var7 <- circle(5) + 5; // var7 equals circle(10)
geometry var8 <- geom1 + geom2; // var8 equals a geometry corresponding to union between geom1 and geom2
int var9 <- 1 + 1; // var9 equals 2
int var10 <- 1.0 + 1; // var10 equals 2.0
int var11 <- 1.0 + 2.5; // var11 equals 3.5
string var12 <- "hello " + 12; // var12 equals "hello 12"
point var13 <- {1, 2} + {4, 5}; // var13 equals {5.0, 7.0}
point var14 <- {1, 2} + 4; // var14 equals {5.0, 6.0,4.0}
point var15 <- {1, 2} + 4.5; // var15 equals {5.5, 6.5,4.5}
rgb var16 <- rgb([255, 128, 32]) + 3; // var16 equals rgb([255,131,35])
geometry var17 <- circle(5) + (5,32,#round); // var17 equals circle(10)
date1 + 200
list<int> var19 <- [1,2,3,4,5,6] + [2,4,9]; // var19 equals [1,2,3,4,5,6,2,4,9]
list<int> var20 <- [1,2,3,4,5,6] + [0,8]; // var20 equals [1,2,3,4,5,6,0,8]
list<int> var21 <- [1,2,3,4,5,6] + 2; // var21 equals [1,2,3,4,5,6,2]
list<int> var22 <- [1,2,3,4,5,6] + 0; // var22 equals [1,2,3,4,5,6,0]
map var0 <- ['a'::1,'b'::2] + ('c'::3); // var0 equals ['a'::1,'b'::2,'c'::3]
map var1 <- ['a'::1,'b'::2] + ('c'::3); // var1 equals ['a'::1,'b'::2,'c'::3]
map var2 <- ['a'::1,'b'::2] + ['c'::3]; // var2 equals ['a'::1,'b'::2,'c'::3]
map var3 <- ['a'::1,'b'::2] + [5::3.0]; // var3 equals ['a'::1.0,'b'::2.0,5::3.0]
<
float
<
int
—> bool
<
(float
, int
) —> bool
int
<
int
—> bool
<
(int
, int
) —> bool
point
<
point
—> bool
<
(point
, point
) —> bool
int
<
float
—> bool
<
(int
, float
) —> bool
date
<
date
—> bool
<
(date
, date
) —> bool
float
<
float
—> bool
<
(float
, float
) —> bool
string
<
string
—> bool
<
(string
, string
) —> bool
true if the left-hand operand is less than the right-hand operand, false otherwise.
bool var5 <- {5,7} < {4,6}; // var5 equals false
bool var6 <- {5,7} < {4,8}; // var6 equals false
bool var7 <- 'abc' < 'aeb'; // var7 equals true
bool var0 <- 3.5 < 7; // var0 equals true
bool var1 <- 3 < 7; // var1 equals true
bool var2 <- 3 < 2.5; // var2 equals false
#now < #now minus_hours 1 :- false
bool var4 <- 3.5 < 7.6; // var4 equals true
<=
string
<=
string
—> bool
<=
(string
, string
) —> bool
date
<=
date
—> bool
<=
(date
, date
) —> bool
float
<=
float
—> bool
<=
(float
, float
) —> bool
int
<=
int
—> bool
<=
(int
, int
) —> bool
int
<=
float
—> bool
<=
(int
, float
) —> bool
float
<=
int
—> bool
<=
(float
, int
) —> bool
point
<=
point
—> bool
<=
(point
, point
) —> bool
true if the left-hand operand is less or equal than the right-hand operand, false otherwise.
bool var5 <- 'abc' <= 'aeb'; // var5 equals true
bool var6 <- {5,7} <= {4,6}; // var6 equals false
bool var7 <- {5,7} <= {4,8}; // var7 equals false
#now <= #now minus_hours 1 :- false
bool var1 <- 3.5 <= 3.5; // var1 equals true
bool var2 <- 3 <= 7; // var2 equals true
bool var3 <- 3 <= 2.5; // var3 equals false
bool var4 <- 7.0 <= 7; // var4 equals true
<>
Same signification as !=
=
date
=
date
—> bool
=
(date
, date
) —> bool
int
=
float
—> bool
=
(int
, float
) —> bool
unknown
=
unknown
—> bool
=
(unknown
, unknown
) —> bool
float
=
float
—> bool
=
(float
, float
) —> bool
float
=
int
—> bool
=
(float
, int
) —> bool
int
=
int
—> bool
=
(int
, int
) —> bool
returns true if both operands are equal, false otherwise returns true if both operands are equal, false otherwise
bool var0 <- [2,3] = [2,3]; // var0 equals true
#now = #now minus_hours 1 :- false
bool var2 <- 3 = 3.0; // var2 equals true
bool var3 <- 4 = 4.7; // var3 equals false
bool var4 <- 4.5 = 4.7; // var4 equals false
bool var5 <- 4.7 = 4; // var5 equals false
bool var6 <- 4 = 5; // var6 equals false
>
int
>
float
—> bool
>
(int
, float
) —> bool
float
>
float
—> bool
>
(float
, float
) —> bool
string
>
string
—> bool
>
(string
, string
) —> bool
int
>
int
—> bool
>
(int
, int
) —> bool
date
>
date
—> bool
>
(date
, date
) —> bool
point
>
point
—> bool
>
(point
, point
) —> bool
float
>
int
—> bool
>
(float
, int
) —> bool
true if the left-hand operand is greater than the right-hand operand, false otherwise.
bool var0 <- 'abc' > 'aeb'; // var0 equals false
bool var1 <- {5,7} > {4,6}; // var1 equals true
bool var2 <- {5,7} > {4,8}; // var2 equals false
bool var3 <- 3 > 2.5; // var3 equals true
bool var4 <- 3.5 > 7.6; // var4 equals false
bool var5 <- 3 > 7; // var5 equals false
#now > #now minus_hours 1 :- true
bool var7 <- 3.5 > 7; // var7 equals false
>=
float
>=
int
—> bool
>=
(float
, int
) —> bool
int
>=
int
—> bool
>=
(int
, int
) —> bool
int
>=
float
—> bool
>=
(int
, float
) —> bool
string
>=
string
—> bool
>=
(string
, string
) —> bool
date
>=
date
—> bool
>=
(date
, date
) —> bool
float
>=
float
—> bool
>=
(float
, float
) —> bool
point
>=
point
—> bool
>=
(point
, point
) —> bool
true if the left-hand operand is greater or equal than the right-hand operand, false otherwise.
bool var5 <- 'abc' >= 'aeb'; // var5 equals false
bool var6 <- 'abc' >= 'abc'; // var6 equals true
bool var7 <- {5,7} >= {4,6}; // var7 equals true
bool var8 <- {5,7} >= {4,8}; // var8 equals false
bool var0 <- 3.5 >= 7; // var0 equals false
bool var1 <- 3 >= 7; // var1 equals false
bool var2 <- 3 >= 2.5; // var2 equals true
#now >= #now minus_hours 1 :- true
bool var4 <- 3.5 >= 3.5; // var4 equals true
abs
abs
(int
) —> int
abs
(float
) —> float
Returns the absolute value of the operand (so a positive int or float depending on the type of the operand).
int var0 <- abs (-10); // var0 equals 10
int var1 <- abs (10); // var1 equals 10
float var3 <- abs (200 * -1 + 0.5); // var3 equals 199.5
accumulate
container
accumulate
any expression
—> container
accumulate
(container
, any expression
) —> container
returns a new flat list, in which each element is the evaluation of the right-hand operand. If this evaluation returns a list, the elements of this result are added directly to the list returned
accumulate is dedicated to the application of a same computation on each element of a container (and returns a list). In the right-hand operand, the keyword each can be used to represent, in turn, each of the left-hand operand elements.
container var0 <- [a1,a2,a3] accumulate (each neighbors_at 10); // var0 equals a flat list of all the neighbors of these three agents
list<int> var1 <- [1,2,4] accumulate ([2,4]); // var1 equals [2,4,2,4,2,4]
list<int> var2 <- [1,2,4] accumulate (each * 2); // var2 equals [2,4,8]
acos
acos
(float
) —> float
acos
(int
) —> float
Returns the value (in the interval [0,180], in decimal degrees) of the arccos of the operand (which should be in [-1,1]).
float var0 <- acos (0); // var0 equals 90.0
action
action
(any
) —> action
Casts the operand into the type action
add_days
Same signification as plus_days
add_edge
graph
add_edge
pair
—> graph
add_edge
(graph
, pair
) —> graph
add an edge between a source vertex and a target vertex (resp. the left and the right element of the pair operand)
if the edge already exists, the graph is unchanged
graph <- graph add_edge (source::target);
add_hours
Same signification as plus_hours
add_minutes
Same signification as plus_minutes
add_months
Same signification as plus_months
add_ms
Same signification as plus_ms
add_node
graph
add_node
geometry
—> graph
add_node
(graph
, geometry
) —> graph
adds a node in a graph.
graph var0 <- graph add_node node(0) ; // var0 equals the graph with node(0)
add_point
geometry
add_point
point
—> geometry
add_point
(geometry
, point
) —> geometry
A new geometry resulting from the addition of the right point (coordinate) to the left-hand geometry. Note that adding a point to a line or polyline will always return a closed contour. Also note that the position at which the added point will appear in the geometry is not necessarily the last one, as points are always ordered in a clockwise fashion in geometries
geometry var0 <- polygon([{10,10},{10,20},{20,20}]) add_point {20,10}; // var0 equals polygon([{10,10},{10,20},{20,20},{20,10}])
add_seconds
Same signification as +
add_weeks
Same signification as plus_weeks
add_years
Same signification as plus_years
adjacency
adjacency
(graph
) —> matrix<float>
adjacency matrix of the given graph.
after
after
(date
) —> bool
any expression
after
date
—> bool
after
(any expression
, date
) —> bool
Returns true if the current_date of the model is strictly after the date passed in argument. Synonym of ‘current_date > argument’. Can be used in its composed form with 2 arguments to express the lower boundary for the computation of a frequency. Note that only dates strictly after this one will be tested against the frequency
reflex when: after(starting_date) {} -: will always be run after the first step
reflex when: false after(starting date + #10days) {} -: will not be run after this date. Better to use 'until' or 'before' in that case
every(2#days) after (starting_date + 1#day) // the computation will return true every two days (using the starting_date of the model as the starting point) only for the dates strictly after this starting_date + 1#day
agent
agent
(any
) —> agent
Casts the operand into the type agent
agent_closest_to
agent_closest_to
(unknown
) —> agent
An agent, the closest 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.
agent var0 <- agent_closest_to(self); // var0 equals the closest agent to the agent applying the operator.
neighbors_at, neighbors_of, agents_inside, agents_overlapping, closest_to, inside, overlapping,
agent_farthest_to
agent_farthest_to
(unknown
) —> agent
An agent, 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.
agent var0 <- agent_farthest_to(self); // var0 equals the farthest agent to the agent applying the operator.
neighbors_at, neighbors_of, agents_inside, agents_overlapping, closest_to, inside, overlapping, agent_closest_to, farthest_to,
agent_from_geometry
path
agent_from_geometry
geometry
—> agent
agent_from_geometry
(path
, geometry
) —> agent
returns the agent corresponding to given geometry (right-hand operand) in the given path (left-hand operand).
geometry line <- one_of(path_followed.segments);
road ag <- road(path_followed agent_from_geometry line);
path,
agents_at_distance
agents_at_distance
(float
) —> container
A list of agents situated at a distance lower than the right argument.
container var0 <- agents_at_distance(20); // var0 equals all the agents (excluding the caller) which distance to the caller is lower than 20
neighbors_at, neighbors_of, agent_closest_to, agents_inside, closest_to, inside, overlapping, at_distance,
agents_inside
agents_inside
(unknown
) —> list<agent>
A list of agents covered by the operand (casted as a geometry).
list<agent> var0 <- agents_inside(self); // var0 equals the agents that are covered by the shape of the agent applying the operator.
agent_closest_to, agents_overlapping, closest_to, inside, overlapping,
agents_overlapping
agents_overlapping
(unknown
) —> list<agent>
A list of agents overlapping the operand (casted as a geometry).
list<agent> var0 <- agents_overlapping(self); // var0 equals the agents that overlap the shape of the agent applying the operator.
neighbors_at, neighbors_of, agent_closest_to, agents_inside, closest_to, inside, overlapping, at_distance,
all_pairs_shortest_path
all_pairs_shortest_path
(graph
) —> matrix<int>
returns the successor matrix of shortest paths between all node pairs (rows: source, columns: target): a cell (i,j) will thus contains the next node in the shortest path between i and j.
matrix<int> var0 <- all_pairs_shortest_paths(my_graph); // var0 equals shortest_paths_matrix will contain all pairs of shortest paths
alpha_index
alpha_index
(graph
) —> float
returns the alpha index of the graph (measure of connectivity which evaluates the number of cycles in a graph in comparison with the maximum number of cycles. The higher the alpha index, the more a network is connected: alpha = nb_cycles / (2*
S-5) - planar graph)
float var1 <- alpha_index(graphEpidemio); // var1 equals the alpha index of the graph
beta_index, gamma_index, nb_cycles, connectivity_index,
among
int
among
container
—> container
among
(int
, container
) —> container
Returns a list of length the value of the left-hand operand, containing random elements from the right-hand operand. As of GAMA 1.6, the order in which the elements are returned can be different than the order in which they appear in the right-hand container
list<int> var0 <- 3 among [1,2,4,3,5,7,6,8]; // var0 equals [1,2,8] (for example)
container var1 <- 3 among g2; // var1 equals [node6,node11,node7]
container var2 <- 3 among list(node); // var2 equals [node1,node11,node4]
list<int> var3 <- 1 among [1::2,3::4]; // var3 equals 2 or 4
and
bool
and
any expression
—> bool
and
(bool
, any expression
) —> bool
a bool value, equal to the logical and between the left-hand operand and the right-hand operand.
both operands are always casted to bool before applying the operator. Thus, an expression like (1 and 0) is accepted and returns false.
and
predicate
and
predicate
—> predicate
and
(predicate
, predicate
) —> predicate
create a new predicate from two others by including them as subintentions
predicate1 and predicate2
angle_between
angle_between
(point
, point
, point
) —> int
the angle between vectors P0P1 and P0P2 (P0, P1, P2 being the three point operands)
int var0 <- angle_between({5,5},{10,5},{5,10}); // var0 equals 90
any
Same signification as one_of
any_location_in
any_location_in
(geometry
) —> point
A point inside (or touching) the operand-geometry.
point var0 <- any_location_in(square(5)); // var0 equals a point in the square, for example : {3,4.6}.
closest_points_with, farthest_point_to, points_at,
any_point_in
Same signification as any_location_in
append_horizontally
matrix
append_horizontally
matrix
—> matrix
append_horizontally
(matrix
, matrix
) —> matrix
matrix
append_horizontally
matrix
—> matrix
append_horizontally
(matrix
, matrix
) —> matrix
A matrix resulting from the concatenation of the rows of the two given matrices. If not both numerical or both object matrices, returns the first matrix.
matrix var0 <- matrix([[1.0,2.0],[3.0,4.0]]) append_horizontally matrix([[1,2],[3,4]]); // var0 equals matrix([[1.0,2.0],[3.0,4.0],[1.0,2.0],[3.0,4.0]])
append_vertically
matrix
append_vertically
matrix
—> matrix
append_vertically
(matrix
, matrix
) —> matrix
matrix
append_vertically
matrix
—> matrix
append_vertically
(matrix
, matrix
) —> matrix
A matrix resulting from the concatenation of the columns of the two given matrices. If not both numerical or both object matrices, returns the first matrix.
matrix var0 <- matrix([[1,2],[3,4]]) append_vertically matrix([[1,2],[3,4]]); // var0 equals matrix([[1,2,1,2],[3,4,3,4]])
arc
arc
(float
, float
, float
) —> geometry
arc
(float
, float
, float
, bool
) —> geometry
An arc, which radius is equal to the first operand, heading to the second and amplitude the third An arc, which radius is equal to the first operand, heading to the second, amplitude to the third and a boolean indicating whether to return a linestring or a polygon to the fourth
the center of the arc is by default the location of the current agent in which has been called this operator. This operator returns a polygon by default.the center of the arc is by default the location of the current agent in which has been called this operator.
geometry var0 <- arc(4,45,90); // var0 equals a geometry as an arc of radius 4, in a direction of 45° and an amplitude of 90°
geometry var1 <- arc(4,45,90, false); // var1 equals a geometry as an arc of radius 4, in a direction of 45° and an amplitude of 90°, which only contains the points on the arc
around, cone, line, link, norm, point, polygon, polyline, super_ellipse, rectangle, square, circle, ellipse, triangle,
around
float
around
unknown
—> geometry
around
(float
, unknown
) —> geometry
A geometry resulting from the difference between a buffer around the right-operand casted in geometry at a distance left-operand (right-operand buffer left-operand) and the right-operand casted as geometry.
geometry var0 <- 10 around circle(5); // var0 equals the ring geometry between 5 and 10.
circle, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,
as
unknown
as
any expression
—> unknown
as
(unknown
, any expression
) —> unknown
casting of the first argument into a given type
It is equivalent to the application of the type operator on the left operand.
int var0 <- 3.5 as int; // var0 equals int(3.5)
as_4_grid
geometry
as_4_grid
point
—> matrix
as_4_grid
(geometry
, point
) —> matrix
A matrix of square geometries (grid with 4-neighborhood) with dimension given by the right-hand operand ({nb_cols, nb_lines}) corresponding to the square tessellation of the left-hand operand geometry (geometry, agent)
matrix var0 <- self as_4_grid {10, 5}; // var0 equals the matrix of square geometries (grid with 4-neighborhood) with 10 columns and 5 lines corresponding to the square tessellation of the geometry of the agent applying the operator.
as_distance_graph
container
as_distance_graph
map
—> graph
as_distance_graph
(container
, map
) —> graph
container
as_distance_graph
float
—> graph
as_distance_graph
(container
, float
) —> graph
as_distance_graph
(container
, float
, species
) —> graph
creates a graph from a list of vertices (left-hand operand). An edge is created between each pair of vertices close enough (less than a distance, right-hand operand).
as_distance_graph is more efficient for a list of points than as_intersection_graph.
list(ant) as_distance_graph 3.0
as_intersection_graph, as_edge_graph,
as_driving_graph
container
as_driving_graph
container
—> graph
as_driving_graph
(container
, container
) —> graph
creates a graph from the list/map of edges given as operand and connect the node to the edge
as_driving_graph(road,node) --: build a graph while using the road agents as edges and the node agents as nodes
as_intersection_graph, as_distance_graph, as_edge_graph,
as_edge_graph
as_edge_graph
(map
) —> graph
as_edge_graph
(container
) —> graph
container
as_edge_graph
float
—> graph
as_edge_graph
(container
, float
) —> graph
creates a graph from the list/map of edges given as operand
graph var0 <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]); // var0 equals a graph with these three vertices and two edges
graph var1 <- as_edge_graph([line([{1,5},{12,45}]),line([{13,45},{34,56}])],1);; // var1 equals a graph with two edges and three vertices
graph var2 <- as_edge_graph([line([{1,5},{12,45}]),line([{12,45},{34,56}])]); // var2 equals a graph with two edges and three vertices
as_intersection_graph, as_distance_graph,
as_grid
geometry
as_grid
point
—> matrix
as_grid
(geometry
, point
) —> matrix
A matrix of square geometries (grid with 8-neighborhood) with dimension given by the right-hand operand ({nb_cols, nb_lines}) corresponding to the square tessellation of the left-hand operand geometry (geometry, agent)
matrix var0 <- self as_grid {10, 5}; // var0 equals a matrix of square geometries (grid with 8-neighborhood) with 10 columns and 5 lines corresponding to the square tessellation of the geometry of the agent applying the operator.
as_hexagonal_grid
geometry
as_hexagonal_grid
point
—> list<geometry>
as_hexagonal_grid
(geometry
, point
) —> list<geometry>
A list of geometries (hexagonal) corresponding to the hexagonal tesselation of the first operand geometry
list<geometry> var0 <- self as_hexagonal_grid {10, 5}; // var0 equals list of geometries (hexagonal) corresponding to the hexagonal tesselation of the first operand geometry
as_int
string
as_int
int
—> int
as_int
(string
, int
) —> int
parses the string argument as a signed integer in the radix specified by the second argument.
int var0 <- '20' as_int 10; // var0 equals 20
int var1 <- '20' as_int 8; // var1 equals 16
int var2 <- '20' as_int 16; // var2 equals 32
int var3 <- '1F' as_int 16; // var3 equals 31
int var4 <- 'hello' as_int 32; // var4 equals 18306744
int,
as_intersection_graph
container
as_intersection_graph
float
—> graph
as_intersection_graph
(container
, float
) —> graph
creates a graph from a list of vertices (left-hand operand). An edge is created between each pair of vertices with an intersection (with a given tolerance).
as_intersection_graph is more efficient for a list of geometries (but less accurate) than as_distance_graph.
list(ant) as_intersection_graph 0.5
as_distance_graph, as_edge_graph,
as_map
container
as_map
any expression
—> map
as_map
(container
, any expression
) —> map
produces a new map from the evaluation of the right-hand operand for each element of the left-hand operand
the right-hand operand should be a pair
map<int,int> var0 <- [1,2,3,4,5,6,7,8] as_map (each::(each * 2)); // var0 equals [1::2, 2::4, 3::6, 4::8, 5::10, 6::12, 7::14, 8::16]
map<int,int> var1 <- [1::2,3::4,5::6] as_map (each::(each * 2)); // var1 equals [2::4, 4::8, 6::12]
as_matrix
unknown
as_matrix
point
—> matrix
as_matrix
(unknown
, point
) —> matrix
casts the left operand into a matrix with right operand as preferred size
This operator is very useful to cast a file containing raster data into a matrix.Note that both components of the right operand point should be positive, otherwise an exception is raised.The operator as_matrix creates a matrix of preferred size. It fills in it with elements of the left operand until the matrix is full If the size is to short, some elements will be omitted. Matrix remaining elements will be filled in by nil.
as_path
list<geometry>
as_path
graph
—> path
as_path
(list<geometry>
, graph
) —> path
create a graph path from the list of shape
path var0 <- [road1,road2,road3] as_path my_graph; // var0 equals a path road1->road2->road3 of my_graph
asin
asin
(float
) —> float
asin
(int
) —> float
the arcsin of the operand
float var0 <- asin (0); // var0 equals 0.0
float var1 <- asin (90); // var1 equals #nan
at
string
at
int
—> string
at
(string
, int
) —> string
container<KeyType,ValueType>
at
KeyType
—> ValueType
at
(container<KeyType,ValueType>
, KeyType
) —> ValueType
the element at the right operand index of the container
The first element of the container is located at the index 0. In addition, if the user tries to get the element at an index higher or equals than the length of the container, he will get an IndexOutOfBoundException.The at operator behavior depends on the nature of the operand
int var1 <- [1, 2, 3] at 2; // var1 equals 3
point var2 <- [{1,2}, {3,4}, {5,6}] at 0; // var2 equals {1.0,2.0}
string var0 <- 'abcdef' at 0; // var0 equals 'a'
at_distance
container<agent>
at_distance
float
—> list<geometry>
at_distance
(container<agent>
, float
) —> list<geometry>
A list of agents or geometries among the left-operand list that are located at a distance <= the right operand from the caller agent (in its topology)
list<geometry> var0 <- [ag1, ag2, ag3] at_distance 20; // var0 equals the agents of the list located at a distance <= 20 from the caller agent (in the same order).
neighbors_at, neighbors_of, agent_closest_to, agents_inside, closest_to, inside, overlapping,
at_location
geometry
at_location
point
—> geometry
at_location
(geometry
, point
) —> geometry
A geometry resulting from the tran of a translation to the right-hand operand point of the left-hand operand (geometry, agent, point)
geometry var0 <- self at_location {10, 20}; // var0 equals the geometry resulting from a translation to the location {10, 20} of the left-hand geometry (or agent).
atan
atan
(float
) —> float
atan
(int
) —> float
Returns the value (in the interval [-90,90], in decimal degrees) of the arctan of the operand (which can be any real number).
float var0 <- atan (1); // var0 equals 45.0
atan2
float
atan2
float
—> float
atan2
(float
, float
) —> float
the atan2 value of the two operands.
The function atan2 is the arctangent function with two arguments. The purpose of using two arguments instead of one is to gather information on the signs of the inputs in order to return the appropriate quadrant of the computed angle, which is not possible for the single-argument arctangent function.
float var0 <- atan2 (0,0); // var0 equals 0.0
attributes
attributes
(any
) —> attributes
Casts the operand into the type attributes
BDIPlan
BDIPlan
(any
) —> BDIPlan
Casts the operand into the type BDIPlan
before
before
(date
) —> bool
any expression
before
date
—> bool
before
(any expression
, date
) —> bool
Returns true if the current_date of the model is strictly before the date passed in argument. Synonym of ‘current_date < argument’
reflex when: before(starting_date) {} -: will never be run
beta_index
beta_index
(graph
) —> float
returns the beta index of the graph (Measures the level of connectivity in a graph and is expressed by the relationship between the number of links (e) over the number of nodes (v) : beta = e/v.
graph graphEpidemio <- graph([]);
float var1 <- beta_index(graphEpidemio); // var1 equals the beta index of the graph
alpha_index, gamma_index, nb_cycles, connectivity_index,
between
date
between
date
—> bool
between
(date
, date
) —> bool
between
(int
, int
, int
) —> bool
between
(any expression
, date
, date
) —> bool
between
(float
, float
, float
) —> bool
between
(date
, date
, date
) —> bool
returns true the first integer operand is bigger than the second integer operand and smaller than the third integer operand returns true if the first float operand is bigger than the second float operand and smaller than the third float operand
(date('2016-01-01') between(date('2000-01-01'), date('2020-02-02') -: true
every #day between(date('2000-01-01'), date('2020-02-02') // will return true every new day between these two dates, taking the first one as the starting point
(date('2016-01-01') between(date('2000-01-01'), date('2020-02-02') -: true
between(date('2000-01-01'), date('2020-02-02') // will return true if the current_date of the model is in_between the 2
bool var0 <- between(5, 1, 10); // var0 equals true
bool var1 <- between(5.0, 1.0, 10.0); // var1 equals true
betweenness_centrality
betweenness_centrality
(graph
) —> map
returns a map containing for each vertex (key), its betweenness centrality (value): number of shortest paths passing through each vertex
graph graphEpidemio <- graph([]);
map var1 <- betweenness_centrality(graphEpidemio); // var1 equals the betweenness centrality index of the graph
biggest_cliques_of
biggest_cliques_of
(graph
) —> list<list>
returns the biggest cliques of a graph using the Bron-Kerbosch clique detection algorithm
graph my_graph <- graph([]);
list<list> var1 <- biggest_cliques_of (my_graph); // var1 equals the list of the biggest cliques as list
binomial
int
binomial
float
—> int
binomial
(int
, float
) —> int
A value from a random variable following a binomial distribution. The operands represent the number of experiments n and the success probability p.
The binomial distribution is the discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p, cf. Binomial distribution on Wikipedia.
int var0 <- binomial(15,0.6); // var0 equals a random positive integer
blend
rgb
blend
rgb
—> rgb
blend
(rgb
, rgb
) —> rgb
blend
(rgb
, rgb
, float
) —> rgb
Blend two colors with an optional ratio (c1 *
r + c2 *
(1 - r)) between 0 and 1
rgb var3 <- blend(#red, #blue); // var3 equals to a color very close to the purple
rgb var1 <- blend(#red, #blue, 0.3); // var1 equals to a color between the purple and the blue
bool
bool
(any
) —> bool
Casts the operand into the type bool
box
box
(point
) —> geometry
box
(float
, float
, float
) —> geometry
A box geometry which side sizes are given by the operands.
the center of the box is by default the location of the current agent in which has been called this operator.the center of the box is by default the location of the current agent in which has been called this operator.
geometry var0 <- box(10, 5 , 5); // var0 equals a geometry as a rectangle with width = 10, height = 5 depth= 5.
geometry var1 <- box({10, 5 , 5}); // var1 equals a geometry as a rectangle with width = 10, height = 5 depth= 5.
around, circle, sphere, cone, line, link, norm, point, polygon, polyline, square, cube, triangle,
brewer_colors
brewer_colors
(string
) —> list<rgb>
string
brewer_colors
int
—> list<rgb>
brewer_colors
(string
, int
) —> list<rgb>
Build a list of colors of a given type (see website http://colorbrewer2.org/) Build a list of colors of a given type (see website http://colorbrewer2.org/) with a given number of classes
list<rgb> var0 <- list<rgb> colors <- brewer_colors("OrRd");; // var0 equals a list of 6 blue colors
list<rgb> var1 <- list<rgb> colors <- brewer_colors("Pastel1", 10);; // var1 equals a list of 10 sequential colors
brewer_palettes
brewer_palettes
(int
) —> list<string>
int
brewer_palettes
int
—> list<string>
brewer_palettes
(int
, int
) —> list<string>
returns the list a palette with a given min number of classes and max number of classes) returns the list a palette with a given min number of classes and max number of classes)
list<string> var0 <- list<rgb> colors <- brewer_palettes(5,10);; // var0 equals a list of palettes that are composed of a min of 5 colors and a max of 10 colors
list<string> var1 <- list<rgb> colors <- brewer_palettes();; // var1 equals a list of palettes that are composed of a min of 5 colors
buffer
Same signification as +
build
build
(matrix<float>
) —> regression
matrix<float>
build
string
—> regression
build
(matrix<float>
, string
) —> regression
returns the regression build from the matrix data (a row = an instance, the last value of each line is the y value) while using the given ordinary least squares method. Usage: build(data) returns the regression build from the matrix data (a row = an instance, the last value of each line is the y value) while using the given method (“GLS” or “OLS”). Usage: build(data,method)
matrix([[1,2,3,4],[2,3,4,2]])
build(matrix([[1,2,3,4],[2,3,4,2]]),"GLS")
ceil
ceil
(float
) —> float
Maps the operand to the smallest following integer, i.e. the smallest integer not less than x.
float var0 <- ceil(3); // var0 equals 3.0
float var1 <- ceil(3.5); // var1 equals 4.0
float var2 <- ceil(-4.7); // var2 equals -4.0
centroid
centroid
(geometry
) —> point
Centroid (weighted sum of the centroids of a decomposition of the area into triangles) of the operand-geometry. Can be different to the location of the geometry
point var0 <- centroid(world); // var0 equals the centroid of the square, for example : {50.0,50.0}.
any_location_in, closest_points_with, farthest_point_to, points_at,
char
char
(int
) —> string
string var0 <- char (34); // var0 equals '"'
circle
circle
(float
) —> geometry
float
circle
point
—> geometry
circle
(float
, point
) —> geometry
A circle geometry which radius is equal to the first operand, and the center has the location equal to the second operand. A circle geometry which radius is equal to the operand.
the center of the circle is by default the location of the current agent in which has been called this operator.
geometry var0 <- circle(10,{80,30}); // var0 equals a geometry as a circle of radius 10, the center will be in the location {80,30}.
geometry var1 <- circle(10); // var1 equals a geometry as a circle of radius 10.
around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,
clean
clean
(geometry
) —> geometry
A geometry corresponding to the cleaning of the operand (geometry, agent, point)
The cleaning corresponds to a buffer with a distance of 0.0
geometry var0 <- clean(self); // var0 equals returns the geometry resulting from the cleaning of the geometry of the agent applying the operator.
closest_points_with
geometry
closest_points_with
geometry
—> list<point>
closest_points_with
(geometry
, geometry
) —> list<point>
A list of two closest points between the two geometries.
list<point> var0 <- geom1 closest_points_with(geom2); // var0 equals [pt1, pt2] with pt1 the closest point of geom1 to geom2 and pt1 the closest point of geom2 to geom1
any_location_in, any_point_in, farthest_point_to, points_at,
closest_to
container<agent>
closest_to
geometry
—> geometry
closest_to
(container<agent>
, geometry
) —> geometry
An agent or a geometry among the left-operand list of agents, species or meta-population (addition of species), the closest to the operand (casted as a geometry).
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 closest 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,
collect
container
collect
any expression
—> container
collect
(container
, any expression
) —> container
returns a new list, in which each element is the evaluation of the right-hand operand.
collect is similar to accumulate except that accumulate always produces flat lists if the right-hand operand returns a list.In addition, collect can be applied to any container.
container var0 <- [1,2,4] collect (each *2); // var0 equals [2,4,8]
container var1 <- [1,2,4] collect ([2,4]); // var1 equals [[2,4],[2,4],[2,4]]
container var2 <- [1::2, 3::4, 5::6] collect (each + 2); // var2 equals [4,6,8]
container var3 <- (list(node) collect (node(each).location.x * 2); // var3 equals the list of nodes with their x multiplied by 2
column_at
matrix
column_at
int
—> list
column_at
(matrix
, int
) —> list
returns the column at a num_col (right-hand operand)
list var0 <- matrix([["el11","el12","el13"],["el21","el22","el23"],["el31","el32","el33"]]) column_at 2; // var0 equals ["el31","el32","el33"]
columns_list
columns_list
(matrix
) —> list<list>
returns a list of the columns of the matrix, with each column as a list of elements
list<list> var0 <- columns_list(matrix([["el11","el12","el13"],["el21","el22","el23"],["el31","el32","el33"]])); // var0 equals [["el11","el12","el13"],["el21","el22","el23"],["el31","el32","el33"]]
command
command
(string
) —> string
command allows GAMA to issue a system command using the system terminal or shell and to receive a string containing the outcome of the command or script executed. By default, commands are blocking the agent calling them, unless the sequence ‘ &’ is used at the end. In this case, the result of the operator is an empty string
cone
cone
(point
) —> geometry
int
cone
int
—> geometry
cone
(int
, int
) —> geometry
A cone geometry which min and max angles are given by the operands. A cone geometry which min and max angles are given by the operands.
the center of the cone is by default the location of the current agent in which has been called this operator.the center of the cone is by default the location of the current agent in which has been called this operator.
geometry var0 <- cone({0, 45}); // var0 equals a geometry as a cone with min angle is 0 and max angle is 45.
geometry var1 <- cone(0, 45); // var1 equals a geometry as a cone with min angle is 0 and max angle is 45.
around, circle, line, link, norm, point, polygon, polyline, rectangle, square, triangle,
cone3D
float
cone3D
float
—> geometry
cone3D
(float
, float
) —> geometry
A cone geometry which base radius size is equal to the first operand, and which the height is equal to the second operand.
the center of the cone is by default the location of the current agent in which has been called this operator.
geometry var0 <- cone3D(10.0,5.0); // var0 equals a geometry as a cone with a base circle of radius 10 and a height of 5.
around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,
connected_components_of
connected_components_of
(graph
) —> list<list>
returns the connected components of of a graph, i.e. the list of all vertices that are in the maximally connected component together with the specified vertex.
graph my_graph <- graph([]);
list<list> var1 <- connected_components_of (my_graph); // var1 equals the list of all the components as list
alpha_index, connectivity_index, nb_cycles,
connectivity_index
connectivity_index
(graph
) —> float
returns a simple connectivity index. This number is estimated through the number of nodes (v) and of sub-graphs (p) : IC = (v - p) /(v - 1).
graph graphEpidemio <- graph([]);
float var1 <- connectivity_index(graphEpidemio); // var1 equals the connectivity index of the graph
alpha_index, beta_index, gamma_index, nb_cycles,
container
container
(any
) —> container
Casts the operand into the type container
contains
container<KeyType,ValueType>
contains
unknown
—> bool
contains
(container<KeyType,ValueType>
, unknown
) —> bool
string
contains
string
—> bool
contains
(string
, string
) —> bool
true, if the container contains the right operand, false otherwise
the contains operator behavior depends on the nature of the operand
bool var0 <- [1, 2, 3] contains 2; // var0 equals true
bool var1 <- [{1,2}, {3,4}, {5,6}] contains {3,4}; // var1 equals true
bool var2 <- 'abcded' contains 'bc'; // var2 equals true
contains_all
container
contains_all
container
—> bool
contains_all
(container
, container
) —> bool
string
contains_all
list
—> bool
contains_all
(string
, list
) —> bool
true if the left operand contains all the elements of the right operand, false otherwise
the definition of contains depends on the container
bool var4 <- "abcabcabc" contains_all ["ca","xy"]; // var4 equals false
bool var0 <- [1,2,3,4,5,6] contains_all [2,4]; // var0 equals true
bool var1 <- [1,2,3,4,5,6] contains_all [2,8]; // var1 equals false
bool var2 <- [1::2, 3::4, 5::6] contains_all [1,3]; // var2 equals false
bool var3 <- [1::2, 3::4, 5::6] contains_all [2,4]; // var3 equals true
contains_any
container
contains_any
container
—> bool
contains_any
(container
, container
) —> bool
string
contains_any
list
—> bool
contains_any
(string
, list
) —> bool
true if the left operand contains one of the elements of the right operand, false otherwise
the definition of contains depends on the container
bool var0 <- [1,2,3,4,5,6] contains_any [2,4]; // var0 equals true
bool var1 <- [1,2,3,4,5,6] contains_any [2,8]; // var1 equals true
bool var2 <- [1::2, 3::4, 5::6] contains_any [1,3]; // var2 equals false
bool var3 <- [1::2, 3::4, 5::6] contains_any [2,4]; // var3 equals true
bool var4 <- "abcabcabc" contains_any ["ca","xy"]; // var4 equals true
contains_edge
graph
contains_edge
unknown
—> bool
contains_edge
(graph
, unknown
) —> bool
graph
contains_edge
pair
—> bool
contains_edge
(graph
, pair
) —> bool
returns true if the graph(left-hand operand) contains the given edge (righ-hand operand), false otherwise
bool var2 <- graphEpidemio contains_edge (node(0)::node(3)); // var2 equals true
graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
bool var1 <- graphFromMap contains_edge link({1,5}::{12,45}); // var1 equals true
contains_vertex
graph
contains_vertex
unknown
—> bool
contains_vertex
(graph
, unknown
) —> bool
returns true if the graph(left-hand operand) contains the given vertex (righ-hand operand), false otherwise
graph graphFromMap<- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
bool var1 <- graphFromMap contains_vertex {1,5}; // var1 equals true
conversation
conversation
(unknown
) —> conversation
convex_hull
convex_hull
(geometry
) —> geometry
A geometry corresponding to the convex hull of the operand.
geometry var0 <- convex_hull(self); // var0 equals the convex hull of the geometry of the agent applying the operator
copy
copy
(unknown
) —> unknown
returns a copy of the operand.
copy_between
copy_between
(string
, int
, int
) —> string
copy_between
(container
, int
, int
) —> container
Returns a copy of the first operand between the indexes determined by the second (inclusive) and third operands (exclusive)
string var0 <- copy_between("abcabcabc", 2,6); // var0 equals "cabc"
container var1 <- copy_between ([4, 1, 6, 9 ,7], 1, 3); // var1 equals [1, 6]
corR
container
corR
container
—> unknown
corR
(container
, container
) —> unknown
returns the Pearson correlation coefficient of two given vectors (right-hand operands) in given variable (left-hand operand).
list X <- [1, 2, 3];
list Y <- [1, 2, 4];
unknown var2 <- corR(X, Y); // var2 equals 0.981980506061966
cos
cos
(int
) —> float
cos
(float
) —> float
Returns the value (in [-1,1]) of the cosinus of the operand (in decimal degrees). The argument is casted to an int before being evaluated.
float var0 <- cos (0); // var0 equals 1.0
float var1 <- cos(360); // var1 equals 1.0
float var2 <- cos(-720); // var2 equals 1.0
cos_rad
cos_rad
(float
) —> float
Returns the value (in [-1,1]) of the cosinus of the operand (in decimal degrees). The argument is casted to an int before being evaluated.
count
container
count
any expression
—> int
count
(container
, any expression
) —> int
returns an int, equal to the number of elements of the left-hand operand that make 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 elements.
int var0 <- [1,2,3,4,5,6,7,8] count (each > 3); // var0 equals 5
// Number of nodes of graph g2 without any out edge
graph g2 <- graph([]);
int var3 <- g2 count (length(g2 out_edges_of each) = 0 ) ; // var3 equals the total number of out edges
// Number of agents node with x > 32
int n <- (list(node) count (round(node(each).location.x) > 32);
int var6 <- [1::2, 3::4, 5::6] count (each > 4); // var6 equals 1
covers
geometry
covers
geometry
—> bool
covers
(geometry
, geometry
) —> bool
A boolean, equal to true if the left-geometry (or agent/point) covers the right-geometry (or agent/point).
bool var0 <- square(5) covers square(2); // var0 equals true
disjoint_from, crosses, overlaps, partially_overlaps, touches,
cross
cross
(float
) —> geometry
float
cross
float
—> geometry
cross
(float
, float
) —> geometry
A cross, which radius is equal to the first operand A cross, which radius is equal to the first operand and the width of the lines for the second
geometry var0 <- cross(10); // var0 equals a geometry as a cross of radius 10
geometry var1 <- cross(10,2); // var1 equals a geometry as a cross of radius 10, and with a width of 2 for the lines
around, cone, line, link, norm, point, polygon, polyline, super_ellipse, rectangle, square, circle, ellipse, triangle,
crosses
geometry
crosses
geometry
—> bool
crosses
(geometry
, geometry
) —> bool
A boolean, equal to true if the left-geometry (or agent/point) crosses the right-geometry (or agent/point).
bool var0 <- polyline([{10,10},{20,20}]) crosses polyline([{10,20},{20,10}]); // var0 equals true
bool var1 <- polyline([{10,10},{20,20}]) crosses {15,15}; // var1 equals true
bool var2 <- polyline([{0,0},{25,25}]) crosses polygon([{10,10},{10,20},{20,20},{20,10}]); // var2 equals true
disjoint_from, intersects, overlaps, partially_overlaps, touches,
crs
crs
(file
) —> string
the Coordinate Reference System (CRS) of the GIS file
string var0 <- crs(my_shapefile); // var0 equals the crs of the shapefile
CRS_transform
CRS_transform
(geometry
) —> geometry
geometry
CRS_transform
string
—> geometry
CRS_transform
(geometry
, string
) —> geometry
geometry var0 <- shape CRS_transform("EPSG:4326"); // var0 equals a geometry corresponding to the agent geometry transformed into the EPSG:4326 CRS
geometry var1 <- CRS_transform(shape); // var1 equals a geometry corresponding to the agent geometry transformed into the current CRS
csv_file
csv_file
(string
) —> file
Constructs a file of type csv. Allowed extensions are limited to csv, tsv
cube
cube
(float
) —> geometry
A cube geometry which side size is equal to the operand.
the center of the cube is by default the location of the current agent in which has been called this operator.
geometry var0 <- cube(10); // var0 equals a geometry as a square of side size 10.
around, circle, cone, line, link, norm, point, polygon, polyline, rectangle, triangle,
curve
curve
(point
, point
, point
) —> geometry
curve
(point
, point
, point
, int
) —> geometry
curve
(point
, point
, point
, point
) —> geometry
curve
(point
, point
, point
, point
, int
) —> geometry
A quadratic Bezier curve geometry built from the three given points composed of a given numnber of points. A quadratic Bezier curve geometry built from the three given points composed of 10 points. A cubic Bezier curve geometry built from the four given points composed of a given number of points. A cubic Bezier curve geometry built from the four given points composed of 10 points.
geometry var0 <- curve({0,0}, {0,10}, {10,10}, 20); // var0 equals a quadratic Bezier curve geometry composed of 20 points from p0 to p2.
geometry var1 <- curve({0,0}, {0,10}, {10,10}); // var1 equals a quadratic Bezier curve geometry composed of 10 points from p0 to p2.
geometry var2 <- curve({0,0}, {0,10}, {10,10}); // var2 equals a cubic Bezier curve geometry composed of 10 points from p0 to p3.
geometry var3 <- curve({0,0}, {0,10}, {10,10}); // var3 equals a cubic Bezier curve geometry composed of 10 points from p0 to p3.
around, circle, cone, link, norm, point, polygone, rectangle, square, triangle, line,
cylinder
float
cylinder
float
—> geometry
cylinder
(float
, float
) —> geometry
A cylinder geometry which radius is equal to the operand.
the center of the cylinder is by default the location of the current agent in which has been called this operator.
geometry var0 <- cylinder(10,10); // var0 equals a geometry as a circle of radius 10.
around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,
date
string
date
string
—> date
date
(string
, string
) —> date
converts a string to a date following a custom pattern. The pattern can use “%Y %M %N %D %E %h %m %s %z” for outputting years, months, name of month, days, name of days, hours, minutes, seconds and the time-zone. A null or empty pattern will parse the date using one of the ISO date & time formats (similar to date(‘…’) in that case). The pattern can also follow the pattern definition found here, which gives much more control over what will be parsed: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns. Different patterns are available by default as constant: #iso_local, #iso_simple, #iso_offset, #iso_zoned and #custom, which can be changed in the preferences
date("1999-12-30", 'yyyy-MM-dd')
dbscan
dbscan
(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)
dead
dead
(agent
) —> bool
true if the agent is dead (or null), false otherwise.
bool var0 <- dead(agent_A); // var0 equals true or false
degree_of
graph
degree_of
unknown
—> int
degree_of
(graph
, unknown
) —> int
returns 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
dem
dem
(file
) —> geometry
file
dem
file
—> geometry
dem
(file
, file
) —> geometry
file
dem
float
—> geometry
dem
(file
, float
) —> geometry
dem
(file
, file
, float
) —> geometry
A 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.
det
Same signification as determinant
determinant
determinant
(matrix
) —> float
The determinant of the given matrix
float var0 <- determinant(matrix([[1,2],[3,4]])); // var0 equals -2
diff
float
diff
float
—> float
diff
(float
, float
) —> float
diff2
float
diff2
float
—> float
diff2
(float
, float
) —> float
directed
directed
(graph
) —> graph
the operand graph becomes a directed graph.
the operator alters the operand graph, it does not create a new one.
direction_between
topology
direction_between
container<geometry>
—> int
direction_between
(topology
, container<geometry>
) —> int
A 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_to
Same signification as towards
disjoint_from
geometry
disjoint_from
geometry
—> bool
disjoint_from
(geometry
, geometry
) —> bool
A 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_between
topology
distance_between
container<geometry>
—> float
distance_between
(topology
, container<geometry>
) —> float
A 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_to
geometry
distance_to
geometry
—> float
distance_to
(geometry
, geometry
) —> float
point
distance_to
point
—> float
distance_to
(point
, point
) —> float
A 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,
distinct
distinct
(container
) —> container
produces 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_of
distribution_of
(container
) —> map
container
distribution_of
int
—> map
distribution_of
(container
, int
) —> map
distribution_of
(container
, int
, float
, float
) —> map
Discretize a list of values into n bins (computes the bins from a numerical variable into n (default 10) bins. Returns a distribution map with the values (values key), the interval legends (legend key), the distribution parameters (params keys, for cumulative charts). Parameters can be (list), (list, nbbins) or (list,nbbins,valmin,valmax)
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_of
container
distribution2d_of
container
—> map
distribution2d_of
(container
, container
) —> map
distribution2d_of
(container
, container
, int
, int
) —> map
distribution2d_of
(container
, container
, int
, float
, float
, int
, float
, float
) —> map
Discretize two lists of values into n bins (computes the bins from a numerical variable into n (default 10) bins. Returns a distribution map with the values (values key), the interval legends (legend key), the distribution parameters (params keys, for cumulative charts). Parameters can be (list), (list, nbbins) or (list,nbbins,valmin,valmax)
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]])
div
float
div
float
—> int
div
(float
, float
) —> int
int
div
int
—> int
div
(int
, int
) —> int
float
div
int
—> int
div
(float
, int
) —> int
int
div
float
—> int
div
(int
, float
) —> int
Returns 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_file
dxf_file
(string
) —> file
Constructs a file of type dxf. Allowed extensions are limited to dxf
edge
edge
(pair
) —> unknown
edge
(unknown
) —> unknown
unknown
edge
unknown
—> unknown
edge
(unknown
, unknown
) —> unknown
pair
edge
float
—> unknown
edge
(pair
, float
) —> unknown
unknown
edge
float
—> unknown
edge
(unknown
, float
) —> unknown
edge
(unknown
, unknown
, unknown
) —> unknown
edge
(unknown
, unknown
, float
) —> unknown
edge
(pair
, unknown
, float
) —> unknown
edge
(unknown
, unknown
, unknown
, float
) —> unknown
edge_between
graph
edge_between
pair
—> unknown
edge_between
(graph
, pair
) —> unknown
returns the edge linking two nodes
unknown var0 <- graphFromMap edge_between node1::node2; // var0 equals edge1
edge_betweenness
edge_betweenness
(graph
) —> map
returns 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
edges
edges
(container
) —> container
eigenvalues
eigenvalues
(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_DM
electre_DM
(list<list>
, list<map<string,object>>
, float
) —> int
The index of the best candidate according to a method based on the ELECTRE methods. The principle of the ELECTRE methods is to compare the possible candidates by pair. These methods analyses the possible outranking relation existing between two candidates. 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,
ellipse
float
ellipse
float
—> geometry
ellipse
(float
, float
) —> geometry
An 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,
emotion
emotion
(any
) —> emotion
Casts the operand into the type emotion
empty
empty
(container<KeyType,ValueType>
) —> bool
empty
(string
) —> bool
true 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_by
Same signification as +
envelope
envelope
(unknown
) —> geometry
A 3D geometry that represents the box that surrounds the geometries or the surface described by the arguments. More general than geometry(arguments).envelope, as it allows to pass int, double, point, image files, shape files, asc files, or any list combining these arguments, in which case the envelope will be correctly expanded. If an envelope cannot be determined from the arguments, a default one of dimensions (0,100, 0, 100, 0, 100) is returned
eval_gaml
eval_gaml
(string
) —> unknown
evaluates the given GAML string.
unknown var0 <- eval_gaml("2+3"); // var0 equals 5
eval_when
eval_when
(BDIPlan
) —> bool
evaluate the facet when of a given plan
eval_when(plan1)
even
even
(int
) —> bool
Returns 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
every
every
(int
) —> bool
every
(any expression
) —> bool
msi.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
—> container
every
(container
, int
) —> container
true 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_cycle
Same signification as every
evidence_theory_DM
list<list>
evidence_theory_DM
list<map<string,object>>
—> int
evidence_theory_DM
(list<list>
, list<map<string,object>>
) —> int
evidence_theory_DM
(list<list>
, list<map<string,object>>
, bool
) —> int
The 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,
exp
exp
(float
) —> float
exp
(int
) —> float
Returns Euler’s number e raised to the power of the operand.
float var0 <- exp (0); // var0 equals 1.0
ln,
fact
fact
(int
) —> float
Returns the factorial of the operand.
float var0 <- fact(4); // var0 equals 24
farthest_point_to
geometry
farthest_point_to
point
—> point
farthest_point_to
(geometry
, point
) —> point
the 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_to
container<agent>
farthest_to
geometry
—> geometry
farthest_to
(container<agent>
, geometry
) —> geometry
An agent or a geometry among the left-operand list of agents, species or meta-population (addition of species), the farthest to the operand (casted as a geometry).
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,
file
file
(string
) —> file
string
file
container
—> file
file
(string
, container
) —> file
opens 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_exists
file_exists
(string
) —> bool
Test whether the parameter is the path to an existing file.
first
first
(string
) —> string
first
(container<KeyType,ValueType>
) —> ValueType
int
first
container
—> container
first
(int
, container
) —> container
the 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_of
Same signification as first
first_with
container
first_with
any expression
—> unknown
first_with
(container
, any expression
) —> unknown
the 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
flip
flip
(float
) —> bool
true or false given the probability represented by the operand
bool var0 <- flip (0.66666); // var0 equals 2/3 chances to return true.
rnd,
float
float
(any
) —> float
Casts the operand into the type float
floor
floor
(float
) —> float
Maps 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
folder
folder
(string
) —> file
opens 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
font
font
(string
, int
, int
) —> font
Creates a new font, by specifying its name (either a font face name like ‘Lucida Grande Bold’ or ‘Helvetica’, or a logical name like ‘Dialog’, ‘SansSerif’, ‘Serif’, etc.), a size in points and a style, either #bold, #italic or #plain or a combination (addition) of them.
font var0 <- font ('Helvetica Neue',12, #bold + #italic); // var0 equals a bold and italic face of the Helvetica Neue family
frequency_of
container
frequency_of
any expression
—> map
frequency_of
(container
, any expression
) —> map
Returns a map with keys equal to the application of the right-hand argument (like collect) and values equal to the frequency of this key (i.e. how many times it has been obtained)
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
from
Same signification as since
fuzzy_kappa
fuzzy_kappa
(list<agent>
, list
, list
, list<float>
, list
, matrix<float>
, float
) —> float
fuzzy_kappa
(list<agent>
, list
, list
, list<float>
, list
, matrix<float>
, float
, list
) —> float
fuzzy kappa indicator for 2 map comparisons: fuzzy_kappa(agents_list,list_vals1,list_vals2, output_similarity_per_agents,categories,fuzzy_categories_matrix, fuzzy_distance, weights). Reference: Visser, H., and T. de Nijs, 2006. The map comparison kit, Environmental Modelling & Software, 21 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_sim
fuzzy_kappa_sim
(list<agent>
, list
, list
, list
, list<float>
, list
, matrix<float>
, float
) —> float
fuzzy_kappa_sim
(list<agent>
, list
, list
, list
, list<float>
, list
, matrix<float>
, float
, list
) —> float
fuzzy kappa simulation indicator for 2 map comparisons: fuzzy_kappa_sim(agents_list,list_vals1,list_vals2, output_similarity_per_agents,fuzzy_transitions_matrix, fuzzy_distance). Reference: Jasper van Vliet, Alex Hagen-Zanker, Jelle Hurkens, Hedwig van Delden, A fuzzy set approach to assess the predictive accuracy of land use simulations, Ecological Modelling, 24 July 2013, Pages 32-42, ISSN 0304-3800, fuzzy kappa simulation indicator for 2 map comparisons: fuzzy_kappa_sim(agents_list,list_vals1,list_vals2, output_similarity_per_agents,fuzzy_transitions_matrix, fuzzy_distance, weights). Reference: Jasper van Vliet, Alex Hagen-Zanker, Jelle Hurkens, Hedwig van Delden, A fuzzy set approach to assess the predictive accuracy of land use simulations, Ecological Modelling, 24 July 2013, Pages 32-42, ISSN 0304-3800,
fuzzy_kappa_sim([ag1, ag2, ag3, ag4, ag5], [cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2], similarity_per_agents,[cat1,cat2,cat3],[[1,0,0,0,0,0,0,0,0],[0,1,0,0,0,0,0,0,0],[0,0,1,0,0,0,0,0,0],[0,0,0,1,0,0,0,0,0],[0,0,0,0,1,0,0,0,0],[0,0,0,0,0,1,0,0,0],[0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,0],[0,0,0,0,0,0,0,0,1]], 2)
fuzzy_kappa_sim([ag1, ag2, ag3, ag4, ag5], [cat1,cat1,cat2,cat3,cat2],[cat2,cat1,cat2,cat1,cat2], similarity_per_agents,[cat1,cat2,cat3],[[1,0,0,0,0,0,0,0,0],[0,1,0,0,0,0,0,0,0],[0,0,1,0,0,0,0,0,0],[0,0,0,1,0,0,0,0,0],[0,0,0,0,1,0,0,0,0],[0,0,0,0,0,1,0,0,0],[0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,0],[0,0,0,0,0,0,0,0,1]], 2,[1.0,3.0,2.0,2.0,4.0])
gaml_file
gaml_file
(string
) —> file
Constructs a file of type gaml. Allowed extensions are limited to gaml, experiment
gamma_index
gamma_index
(graph
) —> float
returns the gamma index of the graph (A measure of connectivity that considers the relationship between the number of observed links and the number of possible links: gamma = e/(3 *
(v - 2)) - for planar graph.
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_rnd
float
gamma_rnd
float
—> float
gamma_rnd
(float
, float
) —> float
returns a random value from a gamma distribution with specified values of the shape and scale parameters
gamma_rnd(10.0,5.0)
gauss
gauss
(point
) —> float
float
gauss
float
—> float
gauss
(float
, float
) —> float
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. 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_albert
generate_barabasi_albert
(container<agent>
, species
, int
, bool
) —> graph
generate_barabasi_albert
(species
, species
, int
, int
, bool
) —> graph
returns 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_graph
generate_complete_graph
(container<agent>
, species
, bool
) —> graph
generate_complete_graph
(container<agent>
, species
, float
, bool
) —> graph
generate_complete_graph
(species
, species
, int
, bool
) —> graph
generate_complete_graph
(species
, species
, int
, float
, bool
) —> graph
returns 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_strogatz
generate_watts_strogatz
(container<agent>
, species
, float
, int
, bool
) —> graph
generate_watts_strogatz
(species
, species
, int
, float
, int
, bool
) —> graph
returns 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_file
geojson_file
(string
) —> file
Constructs a file of type geojson. Allowed extensions are limited to json, geojson, geo.json
geometric_mean
geometric_mean
(container
) —> float
the 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
geometry
geometry
(any
) —> geometry
Casts the operand into the type geometry
geometry_collection
geometry_collection
(container<geometry>
) —> geometry
A 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,
get
geometry
get
string
—> unknown
get
(geometry
, string
) —> unknown
agent
get
string
—> unknown
get
(agent
, string
) —> unknown
Reads 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_about
get_about
(emotion
) —> predicate
get the about value of the given emotion
get_about(emotion)
get_agent
get_agent
(msi.gaml.architecture.simplebdi.SocialLink
) —> agent
get the agent value of the given social link
get_agent(social_link1)
get_agent_cause
get_agent_cause
(emotion
) —> agent
get_agent_cause
(predicate
) —> agent
get the agent cause value of the given emotion
get_agent_cause(emotion)
get_decay
get_decay
(emotion
) —> float
get the decay value of the given emotion
get_decay(emotion)
get_dominance
get_dominance
(msi.gaml.architecture.simplebdi.SocialLink
) —> float
get the dominance value of the given social link
get_dominance(social_link1)
get_familiarity
get_familiarity
(msi.gaml.architecture.simplebdi.SocialLink
) —> float
get the familiarity value of the given social link
get_familiarity(social_link1)
get_intensity
get_intensity
(emotion
) —> float
get the intensity value of the given emotion
emotion set_intensity 12
get_lifetime
get_lifetime
(predicate
) —> int
get_liking
get_liking
(msi.gaml.architecture.simplebdi.SocialLink
) —> float
get the liking value of the given social link
get_liking(social_link1)
get_praiseworthiness
get_praiseworthiness
(predicate
) —> float
get_priority
get_priority
(predicate
) —> float
get_solidarity
get_solidarity
(msi.gaml.architecture.simplebdi.SocialLink
) —> float
get the solidarity value of the given social link
get_solidarity(social_link1)
get_super_intention
get_super_intention
(predicate
) —> predicate
gif_file
gif_file
(string
) —> file
Constructs a file of type gif. Allowed extensions are limited to gif
gini
gini
(list<float>
) —> float
float var0 <- gini([1.0, 0.5, 2.0]); // var0 equals the gini index computed
graph
graph
(any
) —> graph
Casts the operand into the type graph
grayscale
grayscale
(rgb
) —> rgb
Converts 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_at
species
grid_at
point
—> agent
grid_at
(species
, point
) —> agent
returns 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_graph
grid_cells_to_graph
(container
) —> graph
creates a graph from a list of cells (operand). An edge is created between neighbors.
my_cell_graph<-grid_cells_to_graph(cells_list)
grid_file
grid_file
(string
) —> file
Constructs a file of type grid. Allowed extensions are limited to asc, tif
group_by
container
group_by
any expression
—> map
group_by
(container
, any expression
) —> map
Returns a map, where the keys take the possible values of the right-hand operand and the map values are the list of elements of the left-hand operand associated to the key value
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_mean
harmonic_mean
(container
) —> float
the 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
hexagon
hexagon
(point
) —> geometry
hexagon
(float
) —> geometry
A 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_clustering
container<agent>
hierarchical_clustering
float
—> container
hierarchical_clustering
(container<agent>
, float
) —> container
A 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,
hsb
hsb
(float
, float
, float
) —> rgb
hsb
(float
, float
, float
, int
) —> rgb
hsb
(float
, float
, float
, float
) —> rgb
Converts 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,
hypot
hypot
(float
, float
, float
, float
) —> float
Returns sqrt(x2 +y2) without intermediate overflow or underflow.
float var0 <- hypot(0,1,0,1); // var0 equals sqrt(2)
IDW
IDW
(container<agent>
, map<point,float>
, int
) —> map<agent,float>
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)
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
image_file
(string
) —> file
Constructs a file of type image. Allowed extensions are limited to tiff, jpg, jpeg, png, pict, bmp
in
unknown
in
container
—> bool
in
(unknown
, container
) —> bool
string
in
string
—> bool
in
(string
, string
) —> bool
true 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_of
graph
in_degree_of
unknown
—> int
in_degree_of
(graph
, unknown
) —> int
returns 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_of
graph
in_edges_of
unknown
—> container
in_edges_of
(graph
, unknown
) —> container
returns 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_by
string
indented_by
int
—> string
indented_by
(string
, int
) —> string
Converts a (possibly multiline) string by indenting it by a number – specified by the second operand – of tabulations to the right
index_by
container
index_by
any expression
—> map
index_by
(container
, any expression
) —> map
produces 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_of
container
index_of
unknown
—> int
index_of
(container
, unknown
) —> int
map
index_of
unknown
—> unknown
index_of
(map
, unknown
) —> unknown
matrix
index_of
unknown
—> point
index_of
(matrix
, unknown
) —> point
string
index_of
string
—> int
index_of
(string
, string
) —> int
species
index_of
unknown
—> int
index_of
(species
, unknown
) —> int
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
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
inside
container<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,
int
int
(any
) —> int
Casts the operand into the type int
inter
container
inter
container
—> container
inter
(container
, container
) —> container
geometry
inter
geometry
—> geometry
inter
(geometry
, geometry
) —> geometry
the 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, +, -,
interleave
interleave
(container
) —> container
a 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_at
agent
internal_at
container
—> unknown
internal_at
(agent
, container
) —> unknown
geometry
internal_at
container
—> unknown
internal_at
(geometry
, container
) —> unknown
container<KeyType,ValueType>
internal_at
list<KeyType>
—> ValueType
internal_at
(container<KeyType,ValueType>
, list<KeyType>
) —> ValueType
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, 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_value
any expression
internal_integrated_value
any expression
—> container
internal_integrated_value
(any expression
, any expression
) —> container
For internal use only. Corresponds to the implementation, for agents, of the access to containers with [index]
internal_zero_order_equation
internal_zero_order_equation
(any expression
) —> float
intersection
Same signification as inter
intersects
geometry
intersects
geometry
—> bool
intersects
(geometry
, geometry
) —> bool
A 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,
inverse
inverse
(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_weighting
Same signification as IDW
is
unknown
is
any expression
—> bool
is
(unknown
, any expression
) —> bool
returns 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_csv
is_csv
(any
) —> bool
Tests whether the operand is a csv file.
is_dxf
is_dxf
(any
) —> bool
Tests whether the operand is a dxf file.
is_finite
is_finite
(float
) —> bool
Returns 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_gaml
is_gaml
(any
) —> bool
Tests whether the operand is a gaml file.
is_geojson
is_geojson
(any
) —> bool
Tests whether the operand is a geojson file.
is_gif
is_gif
(any
) —> bool
Tests whether the operand is a gif file.
is_grid
is_grid
(any
) —> bool
Tests whether the operand is a grid file.
is_image
is_image
(any
) —> bool
Tests whether the operand is a image file.
is_json
is_json
(any
) —> bool
Tests whether the operand is a json file.
is_number
is_number
(string
) —> bool
is_number
(float
) —> bool
tests 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_obj
is_obj
(any
) —> bool
Tests whether the operand is a obj file.
is_osm
is_osm
(any
) —> bool
Tests whether the operand is a osm file.
is_pgm
is_pgm
(any
) —> bool
Tests whether the operand is a pgm file.
is_property
is_property
(any
) —> bool
Tests whether the operand is a property file.
is_R
is_R
(any
) —> bool
Tests whether the operand is a R file.
is_shape
is_shape
(any
) —> bool
Tests whether the operand is a shape file.
is_skill
unknown
is_skill
string
—> bool
is_skill
(unknown
, string
) —> bool
returns 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_svg
is_svg
(any
) —> bool
Tests whether the operand is a svg file.
is_text
is_text
(any
) —> bool
Tests whether the operand is a text file.
is_threeds
is_threeds
(any
) —> bool
Tests whether the operand is a threeds file.
is_URL
is_URL
(any
) —> bool
Tests whether the operand is a URL file.
is_xml
is_xml
(any
) —> bool
Tests whether the operand is a xml file.
json_file
json_file
(string
) —> file
Constructs a file of type json. Allowed extensions are limited to json
kappa
kappa
(list
, list
, list
) —> float
kappa
(list
, list
, list
, list
) —> float
kappa indicator for 2 map comparisons: kappa(list_vals1,list_vals2,categories). Reference: Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20. kappa indicator for 2 map comparisons: kappa(list_vals1,list_vals2,categories, weights). Reference: Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas. 1960, 20.
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_sim
kappa_sim
(list
, list
, list
, list
) —> float
kappa_sim
(list
, list
, list
, list
, list
) —> float
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). 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])
kmeans
list
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)
kurtosis
kurtosis
(list
) —> float
returns kurtosis value computed from the operand list of values
kurtosis ([1,2,3,4,5])
last
last
(string
) —> string
last
(container<KeyType,ValueType>
) —> ValueType
int
last
container
—> container
last
(int
, container
) —> container
the 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_of
map
last_index_of
unknown
—> unknown
last_index_of
(map
, unknown
) —> unknown
string
last_index_of
string
—> int
last_index_of
(string
, string
) —> int
species
last_index_of
unknown
—> int
last_index_of
(species
, unknown
) —> int
container
last_index_of
unknown
—> int
last_index_of
(container
, unknown
) —> int
matrix
last_index_of
unknown
—> point
last_index_of
(matrix
, unknown
) —> point
the 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_of
Same signification as last
last_with
container
last_with
any expression
—> unknown
last_with
(container
, any expression
) —> unknown
the 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
layout
graph
layout
string
—> graph
layout
(graph
, string
) —> graph
layout
(graph
, string
, int
) —> graph
layout
(graph
, string
, int
, map<string,unknown>
) —> graph
layouts a GAMA graph.
length
length
(string
) —> int
length
(container<KeyType,ValueType>
) —> int
the 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
line
line
(container<geometry>
) —> geometry
container<geometry>
line
float
—> geometry
line
(container<geometry>
, float
) —> geometry
A 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,
link
geometry
link
geometry
—> geometry
link
(geometry
, geometry
) —> geometry
A 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,
list
list
(any
) —> list
Casts the operand into the type list
list_with
int
list_with
any expression
—> container
list_with
(int
, any expression
) —> container
creates 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,
ln
ln
(int
) —> float
ln
(float
) —> float
Returns 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_file
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
loads 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_paths
graph
load_shortest_paths
matrix
—> graph
load_shortest_paths
(graph
, matrix
) —> graph
put 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
log
log
(float
) —> float
log
(int
) —> float
Returns 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_case
lower_case
(string
) —> string
Converts all of the characters in the string operand to lower case
string var0 <- lower_case("Abc"); // var0 equals 'abc'
map
map
(any
) —> map
Casts the operand into the type map
masked_by
geometry
masked_by
container<geometry>
—> geometry
masked_by
(geometry
, container<geometry>
) —> geometry
masked_by
(geometry
, container<geometry>
, int
) —> geometry
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
float
material
float
—> msi.gama.util.GamaMaterial
material
(float
, float
) —> msi.gama.util.GamaMaterial
Returns
matrix
matrix
(any
) —> matrix
Casts the operand into the type matrix
matrix_with
point
matrix_with
any expression
—> matrix
matrix_with
(point
, any expression
) —> matrix
creates 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.
max
max
(container
) —> unknown
the 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_of
container
max_of
any expression
—> unknown
max_of
(container
, any expression
) —> unknown
the 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_of
maximal_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
mean
mean
(container
) —> unknown
the 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_deviation
mean_deviation
(container
) —> float
the 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_of
container
mean_of
any expression
—> unknown
mean_of
(container
, any expression
) —> unknown
the 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,
meanR
meanR
(container
) —> unknown
returns 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
median
median
(container
) —> unknown
the 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,
message
message
(unknown
) —> msi.gama.extensions.messaging.GamaMessage
to be added
milliseconds_between
date
milliseconds_between
date
—> float
milliseconds_between
(date
, date
) —> float
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)
milliseconds_between(d1, d2) -: 10
min
min
(container
) —> unknown
the 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_of
container
min_of
any expression
—> unknown
min_of
(container
, any expression
) —> unknown
the 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_days
date
minus_days
int
—> date
minus_days
(date
, int
) —> date
Subtract a given number of days from a date
date1 minus_days 20
minus_hours
date
minus_hours
int
—> date
minus_hours
(date
, int
) —> date
Remove a given number of hours from a date
date1 minus_hours 15 // equivalent to date1 - 15 #h
minus_minutes
date
minus_minutes
int
—> date
minus_minutes
(date
, int
) —> date
Subtract a given number of minutes from a date
date1 minus_minutes 5 // equivalent to date1 - 5#mn
minus_months
date
minus_months
int
—> date
minus_months
(date
, int
) —> date
Subtract a given number of months from a date
date1 minus_months 5
minus_ms
date
minus_ms
int
—> date
minus_ms
(date
, int
) —> date
Remove a given number of milliseconds from a date
date1 minus_ms 15 // equivalent to date1 - 15 #ms
minus_seconds
Same signification as -
minus_weeks
date
minus_weeks
int
—> date
minus_weeks
(date
, int
) —> date
Subtract a given number of weeks from a date
date1 minus_weeks 15
minus_years
date
minus_years
int
—> date
minus_years
(date
, int
) —> date
Subtract a given number of year from a date
date1 minus_years 3
mod
int
mod
int
—> int
mod
(int
, int
) —> int
Returns 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_between
date
months_between
date
—> int
months_between
(date
, date
) —> int
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)
months_between(d1, d2) -: 10
moran
list<float>
moran
matrix<float>
—> float
moran
(list<float>
, matrix<float>
) —> float
float var0 <- moran([1.0, 0.5, 2.0], weight_matrix); // var0 equals the Moran index computed
mul
mul
(container
) —> unknown
the 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,
nb_cycles
nb_cycles
(graph
) —> int
returns the maximum number of independent cycles in a graph. This number (u) is estimated through the number of nodes (v), links (e) and of sub-graphs (p): u = e - v + p.
graph graphEpidemio <- graph([]);
int var1 <- nb_cycles(graphEpidemio); // var1 equals the number of cycles in the graph
alpha_index, beta_index, gamma_index, connectivity_index,
neighbors_at
geometry
neighbors_at
float
—> container
neighbors_at
(geometry
, float
) —> container
a list, containing all the agents of the same species than the left argument (if it is an agent) located at a distance inferior or equal to the right-hand operand to the left-hand operand (geometry, agent, point).
The topology used to compute the neighborhood is the one of the left-operand if this one is an agent; otherwise the one of the agent applying the operator.
container var0 <- (self neighbors_at (10)); // var0 equals all the agents located at a distance lower or equal to 10 to the agent applying the operator.
neighbors_of, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to, at_distance,
neighbors_of
graph
neighbors_of
unknown
—> container
neighbors_of
(graph
, unknown
) —> container
topology
neighbors_of
agent
—> container
neighbors_of
(topology
, agent
) —> container
neighbors_of
(topology
, geometry
, float
) —> container
a list, containing all the agents of the same species than the argument (if it is an agent) located at a distance inferior or equal to 1 to the right-hand operand agent considering the left-hand operand topology.
container var3 <- neighbors_of (topology(self), self,10); // var3 equals all the agents located at a distance lower or equal to 10 to the agent applying the operator considering its topology.
container var0 <- graphEpidemio neighbors_of (node(3)); // var0 equals [node0,node2]
container var1 <- graphFromMap neighbors_of node({12,45}); // var1 equals [{1.0,5.0},{34.0,56.0}]
container var2 <- topology(self) neighbors_of self; // var2 equals returns all the agents located at a distance lower or equal to 1 to the agent applying the operator considering its topology.
predecessors_of, successors_of, neighbors_at, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to,
new_emotion
new_emotion
(string
) —> emotion
string
new_emotion
agent
—> emotion
new_emotion
(string
, agent
) —> emotion
string
new_emotion
float
—> emotion
new_emotion
(string
, float
) —> emotion
string
new_emotion
predicate
—> emotion
new_emotion
(string
, predicate
) —> emotion
new_emotion
(string
, float
, predicate
) —> emotion
new_emotion
(string
, float
, float
) —> emotion
new_emotion
(string
, predicate
, agent
) —> emotion
new_emotion
(string
, float
, agent
) —> emotion
new_emotion
(string
, float
, float
, agent
) —> emotion
new_emotion
(string
, float
, predicate
, float
) —> emotion
new_emotion
(string
, float
, predicate
, agent
) —> emotion
new_emotion
(string
, float
, predicate
, float
, agent
) —> emotion
a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name,intensity,about) a new emotion with the given properties (name,intensity,decay) a new emotion with the given properties (name) a new emotion with the given properties (name, intensity) a new emotion with the given properties (name,about) a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name) a new emotion with the given properties (name)
emotion("joy",12.3,eatFood,4)
emotion("joy",12.3,eatFood,4)
emotion("joy",12.3,eatFood)
emotion("joy",12.3,4)
emotion("joy",12.3,eatFood,4)
emotion("joy",12.3)
emotion("joy",eatFood)
emotion("joy")
emotion("joy",12.3,eatFood,4)
emotion("joy",12.3,eatFood,4)
emotion("joy",12.3,eatFood,4)
emotion("joy",12.3,eatFood,4)
new_folder
new_folder
(string
) —> file
opens an existing repository or create a new folder if it does not exist.
file dirNewT <- new_folder("incl/"); // dirNewT represents the repository "../incl/"
// eventually creates the directory ../incl
new_predicate
new_predicate
(string
) —> predicate
string
new_predicate
agent
—> predicate
new_predicate
(string
, agent
) —> predicate
string
new_predicate
float
—> predicate
new_predicate
(string
, float
) —> predicate
string
new_predicate
int
—> predicate
new_predicate
(string
, int
) —> predicate
string
new_predicate
map
—> predicate
new_predicate
(string
, map
) —> predicate
string
new_predicate
bool
—> predicate
new_predicate
(string
, bool
) —> predicate
new_predicate
(string
, map
, float
) —> predicate
new_predicate
(string
, map
, int
) —> predicate
new_predicate
(string
, map
, agent
) —> predicate
new_predicate
(string
, map
, bool
) —> predicate
new_predicate
(string
, map
, int
, bool
) —> predicate
new_predicate
(string
, map
, bool
, agent
) —> predicate
new_predicate
(string
, map
, float
, int
) —> predicate
new_predicate
(string
, map
, int
, agent
) —> predicate
new_predicate
(string
, map
, float
, agent
) —> predicate
new_predicate
(string
, map
, float
, bool
) —> predicate
new_predicate
(string
, map
, float
, int
, bool
) —> predicate
new_predicate
(string
, map
, int
, bool
, agent
) —> predicate
new_predicate
(string
, map
, float
, bool
, agent
) —> predicate
new_predicate
(string
, map
, float
, int
, agent
) —> predicate
new_predicate
(string
, map
, float
, int
, bool
, agent
) —> predicate
a new predicate with the given properties (name, values, lifetime, is_true) a new predicate with the given properties (name, values, priority) a new predicate with the given properties (name, values, priority, lifetime, is_true, agentCause) a new predicate with the given properties (name, values, is_true, agentCause) a new predicate with the given properties (name, values, lifetime) a new predicate with the given properties (name, values, priority, lifetime, is_true) a new predicate with the given properties (name, values, lifetime, is_true, agentCause) a new predicate with the given is_true (name, priority) a new predicate with the given is_true (name, lifetime) a new predicate with the given properties (name, values) a new predicate with the given properties (name, values, lifetime) a new predicate with the given is_true (name, is_true) a new predicate with the given properties (name, values, priority,lifetime) a new predicate with the given properties (name, values, priority, is_true, agentCause) a new predicate with the given properties (name, values, agentCause) a new predicate with the given properties (name, values, lifetime, agentCause) a new predicate with the given properties (name) a new predicate with the given properties (name, values, priority, agentCause) a new predicate with the given properties (name, values, priority, is_true) a new predicate with the given properties (name, values, priority, lifetime, agentCause) a new predicate with the given properties (name, values, is_true)
predicate("people to meet", ["time"::10], 10,true)
predicate("people to meet", people1, ["time"::10])
predicate("people to meet", ["time"::10],2.0,10, true, agentA)
predicate("people to meet", ["time"::10], true, agentA)
predicate("people to meet", ["time"::10], true)
predicate("people to meet", ["time"::10],2.0,10, true)
predicate("people to meet", ["time"::10], 10, true, agentA)
predicate("hasWater", 2.0 )
predicate("hasWater", 10
predicate("people to meet", people1 )
predicate("people to meet", ["time"::10], true)
predicate("hasWater", true)
predicate("people to meet", ["time"::10], 2.0,10)
predicate("people to meet", ["time"::10], 2.0, true, agentA)
predicate("people to meet", ["time"::10], agentA)
predicate("people to meet", ["time"::10], 10, agentA)
predicate("people to meet")
predicate("people to meet", ["time"::10], 2.0,agentA)
predicate("people to meet", ["time"::10],2.0, true)
predicate("people to meet", ["time"::10], 2.0,10,agentA)
predicate("people to meet", ["time"::10], true)
new_social_link
new_social_link
(agent
) —> msi.gaml.architecture.simplebdi.SocialLink
new_social_link
(agent
, float
, float
, float
, float
) —> msi.gaml.architecture.simplebdi.SocialLink
a new social link a new social link
new_social_link(agentA)
new_social_link(agentA,0.0,-0.1,0.2,0.1)
node
node
(unknown
) —> unknown
unknown
node
float
—> unknown
node
(unknown
, float
) —> unknown
nodes
nodes
(container
) —> container
norm
norm
(point
) —> float
the norm of the vector with the coordinates of the point operand.
float var0 <- norm({3,4}); // var0 equals 5.0
not
Same signification as !
obj_file
obj_file
(string
) —> file
Constructs a file of type obj. Allowed extensions are limited to obj, OBJ
of
Same signification as .
of_generic_species
container
of_generic_species
species
—> container
of_generic_species
(container
, species
) —> container
a list, containing the agents of the left-hand operand whose species is that denoted by the right-hand operand and whose species extends the right-hand operand species
// species test {}
// species sous_test parent: test {}
container var2 <- [sous_test(0),sous_test(1),test(2),test(3)] of_generic_species test; // var2 equals [sous_test0,sous_test1,test2,test3]
container var3 <- [sous_test(0),sous_test(1),test(2),test(3)] of_generic_species sous_test; // var3 equals [sous_test0,sous_test1]
container var4 <- [sous_test(0),sous_test(1),test(2),test(3)] of_species test; // var4 equals [test2,test3]
container var5 <- [sous_test(0),sous_test(1),test(2),test(3)] of_species sous_test; // var5 equals [sous_test0,sous_test1]
of_species
container
of_species
species
—> container
of_species
(container
, species
) —> container
a list, containing the agents of the left-hand operand whose species is the one denoted by the right-hand operand.The expression agents of_species (species self) is equivalent to agents where (species each = species self); however, the advantage of using the first syntax is that the resulting list is correctly typed with the right species, whereas, in the second syntax, the parser cannot determine the species of the agents within the list (resulting in the need to cast it explicitly if it is to be used in an ask statement, for instance).
container var0 <- (self neighbors_at 10) of_species (species (self)); // var0 equals all the neighboring agents of the same species.
container var1 <- [test(0),test(1),node(1),node(2)] of_species test; // var1 equals [test0,test1]
one_of
one_of
(container<KeyType,ValueType>
) —> ValueType
one of the values stored in this container at a random key
the one_of operator behavior depends on the nature of the operand
int i <- any ([1,2,3]); // i equals 1, 2 or 3
string sMat <- one_of(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // sMat equals "c11","c12","c13", "c21","c22" or "c23"
int im <- one_of ([2::3, 4::5, 6::7]); // im equals 3, 5 or 7
bool var6 <- [2::3, 4::5, 6::7].values contains im; // var6 equals true
bug b <- one_of(bug); // Given a previously defined species bug, b is one of the created bugs, e.g. bug3
or
bool
or
any expression
—> bool
or
(bool
, any expression
) —> bool
a bool value, equal to the logical or between the left-hand operand and the right-hand operand.
both operands are always casted to bool before applying the operator. Thus, an expression like 1 or 0 is accepted and returns true.
or
predicate
or
predicate
—> predicate
or
(predicate
, predicate
) —> predicate
create a new predicate from two others by including them as subintentions. It’s an exclusive “or”
predicate1 or predicate2
osm_file
string
osm_file
map<string,list>
—> file
osm_file
(string
, map<string,list>
) —> file
osm_file
(string
, map<string,list>
, int
) —> file
opens a file that a is a kind of OSM file with some filtering. opens a file that a is a kind of OSM file with some filtering, forcing the initial CRS to be the one indicated by the second int parameter (see http://spatialreference.org/ref/epsg/). If this int parameter is equal to 0, the data is considered as already projected.
The file should have a OSM file extension, cf. file type definition for supported file extensions.The file should have a OSM file extension, cf. file type definition for supported file extensions.
file myOSMfile <- osm_file("../includes/rouen.osm", ["highway"::["primary","motorway"]]);
file myOSMfile2 <- osm_file("../includes/rouen.osm",["highway"::["primary","motorway"]], 0);
file,
out_degree_of
graph
out_degree_of
unknown
—> int
out_degree_of
(graph
, unknown
) —> int
returns the out degree of a vertex (right-hand operand) in the graph given as left-hand operand.
int var1 <- graphFromMap out_degree_of (node(3)); // var1 equals 4
out_edges_of
graph
out_edges_of
unknown
—> container
out_edges_of
(graph
, unknown
) —> container
returns the list of the out-edges of a vertex (right-hand operand) in the graph given as left-hand operand.
container var1 <- graphFromMap out_edges_of (node(3)); // var1 equals 3
overlapping
container<agent>
overlapping
geometry
—> list<geometry>
overlapping
(container<agent>
, geometry
) —> list<geometry>
A list of agents or geometries among the left-operand list, species or meta-population (addition of species), overlapping the operand (casted as a geometry).
list<geometry> var0 <- [ag1, ag2, ag3] overlapping(self); // var0 equals return the agents among ag1, ag2 and ag3 that overlap the shape of the agent applying the operator.
(species1 + species2) overlapping self
neighbors_at, neighbors_of, agent_closest_to, agents_inside, closest_to, inside, agents_overlapping,
overlaps
geometry
overlaps
geometry
—> bool
overlaps
(geometry
, geometry
) —> bool
A boolean, equal to true if the left-geometry (or agent/point) overlaps the right-geometry (or agent/point).
bool var0 <- polyline([{10,10},{20,20}]) overlaps polyline([{15,15},{25,25}]); // var0 equals true
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals true
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps {25,25}; // var2 equals false
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{35,35},{35,45},{45,45},{45,35}]); // var3 equals false
bool var4 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polyline([{10,10},{20,20}]); // var4 equals true
bool var5 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps {15,15}; // var5 equals true
bool var6 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{0,0},{0,30},{30,30}, {30,0}]); // var6 equals true
bool var7 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var7 equals true
bool var8 <- polygon([{10,10},{10,20},{20,20},{20,10}]) overlaps polygon([{10,20},{20,20},{20,30},{10,30}]); // var8 equals true
disjoint_from, crosses, intersects, partially_overlaps, touches,
pair
pair
(any
) —> pair
Casts the operand into the type pair
partially_overlaps
geometry
partially_overlaps
geometry
—> bool
partially_overlaps
(geometry
, geometry
) —> bool
A boolean, equal to true if the left-geometry (or agent/point) partially overlaps the right-geometry (or agent/point).
if one geometry operand fully covers the other geometry operand, returns false (contrarily to the overlaps operator).
bool var0 <- polyline([{10,10},{20,20}]) partially_overlaps polyline([{15,15},{25,25}]); // var0 equals true
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals true
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps {25,25}; // var2 equals false
bool var3 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{35,35},{35,45},{45,45},{45,35}]); // var3 equals false
bool var4 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polyline([{10,10},{20,20}]); // var4 equals false
bool var5 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps {15,15}; // var5 equals false
bool var6 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{0,0},{0,30},{30,30}, {30,0}]); // var6 equals false
bool var7 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{15,15},{15,25},{25,25},{25,15}]); // var7 equals true
bool var8 <- polygon([{10,10},{10,20},{20,20},{20,10}]) partially_overlaps polygon([{10,20},{20,20},{20,30},{10,30}]); // var8 equals false
disjoint_from, crosses, overlaps, intersects, touches,
path
path
(any
) —> path
Casts the operand into the type path
path_between
topology
path_between
container<geometry>
—> path
path_between
(topology
, container<geometry>
) —> path
list<agent>
path_between
container<geometry>
—> path
path_between
(list<agent>
, container<geometry>
) —> path
path_between
(graph
, geometry
, geometry
) —> path
path_between
(list<agent>
, geometry
, geometry
) —> path
path_between
(topology
, geometry
, geometry
) —> path
The shortest path between a list of two objects in a graph The shortest path between two objects according to set of cells The shortest path between several objects according to set of cells
path var0 <- path_between (my_graph, ag1, ag2); // var0 equals A path between ag1 and ag2
path var1 <- my_topology path_between [ag1, ag2]; // var1 equals A path between ag1 and ag2
path var2 <- path_between (cell_grid where each.is_free, ag1, ag2); // var2 equals A path between ag1 and ag2 passing through the given cell_grid agents
path var3 <- my_topology path_between (ag1, ag2); // var3 equals A path between ag1 and ag2
path var4 <- path_between (cell_grid where each.is_free, [ag1, ag2, ag3]); // var4 equals A path between ag1 and ag2 and ag3 passing through the given cell_grid agents
towards, direction_to, distance_between, direction_between, path_to, distance_to,
path_to
geometry
path_to
geometry
—> path
path_to
(geometry
, geometry
) —> path
point
path_to
point
—> path
path_to
(point
, point
) —> path
A path between two geometries (geometries, agents or points) considering the topology of the agent applying the operator.
path var0 <- ag1 path_to ag2; // var0 equals the path between ag1 and ag2 considering the topology of the agent applying the operator
towards, direction_to, distance_between, direction_between, path_between, distance_to,
paths_between
paths_between
(graph
, pair
, int
) —> list<path>
The K shortest paths between a list of two objects in a graph
list<path> var0 <- paths_between(my_graph, ag1:: ag2, 2); // var0 equals the 2 shortest paths (ordered by length) between ag1 and ag2
percent_absolute_deviation
list<float>
percent_absolute_deviation
list<float>
—> float
percent_absolute_deviation
(list<float>
, list<float>
) —> float
percent absolute deviation indicator for 2 series of values: percent_absolute_deviation(list_vals_observe,list_vals_sim)
percent_absolute_deviation([200,300,150,150,200],[250,250,100,200,200])
pgm_file
pgm_file
(string
) —> file
Constructs a file of type pgm. Allowed extensions are limited to pgm
plan
container<geometry>
plan
float
—> geometry
plan
(container<geometry>
, float
) —> geometry
A polyline geometry from the given list of points.
geometry var0 <- polyplan([{0,0}, {0,10}, {10,10}, {10,0}],10); // var0 equals a polyline geometry composed of the 4 points with a depth of 10.
around, circle, cone, link, norm, point, polygone, rectangle, square, triangle,
plus_days
date
plus_days
int
—> date
plus_days
(date
, int
) —> date
Add a given number of days to a date
date1 plus_days 20
plus_hours
date
plus_hours
int
—> date
plus_hours
(date
, int
) —> date
Add a given number of hours to a date
date1 plus_hours 15 // equivalent to date1 + 15 #h
plus_minutes
date
plus_minutes
int
—> date
plus_minutes
(date
, int
) —> date
Add a given number of minutes to a date
date1 plus_minutes 5 // equivalent to date1 + 5 #mn
plus_months
date
plus_months
int
—> date
plus_months
(date
, int
) —> date
Add a given number of months to a date
date1 plus_months 5
plus_ms
date
plus_ms
int
—> date
plus_ms
(date
, int
) —> date
Add a given number of milliseconds to a date
date1 plus_ms 15 // equivalent to date1 + 15 #ms
plus_seconds
Same signification as +
plus_weeks
date
plus_weeks
int
—> date
plus_weeks
(date
, int
) —> date
Add a given number of weeks to a date
date1 plus_weeks 15
plus_years
date
plus_years
int
—> date
plus_years
(date
, int
) —> date
Add a given number of years to a date
date1 plus_years 3
point
float
point
int
—> point
point
(float
, int
) —> point
int
point
float
—> point
point
(int
, float
) —> point
int
point
int
—> point
point
(int
, int
) —> point
float
point
float
—> point
point
(float
, float
) —> point
point
(float
, int
, int
) —> point
point
(int
, int
, int
) —> point
point
(float
, int
, float
) —> point
point
(int
, int
, float
) —> point
point
(int
, float
, float
) —> point
point
(float
, float
, float
) —> point
point
(float
, float
, int
) —> point
internal use only. Use the standard construction {x,y} instead. internal use only. Use the standard construction {x,y} instead. internal use only. Use the standard construction {x,y, z} instead. internal use only. Use the standard construction {x,y, z} instead. internal use only. Use the standard construction {x,y, z} instead. internal use only. Use the standard construction {x,y, z} instead. internal use only. Use the standard construction {x,y, z} instead. internal use only. Use the standard construction {x,y} instead. internal use only. Use the standard construction {x,y} instead. internal use only. Use the standard construction {x,y, z} instead. internal use only. Use the standard construction {x,y, z} instead.
points_along
geometry
points_along
list<float>
—> container
points_along
(geometry
, list<float>
) —> container
A list of points along the operand-geometry given its location in terms of rate of distance from the starting points of the geometry.
container var0 <- line([{10,10},{80,80}]) points_along ([0.3, 0.5, 0.9]); // var0 equals the list of following points: [{31.0,31.0,0.0},{45.0,45.0,0.0},{73.0,73.0,0.0}]
closest_points_with, farthest_point_to, points_at, points_on,
points_at
int
points_at
float
—> list<point>
points_at
(int
, float
) —> list<point>
A list of left-operand number of points located at a the right-operand distance to the agent location.
list<point> var0 <- 3 points_at(20.0); // var0 equals returns [pt1, pt2, pt3] with pt1, pt2 and pt3 located at a distance of 20.0 to the agent location
any_location_in, any_point_in, closest_points_with, farthest_point_to,
points_on
geometry
points_on
float
—> container
points_on
(geometry
, float
) —> container
A list of points of the operand-geometry distant from each other to the float right-operand .
container var0 <- square(5) points_on(2); // var0 equals a list of points belonging to the exterior ring of the square distant from each other of 2.
closest_points_with, farthest_point_to, points_at,
poisson
poisson
(float
) —> int
A value from a random variable following a Poisson distribution (with the positive expected number of occurence lambda as operand).
The Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time and/or space if these events occur with a known average rate and independently of the time since the last event, cf. Poisson distribution on Wikipedia.
int var0 <- poisson(3.5); // var0 equals a random positive integer
polygon
polygon
(container<agent>
) —> geometry
A polygon geometry from the given list of points.
geometry var0 <- polygon([{0,0}, {0,10}, {10,10}, {10,0}]); // var0 equals a polygon geometry composed of the 4 points.
around, circle, cone, line, link, norm, point, polyline, rectangle, square, triangle,
polyhedron
container<geometry>
polyhedron
float
—> geometry
polyhedron
(container<geometry>
, float
) —> geometry
A polyhedron geometry from the given list of points.
geometry var0 <- polyhedron([{0,0}, {0,10}, {10,10}, {10,0}],10); // var0 equals a polygon geometry composed of the 4 points and of depth 10.
around, circle, cone, line, link, norm, point, polyline, rectangle, square, triangle,
polyline
Same signification as line
polyplan
Same signification as plan
predecessors_of
graph
predecessors_of
unknown
—> container
predecessors_of
(graph
, unknown
) —> container
returns the list of predecessors (i.e. sources of in edges) of the given vertex (right-hand operand) in the given graph (left-hand operand)
container var1 <- graphEpidemio predecessors_of ({1,5}); // var1 equals []
container var2 <- graphEpidemio predecessors_of node({34,56}); // var2 equals [{12;45}]
predicate
predicate
(any
) —> predicate
Casts the operand into the type predicate
predict
regression
predict
list<float>
—> float
predict
(regression
, list<float>
) —> float
returns the value predict by the regression parameters for a given instance. Usage: predict(regression, instance)
predict(my_regression, [1,2,3]
product
Same signification as mul
product_of
container
product_of
any expression
—> unknown
product_of
(container
, any expression
) —> unknown
the product 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] product_of (each); // var2 equals 48
unknown var1 <- [1,2] product_of (each * 10 ); // var1 equals 200
min_of, max_of, sum_of, mean_of,
promethee_DM
list<list>
promethee_DM
list<map<string,object>>
—> int
promethee_DM
(list<list>
, list<map<string,object>>
) —> int
The index of the best candidate according to the Promethee II method. This method is based on a comparison per pair of possible candidates along each criterion: all candidates are compared to each other by pair and ranked. More information about this method can be found in [http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6VCT-4VF56TV-1&_user=10&_coverDate=01%2F01%2F2010&_rdoc=1&_fmt=high&_orig=search&_sort=d&_docanchor=&view=c&_searchStrId=1389284642&_rerunOrigin=google&_acct=C000050221&_version=1&_urlVersion=0&_userid=10&md5=d334de2a4e0d6281199a39857648cd36 Behzadian, M., Kazemzadeh, R., Albadvi, A., M., A.: PROMETHEE: A comprehensive literature review on methodologies and applications. European Journal of Operational Research(2009)]. The first operand is the list of candidates (a candidate is a list of criterion values); the second operand the list of criterion: A criterion is a map that contains fours elements: a name, a weight, a preference value (p) and an indifference value (q). The preference value represents the threshold from which the difference between two criterion values allows to prefer one vector of values over another. The indifference value represents the threshold from which the difference between two criterion values is considered significant.
int var0 <- promethee_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], [["name"::"utility", "weight" :: 2.0,"p"::0.5, "q"::0.0, "s"::1.0, "maximize" :: true],["name"::"price", "weight" :: 1.0,"p"::0.5, "q"::0.0, "s"::1.0, "maximize" :: false]]); // var0 equals 1
weighted_means_DM, electre_DM, evidence_theory_DM,
property_file
property_file
(string
) —> file
Constructs a file of type property. Allowed extensions are limited to properties
pyramid
pyramid
(float
) —> geometry
A square geometry which side size is given by the operand.
the center of the pyramid is by default the location of the current agent in which has been called this operator.
geometry var0 <- pyramid(5); // var0 equals a geometry as a square with side_size = 5.
around, circle, cone, line, link, norm, point, polygon, polyline, rectangle, square,
R_correlation
Same signification as corR
R_file
R_file
(string
) —> file
Constructs a file of type R. Allowed extensions are limited to r
R_mean
Same signification as meanR
range
range
(int
) —> container
int
range
int
—> container
range
(int
, int
) —> container
range
(int
, int
, int
) —> container
Allows to build a list of int representing all contiguous values from zero to the argument. The range can be increasing or decreasing. Passing 0 will return a singleton list with 0 Allows to build a list of int representing all contiguous values from the first to the second argument, using the step represented by the third argument. The range can be increasing or decreasing. Passing the same value for both will return a singleton list with this value. Passing a step of 0 will result in an exception. Attempting to build infinite ranges (e.g. end > start with a negative step) will similarly not be accepted and yield an exception Allows to build a list of int representing all contiguous values from the first to the second argument. The range can be increasing or decreasing. Passing the same value for both will return a singleton list with this value
read
read
(string
) —> unknown
Reads an attribute of the agent. The attribute’s name is specified by the operand.
unknown agent_name <- read ('name'); // agent_name equals reads the 'name' variable of agent then assigns the returned value to the 'agent_name' variable.
rectangle
rectangle
(point
) —> geometry
float
rectangle
float
—> geometry
rectangle
(float
, float
) —> geometry
point
rectangle
point
—> geometry
rectangle
(point
, point
) —> geometry
A rectangle geometry which side sizes are given by the operands.
the center of the rectangle is by default the location of the current agent in which has been called this operator.the center of the rectangle is by default the location of the current agent in which has been called this operator.
geometry var0 <- rectangle(10, 5); // var0 equals a geometry as a rectangle with width = 10 and height = 5.
geometry var1 <- rectangle({2.0,6.0}, {6.0,20.0}); // var1 equals a geometry as a rectangle with {2.0,6.0} as the upper-left corner, {6.0,20.0} as the lower-right corner.
geometry var2 <- rectangle({10, 5}); // var2 equals a geometry as a rectangle with width = 10 and height = 5.
around, circle, cone, line, link, norm, point, polygon, polyline, square, triangle,
reduced_by
Same signification as -
regression
regression
(any
) —> regression
Casts the operand into the type regression
remove_duplicates
Same signification as distinct
remove_node_from
geometry
remove_node_from
graph
—> graph
remove_node_from
(geometry
, graph
) —> graph
removes a node from a graph.
all the edges containing this node are also removed.
graph var0 <- node(0) remove_node_from graphEpidemio; // var0 equals the graph without node(0)
replace
replace
(string
, string
, string
) —> string
Returns the String resulting by replacing for the first operand all the sub-strings corresponding the second operand by the third operand
string var0 <- replace('to be or not to be,that is the question','to', 'do'); // var0 equals 'do be or not do be,that is the question'
replace_regex
replace_regex
(string
, string
, string
) —> string
Returns the String resulting by replacing for the first operand all the sub-strings corresponding to the regular expression given in the second operand by the third operand
string var0 <- replace_regex("colour, color", "colou?r", "col"); // var0 equals 'col, col'
reverse
reverse
(string
) —> string
reverse
(container<KeyType,ValueType>
) —> msi.gama.util.IContainer<?,?>
the operand elements in the reversed order in a copy of the operand.
the reverse operator behavior depends on the nature of the operand
string var0 <- reverse ('abcd'); // var0 equals 'dcba'
msi.gama.util.IContainer<?,?> var1 <- reverse ([10,12,14]); // var1 equals [14, 12, 10]
msi.gama.util.IContainer<?,?> var2 <- reverse (['k1'::44, 'k2'::32, 'k3'::12]); // var2 equals [12::'k3', 32::'k2', 44::'k1']
msi.gama.util.IContainer<?,?> var3 <- reverse(matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var3 equals matrix([["c11","c21"],["c12","c22"],["c13","c23"]])
rewire_n
graph
rewire_n
int
—> graph
rewire_n
(graph
, int
) —> graph
rewires the given count of edges.
If there are too many edges, all the edges will be rewired.
graph var1 <- graphEpidemio rewire_n 10; // var1 equals the graph with 3 edges rewired
rgb
rgb
rgb
float
—> rgb
rgb
(rgb
, float
) —> rgb
rgb
rgb
int
—> rgb
rgb
(rgb
, int
) —> rgb
string
rgb
int
—> rgb
rgb
(string
, int
) —> rgb
rgb
(int
, int
, int
) —> rgb
rgb
(int
, int
, int
, float
) —> rgb
rgb
(int
, int
, int
, int
) —> rgb
Returns a color defined by red, green, blue components and an alpha blending value.
rgb var0 <- rgb (255,0,0,0.5); // var0 equals a light red color
rgb var1 <- rgb(rgb(255,0,0),0.5); // var1 equals a light red color
rgb var2 <- rgb(rgb(255,0,0),125); // var2 equals a light red color
rgb var3 <- rgb (255,0,0); // var3 equals #red
rgb var4 <- rgb ("red"); // var4 equals rgb(255,0,0)
rgb var5 <- rgb (255,0,0,125); // var5 equals a light red color
hsb,
rgb_to_xyz
rgb_to_xyz
(file
) —> list<point>
A list of point corresponding to RGB value of an image (r:x , g:y, b:z)
list<point> var0 <- rgb_to_xyz(texture); // var0 equals a list of points
rnd
rnd
(float
) —> float
rnd
(int
) —> int
rnd
(point
) —> point
point
rnd
point
—> point
rnd
(point
, point
) —> point
int
rnd
int
—> int
rnd
(int
, int
) —> int
float
rnd
float
—> float
rnd
(float
, float
) —> float
rnd
(point
, point
, float
) —> point
rnd
(float
, float
, float
) —> float
rnd
(int
, int
, int
) —> int
a random integer in the interval [0, operand]
to obtain a probability between 0 and 1, use the expression (rnd n) / n, where n is used to indicate the precision
float var0 <- rnd(3.4); // var0 equals a random float between 0.0 and 3.4
point var1 <- rnd ({2.0, 4.0}, {2.0, 5.0, 10.0}, 1); // var1 equals a point with x = 2.0, y equal to 2.0, 3.0 or 4.0 and z between 0.0 and 10.0 every 1.0
point var2 <- rnd ({2.0, 4.0}, {2.0, 5.0, 10.0}); // var2 equals a point with x = 2.0, y between 2.0 and 4.0 and z between 0.0 and 10.0
int var3 <- rnd (2, 4); // var3 equals 2, 3 or 4
float var4 <- rnd (2.0, 4.0); // var4 equals a float number between 2.0 and 4.0
float var5 <- rnd (2.0, 4.0, 0.5); // var5 equals a float number between 2.0 and 4.0 every 0.5
int var6 <- rnd (2); // var6 equals 0, 1 or 2
float var7 <- rnd (1000) / 1000; // var7 equals a float between 0 and 1 with a precision of 0.001
point var8 <- rnd ({2.5,3, 0.0}); // var8 equals {x,y} with x in [0.0,2.0], y in [0.0,3.0], z = 0.0
int var9 <- rnd (2, 12, 4); // var9 equals 2, 6 or 10
flip,
rnd_choice
rnd_choice
(container
) —> int
returns an index of the given list with a probability following the (normalized) distribution described in the list (a form of lottery)
int var0 <- rnd_choice([0.2,0.5,0.3]); // var0 equals 2/10 chances to return 0, 5/10 chances to return 1, 3/10 chances to return 2
rnd,
rnd_color
rnd_color
(int
) —> rgb
rgb color
Return a random color equivalent to rgb(rnd(operand),rnd(operand),rnd(operand))
rgb var0 <- rnd_color(255); // var0 equals a random color, equivalent to rgb(rnd(255),rnd(255),rnd(255))
rotated_by
geometry
rotated_by
float
—> geometry
rotated_by
(geometry
, float
) —> geometry
geometry
rotated_by
int
—> geometry
rotated_by
(geometry
, int
) —> geometry
rotated_by
(geometry
, float
, point
) —> geometry
A geometry resulting from the application of a rotation by the right-hand operand angle (degree) to the left-hand operand (geometry, agent, point) A geometry resulting from the application of a rotation by the right-hand operand angles (degree) along the three axis (x,y,z) to the left-hand operand (geometry, agent, point)
the right-hand operand can be a float or a int
geometry var0 <- self rotated_by 45; // var0 equals the geometry resulting from a 45 degrees rotation to the geometry of the agent applying the operator.
geometry var1 <- rotated_by(pyramid(10),45, {1,0,0}); // var1 equals the geometry resulting from a 45 degrees rotation along the {1,0,0} vector to the geometry of the agent applying the operator.
transformed_by, translated_by,
round
round
(int
) —> int
round
(point
) —> point
round
(float
) —> int
Returns the rounded value of the operand.
point var0 <- {12345.78943, 12345.78943, 12345.78943} with_precision 2; // var0 equals {12345.79,12345.79,12345.79}
int var1 <- round (0.51); // var1 equals 1
int var2 <- round (100.2); // var2 equals 100
int var3 <- round(-0.51); // var3 equals -1
row_at
matrix
row_at
int
—> list
row_at
(matrix
, int
) —> list
returns the row at a num_line (right-hand operand)
list var0 <- matrix([["el11","el12","el13"],["el21","el22","el23"],["el31","el32","el33"]]) row_at 2; // var0 equals ["el13","el23","el33"]
rows_list
rows_list
(matrix
) —> list<list>
returns a list of the rows of the matrix, with each row as a list of elements
list<list> var0 <- rows_list(matrix([["el11","el12","el13"],["el21","el22","el23"],["el31","el32","el33"]])); // var0 equals [["el11","el21","el31"],["el12","el22","el32"],["el13","el23","el33"]]
sample
sample
(any expression
) —> string
string
sample
any expression
—> string
sample
(string
, any expression
) —> string
sample
(container
, int
, bool
) —> container
sample
(container
, int
, bool
, container
) —> container
takes a sample of the specified size from the elements of x using either with or without replacement takes a sample of the specified size from the elements of x using either with or without replacement with given weights
container var0 <- sample([2,10,1],2,false); // var0 equals [1,2]
container var1 <- sample([2,10,1],2,false,[0.1,0.7,0.2]); // var1 equals [10,2]
scaled_by
Same signification as [](#)
scaled_to
geometry
scaled_to
point
—> geometry
scaled_to
(geometry
, point
) —> geometry
allows to restrict the size of a geometry so that it fits in the envelope {width, height, depth} defined by the second operand
geometry var0 <- shape scaled_to {10,10}; // var0 equals a geometry corresponding to the geometry of the agent applying the operator scaled so that it fits a square of 10x10
select
Same signification as where
set_about
emotion
set_about
predicate
—> emotion
set_about
(emotion
, predicate
) —> emotion
change the about value of the given emotion
emotion set_about predicate1
set_agent
msi.gaml.architecture.simplebdi.SocialLink
set_agent
agent
—> msi.gaml.architecture.simplebdi.SocialLink
set_agent
(msi.gaml.architecture.simplebdi.SocialLink
, agent
) —> msi.gaml.architecture.simplebdi.SocialLink
change the agent value of the given social link
social_link set_agent agentA
set_agent_cause
emotion
set_agent_cause
agent
—> emotion
set_agent_cause
(emotion
, agent
) —> emotion
predicate
set_agent_cause
agent
—> predicate
set_agent_cause
(predicate
, agent
) —> predicate
change the agentCause value of the given emotion change the agentCause value of the given predicate
emotion set_agent_cause agentA
predicate set_agent_cause agentA
set_decay
emotion
set_decay
float
—> emotion
set_decay
(emotion
, float
) —> emotion
change the decay value of the given emotion
emotion set_decay 12
set_dominance
msi.gaml.architecture.simplebdi.SocialLink
set_dominance
float
—> msi.gaml.architecture.simplebdi.SocialLink
set_dominance
(msi.gaml.architecture.simplebdi.SocialLink
, float
) —> msi.gaml.architecture.simplebdi.SocialLink
change the dominance value of the given social link
social_link set_dominance 0.4
set_familiarity
msi.gaml.architecture.simplebdi.SocialLink
set_familiarity
float
—> msi.gaml.architecture.simplebdi.SocialLink
set_familiarity
(msi.gaml.architecture.simplebdi.SocialLink
, float
) —> msi.gaml.architecture.simplebdi.SocialLink
change the familiarity value of the given social link
social_link set_familiarity 0.4
set_intensity
emotion
set_intensity
float
—> emotion
set_intensity
(emotion
, float
) —> emotion
change the intensity value of the given emotion
emotion set_intensity 12
set_liking
msi.gaml.architecture.simplebdi.SocialLink
set_liking
float
—> msi.gaml.architecture.simplebdi.SocialLink
set_liking
(msi.gaml.architecture.simplebdi.SocialLink
, float
) —> msi.gaml.architecture.simplebdi.SocialLink
change the liking value of the given social link
social_link set_liking 0.4
set_solidarity
msi.gaml.architecture.simplebdi.SocialLink
set_solidarity
float
—> msi.gaml.architecture.simplebdi.SocialLink
set_solidarity
(msi.gaml.architecture.simplebdi.SocialLink
, float
) —> msi.gaml.architecture.simplebdi.SocialLink
change the solidarity value of the given social link
social_link set_solidarity 0.4
set_truth
predicate
set_truth
bool
—> predicate
set_truth
(predicate
, bool
) —> predicate
change the is_true value of the given predicate
predicate set_truth false
set_z
geometry
set_z
container<float>
—> geometry
set_z
(geometry
, container<float>
) —> geometry
set_z
(geometry
, int
, float
) —> geometry
Sets the z ordinate of the n-th point of a geometry to the value provided by the third argument
loop i from: 0 to: length(shape.points) - 1{set shape <- set_z (shape, i, 3.0);}
shape <- triangle(3) set_z [5,10,14];
shape_file
shape_file
(string
) —> file
Constructs a file of type shape. Allowed extensions are limited to shp
shuffle
shuffle
(matrix
) —> matrix
shuffle
(string
) —> string
shuffle
(container
) —> container
The elements of the operand in random order.
matrix var0 <- shuffle (matrix([["c11","c12","c13"],["c21","c22","c23"]])); // var0 equals matrix([["c12","c21","c11"],["c13","c22","c23"]]) (for example)
string var1 <- shuffle ('abc'); // var1 equals 'bac' (for example)
container var2 <- shuffle ([12, 13, 14]); // var2 equals [14,12,13] (for example)
signum
signum
(float
) —> int
Returns -1 if the argument is negative, +1 if it is positive, 0 if it is equal to zero or not a number
int var0 <- signum(-12); // var0 equals -1
int var1 <- signum(14); // var1 equals 1
int var2 <- signum(0); // var2 equals 0
simple_clustering_by_distance
container<agent>
simple_clustering_by_distance
float
—> list<list<agent>>
simple_clustering_by_distance
(container<agent>
, float
) —> list<list<agent>>
A list of agent groups clustered by distance considering a distance min between two groups.
list<list<agent>> var0 <- [ag1, ag2, ag3, ag4, ag5] simpleClusteringByDistance 20.0; // var0 equals for example, can return [[ag1, ag3], [ag2], [ag4, ag5]]
simple_clustering_by_envelope_distance
Same signification as simple_clustering_by_distance
simplification
geometry
simplification
float
—> geometry
simplification
(geometry
, float
) —> geometry
A geometry corresponding to the simplification of the operand (geometry, agent, point) considering a tolerance distance.
The algorithm used for the simplification is Douglas-Peucker
geometry var0 <- self simplification 0.1; // var0 equals the geometry resulting from the application of the Douglas-Peuker algorithm on the geometry of the agent applying the operator with a tolerance distance of 0.1.
sin
sin
(float
) —> float
sin
(int
) —> float
Returns the value (in [-1,1]) of the sinus of the operand (in decimal degrees). The argument is casted to an int before being evaluated.
float var0 <- sin(360); // var0 equals 0.0
float var1 <- sin (0); // var1 equals 0.0
sin_rad
sin_rad
(float
) —> float
Returns the value (in [-1,1]) of the sinus of the operand (in decimal degrees). The argument is casted to an int before being evaluated.
float var0 <- sin(360); // var0 equals 0.0
since
since
(date
) —> bool
any expression
since
date
—> bool
since
(any expression
, date
) —> bool
Returns true if the current_date of the model is after (or equal to) the date passed in argument. Synonym of ‘current_date >= argument’. Can be used, like ‘after’, in its composed form with 2 arguments to express the lowest boundary of the computation of a frequency. However, contrary to ‘after’, there is a subtle difference: the lowest boundary will be tested against the frequency as well
reflex when: since(starting_date) {} -: will always be run
every(2#days) since (starting_date + 1#day) // the computation will return true 1 day after the starting date and every two days after this reference date
skeletonize
skeletonize
(geometry
) —> list<geometry>
A list of geometries (polylines) corresponding to the skeleton of the operand geometry (geometry, agent)
list<geometry> var0 <- skeletonize(self); // var0 equals the list of geometries corresponding to the skeleton of the geometry of the agent applying the operator.
skew_gauss
skew_gauss
(float
, float
, float
, float
) —> float
A value from a skew normally distributed random variable with min value (the minimum skewed value possible), max value (the maximum skewed value possible), skew (the degree to which the values cluster around the mode of the distribution; higher values mean tighter clustering) and bias (the tendency of the mode to approach the min, max or midpoint value; positive values bias toward max, negative values toward min).The algorithm was taken from http://stackoverflow.com/questions/5853187/skewing-java-random-number-generation-toward-a-certain-number
float var0 <- skew_gauss(0.0, 1.0, 0.7,0.1); // var0 equals 0.1729218460343077
gauss, truncated_gauss, poisson,
skewness
skewness
(list
) —> float
returns skewness value computed from the operand list of values
skewness ([1,2,3,4,5])
skill
skill
(any
) —> skill
Casts the operand into the type skill
smooth
geometry
smooth
float
—> geometry
smooth
(geometry
, float
) —> geometry
Returns a ‘smoothed’ geometry, where straight lines are replaces by polynomial (bicubic) curves. The first parameter is the original geometry, the second is the ‘fit’ parameter which can be in the range 0 (loose fit) to 1 (tightest fit).
geometry var0 <- smooth(square(10), 0.0); // var0 equals a 'rounded' square
social_link
social_link
(any
) —> social_link
Casts the operand into the type social_link
solid
Same signification as without_holes
sort
Same signification as sort_by
sort_by
container
sort_by
any expression
—> container
sort_by
(container
, any expression
) —> container
Returns a list, containing the elements of the left-hand operand sorted in ascending order by the value of the right-hand operand when it is evaluated on them.
the left-hand operand is casted to a list before applying the operator. In the right-hand operand, the keyword each can be used to represent, in turn, each of the elements.
container var0 <- [1,2,4,3,5,7,6,8] sort_by (each); // var0 equals [1,2,3,4,5,6,7,8]
container var2 <- g2 sort_by (length(g2 out_edges_of each) ); // var2 equals [node9, node7, node10, node8, node11, node6, node5, node4]
container var3 <- (list(node) sort_by (round(node(each).location.x)); // var3 equals [node5, node1, node0, node2, node3]
container var4 <- [1::2, 5::6, 3::4] sort_by (each); // var4 equals [2, 4, 6]
source_of
graph
source_of
unknown
—> unknown
source_of
(graph
, unknown
) —> unknown
returns the source of the edge (right-hand operand) contained in the graph given in left-hand operand.
graph graphEpidemio <- generate_barabasi_albert( ["edges_species"::edge,"vertices_specy"::node,"size"::3,"m"::5] );
unknown var1 <- graphEpidemio source_of(edge(3)); // var1 equals node1
graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
point var3 <- graphFromMap source_of(link({1,5}::{12,45})); // var3 equals {1,5}
spatial_graph
spatial_graph
(container
) —> graph
allows to create a spatial graph from a container of vertices, without trying to wire them. The container can be empty. Emits an error if the contents of the container are not geometries, points or agents
species
species
(unknown
) —> species
casting of the operand to a species.
species var0 <- species(self); // var0 equals the species of the current agent
species var1 <- species('node'); // var1 equals node
species var2 <- species([1,5,9,3]); // var2 equals nil
species var3 <- species(node1); // var3 equals node
species_of
Same signification as species
sphere
sphere
(float
) —> geometry
A sphere geometry which radius is equal to the operand.
the centre of the sphere is by default the location of the current agent in which has been called this operator.
geometry var0 <- sphere(10); // var0 equals a geometry as a circle of radius 10 but displays a sphere.
around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,
split_at
geometry
split_at
point
—> list<geometry>
split_at
(geometry
, point
) —> list<geometry>
The two part of the left-operand lines split at the given right-operand point
list<geometry> var0 <- polyline([{1,2},{4,6}]) split_at {7,6}; // var0 equals [polyline([{1.0,2.0},{7.0,6.0}]), polyline([{7.0,6.0},{4.0,6.0}])]
split_geometry
geometry
split_geometry
float
—> list<geometry>
split_geometry
(geometry
, float
) —> list<geometry>
geometry
split_geometry
point
—> list<geometry>
split_geometry
(geometry
, point
) —> list<geometry>
split_geometry
(geometry
, int
, int
) —> list<geometry>
A list of geometries that result from the decomposition of the geometry by square cells of the given side size (geometry, size) A list of geometries that result from the decomposition of the geometry by rectangle cells of the given dimension (geometry, {size_x, size_y}) A list of geometries that result from the decomposition of the geometry according to a grid with the given number of rows and columns (geometry, nb_cols, nb_rows)
list<geometry> var0 <- to_squares(self, 10.0); // var0 equals the list of the geometries corresponding to the decomposition of the geometry by squares of side size 10.0
list<geometry> var1 <- to_rectangles(self, {10.0, 15.0}); // var1 equals the list of the geometries corresponding to the decomposition of the geometry by rectangles of size 10.0, 15.0
list<geometry> var2 <- to_rectangles(self, 10,20); // var2 equals the list of the geometries corresponding to the decomposition of the geometry of the agent applying the operator
split_lines
split_lines
(container<geometry>
) —> list<geometry>
A list of geometries resulting after cutting the lines at their intersections.
list<geometry> var0 <- split_lines([line([{0,10}, {20,10}]), line([{0,10}, {20,10}])]); // var0 equals a list of four polylines: line([{0,10}, {10,10}]), line([{10,10}, {20,10}]), line([{10,0}, {10,10}]) and line([{10,10}, {10,20}])
split_with
string
split_with
string
—> container
split_with
(string
, string
) —> container
Returns a list containing the sub-strings (tokens) of the left-hand operand delimited by each of the characters of the right-hand operand.
Delimiters themselves are excluded from the resulting list.
container var0 <- 'to be or not to be,that is the question' split_with ' ,'; // var0 equals ['to','be','or','not','to','be','that','is','the','question']
sqrt
sqrt
(int
) —> float
sqrt
(float
) —> float
Returns the square root of the operand.
float var0 <- sqrt(4); // var0 equals 2.0
float var1 <- sqrt(4); // var1 equals 2.0
square
square
(float
) —> geometry
A square geometry which side size is equal to the operand.
the centre of the square is by default the location of the current agent in which has been called this operator.
geometry var0 <- square(10); // var0 equals a geometry as a square of side size 10.
around, circle, cone, line, link, norm, point, polygon, polyline, rectangle, triangle,
squircle
float
squircle
float
—> geometry
squircle
(float
, float
) —> geometry
A mix of square and circle geometry (see : http://en.wikipedia.org/wiki/Squircle), which side size is equal to the first operand and power is equal to the second operand
the center of the ellipse is by default the location of the current agent in which has been called this operator.
geometry var0 <- squircle(4,4); // var0 equals a geometry as a squircle of side 4 with a power of 4.
around, cone, line, link, norm, point, polygon, polyline, super_ellipse, rectangle, square, circle, ellipse, triangle,
standard_deviation
standard_deviation
(container
) —> float
the standard deviation on the elements of the operand. See Standard_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 <- standard_deviation ([4.5, 3.5, 5.5, 7.0]); // var0 equals 1.2930100540985752
string
date
string
string
—> string
string
(date
, string
) —> string
converts a date to astring following a custom pattern. The pattern can use “%Y %M %N %D %E %h %m %s %z” for outputting years, months, name of month, days, name of days, hours, minutes, seconds and the time-zone. A null or empty pattern will return the complete date as defined by the ISO date & time format. The pattern can also follow the pattern definition found here, which gives much more control over the format of the date: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns. Different patterns are available by default as constants: #iso_local, #iso_simple, #iso_offset, #iso_zoned and #custom, which can be changed in the preferences
format(#now, 'yyyy-MM-dd')
subtract_days
Same signification as minus_days
subtract_hours
Same signification as minus_hours
subtract_minutes
Same signification as minus_minutes
subtract_months
Same signification as minus_months
subtract_ms
Same signification as minus_ms
subtract_seconds
Same signification as -
subtract_weeks
Same signification as minus_weeks
subtract_years
Same signification as minus_years
successors_of
graph
successors_of
unknown
—> container
successors_of
(graph
, unknown
) —> container
returns the list of successors (i.e. targets of out edges) of the given vertex (right-hand operand) in the given graph (left-hand operand)
container var1 <- graphEpidemio successors_of ({1,5}); // var1 equals [{12,45}]
container var2 <- graphEpidemio successors_of node({34,56}); // var2 equals []
predecessors_of, neighbors_of,
sum
sum
(graph
) —> float
sum
(container
) —> unknown
the sum of all the elements of the operand
the behavior depends on the nature of the operand
int var0 <- sum ([12,10,3]); // var0 equals 25
unknown var1 <- sum([{1.0,3.0},{3.0,5.0},{9.0,1.0},{7.0,8.0}]); // var1 equals {20.0,17.0}
mul,
sum_of
container
sum_of
any expression
—> unknown
sum_of
(container
, any expression
) —> unknown
the sum 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] sum_of (each + 3); // var2 equals 21
unknown var1 <- [1,2] sum_of (each * 100 ); // var1 equals 300
min_of, max_of, product_of, mean_of,
svg_file
svg_file
(string
) —> file
Constructs a file of type svg. Allowed extensions are limited to svg
tan
tan
(int
) —> float
tan
(float
) —> float
Returns the value (in [-1,1]) of the trigonometric tangent of the operand (in decimal degrees). The argument is casted to an int before being evaluated.
*
180 (k an positive or negative integer). Nevertheless notice that tan(90) returns 1.633123935319537E16 (whereas we could except infinity).float var0 <- tan (0); // var0 equals 0.0
float var1 <- tan(90); // var1 equals 1.633123935319537E16
tan_rad
tan_rad
(float
) —> float
Returns the value (in [-1,1]) of the trigonometric tangent of the operand (in decimal degrees). The argument is casted to an int before being evaluated.
*
180 (k an positive or negative integer). Nevertheless notice that tan(90) returns 1.633123935319537E16 (whereas we could except infinity).tanh
tanh
(float
) —> float
tanh
(int
) —> float
Returns the value (in the interval [-1,1]) of the hyperbolic tangent of the operand (which can be any real number, expressed in decimal degrees).
float var0 <- tanh(0); // var0 equals 0.0
float var1 <- tanh(100); // var1 equals 1.0
target_of
graph
target_of
unknown
—> unknown
target_of
(graph
, unknown
) —> unknown
returns the target of the edge (right-hand operand) contained in the graph given in left-hand operand.
graph graphEpidemio <- generate_barabasi_albert( ["edges_species"::edge,"vertices_specy"::node,"size"::3,"m"::5] );
unknown var1 <- graphEpidemio source_of(edge(3)); // var1 equals node1
graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
unknown var3 <- graphFromMap target_of(link({1,5}::{12,45})); // var3 equals {12,45}
teapot
teapot
(float
) —> geometry
A teapot geometry which radius is equal to the operand.
the centre of the teapot is by default the location of the current agent in which has been called this operator.
geometry var0 <- teapot(10); // var0 equals a geometry as a circle of radius 10 but displays a teapot.
around, cone, line, link, norm, point, polygon, polyline, rectangle, square, triangle,
text_file
text_file
(string
) —> file
Constructs a file of type text. Allowed extensions are limited to txt, data, text
TGauss
Same signification as truncated_gauss
threeds_file
threeds_file
(string
) —> file
Constructs a file of type threeds. Allowed extensions are limited to 3ds, max
to
date
to
date
—> msi.gama.util.IList<msi.gama.util.GamaDate>
to
(date
, date
) —> msi.gama.util.IList<msi.gama.util.GamaDate>
builds an interval between two dates (the first inclusive and the second exclusive, which behaves like a read-only list of dates. The default step between two dates is the step of the model
The default step can be overruled by using the every operator applied to this interval
date('2000-01-01') to date('2010-01-01') // builds an interval between these two dates
(date('2000-01-01') to date('2010-01-01')) every (#month) // builds an interval between these two dates which contains all the monthly dates starting from the beginning of the interval
to_GAMA_CRS
to_GAMA_CRS
(geometry
) —> geometry
geometry
to_GAMA_CRS
string
—> geometry
to_GAMA_CRS
(geometry
, string
) —> geometry
geometry var0 <- to_GAMA_CRS({121,14}, "EPSG:4326"); // var0 equals a geometry corresponding to the agent geometry transformed into the GAMA CRS
geometry var1 <- to_GAMA_CRS({121,14}); // var1 equals a geometry corresponding to the agent geometry transformed into the GAMA CRS
to_gaml
to_gaml
(unknown
) —> string
returns the literal description of an expression or description – action, behavior, species, aspect, even model – in gaml
string var0 <- to_gaml(0); // var0 equals '0'
string var1 <- to_gaml(3.78); // var1 equals '3.78'
string var2 <- to_gaml(true); // var2 equals 'true'
string var3 <- to_gaml({23, 4.0}); // var3 equals '{23.0,4.0,0.0}'
string var4 <- to_gaml(5::34); // var4 equals '5::34'
string var5 <- to_gaml(rgb(255,0,125)); // var5 equals 'rgb (255, 0, 125,255)'
string var6 <- to_gaml('hello'); // var6 equals "'hello'"
string var7 <- to_gaml([1,5,9,3]); // var7 equals '[1,5,9,3]'
string var8 <- to_gaml(['a'::345, 'b'::13, 'c'::12]); // var8 equals "(['a'::345,'b'::13,'c'::12] as map )"
string var9 <- to_gaml([[3,5,7,9],[2,4,6,8]]); // var9 equals '[[3,5,7,9],[2,4,6,8]]'
string var10 <- to_gaml(a_graph); // var10 equals ([((1 as node)::(3 as node))::(5 as edge),((0 as node)::(3 as node))::(3 as edge),((1 as node)::(2 as node))::(1 as edge),((0 as node)::(2 as node))::(2 as edge),((0 as node)::(1 as node))::(0 as edge),((2 as node)::(3 as node))::(4 as edge)] as map ) as graph
string var11 <- to_gaml(node1); // var11 equals 1 as node
to_rectangles
to_rectangles
(geometry
, point
, bool
) —> list<geometry>
to_rectangles
(geometry
, int
, int
, bool
) —> list<geometry>
A list of rectangles of the size corresponding to the given dimension that result from the decomposition of the geometry into rectangles (geometry, dimension, overlaps), if overlaps = true, add the rectangles that overlap the border of the geometry A list of rectangles corresponding to the given dimension that result from the decomposition of the geometry into rectangles (geometry, nb_cols, nb_rows, overlaps) by a grid composed of the given number of columns and rows, if overlaps = true, add the rectangles that overlap the border of the geometry
list<geometry> var0 <- to_rectangles(self, {10.0, 15.0}, true); // var0 equals the list of rectangles of size {10.0, 15.0} corresponding to the discretization into rectangles of the geometry of the agent applying the operator. The rectangles overlapping the border of the geometry are kept
list<geometry> var1 <- to_rectangles(self, 5, 20, true); // var1 equals the list of rectangles corresponding to the discretization by a grid of 5 columns and 20 rows into rectangles of the geometry of the agent applying the operator. The rectangles overlapping the border of the geometry are kept
to_squares
Same signification as split_geometry
to_squares
(geometry
, int
, bool
) —> list<geometry>
to_squares
(geometry
, float
, bool
) —> list<geometry>
to_squares
(geometry
, int
, bool
, float
) —> list<geometry>
A list of a given number of squares from the decomposition of the geometry into squares (geometry, nb_square, overlaps), if overlaps = true, add the squares that overlap the border of the geometry A list of squares of the size corresponding to the given size that result from the decomposition of the geometry into squares (geometry, size, overlaps), if overlaps = true, add the squares that overlap the border of the geometry A list of a given number of squares from the decomposition of the geometry into squares (geometry, nb_square, overlaps, precision_coefficient), if overlaps = true, add the squares that overlap the border of the geometry, coefficient_precision should be close to 1.0
list<geometry> var0 <- to_squares(self, 10, true); // var0 equals the list of 10 squares corresponding to the discretization into squares of the geometry of the agent applying the operator. The squares overlapping the border of the geometry are kept
list<geometry> var1 <- to_squares(self, 10.0, true); // var1 equals the list of squares of side size 10.0 corresponding to the discretization into squares of the geometry of the agent applying the operator. The squares overlapping the border of the geometry are kept
list<geometry> var2 <- to_squares(self, 10, true, 0.99); // var2 equals the list of 10 squares corresponding to the discretization into squares of the geometry of the agent applying the operator. The squares overlapping the border of the geometry are kept
to_triangles
Same signification as triangulate
tokenize
Same signification as split_with
topology
topology
(unknown
) —> topology
casting of the operand to a topology.
topology var0 <- topology(0); // var0 equals nil
topology(a_graph) --: Multiple topology in POLYGON ((24.712119771887785 7.867357373616512, 24.712119771887785 61.283226839310565, 82.4013676510046 7.867357373616512)) at location[53.556743711446195;34.57529210646354]
touches
geometry
touches
geometry
—> bool
touches
(geometry
, geometry
) —> bool
A boolean, equal to true if the left-geometry (or agent/point) touches the right-geometry (or agent/point).
returns true when the left-operand only touches the right-operand. When one geometry covers partially (or fully) the other one, it returns false.
bool var0 <- polyline([{10,10},{20,20}]) touches {15,15}; // var0 equals false
bool var1 <- polyline([{10,10},{20,20}]) touches {10,10}; // var1 equals true
bool var2 <- {15,15} touches {15,15}; // var2 equals false
bool var3 <- polyline([{10,10},{20,20}]) touches polyline([{10,10},{5,5}]); // var3 equals true
bool var4 <- polyline([{10,10},{20,20}]) touches polyline([{5,5},{15,15}]); // var4 equals false
bool var5 <- polyline([{10,10},{20,20}]) touches polyline([{15,15},{25,25}]); // var5 equals false
bool var6 <- polygon([{10,10},{10,20},{20,20},{20,10}]) touches polygon([{15,15},{15,25},{25,25},{25,15}]); // var6 equals false
bool var7 <- polygon([{10,10},{10,20},{20,20},{20,10}]) touches polygon([{10,20},{20,20},{20,30},{10,30}]); // var7 equals true
bool var8 <- polygon([{10,10},{10,20},{20,20},{20,10}]) touches polygon([{10,10},{0,10},{0,0},{10,0}]); // var8 equals true
bool var9 <- polygon([{10,10},{10,20},{20,20},{20,10}]) touches {15,15}; // var9 equals false
bool var10 <- polygon([{10,10},{10,20},{20,20},{20,10}]) touches {10,15}; // var10 equals true
disjoint_from, crosses, overlaps, partially_overlaps, intersects,
towards
geometry
towards
geometry
—> int
towards
(geometry
, geometry
) —> int
The direction (in degree) between the two geometries (geometries, agents, points) considering the topology of the agent applying the operator.
int var0 <- ag1 towards ag2; // var0 equals the direction between ag1 and ag2 and ag3 considering the topology of the agent applying the operator
distance_between, distance_to, direction_between, path_between, path_to,
trace
trace
(matrix
) —> float
The trace of the given matrix (the sum of the elements on the main diagonal).
float var0 <- trace(matrix([[1,2],[3,4]])); // var0 equals 5
transformed_by
geometry
transformed_by
point
—> geometry
transformed_by
(geometry
, point
) —> geometry
A geometry resulting from the application of a rotation and a scaling (right-operand : point {angle(degree), scale factor} of the left-hand operand (geometry, agent, point)
geometry var0 <- self transformed_by {45, 0.5}; // var0 equals the geometry resulting from 45 degrees rotation and 50% scaling of the geometry of the agent applying the operator.
translated_by
geometry
translated_by
point
—> geometry
translated_by
(geometry
, point
) —> geometry
A geometry resulting from the application of a translation by the right-hand operand distance to the left-hand operand (geometry, agent, point)
geometry var0 <- self translated_by {10,10,10}; // var0 equals the geometry resulting from applying the translation to the left-hand geometry (or agent).
translated_to
Same signification as at_location
transpose
transpose
(matrix
) —> matrix
The transposition of the given matrix
matrix var0 <- transpose(matrix([[5,-3],[6,-4]])); // var0 equals [[5,6],[-3,-4]]
triangle
triangle
(float
) —> geometry
A triangle geometry which side size is given by the operand.
the center of the triangle is by default the location of the current agent in which has been called this operator.
geometry var0 <- triangle(5); // var0 equals a geometry as a triangle with side_size = 5.
around, circle, cone, line, link, norm, point, polygon, polyline, rectangle, square,
triangulate
triangulate
(list<geometry>
) —> list<geometry>
triangulate
(geometry
) —> list<geometry>
A list of geometries (triangles) corresponding to the Delaunay triangulation of the operand geometry (geometry, agent, point)
list<geometry> var0 <- triangulate(self); // var0 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator.
list<geometry> var1 <- triangulate(self); // var1 equals the list of geometries (triangles) corresponding to the Delaunay triangulation of the geometry of the agent applying the operator.
truncated_gauss
truncated_gauss
(container
) —> float
truncated_gauss
(point
) —> float
A random value from a normally distributed random variable in the interval ]mean - standardDeviation; mean + standardDeviation[.
float var0 <- truncated_gauss ([0.5, 0.0]); // var0 equals 0.5
float var1 <- truncated_gauss ({0, 0.3}); // var1 equals a float between -0.3 and 0.3
undirected
undirected
(graph
) —> graph
the operand graph becomes an undirected graph.
the operator alters the operand graph, it does not create a new one.
union
union
(container<geometry>
) —> geometry
container
union
container
—> container
union
(container
, container
) —> container
returns a new list containing all the elements of both containers without duplicated elements.
container var0 <- [1,2,3,4,5,6] union [2,4,9]; // var0 equals [1,2,3,4,5,6,9]
container var1 <- [1,2,3,4,5,6] union [0,8]; // var1 equals [1,2,3,4,5,6,0,8]
container var2 <- [1,3,2,4,5,6,8,5,6] union [0,8]; // var2 equals [1,3,2,4,5,6,8,0]
geometry var3 <- union([geom1, geom2, geom3]); // var3 equals a geometry corresponding to union between geom1, geom2 and geom3
unknown
unknown
(any
) —> unknown
Casts the operand into the type unknown
until
until
(date
) —> bool
any expression
until
date
—> bool
until
(any expression
, date
) —> bool
Returns true if the current_date of the model is before (or equel to) the date passed in argument. Synonym of ‘current_date <= argument’
reflex when: until(starting_date) {} -: will be run only once at the beginning of the simulation
upper_case
upper_case
(string
) —> string
Converts all of the characters in the string operand to upper case
string var0 <- upper_case("Abc"); // var0 equals 'ABC'
URL_file
URL_file
(string
) —> file
Constructs a file of type URL. Allowed extensions are limited to url
use_cache
graph
use_cache
bool
—> graph
use_cache
(graph
, bool
) —> graph
if the second operand is true, the operand graph will store in a cache all the previously computed shortest path (the cache be cleared if the graph is modified).
the operator alters the operand graph, it does not create a new one.
user_input
user_input
(any expression
) —> map<string,unknown>
string
user_input
any expression
—> map<string,unknown>
user_input
(string
, any expression
) —> map<string,unknown>
asks the user for some values (not defined as parameters). Takes a string (optional) and a map as arguments. The string is used to specify the message of the dialog box. The map is to specify the parameters you want the user to change before the simulation starts, with the name of the parameter in string key, and the default value as value.
This operator takes a map [string::value] as argument, displays a dialog asking the user for these values, and returns the same map with the modified values (if any). The dialog is modal and will interrupt the execution of the simulation until the user has either dismissed or accepted it. It can be used, for instance, in an init section to force the user to input new values instead of relying on the initial values of parameters :
map<string,unknown> values2 <- user_input("Enter numer of agents and locations",["Number" :: 100, "Location" :: {10, 10}]);
create bug number: int(values2 at "Number") with: [location:: (point(values2 at "Location"))];
map<string,unknown> values <- user_input(["Number" :: 100, "Location" :: {10, 10}]);
create bug number: int(values at "Number") with: [location:: (point(values at "Location"))];
using
any expression
using
topology
—> unknown
using
(any expression
, topology
) —> unknown
Allows to specify in which topology a spatial computation should take place.
unknown var0 <- (agents closest_to self) using topology(world); // var0 equals the closest agent to self (the caller) in the continuous topology of the world
variance
variance
(container
) —> float
the variance of the elements of the operand. See Variance 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 <- variance ([4.5, 3.5, 5.5, 7.0]); // var0 equals 1.671875
variance_of
container
variance_of
any expression
—> unknown
variance_of
(container
, any expression
) —> unknown
the variance 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.
min_of, max_of, sum_of, product_of,
voronoi
voronoi
(list<point>
) —> list<geometry>
list<point>
voronoi
geometry
—> list<geometry>
voronoi
(list<point>
, geometry
) —> list<geometry>
A list of geometries corresponding to the Voronoi diagram built from the list of points according to the given clip A list of geometries corresponding to the Voronoi diagram built from the list of points
list<geometry> var0 <- voronoi([{10,10},{50,50},{90,90},{10,90},{90,10}], square(300)); // var0 equals the list of geometries corresponding to the Voronoi Diagram built from the list of points with a square of 300m side size as clip.
list<geometry> var1 <- voronoi([{10,10},{50,50},{90,90},{10,90},{90,10}]); // var1 equals the list of geometries corresponding to the Voronoi Diagram built from the list of points.
weight_of
graph
weight_of
unknown
—> float
weight_of
(graph
, unknown
) —> float
returns the weight of the given edge (right-hand operand) contained in the graph given in right-hand operand.
In a localized graph, an edge has a weight by default (the distance between both vertices).
graph graphFromMap <- as_edge_graph([{1,5}::{12,45},{12,45}::{34,56}]);
float var1 <- graphFromMap weight_of(link({1,5}::{12,45})); // var1 equals 1.0
weighted_means_DM
list<list>
weighted_means_DM
list<map<string,object>>
—> int
weighted_means_DM
(list<list>
, list<map<string,object>>
) —> int
The index of the candidate that maximizes the weighted mean of its criterion values. The first operand is the list of candidates (a candidate is a list of criterion values); the second operand the list of criterion (list of map)
int var0 <- weighted_means_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], [["name"::"utility", "weight" :: 2.0],["name"::"price", "weight" :: 1.0]]); // var0 equals 1
promethee_DM, electre_DM, evidence_theory_DM,
where
container
where
any expression
—> container
where
(container
, any expression
) —> container
a list containing all the elements of the left-hand operand that make 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.
container var4 <- [1::2, 3::4, 5::6] where (each >= 4); // var4 equals [4, 6]
container var0 <- [1,2,3,4,5,6,7,8] where (each > 3); // var0 equals [4, 5, 6, 7, 8]
container var2 <- g2 where (length(g2 out_edges_of each) = 0 ); // var2 equals [node9, node7, node10, node8, node11]
container var3 <- (list(node) where (round(node(each).location.x) > 32); // var3 equals [node2, node3]
with_lifetime
predicate
with_lifetime
int
—> predicate
with_lifetime
(predicate
, int
) —> predicate
change the parameters of the given predicate
predicate with_lifetime 10
with_max_of
container
with_max_of
any expression
—> unknown
with_max_of
(container
, any expression
) —> unknown
one of elements of the left-hand operand that maximizes the value of the right-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 var0 <- [1,2,3,4,5,6,7,8] with_max_of (each ); // var0 equals 8
unknown var2 <- g2 with_max_of (length(g2 out_edges_of each) ) ; // var2 equals node4
unknown var3 <- (list(node) with_max_of (round(node(each).location.x)); // var3 equals node3
unknown var4 <- [1::2, 3::4, 5::6] with_max_of (each); // var4 equals 6
with_min_of
container
with_min_of
any expression
—> unknown
with_min_of
(container
, any expression
) —> unknown
one of elements of the left-hand operand that minimizes the value of the right-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 var0 <- [1,2,3,4,5,6,7,8] with_min_of (each ); // var0 equals 1
unknown var2 <- g2 with_min_of (length(g2 out_edges_of each) ); // var2 equals node11
unknown var3 <- (list(node) with_min_of (round(node(each).location.x)); // var3 equals node0
unknown var4 <- [1::2, 3::4, 5::6] with_min_of (each); // var4 equals 2
with_optimizer_type
graph
with_optimizer_type
string
—> graph
with_optimizer_type
(graph
, string
) —> graph
changes the shortest path computation method of the given graph
the right-hand operand can be “Djikstra”, “Bellmann”, “Astar” to use the associated algorithm. Note that these methods are dynamic: the path is computed when needed. In contrarily, if the operand is another string, a static method will be used, i.e. all the shortest are previously computed.
graphEpidemio <- graphEpidemio with_optimizer_type "static";
with_praiseworthiness
predicate
with_praiseworthiness
float
—> predicate
with_praiseworthiness
(predicate
, float
) —> predicate
change the praiseworthiness value of the given predicate
predicate set_truth false
with_precision
float
with_precision
int
—> float
with_precision
(float
, int
) —> float
point
with_precision
int
—> point
with_precision
(point
, int
) —> point
Rounds off the value of left-hand operand to the precision given by the value of right-hand operand Rounds off the ordinates of the left-hand point to the precision given by the value of right-hand operand
float var0 <- 12345.78943 with_precision 2; // var0 equals 12345.79
float var1 <- 123 with_precision 2; // var1 equals 123.00
point var2 <- {12345.78943, 12345.78943, 12345.78943} with_precision 2 ; // var2 equals {12345.79, 12345.79, 12345.79}
with_priority
predicate
with_priority
float
—> predicate
with_priority
(predicate
, float
) —> predicate
change the priority of the given predicate
predicate with_priority 2
with_values
predicate
with_values
map
—> predicate
with_values
(predicate
, map
) —> predicate
change the parameters of the given predicate
predicate with_values ["time"::10]
with_weights
graph
with_weights
map
—> graph
with_weights
(graph
, map
) —> graph
graph
with_weights
container
—> graph
with_weights
(graph
, container
) —> graph
returns the graph (left-hand operand) with weight given in the map (right-hand operand).
this operand re-initializes the path finder
graph_from_edges (list(ant) as_map each::one_of (list(ant))) with_weights (list(ant) as_map each::each.food)
without_holes
without_holes
(geometry
) —> geometry
A geometry corresponding to the operand geometry (geometry, agent, point) without its holes
geometry var0 <- solid(self); // var0 equals the geometry corresponding to the geometry of the agent applying the operator without its holes.
writable
file
writable
bool
—> file
writable
(file
, bool
) —> file
Marks the file as read-only or not, depending on the second boolean argument, and returns the first argument
A file is created using its native flags. This operator can change them. Beware that this change is system-wide (and not only restrained to GAMA): changing a file to read-only mode (e.g. “writable(f, false)”)
file var0 <- shape_file("../images/point_eau.shp") writable false; // var0 equals returns a file in read-only mode
file,
xml_file
xml_file
(string
) —> file
Constructs a file of type xml. Allowed extensions are limited to xml
years_between
date
years_between
date
—> int
years_between
(date
, date
) —> int
Provide the exact number of years between two dates. This number can be positive or negative (if the second operand is smaller than the first one)
years_between(d1, d2) -: 10