Pedestrian Groups

AnyLogic supports modeling groups of pedestrians. You can assemble pedestrian into groups, adjust the formation of the group and disassemble the group using the specific blocks of Pedestrian Library.

Servicing groups of pedestrians

When passing through services with lines, a group of pedestrians may behave differently.

The behaviors are:

You can choose one of three alternative behavior modes in the flowchart block that creates pedestrian groups (it can be PedSource, PedEnter, or PedGroupAssemble), and even change the group servicing settings in the properties of some specific service with lines (Grouping property section).

Demo model: Group Behavior in Services

Assembling groups

Groups can be assembled by PedSource, PedEnter and PedGroupAssemble flowchart blocks.

PedSource generates pedestrians and also can be used to generate groups of pedestrians.

PedEnter accepts pedestrians generated somewhere (e.g. using Process Modeling Library Source block) at input port and injects pedestrians into the simulated environment at specified location. This block also can be used to organize groups from sequence of pedestrians on input port.

PedGroupAssemble organizes groups from sequence of pedestrians on input port. Also this block is used to reassemble groups which have been split by blocks which don't support groups (like PedService): pedestrians wait in the given area and leave it in their original group when the whole group arrives.

You can choose how you want groups to be created:

Changing forms of groups

Groups may have one of predefined forms (swarm, front, chain) or a custom form. Custom form of the group can be defined with a polyline. Points of such a polyline mean desired locations of pedestrians in the group.

The form of the group is defined on group formation and can be changed later using the PedGroupChangeFormation block. This block causes group to change its form to a specified one when group leader passes this block.

Disassembling groups

Groups are disassembled by PedGroupDisassemble flowchart block. When group leader enters this block, group dissolves, so pedestrians become independent from each other and follow their personal paths.

Demo model: Pedestrian Groups

Social distancing

Pedestrians in the group do not observe social distance between each other while moving or waiting in queues or service areas.

Groups and nodes with access restrictions

When the route is being created for pedestrian groups, all members of the group will receive the same instructions on how to handle the closed nodes: either all of them will wait until the node opens or all of them will bypass the node.

When the members of the group get into a queue to enter a node where access restrictions are enabled, every member is handled individually: they enter the node one by one.

Note: To avoid situations where agents may remain in the queue indefinitely, we recommend disassembling groups before they have to pass through such nodes, and reassembling them after.

Working with groups programmatically

Groups of pedestrians are instances of class Group. You can work with groups programmatically using the API of this class.

Pedestrians in the group can be iterated using loop like this one:

for (Agent ped : group) { }

There is also a set of functions for working with group contents:

int size() - Returns number of pedestrians in this group.

disassemble() - Disassembles this group, removes all the pedestrians from this group making them independent. Group is destroyed.

add(Agent ped) - Adds the given pedestrian (ped) to this group.

remove(Agent ped) - Removes the given pedestrian (ped) from this group.

Agent get(int index) - Returns a pedestrian with the given index in a group. Index is 0-based, leader has index 0.

Agent getLeader() - Returns leader of this group. Note that group leader is chosen internally and may be changed at any time of group movement, so user shouldn't completely rely on the value returned by this function. Sample use cases of this function:
- the designation of an event occurring once per group, e.g. when a pedestrian leaving PedGroupAssemble block is a group leader: ped.getGroup().getLeader() == ped
- group selection by selection of its leader:

setFormation( GroupFormation formation ) - Sets a new formation type for this group.

int getId() - Returns unique identifier for the group.