/CourseScheduler

Course and exam scheduling tool

Primary LanguageC++BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

404pr1

Placeholder repository for CENG404's project.
https://github.com/He-Is-HaZaRdOuS/404pr1

Originally derived from CENG303's Term project

About

The aim of this repository is to collaborate and develop the project into a useful "Course Scheduler Tool".
This tool aims to assist university staff in constructing weekly programs for lectures and exams (midterm/final).

There are the usual hard constraints:

  • A student can't have more than one exam assigned at the same time.
  • A student could possibly have more than one course assigned the same time (WIP).
  • A professor can't have more than one course/exam assigned at the same time.
  • A course must be assigned a big enough classroom to seat the students (WIP).
  • An exam must be assigned enough classrooms to seat the students in alternating seats.
  • Certain time hours are reserved for Service course and no other course can be hosted at those times.

And some soft constraints (WIP)

  • Students shouldn't have back-to-back courses/exams.
  • Students shouldn't have a large time difference between courses/exams.
  • Because satisfying the above two conditions is infeasible, try to minimize number of upset students.

TODO

  • Re-write the Solution class to be faster and neater
  • Use more C++ STL features
  • Parallelize any repetitive independent operation wherever possible
  • Make an interactive GUI
  • Implement networking to allow for communication with the outside world
  • TBD...

Disclaimer!

CMake does not recognize non-english characters in the build path.
If your computer's file structure contains any non-english characters then you won't be able to compile the program.
Please place the project folder somewhere such that the absolute path to it won't contain any non-english characters.

Installing CMake (3.28.1)

(Windows && MacOS)

Download the respective binaries from the following link and install them.
https://cmake.org/download/

(Linux)

Open a terminal window and execute the following commands line by line

 version=3.28
 build=1
 limit=3.20
 result=$(echo "$version >= $limit" | bc -l)
 os=$([ "$result" == 1 ] && echo "linux" || echo "Linux")
 mkdir ~/temp
 cd ~/temp
 wget https://cmake.org/files/v$version/cmake-$version.$build-$os-x86_64.sh
 sudo mkdir /opt/cmake
 sudo sh cmake-$version.$build-$os-x86_64.sh --prefix=/opt/cmake #(Type "y" to accept the license agreement and type "n" to forego installing inside the subdirectory)
 cmake --version #(expected output is "cmake version 3.28.1") 

Installing MinGW (gcc for Windows)

  • Download and install the gcc compiler for Windows from the following link.
  • https://nuwen.net/files/mingw/mingw-18.0-without-git.exe
  • Extract to somewhere temporary and then move it inside the "C:\Program Files" directory.
  • Then update the System Environment Path Variables to point to the /bin directory of MinGW
  • to verify the compiler is detected, open a powershell window and type
gcc --version

Compilation

(Linux && MacOS)

open a terminal window and cd into the project folder

(Release)

 mkdir build-release
 cd build-release
 cmake -DCMAKE_BUILD_TYPE=Release ..
 cmake --build .

(Debug)

 mkdir build-debug
 cd build-debug
 cmake -DCMAKE_BUILD_TYPE=Debug ..
 cmake --build .

(Release With Debug Info)

 mkdir build-relwithdebinfo
 cd build-relwithdebinfo
 cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
 cmake --build .

(Release With Minimum Size)

 mkdir build-minsizerel
 cd build-minsizerel
 cmake -DCMAKE_BUILD_TYPE=MinSizeRel ..
 cmake --build .

the executable will be generated inside the respective build-X folder.

(Windows)

open a powershell window and cd into the project folder

(Release)

 mkdir build-release
 cd build-release
 cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
 make

(Debug)

 mkdir build-debug
 cd build-debug
 cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
 make

(Release With Debug Info)

 mkdir build-relwithdebinfo
 cd build-relwithdebinfo
 cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
 make

(Release With Minimum Size)

 mkdir build-minsizerel
 cd build-minsizerel
 cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=MinSizeRel ..
 make

the executable will be generated inside the respective build-X folder.

Running

The CMakeLists.txt is currently set up in such a way which is suitable for a development environment such as CLion or VisualStudio IDE's.
Consquently, the generated executable is hard linked to the resource path of the project's current directory and thus, is not portable.
The solution for this is to open the CMakeLists.txt file and comment out this line and uncomment this line.
This effectively changes the RESOURCES_PATH macro to be relative to the current path of the executable, making it portable (Release Ready).
Now re-compile the project by running the build command(s) from the previous section.
The only thing left to do is to copy the res/ folder from the project root and paste it into the directory of the new executable.
To run the executable, open a terminal/powershell window and type

./404pr1 <N-value> <course-list.csv> <classrooms.csv> <?blocked.csv>

Or type the following for help

./404pr1 -h

The following explains the arguments and their format.

  • N-value: Number of iterations to find optimal schedule.
  • course-list.csv: CSV file containing course lists.
    StudentID,Professor Name,CourseID,ExamDuration(in mins)
  • classrooms.csv: CSV file containing classrooms. (RoomID,Capacity)
  • blocked.csv: (Optional) CSV file containing blocked hours. (Day,TimeInterval,Course)

IDE's

CLion (Stable/Nova)

Open the project folder in CLion and configure CMake presets.

Visual Studio (2022)

Be sure to have installed the CMake build tools from the Visual installer.
Open the project folder in explorer, shift-right click and open with Visual Studio.