📍 The Facility Location Problem: Where to Place Resources for Maximum Coverage
Explore the classic operations-research problem of choosing where to site a limited number of facilities, like EV charging stations, warehouses, or fire stations, to best serve a set of demand points, through the p-median and p-center formulations.
The simulation places a set of weighted demand points on a map and lets you open a limited number of facilities among candidate sites, visualizing in real time how the p-median total weighted distance and the p-center worst-case distance change as facilities are added, moved, or swapped.
🔬 What It Demonstrates
The simulation places a set of weighted demand points on a map and lets you open a limited number of facilities among candidate sites, visualizing in real time how the p-median total weighted distance and the p-center worst-case distance change as facilities are added, moved, or swapped.
🎮 How to Use
Set the number of facilities p with the slider, click candidate sites to open or close them, toggle between the p-median and p-center objective to see how the same demand points get served differently, and press the heuristic-solve button to watch greedy construction and swap-based local search improve the layout step by step.
💡 Did You Know?
The p-median problem was first formalized in the 1960s by operations researchers studying public facility siting, and it remains so computationally hard that even today, large real-world instances with thousands of candidate sites are typically solved with heuristics rather than exact optimization methods.
Watch a greedy-plus-swap heuristic relocate facilities across a plane of demand points, service regions shifting as total weighted travel cost trends downward.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install