GithubHelp home page GithubHelp logo

school-timetabling's Introduction

School Timetabling

A minimal OptaPlanner project to solve a school timetabling problem

Problem description

School timetabling is an NP-hard problem. It is difficult to scale. AI constraint solvers such as OptaPlanner have advanced algorithms that deliver a near-optimal solution in a reasonable amount of time.

timeTableApp

Define constraints

The solver will assign Lesson instances to Timeslot and Room instances automatically by using AI to adhere to the following hard and soft constraints.

  • A room can have at most one lesson at the same time.
  • A teacher can teach at most one lesson at the same time.
  • A student can attend at most one lesson at the same time.
  • A teacher prefers to teach every lesson in a single room.
  • A teacher prefers to teach sequential lessons and dislikes gaps between lessons.

The constraints are implemented in the Drools score file.

Load the problem

All lessons, timeslots and rooms from the above screenshot are specified in the App file.

Solve for a solution

Make sure you have Gradle on your computer and run:

$ ./gradlew run
Solved TimeTable with 5 timeslots, 3 rooms and 10 lessons:

* Geography(1) -> Room A, MONDAY 09:30
* Physics(2) -> Room A, MONDAY 08:30
* Physics(3) -> Room A, MONDAY 13:30
* Chemistry(4) -> Room A, MONDAY 10:30
* Math(5) -> Room C, MONDAY 14:30
* Math(6) -> Room C, MONDAY 10:30
* Spanish(7) -> Room B, MONDAY 08:30
* Spanish(8) -> Room B, MONDAY 13:30
* English(9) -> Room B, MONDAY 09:30
* English(10) -> Room B, MONDAY 14:30

Score: 0hard/-6soft

Increase the time limit in the solver config file to get a better result.

school-timetabling's People

Contributors

wulab avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.