Skip to content

Simulation study of proposed dog park spaced based on BOIDS flocking model and mass transfer convection and diffusion

Notifications You must be signed in to change notification settings

DylanEsguerra/DOG_PPL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dog Park Layout Simulator

Project Overview

This project aims to understand and optimize dog park space utilization through computational modeling of foot traffic patterns. By simulating how dogs and their owners might navigate through a proposed dog park layout, we can identify potential congestion points, underutilized areas, and optimize the placement of features and obstacles.

Simulation Methods

The project implements two complementary simulation approaches to model movement and space utilization:

1. Flocking Simulation (BOIDS)

The flocking simulation utilizes Craig Reynolds' BOIDS algorithm to model the natural group behavior of dogs in a social setting. This agent-based approach simulates individual dogs moving through the space following three primary rules:

  • Separation: Dogs avoid crowding and colliding with each other
  • Alignment: Dogs tend to move in the same direction as nearby dogs
  • Cohesion: Dogs are attracted to the center of mass of nearby dogs

Additional rules handle obstacle avoidance and boundary constraints. This simulation provides a realistic representation of social animal movement patterns and emergent group behaviors.

2. Diffusion-Convection Simulation

The diffusion-convection simulation takes a different approach by treating foot traffic as a fluid-like phenomenon modeling the transport of solutes in a fluid:

  • Diffusion: Models the natural spreading of movement in all directions
  • Convection: Represents directed movement trends in specific directions

This physics-based approach treats dogs and owners as a concentration that flows through the park, spreading around obstacles and settling into a steady-state distribution over time. The simulation provides insights into overall traffic density and identifies areas of high and low utilization.

Layout Extraction

The simulator works with blueprint images of proposed dog park layouts:

  1. Boundary Detection: Red boundaries in the blueprint define the overall park perimeter
  2. Obstacle Identification:
    • White obstacles (structures, benches, etc.) are detected based on color thresholds
    • Grey obstacles (trees, posts, etc.) are identified using separate color processing
  3. Traversable Space: Areas inside the boundaries that are not obstacles are identified as traversable space
  4. Entry Points: The system detects park entrances for realistic simulation of arrival patterns

The Space_Preprocessor module handles this conversion from blueprints to simulation-ready data structures, with an interactive approval process allowing manual correction of detected features.

Key Features

  • Interactive visualization with parameter adjustment sliders
  • Heatmap generation for analyzing space utilization
  • Adjustable simulation parameters (diffusion coefficient, convection direction, cohesion/separation/alignment factors)
  • Automatic obstacle and boundary detection from blueprints
  • Support for downsampling to speed up development iterations

Analysis

The generated heatmaps provide visual insights into:

  • High-traffic areas that may experience congestion
  • Underutilized spaces that might benefit from feature placement
  • Flow patterns around obstacles
  • Impact of entry points on overall space utilization

By comparing results from both simulation methods, designers can gain a more comprehensive understanding of how the proposed space might function in real-world scenarios.

Example Results

Below are example heatmaps generated by the two simulation methods, visualizing space utilization in a sample dog park layout.

Proof of Concept: Simple Rectangle Layout

The following figures are generated using a simple empty rectangular layout (no obstacles, just boundaries). This serves as a proof of concept to demonstrate the general behavior of the algorithms in an unobstructed space.

Diffusion-Convection Heatmap (Simple Layout)

Diffusion-Convection Heatmap

Figure: Concentration heatmap from the diffusion-convection simulation on a simple rectangle. High values (yellow/white) indicate areas with the most expected foot traffic, while dark regions are less utilized.

Flocking (BOIDS) Heatmap (Simple Layout)

Flocking Heatmap

Figure: Agent density heatmap from the flocking (BOIDS) simulation on a simple rectangle. Brighter areas show where simulated dogs spend the most time, revealing emergent group behaviors and congestion points.

Results on Proposed Dog Park Layout with Obstacles

The following figures show the results of both simulation methods on the actual proposed dog park layout, including detected obstacles and boundaries. These visualizations provide insight into how the real space will be utilized, highlighting congestion points, underutilized areas, and the impact of obstacles on movement patterns.

Diffusion-Convection Heatmap (Proposed Layout)

Diffusion-Convection Heatmap - Proposed

Figure: Steady-state concentration heatmap from the diffusion-convection simulation on the proposed dog park layout with obstacles.

