# ── Room Definitions ────────────────────────────────────────────────────────── # Mandatory rooms in every plan (per professor's spec) COMMON_ROOMS = [ "external_staircase", "foyer", "living_room", "kitchen", "dining_room", "utility_area", "common_bathroom", "master_bedroom", "attached_bathroom", ] # Optional rooms the user can opt-in via checkboxes OPTIONAL_ROOMS = [ "bedroom_01", "bedroom_02", "bedroom_03", "balcony", "study", "pooja_room", "lift", ] ROOM_CONFIGS = { "1BHK": ["master_bedroom", "kitchen", "living_room", "bathroom", "foyer"], "2BHK": ["master_bedroom", "bedroom_01", "kitchen", "living_room", "dining_room", "common_bathroom", "attached_bathroom", "foyer", "balcony"], "3BHK": ["master_bedroom", "bedroom_01", "bedroom_02", "kitchen", "living_room", "dining_room", "common_bathroom", "attached_bathroom", "pooja_room", "foyer", "balcony", "utility_area"], "3BHK+Study": ["master_bedroom", "bedroom_01", "bedroom_02", "kitchen", "living_room", "dining_room", "common_bathroom", "attached_bathroom", "pooja_room", "foyer", "balcony", "utility_area", "study"], } # Min / Max area in sq ft per room type (latest guide table). ROOM_MIN_AREA = { "master_bedroom": 150, # 10 x 15 "bedroom_01": 96, # 8 x 12 "bedroom_02": 96, "bedroom_03": 96, "kitchen": 77, # 7 x 11 "living_room": 126, # 9 x 14 "dining_room": 40, # 5 x 8 "common_bathroom": 24, # 4 x 6 "attached_bathroom": 24, "attached_bathroom_02": 24, "powder_room": 20, "foyer": 24, # 4 x 6 "internal_corridor": 30, "balcony": 15, # 3 x 5 "pooja_room": 15, # 3 x 5 "utility_area": 24, # 4 x 6 "study": 72, "external_staircase":84, # 14 × 6 ft minimum "lift": 20, # 4 x 5 } ROOM_MAX_AREA = { "master_bedroom": 384, # 16 x 24 "bedroom_01": 216, # 12 x 18 "bedroom_02": 216, "bedroom_03": 216, "kitchen": 150, # 10 x 15 "living_room": 216, # 12 x 18 "dining_room": 126, # 9 x 14 "common_bathroom": 77, # 7 x 11 "attached_bathroom": 77, "attached_bathroom_02": 77, "powder_room": 50, "foyer": 54, # 6 x 9 "internal_corridor":150, "balcony": 9999, # no fixed max in guide table "pooja_room": 64, # 8 x 8 "utility_area": 54, # 6 x 9 "study": 154, "external_staircase":200, # 18 × 11 ft maximum (strip height can exceed 8 ft) "lift": 35, # 5 x 7 } # (width, height/length) ranges in feet aligned with the latest guide table. ROOM_SIZE_RANGES = { "external_staircase": ((14, 18), (6, 8)), # 14-18 ft wide, 6-8 ft deep "foyer": ((4, 6), (6, 9)), "living_room": ((9, 12), (14, 18)), "dining_room": ((5, 9), (8, 14)), "kitchen": ((7, 10), (11, 15)), "utility_area": ((4, 6), (6, 9)), "master_bedroom": ((10, 16), (15, 24)), "attached_bathroom": ((4, 7), (6, 11)), "attached_bathroom_02": ((4, 7), (6, 11)), "bedroom_01": ((8, 12), (12, 18)), "bedroom_02": ((8, 12), (12, 18)), "bedroom_03": ((8, 12), (12, 18)), "common_bathroom": ((4, 7), (6, 11)), "pooja_room": ((3, 8), (5, 8)), "balcony": ((3, 6.5), (5, 20)), "study": ((8, 12), (9, 14)), "lift": ((4, 5), (5, 7)), "internal_corridor": ((3, 4), (10, 30)), } CORRIDOR_WIDTH_MIN = 3.0 CORRIDOR_WIDTH_MAX = 4.0 # Room display colors ROOM_COLORS = { "master_bedroom": "#1565C0", "bedroom_01": "#1976D2", "bedroom_02": "#1E88E5", "bedroom_03": "#2196F3", "kitchen": "#B71C1C", "living_room": "#2E7D32", "dining_room": "#388E3C", "common_bathroom": "#F9A825", "attached_bathroom":"#F57F17", "attached_bathroom_02":"#FFB300", "powder_room": "#FF8F00", "foyer": "#6A1B9A", "internal_corridor":"#78909C", "balcony": "#00695C", "pooja_room": "#E65100", "utility_area": "#4E342E", "study": "#283593", "external_staircase":"#455A64", "lift": "#212121", } # Required adjacencies (legacy single-tier list, kept for back-compat). # The 4-tier matrix below is the source of truth used by scoring. REQUIRED_ADJACENCIES = [ ("kitchen", "dining_room", 1.0), ("dining_room", "living_room", 0.9), ("living_room", "foyer", 1.0), ("master_bedroom", "attached_bathroom",1.0), ("bedroom_01", "common_bathroom", 0.8), ("bedroom_02", "common_bathroom", 0.8), ("kitchen", "utility_area", 0.7), ("pooja_room", "living_room", 0.6), ("living_room", "balcony", 0.7), ("dining_room", "kitchen", 1.0), ("foyer", "living_room", 0.9), ] # ── 4-tier adjacency matrix (from professor's table) ───────────────────────── # Each pair maps to one of: HIGH, MED, LOW, ZERO, FORBIDDEN. # HIGH → must share a wall (+1.0 contribution) # MED → close / open path (+0.5) # LOW → indirect / via passage (+0.2) # ZERO → strictly separate (penalty −0.5 if adjacent) # FORBIDDEN → must NEVER share a wall (penalty −1.0) # `bedroom` here means any of bedroom_01/02/03. ADJ_HIGH = "HIGH" ADJ_MED = "MED" ADJ_LOW = "LOW" ADJ_ZERO = "ZERO" ADJ_FORBIDDEN = "FORBIDDEN" ADJ_WEIGHTS = { ADJ_HIGH: 1.0, # penalise heavily if violated ADJ_MED: 0.5, # allowed, fine ADJ_LOW: 0.05, # allowed, not usually preferred ADJ_ZERO: -0.5, # AVOID (hard) — penalise if they share a wall ADJ_FORBIDDEN: -0.5, # treated same as AVOID in the latest spec } # Latest client adjacency spec (tiers below). Only the pairs explicitly listed # carry a non-default weight; every unlisted pair defaults to LOW (+0.05) via # get_adjacency_class, i.e. "allowed, not usually preferred". ADJACENCY_MATRIX = { # ── HIGH +1.0 — penalise heavily if violated ───────────────────────── ("living_room", "dining_room"): ADJ_HIGH, ("living_room", "balcony"): ADJ_HIGH, ("living_room", "pooja_room"): ADJ_HIGH, ("living_room", "study"): ADJ_HIGH, ("kitchen", "dining_room"): ADJ_HIGH, ("kitchen", "utility_area"): ADJ_HIGH, ("common_bathroom", "bedroom_01"): ADJ_HIGH, ("common_bathroom", "bedroom_02"): ADJ_HIGH, ("common_bathroom", "bedroom_03"): ADJ_HIGH, ("common_bathroom", "master_bedroom"): ADJ_HIGH, ("master_bedroom", "bedroom_01"): ADJ_HIGH, ("master_bedroom", "bedroom_02"): ADJ_HIGH, ("master_bedroom", "bedroom_03"): ADJ_HIGH, # ── MEDIUM +0.5 — allowed, no problem ──────────────────────────────── ("pooja_room", "dining_room"): ADJ_MED, ("study", "pooja_room"): ADJ_MED, ("study", "balcony"): ADJ_MED, ("dining_room", "common_bathroom"): ADJ_MED, ("master_bedroom", "balcony"): ADJ_MED, ("external_staircase", "utility_area"): ADJ_MED, ("dining_room", "balcony"): ADJ_MED, # ── LOW +0.05 — allowed, not usually preferred ─────────────────────── ("bedroom_01", "study"): ADJ_LOW, ("bedroom_02", "study"): ADJ_LOW, ("bedroom_03", "study"): ADJ_LOW, ("master_bedroom", "study"): ADJ_LOW, ("bedroom_01", "balcony"): ADJ_LOW, ("bedroom_02", "balcony"): ADJ_LOW, ("bedroom_03", "balcony"): ADJ_LOW, ("living_room", "common_bathroom"): ADJ_LOW, ("living_room", "attached_bathroom"): ADJ_LOW, ("living_room", "attached_bathroom_02"): ADJ_LOW, ("kitchen", "pooja_room"): ADJ_LOW, ("kitchen", "study"): ADJ_LOW, ("dining_room", "study"): ADJ_LOW, # ── AVOID -0.5 — hard constraint, never share a wall ───────────────── ("pooja_room", "utility_area"): ADJ_ZERO, ("pooja_room", "common_bathroom"): ADJ_ZERO, ("pooja_room", "attached_bathroom"): ADJ_ZERO, ("pooja_room", "attached_bathroom_02"): ADJ_ZERO, } def get_adjacency_class(a: str, b: str) -> str: """Look up the (a,b) adjacency class regardless of order. Bedrooms canonicalise to themselves; unspecified pairs default to LOW.""" if (a, b) in ADJACENCY_MATRIX: return ADJACENCY_MATRIX[(a, b)] if (b, a) in ADJACENCY_MATRIX: return ADJACENCY_MATRIX[(b, a)] return ADJ_LOW # Vastu rules per the LATEST client spec. # Format: (rule_name, room_name, preferred_zones, weight) # Zones: NE, N, NW, W, SW, S, SE, E, Centre # # HIGHEST priority (weight 1.0): the three non-negotiable ideal zones. # DIRECTION-ORDER (weight 0.5): the client's per-direction preference list — # each room earns MED credit when it sits in any direction that lists it. # score_vastu awards the BEST matching tier per room. # # N → Living, Balcony, Dining, Staircase # NE → Pooja, Staircase, Balcony # E → Study, Living, Staircase, Kitchen, Balcony, Bedroom, Bathrooms # SE → Kitchen, Dining # S → Staircase, Bedrooms # SW → Master bedroom, Bedrooms, Staircase # W → Study, Bedrooms, Washrooms, Staircase # NW → Washrooms, Bedrooms, Study VASTU_RULES = [ # ── HIGHEST priority — weight 1.0 (non-negotiable) ── ("Pooja NE", "pooja_room", ["NE"], 1.0), ("Kitchen SE", "kitchen", ["SE"], 1.0), ("Master Bedroom SW", "master_bedroom", ["SW"], 1.0), # ── Direction-order acceptable zones — weight 0.5 ── ("Living N/E", "living_room", ["N", "E"], 0.5), ("Balcony N/NE/E", "balcony", ["N", "NE", "E"], 0.5), ("Dining N/SE", "dining_room", ["N", "SE"], 0.5), ("Study E/W/NW", "study", ["E", "W", "NW"], 0.5), ("Kitchen E (alt)", "kitchen", ["E"], 0.5), ("Pooja N (alt)", "pooja_room", ["N"], 0.5), ("Master S/W (alt)", "master_bedroom", ["S", "W"], 0.5), ("Common Bath NW/W/E", "common_bathroom", ["NW", "W", "E"], 0.5), ("Attached Bath NW/W/E","attached_bathroom", ["NW", "W", "E"], 0.5), ("Attached Bath 2 NW/W/E", "attached_bathroom_02", ["NW", "W", "E"], 0.5), ("Bedroom E/S/SW/W/NW", "bedroom_01", ["E", "S", "SW", "W", "NW"], 0.5), ("Bedroom2 E/S/SW/W/NW","bedroom_02", ["E", "S", "SW", "W", "NW"], 0.5), ("Bedroom3 E/S/SW/W/NW","bedroom_03", ["E", "S", "SW", "W", "NW"], 0.5), # Staircase is flexible — the client lists it in almost every direction. ("Staircase flexible", "external_staircase", ["N", "NE", "E", "S", "SW", "W"], 0.5), ] # Climate zones CLIMATE_ZONES = { "Hot-Dry (Rajasthan, Gujarat)": {"wwr": 0.15, "orientation": "EW", "buffer": "W"}, "Hot-Humid (Mumbai, Chennai, Kochi)":{"wwr": 0.25, "orientation": "EW", "buffer": "W"}, "Composite (Delhi, Bengaluru, Pune)":{"wwr": 0.20, "orientation": "EW", "buffer": "SW"}, "Cold (Shimla, Dehradun)": {"wwr": 0.35, "orientation": "NS", "buffer": "N"}, "Warm-Humid (Kolkata, Bhubaneswar)": {"wwr": 0.22, "orientation": "EW", "buffer": "W"}, } # India construction cost per sqft (₹) by finishing level COST_PER_SQFT = { "Basic": 1800, "Standard": 2400, "Premium": 3200, } PLUMBING_COST_PER_METER = 2500 # ₹ per metre of pipe run WALL_COST_PER_METER = 1200 # ₹ per metre of wall (material only)