### Nikhil Kumar

A stylish blog on my code

Changelog:

# Crowd Simulation of Social Forces

In this post we will discuss the implementation of Social Forces in crowd simulations using SteerLite. The projects were created by a team of 3 as part of a class project for Introduction to Computer Graphics at Rutgers University.

## Demonstration

### Bottle Neck

Info In this simulation a crowd of agents needs to pass through a narrow opening of the room. The situation leads to many agents shoving each other to leave the room.

Bench Scores:

### One Way Hallway

Info In this simulation a crowd of agents needs to pass through a hallway. The agents are all traveling one direction. room.

Bench Scores:

### Two Way Hallway

Info In this simulation a crowd of agents needs to pass through a hallway. The agents are traveling in both directions. room.

Bench Scores:

### Four Way Hallway

Info In this simulation a crowd of agents need to pass through a four way intersection.

Bench Scores:

# Implementation

#### Sum of Forces:

$m_i\frac{dv_i}{dt} = F_{goal} + F_{agents} + F_{walls}$

This is the sum of all the forces that make up the Social Force.

#### Goal Directed Force:

$F_{goal} = m_i\frac{v_i^0(t)e^0_i(t) - v_i(t)}{\tau_i}$

This Force changes the speed and direction according to the direction of the goal.

We choose to divide the goal force by 5 so that it does not overpower other collision avoiding forces during cases such as the bottleneck test case. Here is a print out of the results before goal force was divided. We can see that the magnitude is roughly equal to the repulsion force. This is not good.

#### Agent Collision Avoidance Force:

$F_{agents} = \sum_{j \ne i }F_{ij}$ $F_{ij} = (A_ie^{\frac{r_{ij}-d_{ij}}{B_i}} + kg(r_{ij} - d_{ij}))n_{ij} + kg(r_{ij}-d_{ij})\Delta v^t_{ji}t_{ij}$

$F_{ij}$ is the sum of forces of agent j on agent i
$F_{walls} = \sum_{j \ne i}F_{iW}$ $F_{iW} = (A_ie^{\frac{r_{i}-d_{iW}}{B_i}} + kg(r_{i} - d_{iW}))n_{iW} - kg(r_{i}-d_{iW})(v_i * t_{iW})t_{iW}$
$F_{iW}$ is the sum of forces of wall W on agent i