Skip to content

Agent-Based Modeling Theory

Agent-Based Modeling simulates individual agents that interact with their environment. Instead of aggregate statistics, you model each person’s decision.

Source: Wilensky, U. & Rand, W. — An Introduction to Agent-Based Modeling (MIT Press, 2015)

DatasetWhat We UseLink
Current Weather (HKO)Foot traffic modifier (rain/heat reduces outdoor movement)View →
Rainfall NowcastReal-time rain events triggering agent shelter-seeking behaviourView →
MTR RidershipCalibrate agent arrival/departure waves at transit nodesView →
Census PopulationBase agent population per zoneView →
Traffic DetectorsVehicle flow validation for agent movementView →
A&E Wait TimesPopulation density proxy for validationView →
Consumer Price IndexAgent spending parameters calibrated to current pricesView →

Traditional agents follow rule-based logic:

IF distance < 400m AND price < budget AND cuisine_matches:
visit_probability = base_rate * distance_decay * preference_weight
IF random() < visit_probability: VISIT

Strengths: Fast, reproducible, can simulate millions of agents. Weakness: Rules are brittle. Real humans weigh tradeoffs, mood, weather, social context.

Three Design Principles (Wilensky & Rand, Ch. 3)

Section titled “Three Design Principles (Wilensky & Rand, Ch. 3)”

1. Heterogeneity — Agents differ in meaningful ways: income, location, preferences, habits.

2. Autonomy — Each agent decides based on its own perception. An office worker sees “many competitors nearby” as options; a shop owner sees saturation.

3. Interaction — Agents influence each other. Mrs. Cheung only visits if neighbors recommend. Jenny only visits if friends post on Instagram.

ABM reveals emergent patterns that no single formula predicts:

  • Network effects from word-of-mouth
  • Tipping points where a restaurant goes from unknown to popular
  • Conflicting requirements that make serving all segments impossible

Persona mix (5 personas, weights sum to 1.0):

PersonaWeightSample Size
Office Worker30%30 agents
Local Resident30%30 agents
Tourist15%15 agents
Foodie/Expat15%15 agents
Family10%10 agents

Simulation runs: 100 runs per analysis call. overallVisitRate = sum(visitRate × sampleSize) / 100.

Visit rate formula (per persona): huffBase × cuisineMatch × targetMatch × priceFit × distanceFit × noise

Multiplier values:

  • huffBase: Huff model capture probability (from calcHuff); serves as the base visit rate anchor
  • cuisineMatch: 1.0 if persona preferences overlap with restaurant cuisine, 0.3 if not
  • targetMatch: 1.2 if persona type is in targetCustomers, 0.8 if not targeted
  • priceFit: 1.0 if persona’s income supports the price band, 0.4 if priced out
  • distanceFit: decays from 1.0 (at 0m) toward 0.2 as distance increases
  • noise: random multiplier in [0.8, 1.2] range providing run-to-run variance

Emergent insights: After simulation, the model generates contextual insight strings based on results:

  • Best-performing and worst-performing persona (with visit rate %)
  • If competitors.total &gt; 30: “High competition triggers price-war behaviour”
  • If overallVisitRate &gt; 0.3: “Strong overall attraction suggests potential queue/wait times”
  • If overallVisitRate &lt; 0.1: “Low visit rate suggests concept-market mismatch”
  • If cuisineTypes.length &gt; 2: “Multi-cuisine concept appeals to broader agent pool but may dilute brand identity”
DateChangeWhy
2026-03-25Visit rate formula changed from flat 2% to huffBase × cuisineMatch × targetMatch × priceFit × distanceFit × noiseAll locations returned ~2% regardless of inputs; needed Huff capture rate as base anchor
2026-03-25Emergent insights generation addedResults were returning raw numbers with no interpretation; contextual strings improve UX
2026-03-25100 simulation runs formalizedSingle-pass output was unstable; 100 runs and weighted averaging provides stable estimates
2026-03-24Initial implementationVisit rates undifferentiated (~2% everywhere); architecture established, calibration needed