{"id":18024128,"url":"https://github.com/thomasnield/classroom-scheduling-demo","last_synced_at":"2025-03-27T00:30:50.045Z","repository":{"id":148076009,"uuid":"106970692","full_name":"thomasnield/classroom-scheduling-demo","owner":"thomasnield","description":"A branch-and-bound solver to create classroom schedules","archived":false,"fork":false,"pushed_at":"2019-01-31T18:31:13.000Z","size":451,"stargazers_count":39,"open_issues_count":3,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-22T18:11:24.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasnield.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-14T23:40:34.000Z","updated_at":"2025-01-08T23:51:24.000Z","dependencies_parsed_at":"2023-05-19T02:00:39.967Z","dependency_job_id":null,"html_url":"https://github.com/thomasnield/classroom-scheduling-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasnield%2Fclassroom-scheduling-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasnield%2Fclassroom-scheduling-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasnield%2Fclassroom-scheduling-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasnield%2Fclassroom-scheduling-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasnield","download_url":"https://codeload.github.com/thomasnield/classroom-scheduling-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245760581,"owners_count":20667886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T07:11:58.985Z","updated_at":"2025-03-27T00:30:50.040Z","avatar_url":"https://github.com/thomasnield.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Schedule Generator Demo\n### Branch-and-Prune Discrete Optimization\n\nCompanion blog article can be [found here](https://towardsdatascience.com/sudokus-and-schedules-60f3de5dfe0d).\n\n## YouTube Walkthrough\n\n[![](https://img.youtube.com/vi/2iZBcVr5OaQ/hqdefault.jpg)](https://www.youtube.com/watch?v=2iZBcVr5OaQ)\n\n## Abstract\n\nThis was an exercise at creating a class schedule generator using [branch-and-prune optimization](https://en.wikipedia.org/wiki/Branch_and_bound) and constraint propogation. \n\nI initially used [Kotlin](http://kotlinlang.org/) with [ojAlgo](http://www.ojalgo.org/), which turned out to be effective. However, I found implementing from scratch gave me more control and allowed me to optimize for the specific problem. Both implementations are in this repo. \n\nFor now, the model just assumes we are scheduling against one room.\n\n\n## Data Input\n\nHere is the starting data set:\n\n**Classrooms:**\n\n1) Psych 101 (1 hour, 2 sessions/week)\n2) English 101 (1.5 hours, 2 sessions/week)\n3) Math 300 (1.5 hours, 2 sessions/week)\n4) Psych 300 (3 hours, 1 session/week)\n5) Calculus I (2 hours, 2 sessions/week)\n6) Linear Algebra I (2 hours, 3 sessions/week)\n7) Sociology 101 (1 hour, 2 sessions/week)\n8) Biology 101 (1 hour, 2 sessions/week)\n9) Supply Chain 300 (2.5 hours, 2 sessions/week)\n10) Orientation 101 (1 hours, 1 session/week)\n\nI set the model to put each recurring session 48 hours apart.\n\n**Availability for each day Monday-Friday:**\n\n* 8:00AM-11:30AM\n* 1:00PM-5:00PM\n\n## Output\n\n```\nPsych 101- MONDAY/WEDNESDAY 13:00-14:00\nEnglish 101- MONDAY/WEDNESDAY/FRIDAY 08:00-09:30\nMath 300- MONDAY/WEDNESDAY 14:00-15:30\nPsych 300- FRIDAY 13:00-16:00\nCalculus I- TUESDAY/THURSDAY 08:00-10:00\nLinear Algebra I- MONDAY/WEDNESDAY/FRIDAY 09:30-11:30\nSociology 101- MONDAY/WEDNESDAY 15:30-16:30\nBiology 101- TUESDAY/THURSDAY 10:00-11:00\nSupply Chain 300- TUESDAY/THURSDAY 13:00-15:30\nOrientation 101- TUESDAY 15:30-16:30\n```\n\n![](kotlin_from_scratch_solution/output.png)\n\nObviously, a room cannot be occupied by more than one class at any time. The solver does this successfully and prevents any overlap in scheduling. \n\n\n## How to Execute\n\nBuild the Kotlin project with Gradle, then run the `main()` function inside the `InputAndRun.kt` file. You can also change the hardcoded inputs in that file too.\n\nThe optimizer should hopefully run in a few seconds and then display the schedule in the console output. \n\n\n## Resources\n\n[Coursera Class on Discrete Optimization](https://www.coursera.org/learn/discrete-optimization/home/welcome)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasnield%2Fclassroom-scheduling-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasnield%2Fclassroom-scheduling-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasnield%2Fclassroom-scheduling-demo/lists"}