custom_branches = [ { 'name': 'CS', 'subjects': [ {'name':'OOPS','duration': 1, 'frequency': 3, 'teachers': ['rks'], 'type': 'theory'}, {'name':'OS','duration': 1, 'frequency': 3, 'teachers': ['hsp'], 'type': 'theory', }, {'name':'Networks','duration': 1, 'frequency': 3, 'teachers': ['ak'], 'type': 'theory', }, {'name':'Database','duration': 1, 'frequency': 3, 'teachers': ['msa'], 'type': 'theory', }, {'name':'Language','duration': 1, 'frequency': 2, 'teachers': ['nj'], 'type': 'theory', }, {'name':'TestOnline','duration': 1, 'frequency': 1, 'teachers': ['msa'], 'type': 'online'} ] }, { 'name':'EE', 'subjects': [ {'name':'Robotics','duration': 1, 'frequency': 3, 'teachers': ['rks'], 'type': 'theory', }, {'name':'BEEE','duration': 1, 'frequency': 3, 'teachers': ['hsp'], 'type': 'theory', }, {'name':'EmbeddedSystem','duration': 1, 'frequency': 3, 'teachers': ['ak'], 'type': 'theory', }, {'name':'Microcontrollers','duration': 1, 'frequency': 3, 'teachers': ['msa'], 'type': 'theory', }, {'name':'DLD','duration': 1, 'frequency': 2, 'teachers': ['nj'], 'type': 'theory', }, {'name':'Calculus','duration': 2, 'frequency': 1, 'teachers': ['ns'], 'type': 'theory', }, {'name':'TestOnline2','duration': 1, 'frequency': 1, 'teachers': ['hsp'], 'type': 'online'} ] }, { 'name':'BS', 'subjects':[ {'name':'LinearAlgebra','duration': 1, 'frequency': 3, 'teachers': ['na'], 'type': 'theory', }, {'name':'Buisness','duration': 1, 'frequency': 3, 'teachers': ['mc'], 'type': 'theory', }, {'name':'Economics','duration': 1, 'frequency': 3, 'teachers': ['pd'], 'type': 'theory', }, {'name':'PoliticalScience','duration': 1, 'frequency': 3, 'teachers': ['rrs'], 'type': 'theory', }, {'name':'Geometry','duration': 1, 'frequency': 2, 'teachers': ['nm'], 'type': 'theory', }, {'name':'Idiocracy','duration': 2, 'frequency': 1, 'teachers': ['na'], 'type': 'theory', }, {'name':'TestOnline3','duration': 1, 'frequency': 1, 'teachers': ['pt'], 'type': 'online', } ] } ] custom_teachers = ['rks', 'hsp', 'ak', 'msa', 'nj', 'ab', 'na', 'vt', 'rs', 'mc', 'nm', 'aa', 'ns', 'pd', 'rrs', 'bsr', 'gh', 'sks', 'ast', 'pt', 'sd', 'sm', 'kt', 'res', 'jkm', 'dkm', 'pm', 'so', 'ts'] batches = 2 day_names = ["Mon", "Tue", "Wed", "Thr", "Fri", "Sat"] slot_names = [ "9:00", "10:00", "11:00", "12:00", "BREAK", "2:00", "3:00", "4:00", "5:00" ] days = range(len(day_names)) slots = range(len(slot_names)) ast_json = [ { "type": "hard", "name": "no_classes_on_saturday", "forall": [ {"b": "branches"}, {"sub": {"subjects": "b"}}, {"d": "days"}, {"s": "slots"} ], "where": { "operator": "AND", "left": { "operator": "==", "left": "d", "right": 5 }, "right": { "operator": "!=", "left": {"type": "sub"}, "right": "online" } }, "assert": { "operator": "==", "left": { "target": "schedule", "args": [{"name": "b"}, {"name":"sub" }, "d", "s"] }, "right": 0 } } , { "type": "hard", "name": "teacher_no_double_booking", "forall": [ {"teacher": "teachers"}, {"d": "days"}, {"t": "slots"} ], "assert": { "operator": "<=", "left": { "operator": "sum", "over": [ {"b": "branches"}, {"sub": {"subjects": "b"}} ], "expression": { "target": "occupies_teacher", "args": ["b", "sub", "teacher", "d", "t"] } }, "right": 1 } }, { "type": "hard", "name": "subject_weekly_frequency", "forall": [ {"b": "branches"}, {"sub": {"subjects": "b"}} ], "assert": { "operator": "==", "left": { "operator": "sum", "over": [ {"d": "days"}, {"s": "slots"} ], "expression": { "target": "schedule", "args": [{"name": "b"}, {"name":"sub" }, "d", "s"] } }, "right": {"frequency": "sub"} } }, { "type": "hard", "name": "cs_department_meeting", "forall": [ {"b": "branches"}, {"sub": {"subjects": "b"}}, {"d": "days"}, {"s": "slots"} ], "where": { "operator": "AND", "left": { "operator": "==", "left": {"name":"b"}, "right": "CS" }, "right": { "operator": "AND", "left": { "operator": "==", "left": "d", "right": 2 }, "right": { "operator": "==", "left": "s", "right": 3 } } }, "assert": { "operator": "==", "left": { "target": "schedule", "args": [{"name": "b"}, {"name":"sub" }, "d", "s"] }, "right": 0 } }, { "type": "hard", "name": "one_class_per_slot_per_branch", "forall": [ {"b": "branches"}, {"d": "days"}, {"s": "slots"} ], "assert": { "operator": "<=", "left": { "operator": "sum", "over": [ {"sub": {"subjects": "b"}} ], "expression": { "target": "schedule", "args": [{"name": "b"}, {"name": "sub"}, "d", "s"] } }, "right": 1 } } ]