Operators (D to H)
This file is automatically generated from java files. Do Not Edit It.
Definition​
Operators in the GAML language are used to compose complex expressions. An operator performs a function on one, two, or n operands (which are other expressions and thus may be themselves composed of operators) and returns the result of this function.
Most of them use a classical prefixed functional syntax (i.e. operator_name(operand1, operand2, operand3), see below), with the exception of arithmetic (e.g. +, /), logical (and, or), comparison (e.g. >, <), access (., [..]) and pair (::) operators, which require an infixed notation (i.e. operand1 operator_symbol operand1).
The ternary functional if-else operator, ? :, uses a special infixed syntax composed with two symbols (e.g. operand1 ? operand2 : operand3). Two unary operators (- and !) use a traditional prefixed syntax that does not require parentheses unless the operand is itself a complex expression (e.g. - 10, ! (operand1 or operand2)).
Finally, special constructor operators ({...} for constructing points, [...] for constructing lists and maps) will require their operands to be placed between their two symbols (e.g. {1,2,3}, [operand1, operand2, ..., operandn] or [key1::value1, key2::value2... keyn::valuen]).
With the exception of these special cases above, the following rules apply to the syntax of operators:
- if they only have one operand, the functional prefixed syntax is mandatory (e.g.
operator_name(operand1)) - if they have two arguments, either the functional prefixed syntax (e.g.
operator_name(operand1, operand2)) or the infixed syntax (e.g.operand1 operator_name operand2) can be used. - if they have more than two arguments, either the functional prefixed syntax (e.g.
operator_name(operand1, operand2, ..., operand)) or a special infixed syntax with the first operand on the left-hand side of the operator name (e.g.operand1 operator_name(operand2, ..., operand)) can be used.
All of these alternative syntaxes are completely equivalent.
Operators in GAML are purely functional, i.e. they are guaranteed to not have any side effects on their operands. For instance, the shuffle operator, which randomizes the positions of elements in a list, does not modify its list operand but returns a new shuffled list.
Priority between operators​
The priority of operators determines, in the case of complex expressions composed of several operators, which one(s) will be evaluated first.
GAML follows in general the traditional priorities attributed to arithmetic, boolean, comparison operators, with some twists. Namely:
- the constructor operators, like
::, used to compose pairs of operands, have the lowest priority of all operators (e.g.a > b :: b > cwill return a pair of boolean values, which means that the two comparisons are evaluated before the operator applies. Similarly,[a > 10, b > 5]will return a list of boolean values. - it is followed by the
?:operator, the functional if-else (e.g.a > b ? a + 10 : a - 10will return the result of the if-else). - next are the logical operators,
andandor(e.g.a > b or b > cwill return the value of the test) - next are the comparison operators (i.e.
>,<,<=,>=,=,!=) - next the arithmetic operators in their logical order (multiplicative operators have a higher priority than additive operators)
- next the unary operators
-and! - next the access operators
.and[](e.g.{1,2,3}.x > 20 + {4,5,6}.ywill return the result of the comparison between the x and y ordinates of the two points) - and finally the functional operators, which have the highest priority of all.
Using actions as operators​
Actions defined in species can be used as operators, provided they are called on the correct agent. The syntax is that of normal functional operators, but the agent that will perform the action must be added as the first operand.
For instance, if the following species is defined:
species spec1 {
int min(int x, int y) {
return x > y ? x : y;
}
}
Any agent instance of spec1 can use min as an operator (if the action conflicts with an existing operator, a warning will be emitted). For instance, in the same model, the following line is perfectly acceptable:
global {
init {
create spec1;
spec1 my_agent <- spec1[0];
int the_min <- my_agent min(10,20); // or min(my_agent, 10, 20);
}
}
If the action doesn't have any operands, the syntax to use is my_agent the_action(). Finally, if it does not return a value, it might still be used but is considering as returning a value of type unknown (e.g. unknown result <- my_agent the_action(op1, op2);).
Note that due to the fact that actions are written by modelers, the general functional contract is not respected in that case: actions might perfectly have side effects on their operands (including the agent).
Table of Contents​
Operators by categories​
3D​
box, cone3D, cube, cylinder, dem, hexagon, pyramid, set_z, sphere, teapot,
Arithmetic operators​
-, /, ^, *, +, abs, acos, asin, atan, atan2, ceil, cos, cos_rad, div, even, exp, fact, floor, hypot, is_finite, is_number, ln, log, mod, round, signum, sin, sin_rad, sqrt, tan, tan_rad, tanh, with_precision,
BDI​
add_values, and, eval_when, get_about, get_agent, get_agent_cause, get_belief_op, get_belief_with_name_op, get_beliefs_op, get_beliefs_with_name_op, get_current_intention_op, get_decay, get_desire_op, get_desire_with_name_op, get_desires_op, get_desires_with_name_op, get_dominance, get_familiarity, get_ideal_op, get_ideal_with_name_op, get_ideals_op, get_ideals_with_name_op, get_intensity, get_intention_op, get_intention_with_name_op, get_intentions_op, get_intentions_with_name_op, get_lifetime, get_liking, get_modality, get_obligation_op, get_obligation_with_name_op, get_obligations_op, get_obligations_with_name_op, get_plan_name, get_predicate, get_solidarity, get_strength, get_super_intention, get_trust, get_truth, get_uncertainties_op, get_uncertainties_with_name_op, get_uncertainty_op, get_uncertainty_with_name_op, get_values, has_belief_op, has_belief_with_name_op, has_desire_op, has_desire_with_name_op, has_ideal_op, has_ideal_with_name_op, has_intention_op, has_intention_with_name_op, has_obligation_op, has_obligation_with_name_op, has_uncertainty_op, has_uncertainty_with_name_op, new_emotion, new_mental_state, new_predicate, new_social_link, not, or, set_about, set_agent, set_agent_cause, set_decay, set_dominance, set_familiarity, set_intensity, set_lifetime, set_liking, set_modality, set_predicate, set_solidarity, set_strength, set_trust, set_truth, with_values,
Casting operators​
as, as_int, as_matrix, font, is, is_skill, list_with, matrix_with, species, to_gaml, topology,
Color-related operators​
-, /, *, +, blend, brewer_colors, brewer_palettes, grayscale, hsb, mean, median, rgb, rnd_color, sum,
Comparison operators​
Containers-related operators​
-, ::, +, accumulate, all_match, among, at, collect, contains, contains_all, contains_any, contains_key, count, distinct, empty, every, first, first_with, get, group_by, in, index_by, inter, interleave, internal_at, internal_integrated_value, last, last_with, length, max, max_of, mean, mean_of, median, min, min_of, mul, none_matches, one_matches, one_of, product_of, range, reverse, shuffle, sort_by, split, split_in, split_using, sum, sum_of, union, variance_of, where, with_max_of, with_min_of,
Date-related operators​
-, !=, +, <, <=, =, >, >=, after, before, between, every, milliseconds_between, minus_days, minus_hours, minus_minutes, minus_months, minus_ms, minus_weeks, minus_years, months_between, plus_days, plus_hours, plus_minutes, plus_months, plus_ms, plus_weeks, plus_years, since, to, until, years_between,
Dates​
Displays​
Driving operators​
edge​
EDP-related operators​
Files-related operators​
crs, csv_file, dxf_file, evaluate_sub_model, file_exists, folder, folder_exists, gaml_file, geojson_file, get, gif_file, gml_file, grid_file, image_file, is_csv, is_dxf, is_gaml, is_geojson, is_gif, is_gml, is_grid, is_image, is_json, is_obj, is_osm, is_pgm, is_property, is_R, is_saved_simulation, is_shape, is_svg, is_text, is_threeds, is_xml, json_file, new_folder, obj_file, osm_file, pgm_file, property_file, R_file, read, saved_simulation_file, shape_file, step_sub_model, svg_file, text_file, threeds_file, writable, xml_file,
FIPA-related operators​
GamaMetaType​
Graphs-related operators​
add_edge, add_node, adjacency, agent_from_geometry, all_pairs_shortest_path, alpha_index, as_distance_graph, as_edge_graph, as_intersection_graph, as_path, 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_circle, layout_force, layout_grid, load_graph_from_file, load_shortest_paths, main_connected_component, max_flow_between, maximal_cliques_of, nb_cycles, neighbors_of, node, nodes, out_degree_of, out_edges_of, path_between, paths_between, predecessors_of, remove_node_from, rewire_n, source_of, spatial_graph, strahler, successors_of, sum, target_of, undirected, use_cache, weight_of, with_optimizer_type, with_weights,
Grid-related operators​
as_4_grid, as_grid, as_hexagonal_grid, grid_at, path_between,
Iterator operators​
accumulate, all_match, as_map, collect, count, create_map, first_with, frequency_of, group_by, index_by, last_with, max_of, mean_of, min_of, none_matches, one_matches, product_of, sort_by, sum_of, variance_of, where, with_max_of, with_min_of,
List-related operators​
all_indexes_of, copy_between, index_of, last_index_of,
Logical operators​
:, !, ?, add_3Dmodel, add_geometry, add_icon, and, or, xor,
Map comparaison operators​
fuzzy_kappa, fuzzy_kappa_sim, kappa, kappa_sim, percent_absolute_deviation,
Map-related operators​
as_map, create_map, index_of, last_index_of,
Material​
Matrix-related operators​
-, /, ., *, +, append_horizontally, append_vertically, column_at, columns_list, determinant, eigenvalues, index_of, inverse, last_index_of, row_at, rows_list, shuffle, trace, transpose,
multicriteria operators​
electre_DM, evidence_theory_DM, fuzzy_choquet_DM, promethee_DM, weighted_means_DM,
Path-related operators​
agent_from_geometry, all_pairs_shortest_path, as_path, load_shortest_paths, max_flow_between, path_between, path_to, paths_between, use_cache,
Points-related operators​
-, /, *, +, <, <=, >, >=, add_point, angle_between, any_location_in, centroid, closest_points_with, farthest_point_to, grid_at, norm, points_along, points_at, points_on,
Random operators​
binomial, flip, gamma_density, gamma_rnd, gamma_trunc_rnd, gauss, lognormal_density, lognormal_rnd, lognormal_trunc_rnd, open_simplex_generator, poisson, rnd, rnd_choice, sample, shuffle, simplex_generator, skew_gauss, truncated_gauss, weibull_density, weibull_rnd, weibull_trunc_rnd,
ReverseOperators​
restore_simulation, restore_simulation_from_file, save_agent, save_simulation, serialize, serialize_agent,
Shape​
arc, box, circle, cone, cone3D, cross, cube, curve, cylinder, ellipse, elliptical_arc, envelope, geometry_collection, hexagon, line, link, plan, polygon, polyhedron, pyramid, rectangle, sphere, square, squircle, teapot, triangle,
Spatial operators​
-, *, +, add_point, agent_closest_to, agent_farthest_to, agents_at_distance, agents_inside, agents_overlapping, angle_between, any_location_in, arc, around, as_4_grid, as_grid, as_hexagonal_grid, at_distance, at_location, box, centroid, circle, clean, clean_network, closest_points_with, closest_to, cone, cone3D, convex_hull, covers, cross, crosses, crs, CRS_transform, cube, curve, cylinder, dem, direction_between, disjoint_from, distance_between, distance_to, ellipse, elliptical_arc, envelope, farthest_point_to, farthest_to, geometry_collection, gini, hexagon, hierarchical_clustering, IDW, inside, inter, intersects, inverse_rotation, line, link, masked_by, moran, neighbors_at, neighbors_of, normalized_rotation, overlapping, overlaps, partially_overlaps, path_between, path_to, plan, points_along, points_at, points_on, polygon, polyhedron, pyramid, rectangle, rotated_by, rotation_composition, round, scaled_to, set_z, simple_clustering_by_distance, simplification, skeletonize, smooth, sphere, split_at, split_geometry, split_lines, square, squircle, teapot, to_GAMA_CRS, to_rectangles, to_segments, to_squares, to_sub_geometries, touches, towards, transformed_by, translated_by, triangle, triangulate, union, using, voronoi, with_precision, without_holes,
Spatial properties operators​
covers, crosses, intersects, partially_overlaps, touches,
Spatial queries operators​
agent_closest_to, agent_farthest_to, agents_at_distance, agents_inside, agents_overlapping, at_distance, closest_to, farthest_to, inside, neighbors_at, neighbors_of, overlapping,
Spatial relations operators​
direction_between, distance_between, distance_to, path_between, path_to, towards,
Spatial statistical operators​
hierarchical_clustering, simple_clustering_by_distance,
Spatial transformations operators​
-, *, +, as_4_grid, as_grid, as_hexagonal_grid, at_location, clean, clean_network, convex_hull, CRS_transform, inverse_rotation, normalized_rotation, rotated_by, rotation_composition, scaled_to, simplification, skeletonize, smooth, split_geometry, split_lines, to_GAMA_CRS, to_rectangles, to_segments, to_squares, to_sub_geometries, transformed_by, translated_by, triangulate, voronoi, with_precision, without_holes,
Species-related operators​
index_of, last_index_of, of_generic_species, of_species,
Statistical operators​
auto_correlation, beta, binomial_coeff, binomial_complemented, binomial_sum, build, chi_square, chi_square_complemented, corR, correlation, covariance, dbscan, distribution_of, distribution2d_of, dtw, durbin_watson, frequency_of, gamma, gamma_distribution, gamma_distribution_complemented, geometric_mean, gini, harmonic_mean, hierarchical_clustering, incomplete_beta, incomplete_gamma, incomplete_gamma_complement, kmeans, kurtosis, kurtosis, log_gamma, max, mean, mean_deviation, meanR, median, min, moment, moran, mul, normal_area, normal_density, normal_inverse, predict, pValue_for_fStat, pValue_for_tStat, quantile, quantile_inverse, rank_interpolated, rms, simple_clustering_by_distance, skew, skewness, split, split_in, split_using, standard_deviation, student_area, student_t_inverse, sum, variance, variance,
Strings-related operators​
+, <, <=, >, >=, 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,
SubModel​
System​
., choose, command, copy, copy_to_clipboard, dead, enter, eval_gaml, every, is_error, is_warning, user_input,
Time-related operators​
Types-related operators​
action, agent, attributes, BDIPlan, bool, container, emotion, file, float, gaml_type, geometry, graph, int, kml, list, map, material, matrix, mental_state, Norm, pair, path, point, predicate, regression, rgb, Sanction, skill, social_link, topology, unknown,
User control operators​
Operators​
date​
Possible use:​
stringdatestring--->datedate(string,string) --->datedate(string,string,string) --->date
Result:​
converts a string to a date following a custom pattern. The pattern can use "%Y %M %N %D %E %h %m %s %z" for outputting years, months, name of month, days, name of days, hours, minutes, seconds and the time-zone. A null or empty pattern will parse the date using one of the ISO date & time formats (similar to date('...') in that case). The pattern can also follow the pattern definition found here, which gives much more control over what will be parsed: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns. Different patterns are available by default as constant: #iso_local, #iso_simple, #iso_offset, #iso_zoned and #custom, which can be changed in the preferences converts a string to a date following a custom pattern and a specific locale (e.g. 'fr', 'en'...). The pattern can use "%Y %M %N %D %E %h %m %s %z" for parsing 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
Examples:​
date den <- date("1999-12-30", 'yyyy-MM-dd');
date d <- date("1999-january-30", 'yyyy-MMMM-dd', 'en');
dbscan​
Possible use:​
dbscan(list,float,int) --->list<list>
Result:​
returns the list of clusters (list of instance indices) computed with the dbscan (density-based spatial clustering of applications with noise) algorithm from the first operand data according to the maximum radius of the neighborhood to be considered (eps) and the minimum number of points needed for a cluster (minPts). Usage: dbscan(data,eps,minPoints)
Special cases:​
- if the lengths of two vectors in the right-hand aren't equal, returns 0
Examples:​
list<list> var0 <- dbscan ([[2,4,5], [3,8,2], [1,1,3], [4,3,4]],10,2); // var0 equals [[0,1,2,3]]
dead​
Possible use:​
dead(agent) --->bool
Result:​
true if the agent is dead (or null), false otherwise.
Examples:​
bool var0 <- dead(agent_A); // var0 equals true or false
degree_of​
Possible use:​
graphdegree_ofunknown--->intdegree_of(graph,unknown) --->int
Result:​
returns the degree (in+out) of a vertex (right-hand operand) in the graph given as left-hand operand.
Examples:​
int var1 <- graphFromMap degree_of (node(3)); // var1 equals 3
See also:​
dem​
Possible use:​
dem(file) --->geometryfiledemfile--->geometrydem(file,file) --->geometryfiledemfloat--->geometrydem(file,float) --->geometrydem(file,file,float) --->geometry
Result:​
A polygon that is equivalent to the surface of the texture
Examples:​
geometry var0 <- dem(dem,texture); // var0 equals a geometry as a rectangle of weight and height equal to the texture.
geometry var1 <- dem(dem,texture,z_factor); // var1 equals a geometry as a rectangle of width 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​
Possible use:​
determinant(matrix<unknown>) --->float
Result:​
The determinant of the given matrix
Examples:​
float var0 <- determinant(matrix([[1,2],[3,4]])); // var0 equals -2
diff​
Possible use:​
floatdifffloat--->floatdiff(float,float) --->float
Result:​
A placeholder function for expressing equations
diff2​
Possible use:​
floatdiff2float--->floatdiff2(float,float) --->float
Result:​
A placeholder function for expressing equations
directed​
Possible use:​
directed(graph) --->graph
Result:​
the operand graph becomes a directed graph.
Comment:​
WARNING / side effect: this operator modifies the operand and does not create a new graph.
See also:​
direction_between​
Possible use:​
topologydirection_betweencontainer<unknown,geometry>--->floatdirection_between(topology,container<unknown,geometry>) --->float
Result:​
A direction (in degree) between a list of two geometries (geometries, agents, points) considering a topology.
Examples:​
float var0 <- my_topology direction_between [ag1, ag2]; // var0 equals the direction between ag1 and ag2 considering the topology my_topology
See also:​
towards, direction_to, distance_to, distance_between, path_between, path_to,
direction_to​
Same signification as towards
disjoint_from​
Possible use:​
geometrydisjoint_fromgeometry--->booldisjoint_from(geometry,geometry) --->bool
Result:​
A boolean, equal to true if the left-geometry (or agent/point) is disjoints from the right-geometry (or agent/point).
Special cases:​
- if one of the operand is null, returns true.
- if one operand is a point, returns false if the point is included in the geometry.
Examples:​
bool var0 <- polyline([{10,10},{20,20}]) disjoint_from polyline([{15,15},{25,25}]); // var0 equals false
bool var1 <- polygon([{10,10},{10,20},{20,20},{20,10}]) disjoint_from polygon([{15,15},{15,25},{25,25},{25,15}]); // var1 equals false
bool var2 <- polygon([{10,10},{10,20},{20,20},{20,10}]) disjoint_from {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
See also:​
intersects, crosses, overlaps, partially_overlaps, touches,
distance_between​
Possible use:​
topologydistance_betweencontainer<unknown,geometry>--->floatdistance_between(topology,container<unknown,geometry>) --->float
Result:​
A distance between a list of geometries (geometries, agents, points) considering a topology.
Examples:​
float var0 <- my_topology distance_between [ag1, ag2, ag3]; // var0 equals the distance between ag1, ag2 and ag3 considering the topology my_topology
See also:​
towards, direction_to, distance_to, direction_between, path_between, path_to,
distance_to​
Possible use:​
geometrydistance_togeometry--->floatdistance_to(geometry,geometry) --->floatpointdistance_topoint--->floatdistance_to(point,point) --->float
Result:​
A distance between two geometries (geometries, agents or points) considering the topology of the agent applying the operator.
Examples:​
float var0 <- ag1 distance_to ag2; // var0 equals the distance between ag1 and ag2 considering the topology of the agent applying the operator
See also:​
towards, direction_to, distance_between, direction_between, path_between, path_to,
distinct​
Possible use:​
distinct(container) --->list
Result:​
produces a set from the elements of the operand (i.e. a list without duplicated elements)
Special cases:​
- if the operand is a graph, remove_duplicates returns the set of nodes
- if the operand is nil, remove_duplicates returns nil
list var1 <- remove_duplicates([]); // var1 equals []
- if the operand is a map, remove_duplicates returns the set of values without duplicate
list var2 <- remove_duplicates([1::3,2::4,3::3,5::7]); // var2 equals [3,4,7]
- if the operand is a matrix, remove_duplicates returns a list containing all the elments with duplicated.
list var3 <- remove_duplicates([["c11","c12","c13","c13"],["c21","c22","c23","c23"]]); // var3 equals [["c11","c12","c13","c21","c22","c23"]]
Examples:​
list var0 <- remove_duplicates([3,2,5,1,2,3,5,5,5]); // var0 equals [3,2,5,1]
distribution_of​
Possible use:​
distribution_of(container) --->mapcontainerdistribution_ofint--->mapdistribution_of(container,int) --->mapdistribution_of(container,int,float,float) --->map
Result:​
Discretize a list of values into n bins (computes the bins from a numerical variable into n (default 10) bins. Returns a distribution map with the values (values key), the interval legends (legend key), the distribution parameters (params keys, for cumulative charts). Parameters can be (list), (list, nbbins) or (list,nbbins,valmin,valmax)
Examples:​
map var0 <- distribution_of([1,1,2,12.5],10); // var0 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
map var1 <- distribution_of([1,1,2,12.5]); // var1 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
map var2 <- distribution_of([1,1,2,12.5]); // var2 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
See also:​
distribution2d_of​
Possible use:​
containerdistribution2d_ofcontainer--->mapdistribution2d_of(container,container) --->mapdistribution2d_of(container,container,int,int) --->mapdistribution2d_of(container,container,int,float,float,int,float,float) --->map
Result:​
Discretize two lists of values into n bins (computes the bins from a numerical variable into n (default 10) bins. Returns a distribution map with the values (values key), the interval legends (legend key), the distribution parameters (params keys, for cumulative charts). Parameters can be (list), (list, nbbins) or (list,nbbins,valmin,valmax)
Examples:​
map var0 <- distribution2d_of([1,1,2,12.5]); // var0 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
map var1 <- distribution2d_of([1,1,2,12.5],10); // var1 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
map var2 <- distribution2d_of([1,1,2,12.5],10); // var2 equals map(['values'::[2,1,0,0,0,0,1,0,0,0],'legend'::['[0.0:2.0]','[2.0:4.0]','[4.0:6.0]','[6.0:8.0]','[8.0:10.0]','[10.0:12.0]','[12.0:14.0]','[14.0:16.0]','[16.0:18.0]','[18.0:20.0]'],'parlist'::[1,0]])
See also:​
div​
Possible use:​
intdivfloat--->intdiv(int,float) --->intfloatdivfloat--->intdiv(float,float) --->intintdivint--->intdiv(int,int) --->intfloatdivint--->intdiv(float,int) --->int
Result:​
Returns the truncation of the division of the left-hand operand by the right-hand operand.
Special cases:​
- if the right-hand operand is equal to zero, raises an exception.
- if the right-hand operand is equal to zero, raises an exception.
- if the right-hand operand is equal to zero, raises an exception.
Examples:​
int var0 <- 40 div 4.1; // var0 equals 9
int var1 <- 40.1 div 4.5; // var1 equals 8
int var2 <- 40 div 3; // var2 equals 13
int var3 <- 40.5 div 3; // var3 equals 13
See also:​
mod,
dnorm​
Same signification as normal_density
dtw​
Possible use:​
listdtwlist--->floatdtw(list,list) --->floatdtw(list,list,int) --->float
Result:​
returns the dynamic time warping between the two series of values (step pattern used: symetric1) returns the dynamic time warping between the two series of values (step pattern used: symetric1) with Sakoe-Chiba band (radius: the window width of Sakoe-Chiba band)
Examples:​
float var0 <- dtw([32.0,5.0,1.0,3.0],[1.0,10.0,5.0,1.0]); // var0 equals 38.0
float var1 <- dtw([10.0,5.0,1.0, 3.0],[1.0,10.0,5.0,1.0], 2); // var1 equals 11.0
durbin_watson​
Possible use:​
durbin_watson(container) --->float
Result:​
Durbin-Watson computation
Examples:​
float var0 <- durbin_watson([13,2,1,4,1,2]) with_precision(4); // var0 equals 0.7231
dxf_file​
Possible use:​
dxf_file(string) --->filestringdxf_filefloat--->filedxf_file(string,float) --->file
Result:​
Constructs a file of type dxf. Allowed extensions are limited to dxf
Special cases:​
- dxf_file(string): This file constructor allows to read a dxf (.dxf) file
file f <- dxf_file("file.dxf");
- dxf_file(string,float): This file constructor allows to read a dxf (.dxf) file and specify the unit (meter by default)
file f <- dxf_file("file.dxf",#m);
See also:​
edge​
Possible use:​
edge(pair) --->unknownedge(unknown) --->unknownpairedgefloat--->unknownedge(pair,float) --->unknownunknownedgefloat--->unknownedge(unknown,float) --->unknownunknownedgeunknown--->unknownedge(unknown,unknown) --->unknownunknownedgeint--->unknownedge(unknown,int) --->unknownpairedgeint--->unknownedge(pair,int) --->unknownedge(unknown,unknown,int) --->unknownedge(pair,unknown,int) --->unknownedge(unknown,unknown,float) --->unknownedge(pair,unknown,float) --->unknownedge(unknown,unknown,unknown) --->unknownedge(unknown,unknown,unknown,float) --->unknownedge(unknown,unknown,unknown,int) --->unknown
edge_between​
Possible use:​
graphedge_betweenpair--->unknownedge_between(graph,pair) --->unknown
Result:​
returns the edge linking two nodes
Examples:​
unknown var0 <- graphFromMap edge_between node1::node2; // var0 equals edge1
See also:​
edge_betweenness​
Possible use:​
edge_betweenness(graph) --->map
Result:​
returns a map containing for each edge (key), its betweenness centrality (value): number of shortest paths passing through each edge
Examples:​
graph graphEpidemio <- graph([]);
map var1 <- edge_betweenness(graphEpidemio); // var1 equals the edge betweenness index of the graph
edges​
Possible use:​
edges(container) --->container
eigenvalues​
Possible use:​
eigenvalues(matrix<unknown>) --->list<float>
Result:​
The eigen values (matrix) of the given matrix
Examples:​
list<float> var0 <- eigenvalues(matrix([[5,-3],[6,-4]])); // var0 equals [2.0000000000000004,-0.9999999999999998]
electre_DM​
Possible use:​
electre_DM(list<list>,list<map<string,unknown>>,float) --->int
Result:​
The index of the best candidate according to a method based on the ELECTRE methods. The principle of the ELECTRE methods is to compare the possible candidates by pair. These methods analyses the possible outranking relation existing between two candidates. 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.
Special cases:​
- returns -1 is the list of candidates is nil or empty
Examples:​
int var0 <- electre_DM([[1.0, 7.0],[4.0,2.0],[3.0, 3.0]], [["name"::"utility", "weight" :: 2.0,"p"::0.5, "q"::0.0, "s"::1.0, "maximize" :: true],["name"::"price", "weight" :: 1.0,"p"::0.5, "q"::0.0, "s"::1.0, "maximize" :: false]],0.7); // var0 equals 0
See also:​
weighted_means_DM, promethee_DM, evidence_theory_DM,
ellipse​
Possible use:​
floatellipsefloat--->geometryellipse(float,float) --->geometry
Result:​
An ellipse geometry which x-radius is equal to the first operand and y-radius is equal to the second operand
Comment:​
the center of the ellipse is by default the location of the current agent in which has been called this operator.
Special cases:​
- returns a point if both operands are lower or equal to 0, a line if only one is.
Examples:​
geometry var0 <- ellipse(10, 10); // var0 equals a geometry as an ellipse of width 10 and height 10.
See also:​
around, cone, line, link, norm, point, polygon, polyline, rectangle, square, circle, squircle, triangle,
elliptical_arc​
Possible use:​
elliptical_arc(point,point,float,int) --->geometry
Result:​
An elliptical arc from the first operand (point) to the second operand (point), which radius is equal to the third operand, and a int giving the number of points to use as a last operand
Examples:​
geometry var0 <- elliptical_arc({0,0},{10,10},5.0, 20); // var0 equals a geometry from {0,0} to {10,10} considering a radius of 5.0 built using 20 points
See also:​
arc, around, cone, line, link, norm, point, polygon, polyline, super_ellipse, rectangle, square, circle, ellipse, triangle,
emotion​
Possible use:​
emotion(any) --->emotion
Result:​
empty​
Possible use:​
empty(container<KeyType,ValueType>) --->boolempty(string) --->bool
Result:​
true if the operand is empty, false otherwise.
Comment:​
the empty operator behavior depends on the nature of the operand
Special cases:​
- if it is a map, empty returns true if the map contains no key-value mappings, and false otherwise
- if it is a file, empty returns true if the content of the file (that is also a container) is empty, and false otherwise
- if it is a population, empty returns true if there is no agent in the population, and false otherwise
- if it is a graph, empty returns true if it contains no vertex and no edge, and false otherwise
- if it is a matrix of int, float or object, it will return true if all elements are respectively 0, 0.0 or null, and false otherwise
- if it is a matrix of geometry, it will return true if the matrix contains no cell, and false otherwise
- if it is a list, empty returns true if there is no element in the list, and false otherwise
bool var0 <- empty([]); // var0 equals true
- if it is a string, empty returns true if the string does not contain any character, and false otherwise
bool var1 <- empty ('abced'); // var1 equals false
enlarged_by​
Same signification as +
enter​
Possible use:​
stringenterbool--->msi.gama.kernel.experiment.IParameterenter(string,bool) --->msi.gama.kernel.experiment.IParameterstringenterfloat--->msi.gama.kernel.experiment.IParameterenter(string,float) --->msi.gama.kernel.experiment.IParameterstringenterint--->msi.gama.kernel.experiment.IParameterenter(string,int) --->msi.gama.kernel.experiment.IParameterstringenterstring--->msi.gama.kernel.experiment.IParameterenter(string,string) --->msi.gama.kernel.experiment.IParameterstringenterunknown--->msi.gama.kernel.experiment.IParameterenter(string,unknown) --->msi.gama.kernel.experiment.IParameterstringenterany GAML type--->msi.gama.kernel.experiment.IParameterenter(string,any GAML type) --->msi.gama.kernel.experiment.IParameterenter(string,any GAML type,unknown) --->msi.gama.kernel.experiment.IParameterenter(string,float,float,float) --->msi.gama.kernel.experiment.IParameterenter(string,int,int,int) --->msi.gama.kernel.experiment.IParameterenter(string,int,int,int,int) --->msi.gama.kernel.experiment.IParameterenter(string,float,float,float,float) --->msi.gama.kernel.experiment.IParameter
Result:​
Allows the user to enter a boolean value by specifying a title and an initial value Allows the user to enter an int by specifying a title, an initial value, a min, a max and a step value Allows the user to enter a float by specifying a title, an initial value, a min, a max and a step value Allows the user to enter a float by specifying a title and an initial value Allows the user to enter an int by specifying a title, an initial value, a min and a max value Allows the user to enter an int by specifying a title and an initial value Allows the user to enter a string by specifying a title and an initial value Allows the user to enter a value by specifying a title and an initial value. The type will be deduced from the value Allows the user to enter a value by specifying a title, a type, and an initial value Allows the user to enter an int by specifying a title, an initial value, a min and a max value Allows the user to enter a value by specifying a title and a type
envelope​
Possible use:​
envelope(unknown) --->geometry
Result:​
A 3D geometry that represents the box that surrounds the geometries or the surface described by the arguments. More general than geometry(arguments).envelope, as it allows to pass int, double, point, image files, shape files, asc files, or any list combining these arguments, in which case the envelope will be correctly expanded. If an envelope cannot be determined from the arguments, a default one of dimensions (0,100, 0, 100, 0, 100) is returned
Special cases:​
- This operator is often used to define the environment of simulation
Examples:​
file road_shapefile <- file("../includes/roads.shp");
geometry shape <- envelope(road_shapefile);
// shape is the system variable of the environment
geometry var3 <- polygon([{0,0}, {20,0}, {10,10}, {10,0}]); // var3 equals create a polygon to get the envolpe
float var4 <- envelope(polygon([{0,0}, {20,0}, {10,10}, {10,0}])).area; // var4 equals 200.0
eval_gaml​
Possible use:​
eval_gaml(string) --->unknown
Result:​
evaluates the given GAML string.
Examples:​
unknown var0 <- eval_gaml("2+3"); // var0 equals 5
eval_when​
Possible use:​
eval_when(BDIPlan) --->bool
Result:​
evaluate the facet when of a given plan
Examples:​
eval_when(plan1)