more data

This commit is contained in:
Talhadeveloperr
2026-09-11 16:54:23 +05:00
parent 9079ba2739
commit 71042c2aae
352 changed files with 1715 additions and 3098 deletions

View File

@@ -1,7 +1,7 @@
"""
Phase 1: general courses (shared across every batch of a session).
Simple strategy — small offering count, Tue/Thu preferred first. After
Simple strategy — small offering count, Mon/Wed preferred first. After
placing everything, self-repair: any batch left with two general-course
sessions in the same slot has the losing session unmarked and re-placed
(scanning every day) until this phase's own sessions are clash-free.
@@ -10,7 +10,7 @@ sessions in the same slot has the losing session unmarked and re-placed
from . import grid
def run(board, data, preferred_days=("Tuesday", "Thursday"), max_repair_attempts=20):
def run(board, data, preferred_days=("Monday", "Wednesday"), max_repair_attempts=20):
"""Places every general-course offering's weekly lectures. Returns this phase's sessions."""
general = [o for o in data["offerings"] if o["course"]["is_general"]]
preferred_order = list(preferred_days) + [d for d in grid.DAYS if d not in preferred_days]

View File

@@ -10,11 +10,21 @@ phases' placements as fixed/locked.
from . import grid
def _is_lab_room_type(room_type):
"""
Real room data uses free-text room_type labels (e.g. "Computing
Laboratories", "electrical", "Classrooms", "Civil", "physics") rather
than a fixed classroom/lab enum. Any label mentioning "lab" is treated
as a lab room; everything else is a classroom.
"""
return "lab" in (room_type or "").lower()
class PlacementBoard:
def __init__(self, data):
self.data = data
self.classrooms = [r for r in data["rooms"] if r["room_type"] == "classroom"]
self.labs = [r for r in data["rooms"] if r["room_type"] == "lab"]
self.classrooms = [r for r in data["rooms"] if not _is_lab_room_type(r["room_type"])]
self.labs = [r for r in data["rooms"] if _is_lab_room_type(r["room_type"])]
# busy[(day, slot_index)] -> set of keys already occupied
self.room_busy = {}