A real-time, intelligent pricing engine for smart city parking lots that dynamically adjusts rates based on demand, location-based competition, and environmental context (traffic, vehicle type, etc). This project simulates urban-scale parking lot optimization using streaming data and edge-level intelligence.
Urban congestion and inefficient parking pricing lead to traffic delays, lost revenue, and poor utilization. This system models how cities can use data to drive dynamic pricing for parking in real-time, optimizing:
- Space utilization
- Revenue generation
- Customer fairness
Built using Pathway's stream processing framework, the system processes simulated CSV streams and implements three distinct pricing strategies (models).
| Layer | Tools/Frameworks |
|---|---|
| Language | Python 3.11 |
| Stream Engine | Pathway (for real-time table processing) |
| Visualization | Panel + Bokeh |
| IDE/Notebook | Jupyter Notebook / Google Colab |
| Data Source | Simulated CSV stream (parking_stream.csv) |
| Architecture Tool | Mermaid.js (diagram below) |
flowchart TD A[parking_stream.csv (simulated real-time feed)] A --> B[Pathway Streaming Ingest] B --> C[Model 1: Timestamp + Schema Parsing] C --> D[Model 2: Demand-Based Pricing] D --> E[Model 3: Competitive Adjustment] E --> F[Final Table: final_price] F --> G[Live Price Visualization (Panel + Bokeh)]
- Reads parking_stream.csv in simulated real-time
- Applies schema parsing
- Converts string timestamp → datetime
- Output: table with real-time streaming rows
🛠️ Tools: Pathway.replay_csv, dt.strptime
Dynamically adjusts price based on real-time indicators:
Formula:
-
demand_raw = α × (Occupancy / Capacity) + β × QueueLength − γ × traffic_score + δ × IsSpecialDay + ε × vehicle_score
-
demand_norm = min(1, max(0, demand_raw / 5))
-
price = base_price × (1 + λ × demand_norm)
Coefficients (Tunable):
| Symbol | Factor | Default |
|---|---|---|
| α | Occupancy weight | 1.0 |
| β | Queue length | 0.1 |
| γ | Traffic penalty | 0.5 |
| δ | Special day bonus | 0.3 |
| ε | Vehicle type score | 1.0 |
| λ | Demand scaler | 0.5 |
💡 Algorithm: Feature-weighted scoring → normalization → capped pricing
Incorporates spatial dynamics: adjusts price downwards if nearby competitors are cheaper.
Steps:
- Cross join all parking lots → lot pairs
- Compute Haversine distance between locations
- Filter only pairs where price_right < price_left
- For each lot, compute avg_price_diff = avg(price_left − price_right)
- final_price = price − φ × avg_price_diff
Parameters:
| Variable | Description | Default |
|---|---|---|
| φ (phi) | Competition sensitivity | 0.5 |
Algorithm: Cross join → spatial filter → groupby-reduce → price correction
Final Output: final_price ∈ [min_price, max_price]
- Ingest simulated data as a stream
- Parse timestamps and schema (Model 1)
- Compute demand-weighted price (Model 2)
- Identify and incorporate cheaper nearby competitors (Model 3)
- Output dynamic final_price
- Visualize in real-time with Bokeh + Panel
- Time series plot of final_price per lot
- Reacts to spikes in demand, traffic, and competition
- Highly tunable via phi, lambda, alpha, etc.
| File Name | Description |
|---|---|
| Sample_Notebook.ipynb | Base model development notebook |
| dataset.csv | Sample CSV used for simulation |
| README.md | Project documentation |