AnyLogic
Expand
Font size

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:

  • All group members are serviced individually — Each member of the group should be serviced individually. The example of such a service: turnstiles.
  • Only one group member is serviced, others wait in a queue — The example: a family buying cinema tickets at the counter. All the family members wait in a queue to choose the seats together, but only one of them — the head of the family pays and gets serviced.
  • Only one group member is serviced, others wait in a waiting area — The example: a tourist group buying museum tickets. The tourists do not wait in the queue, they just wait for their tour guide to buy the tickets for the whole group.

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).

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:

  • on size reached — When the specified group size is reached.
  • on timeout — When the specified timeout expires.
  • on time gap — When delay between pedestrian arrivals exceeds the specified gap value.

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 the  PedGroupDisassemble flowchart block. When group leader enters this block, group dissolves, so pedestrians become independent from each other and follow their personal paths.

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.

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 through using loop like this one:

for (Agent ped : group) { }

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

Accessing group and its elements
Function Description
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.
Group leader is chosen internally and may be changed at any time of group movement, so you 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: pedConfiguration.select(group.getLeader()
int getId() Returns the unique identifier for the group.
Control
Function Description
add(Agent ped) Adds the given pedestrian (ped) to this group.
remove(Agent ped) Removes the given pedestrian (ped) from this group.
disassemble() Disassembles this group, removes all the pedestrians from this group making them independent. Group is destroyed.
setFormation(GroupFormation formation) Sets a new formation type for this group.
Statistics
Function Description
int size() Returns the number of pedestrians in this group.
How can we improve this article?