Returns a list of indexes of agents from a list that satisfies the test argument.
Returns a list of indexes of agents from a list that the test argument. The test can consist of multiple conditions.
In the test expressions, agent properties refer to the evaluating agent while
the special variable “
_” refers to the evaluated agent from the given list.
For example, the test expression
age < ask(_,age) would compare the
evaluating agent’s age against the age of each agent in the list.
A list expression that evaluates to a list of agent ids.
A boolean expression used to evaluated the current agent against the given list of agents.
A list of indexes of agents from
agent-list that satisfies the test
The following sets the list
my_list to the list of indexes of agents from the evaluating agent’s school who are male and older than 15:
my_list = index_agents(members(School), ask(_,sex)==male & ask(_,age)>15)
filter_agents() filter_by_index() filter_values() index_values() list() pair-expression