# Shopping using Triggers to Change Behavior

Created with software version: 2024.1

## 1. Overview

In this example, we show how triggers can be used to simulate shopping. The model simulates a walkway with shops on the side. As people walk past they are attracted to enter each shop. This is modeled using triggers. This description assumes the user is familiar with basic use of Pathfinder.

## 2. Before Starting

Before beginning this tutorial:

• Download the shopping_triggers.pth files to follow along. Note that this was made with a pre-release version of Pathfinder 2024, however it will import into the current release.
• Read through the Triggers section in the User Manual.

## 3. Geometry

As shown below, the passageway is 5 m wide and each store is 5x5 m. People enter, walk through the passageway, and then exit.

Triggers are located in the passageway. These attract occupants to enter the adjacent stores.

## 4. Step 1: Geometry

Make the model as shown above.

• Draw the geometry, including the doors.
• Name each room.
• Name the Entry and Exit doors.
• Add the queues. The queue name should match the store name. The service time at all queues (except Fast Food) is 60 seconds.
• The Fast Food store has a queue, a counter, and a seating area that the occupants move through before exiting, see below.
• The Restaurant has four small rooms that represent tables. Occupants who enter the restaurant go to one of the four tables and stay there for 120 seconds, see below.

Obviously, the service and restaurant wait times are not realistic. You can change them to more realistic numbers.

## 5. Step 2: Profiles

Triggers interact with occupant Profiles and Behaviors, so we will start by creating profiles with the attributes we want. For this model, we just want to change the colors of the occupants to show what they are doing:

• Shopping - This means the occupant is walking in the passageway and able to be attracted to enter a store. The color will be green.
• Browse - This means the occupant has entered a store, but is just browsing. They will not purchase an item. The color will be blue.
• Buy - This means the occupant has entered a store and will buy something by entering a queue with a time required for the purchase. The color will be red.

To set the profiles:

• Double-click Profiles in the Navigation view.
• Select the Default profile and change the name to Shopping.
• Change the Color to blue.
• Click the Movement tab and change the Trigger Susceptibility (Seeking) to 20%. This means that if the occupant is walking through the passageway, they will have a 20% probability of responding to a trigger. For this model, the Trigger Susceptibility (Waiting) is not used.
• Now click New and make a new profile named Browse, based on the Shopping profile. Change the color to green.
• Again click New and make a new profile named Buy, based on the Shopping profile. Change the color to red.
• Close the Edit Profiles dialog.

## 6. Step 3: Behaviors

When an occupant responds to a trigger, they can change their behavior. In this example, the occupants enter the store associated with the trigger and either browse or buy an item.

### 6.1. Make a Shopping Behavior

The shopping behavior is the "normal" behavior in this model. When shopping the occupants are moving in the passageway from the entry to the exit door.

• Double-click the Goto Any Exit behavior. Change the name to Shopping.
• Click the Exit action and for the allowable Exits, select the Exit door in the model.

### 6.2. Make Clothing Behaviors

We will make three behaviors to control how the occupant responds to a Clothing trigger. We will make the Buy Clothing and Browse Clothing behaviors first, then the Clothing behavior that will reference the buy and browse behaviors.

When finished, your behaviors will look as shown below.

#### 6.2.1. The Buy Clothing Behavior

• Double-click Behaviors in the navigation view.
• Make a new behavior named Buy Clothing.
• Add a Change Profile action and set to 100% Buy. This change in profile changes the color of the occupant so that we can follow this in the results.
• Add a Goto Queues action and select the Clothing queue. The occupant will go to the queue path and wait for service.
• Add a Change Profile action and set to 100% Shopping. This change in profile changes the color of the occupant back to the shopping state.
• Add a Change Behavior action. Set the Target Behaviors to 100% Shopping. The occupant leaves the store and continues in the passageway towards the Exit.

#### 6.2.2. The Browse Clothing Behavior

• Double-click Behaviors in the navigation view.
• Make a new behavior named Browse Clothing.
• Add a Change Profile action and set to 100% Browse. This change in profile changes the color of the occupant so that we can follow this in the results.
• Add a Wait action and set the wait time to 5 seconds.
• Add a Change Profile action and set to 100% Shopping. This change in profile changes the color of the occupant back to the shopping state.
• Add a Change Behavior action. Set the Target Behaviors to 100% Shopping. The occupant leaves the store and continues in the passageway towards the Exit.

So now we have two behaviors in the store: some occupants will buy something and some will just browse. We set up the two options by adding a Clothing behavior.

#### 6.2.3. The Clothing Behavior

This is the first behavior for all occupants that respond to the Clothing trigger.

• Double-click Behaviors in the Navigation view.
• Make a new behavior named Clothing.
• Add a Goto Rooms action and select the room as Clothing. The occupant will enter the store.
• Add a Change Behavior action, set the Target Behaviors to 75% Browse Clothing and 25% Buy Clothing. The occupant has a 75% chance that they will just browse and a 25% chance they will buy something.

This shows the three Clothing behaviors.

### 6.3. Repeat for All Other Stores Except Fast Food and Restaurant

Repeat this pattern for all stores, except the Fast Food store and the Restaurant. Everyone who enters the Fast Food store buys something, so they: go to the Fast Food queue, enter the Fast Food counter, go the Seating Area, wait, and then leave the store.

The Restaurant does not have a queue. Instead those entering go to a table, wait, and then leave.

## 7. Step 4: Triggers

The triggers are located in front of each store. As an occupant enters the trigger, they have a 20% probability that they will respond to the trigger (as set in profile).

• In the drawing toolbar, select the Add a Trigger tool. Place the trigger in front of the Clothing store.
• Change the Name to Clothing.
• Change the Behavior to Clothing. This is the behavior that will be applied to the occupant when they respond to the trigger.
• Change the Awareness Radius to 2.5 m.

The Clothing trigger should look as shown below.

Repeat for all the triggers for each store. Note that the Toys trigger has a radius of 3.5 m since the store is located on the outer corner of the curve and occupants walk close to the inner corner. A bigger radius makes sure they are exposed to the Toys trigger.

We want to reduce the number of occupants that respond to the Restaurant trigger. We accomplish this by changing the trigger Influence to 25%. Set the Initial Value to 25%. Now the probability an occupant will enter the Restaurant is 5% (20% in Profile x 25% in Trigger).

## 8. Step 5: Occupant Sources

• Right-click the Entry door and select Add Occupant Source.
• Set the Flow Rate to Constant and 0.2 pers/s. People will arrive every 5 seconds.
• Set the Profile to Shopping. This sets the color.
• Set the Behavior to Shopping. The people will have the shopping behavior, so they will enter and move toward the exit.

## 9. Step 6: Run the Simulation

To run the simulation:

• In the Simulation menu, click Simulation Parameters. Set the End Time to 1200 seconds.
• Click Run Simulation. Ignore the warnings. The warnings occur because of the complex chain of behaviors.

## 10. Step 7: View Results

The following shows the results at 600 seconds. The display includes the occupant paths. You can see that an occupant has entered each of the stores.