Flocking (BOIDS) Heatmap (Proposed Layout)

Flocking Heatmap - Proposed

Figure: Agent density heatmap from the flocking (BOIDS) simulation on the proposed dog park layout with obstacles.

Additional Flocking Visualizations

The primary heatmap can be a bit faint making understanding the foot traffic difficult so too additonal visualizations are provided.

Flocking Total Traveled Path

Figure: Binary map of all areas visited by agents during the flocking simulation (proposed layout).

Flocking Coarse-Grained Density Heatmap

Figure: Coarse-grained, normalized density heatmap from the flocking simulation (proposed layout).

Results Interpretation

The following interpretations can help guide design decisions based on the simulation outputs:

Diffusion-Convection Heatmap

  • What it shows:
    • Visualizes the steady-state "foot traffic" density across the park, treating movement like a fluid.
  • How to interpret:
    • Bright (yellow/white) areas indicate regions with the highest expected traffic, such as main paths or areas near entrances.
    • Dark areas are underutilized, possibly due to obstacles or distance from entry points.
    • Obstacles and boundaries are respected by the simulated flow, creating "shadows" or low-density regions behind them.
  • Design implications:
    • High-density areas may need reinforcement, wider paths, or additional features to manage congestion.
    • Underutilized areas could be enhanced with attractions or amenities to balance usage.

Flocking (BOIDS) Heatmap

  • What it shows:
    • Displays where simulated dogs (agents) spend the most time, based on social animal movement rules.
  • How to interpret:
    • Bright regions show emergent gathering points or preferred paths.
    • Congestion points may appear at bottlenecks, narrow passages, or near popular features.
    • Obstacles create natural flow diversions, which can be seen as gaps or low-density zones.
  • Design implications:
    • Identify and address potential congestion points.
    • Use natural gathering areas for placing water stations, benches, or shade.
    • Ensure that obstacles do not create dead-ends or inaccessible regions.

Additional Flocking Visualizations

  • Total Traveled Path Map:
    • Shows all areas visited by agents, highlighting which parts of the park are never visited
  • Coarse-Grained Density Heatmap:
    • Makes it easier to spot broad patterns and under/over-utilized zones, especially in large or complex layouts.

By iteratively adjusting the park layout and re-running the simulations, designers can optimize for both efficient use and a pleasant experience for dogs and their owners.

Usage

You can run both simulation types in two modes:

  • Heatmap Mode (--heatmap flag):

    • Runs the simulation for many steps and saves summary figures (heatmaps) to the figures directory.
    • Best for analyzing overall space utilization and generating results for reports or the README.
    • No animation window will appear; only images are saved.
  • Animation Mode (no --heatmap flag):

    • Opens an interactive animation window showing the simulation in real time.
    • Useful for visually exploring the dynamics and adjusting parameters live.
    • Not recommended for very long simulations, as it can be slow.

Preprocessing a Blueprint

python src/Space_Preprocessor.py path/to/blueprint.png

Obstacles can be deselected by clicking on them. This is often required as the object detection has some errors.

Select Done when the space looks correct and respond yes to the following terminal prompt.

Running Simulations

Diffusion-Convection Simulation

  • To generate a heatmap (summary figure, best for long runs):

    python src/diffusion_simulation.py --layout layouts/processed_space.pkl --diffusion 1.0 --convection_x 0.5 --convection_y -0.1 --dt 0.15 --steps 2000 --heatmap

    This will save the heatmap to the figures directory and not show an animation.

  • To view the interactive animation:

    python src/diffusion_simulation.py --layout layouts/processed_space.pkl --diffusion 1.0 --convection_x 0.5 --convection_y -0.1 --dt 0.15 --steps 500

    This will open a window with a live animation of the simulation.

Flocking (BOIDS) Simulation

  • To generate a heatmap (summary figure, best for long runs):

    python src/flocking_simulation.py --layout layouts/processed_space.pkl --steps 2000 --heatmap

    This will save the heatmap to the figures directory and not show an animation.

  • To view the interactive animation:

    python src/flocking_simulation.py --layout layouts/processed_space.pkl --steps 500

    This will open a window with a live animation of the simulation.

About

Simulation study of proposed dog park spaced based on BOIDS flocking model and mass transfer convection and diffusion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors