Skip to content

bardo84/Aemter

Repository files navigation

Aemter

A fair and balanced duty scheduling system for schools using the Hungarian Algorithm (Munkres).

Overview

Students take turns performing small duties ("Ämter") on a 2-week rotation schedule. This program automatically assigns duties to students while:

  • Ensuring fair distribution (everyone gets equal free time)
  • Matching student profiles with duty requirements
  • Avoiding unnecessary repetitions

The program calculates individual costs for each student-duty combination based on profile compatibility and past assignments, then finds the optimal assignment with minimum total cost.

Requirements

Installation

No installation required. Simply ensure Node.js is installed on your system.

Input Files

Create profile files from the Excel spreadsheet provided:

kinder_[YEAR].txt

Student profile file with student name and attributes:

Name    Gender  Grade   Color
MaximilianB  J   P2   G
Maja         M   P1   O
...

Columns:

  • Name (unique, no separators allowed)
  • Gender: J (boy) or M (girl)
  • Grade: P1, P2 (primary), S1, S2 (secondary)
  • Color: G (green), O (orange)

Valid separators: Tab, Space, Comma, Semicolon

aemter_[YEAR].txt

Duty requirements with profile specifications:

Duty Name               Requirement 1        Requirement 2       ...
Materialräume          1/P1/P2              1/S1/S2
Terrasse_Eingang       1/K
Geschirrspüler#1       2/S1/S2
Geschirrspüler#2       2/P1/P2

Format: [Count]/[Profile1]/[Profile2]/...

Special Profiles:

  • K - Any student (equivalent to all profiles)
  • #1, #2 - Alternate weeks (e.g., for separating groups)

Examples:

  • 1/P1/P2 - 1 student from P1 or P2
  • 2/S1/S2 - 2 students from S1 or S2

Usage

Run the program in the duty folder:

node .\aemter.js [YEAR] [WEEKS]

Example

node .\aemter.js 2023_2024 20

Output:

** aemter.js
67 students read from kinder_2023_2024.txt
78 duties read from aemter_2023_2024.txt
20-week plan written to plan_2023_2024.txt

Output Format

plan_[YEAR].txt - Weekly schedule:

--- Week 1 (#1) ---
Free_Primary: Karl Aurelia ClaraB AnikaF
Free_Secondary: LeonardK MaximilianL Markus Milo
Toilet: MarlenM GabrielKS
...

--- Week 2 (#2) ---
Free_Primary: Nino Simon MaximilianB Emma
Free_Secondary: Paulina Noel Chiara Leona
Toilet: ClaraB Finn
...

Notes

  • Excess students: If there are more students than duty slots, extras are assigned to a "Reserve" duty.
  • Planning failures: If you see "Plan cannot be fulfilled!", there are likely too few suitable students for the duties or contradictory assignments. Check for hidden spaces in student names.

Algorithm

Uses the Hungarian Algorithm (Munkres method) to solve the assignment problem optimally, ensuring fair and balanced duty distribution.

License

Created by Bardo Mueller ([email protected])

About

A fair and balanced duty scheduling system using the Hungarian Algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published