Design a Smart Workspace Allocation & Ranking Engine
System DesignModel answerLast updated
Architect an enterprise workspace ranking engine that evaluates hard constraints, minimizes space fragmentation, ensures inter-team fairness, and balances user preferences with learned scoring models.
Design an enterprise meeting room allocation and ranking system. Given a user's reservation request—including duration, time window, expected attendees, mandatory/optional equipment, and location parameters—the system must return a prioritized list of viable spaces.
Your design should cover:
- High-Level System Architecture & Filtering: Distinguishing hard feasibility constraints (candidate generation) from soft ranking criteria (scoring).
- Scoring Function Formulation: Explaining how to evaluate factors such as schedule fragmentation, space capacity efficiency, attendee walking distance, equipment overlap, historical no-show risks, and user preferences.
- Weight Tuning Strategy: Moving from rule-based heuristics to a hybrid machine-learning ranking model (LTR), including position bias mitigation and multi-objective optimization (user convenience vs. organizational efficiency).
- Fairness & Starvation Prevention: Mechanisms to prevent high-demand rooms from being monopolized by specific teams or executive groups, avoiding feedback loops.
- Experimentation Strategy: Designing an A/B testing framework that accounts for network interference and inventory competition (shared scarce resource constraints).
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
System Architecture & Domain Model
An enterprise workspace allocation engine serves a dual purpose: optimizing user convenience while maximizing facility utilization. The primary architectural challenge lies in decoupling fast candidate retrieval (hard spatial/temporal bounds) from high-throughput soft ranking (multi-criteria scoring).
[ Client Request ]
│
▼
[ API Gateway / Orchestrator ]
│
├──► [ Candidate Generator ] ──► Queries In-Memory Schedule Index (Sharded by Location)
│ │ (Hard filters: Capacity, Time, Required Gear)
│ ▼
│ [ Candidate Set: ~50-200 slots ]
│ │
├──► [ Feature Hydrator ] ──► Fetches vectors from Online Feature Store (Redis/DynamoDB)
│ │
├──► [ Ranking Engine ] ────► Computes Core Score (Linear or LTR Model)
│ │
├──► [ Re-Ranker ] ────────► Applies Fairness Ledger & Anti-Starvation Rules
│ │
▼ ▼
[ Ranked API Response + Impression Logging to Kafka ]
Scale & Non-Functional Requirements
- Scale: ~50,000 employees, 200 physical locations, ~10,000 bookable spaces.
- Traffic Profile: ~100,000 search queries daily. Peak load centered before major business hours (~100 QPS).
- Latency Budget: $p_{99} \le 250 \text{ ms}$ for candidate generation and scoring combined.
- Consistency: Hard booking creation requires strong consistency (e.g., transactional checks or dynamic locking). Search and ranking operate under eventual consistency (stale by seconds/minutes).
1. Candidate Generation (Hard Constraints)
Before applying score models, the candidate generator narrows down the global space inventory to a feasible set ($N \approx 50\text{--}200$) using an in-memory interval index sharded by campus/building.
Hard Filtering Criteria:
- Temporal Availability: The space must be completely unreserved for a contiguous block of length $T_{\text{duration}}$ inside the window $[T_{\text{start}}, T_{\text{end}}]$.
- Capacity Floor: $\text{Capacity}{\text{room}} \ge \text{Count}{\text{attendees}}$.
- Mandatory Equipment: $\text{Equipment}{\text{required}} \subseteq \text{Equipment}{\text{room}}$ (bitmask check).
- Access Rights: Filter out restricted rooms (e.g., executive suites) unless authorized.
2. Feature Definitions & Multi-Factor Scoring
Once candidates are retrieved, each candidate pair $(r, s)$—room $r$, start time slot $s$—is evaluated. All soft signals are normalized to $[0, 1]$ prior to weighting.
$$\text{Score}(r, s \mid q) = \sum_{k} w_k \cdot f_k(r, s, q)$$
SCORING MATRIX
┌───────────────────────┬─────────────────────────────────────────────────────────────┐
│ Feature Category │ Mathematical / Logical Formulation │
├───────────────────────┼─────────────────────────────────────────────────────────────┤
│ Equipment Match │ f_equip = |Eq_opt ∩ Eq_room| / |Eq_opt| - Penalty(Waste) │
├───────────────────────┼─────────────────────────────────────────────────────────────┤
│ Capacity Overhead │ f_cap = 1 - ((Capacity_room - Headcount) / Capacity_room) │
├───────────────────────┼─────────────────────────────────────────────────────────────┤
│ Distance & Traversal │ f_dist = exp(- λ · Weighted_Walk_Time(Attendees, Room)) │
├───────────────────────┼─────────────────────────────────────────────────────────────┤
│ Schedule Fragmentation│ f_frag = Penalty(gaps < min_unit) + Reward(abutment) │
├───────────────────────┼─────────────────────────────────────────────────────────────┤
│ Historical Preference │ f_pref = log(1 + Historical_Bookings(User, Room)) │
├───────────────────────┼─────────────────────────────────────────────────────────────┤
│ Reliability Adjusted │ f_noshow = (1 - P_noshow(Organizer, Team)) · Scarcity(r, s) │
└───────────────────────┴─────────────────────────────────────────────────────────────┘
Deep Dive into Key Signals:
-
Schedule Fragmentation ($f_{\text{frag}}$): A major cause of under-utilized real estate is unusable gaps (e.g., a 15-minute free window between two 1-hour meetings).
- Let $g_{\text{before}}$ and $g_{\text{after}}$ be the duration of free gaps created immediately before and after slot $s$.
- If $g < 30\text{ mins}$ and $g > 0$, apply a heavy penalty (e.g., $-1.0$).
- If $g = 0$ (perfect abutment to an existing booking or boundary), apply a positive reward ($+0.5$).
-
Distance & Traversal ($f_{\text{dist}}$): Rather than relying on straight-line Euclidean distance, use a intra-building routing graph that incorporates floor changes and elevator latency: $$\text{Cost} = \text{Time}{\text{walk}} + \alpha \cdot |\text{Floor}{\text{room}} - \text{Floor}_{\text{attendee}}| + \beta \cdot \text{BuildingChange}$$ Aggregate the weighted 80th percentile walking time across all physical (non-remote) attendees.
-
No-Show Scarcity Adjustment ($f_{\text{noshow}}$): Compute user and team no-show probabilities using Beta-binomial smoothing: $$P_{\text{noshow}} = \frac{\text{NoShows}{\text{user}} + \gamma \cdot \mu{\text{global}}}{\text{Bookings}_{\text{user}} + \gamma}$$ Scale the penalty based on peak time demand ($\text{Scarcity}(r,s)$). High-risk users are discouraged from tying up high-demand spaces during peak hours.
3. Weight Tuning & Model Evolution
Phase 1: Rule-Based Linear Model ──► Phase 2: Learning-to-Rank (LTR) + Utility Constraining
- Transparent & deterministic - Gradient Boosted Decision Trees (LambdaMART)
- Manually tuned coefficients - Inverse Propensity Weighting (IPW) for Position Bias
Phase 1: Rule-Based Heuristic
In the initial deployment, weights $w_k$ are set via heuristic policy to establish baselines, ensure transparent debugging, and log training data.
Phase 2: Learning-to-Rank (LTR)
Train a GBDT-based Learning-to-Rank model (e.g., LambdaMART) using logged impression data.
- Labels: Positive implicit feedback ($+1$ if booked and attended), negative implicit feedback ($0$ if shown but not booked), heavy negative ($-1$ if booked but resulting in a no-show).
- Position Bias Correction: Users frequently click top-ranked items regardless of suitability. We mitigate this by applying Inverse Propensity Weighting (IPW): $$L_{\text{corrected}} = \sum_{i} \frac{\text{Loss}(y_i, \hat{y}_i)}{P(\text{Examine} \mid \text{Position}_i)}$$ Where $P(\text{Examine} \mid \text{Position}_i)$ is estimated using a small (1–2%) randomized traffic slice where adjacent recommendations are randomly swapped.
Multi-Objective Objective Function
A purely user-centric LTR model prioritizes individual preference over corporate utilization. To balance both objectives, the post-LTR score combines individual intent with overall facility efficiency:
$$\text{FinalScore} = \lambda \cdot \text{Score}{\text{LTR}}(q, r, s) + (1 - \lambda) \cdot \text{Utility}{\text{system}}(r, s)$$
Where $\text{Utility}{\text{system}} = w{\text{frag}} f_{\text{frag}} + w_{\text{cap}} f_{\text{cap}} - w_{\text{waste}} f_{\text{noshow}}$.
4. Anti-Starvation & Inter-Team Fairness
Relying entirely on score maximization can create unfair feedback loops: executive or fast-moving teams may monopolize premium spaces, leaving other groups with inconvenient options.
DEMAND LEDGER CHECK
│
Is Team Over-Allocated Relative to Target?
/ \
YES / \ NO
/ \
▼ ▼
Apply Dynamic Keep Raw
Dampening Score
The Fairness Ledger
Maintain a sliding-window ledger (streaming via Kafka) tracking the ratio of high-tier/prime room usage by department $D$:
$$\text{Ratio}(D) = \frac{\text{HoursBooked}_{\text{prime}}(D)}{\text{TotalHoursBooked}(D)}$$
If $\text{Ratio}(D)$ exceeds an assigned target allowance $\text{Quota}(D)$, a dynamic fairness penalty is applied during the re-ranking phase:
$$\text{FairnessBoost}(D, r) = -\max\left(0, ; \eta \cdot (\text{Ratio}(D) - \text{Quota}(D))\right) \quad \text{for } r \in \text{PrimeRooms}$$
Hard Safeguards:
- Max Advance Booking Windows: Limit non-executives from locking out room availability months in advance.
- Post-Scoring Rule Filtering: Ensure the top-3 candidate slots shown to any user include at least one standard/non-premium option to preserve inventory diversity.
5. Experimentation & A/B Testing Strategy
Testing room allocation models via standard user-level randomized A/B splits leads to SUTVA (Single Unit Treatment Value Assumption) violations: user $A$ (in Treatment) and user $B$ (in Control) compete for the exact same physical inventory. If Treatment aggressively claims prime rooms, Control's metrics will degrade artificially.
INTERFERENCE MITIGATION STRATEGIES
┌───────────────────────────────────┬────────────────────────────────────────────────┐
│ Strategy │ Operational Mechanism │
├───────────────────────────────────┼────────────────────────────────────────────────┤
│ Cluster-Based Randomization │ Randomize by independent physical locations │
│ (Geographic Isolation) │ (Campus A = Control, Campus B = Treatment). │
├───────────────────────────────────┼────────────────────────────────────────────────┤
│ Time-Based Switchback │ Alternate allocation algorithms across all │
│ (Temporal Isolation) │ locations in 48-hour windows (A/B/A/B). │
└───────────────────────────────────┴────────────────────────────────────────────────┘
Key Metric Framework
- Primary Business Metrics:
- Space Utilization Rate: $\frac{\text{Hours Occupied}}{\text{Hours Available}}$.
- Fragmentation Index: Ratio of unbookable free gaps ($<30\text{ mins}$) to total free time.
- User Experience Metrics:
- Time-to-Book: Latency between query initiation and confirmed booking.
- Override Rate: How often users select a room ranked below top-3 position.
- Guardrail Metrics:
- No-Show Rate: Must not increase significantly under new ranking schemes.
- Inter-Team Variance: Gini coefficient of prime room usage across departments must stay below a defined threshold.