preplancalc

package
v1.217.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: BSD-3-Clause Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package preplancalc holds the pure room-capacity math of the SEB/EXaHM pre-planning: which rooms cover a slot's seat demand for a kind (honouring per-exam room restrictions), how many seats a room set provides, which rooms still need to be booked, and the per-program clashes within a slot. All functions are I/O-free over graph/model types and the RoomCapacity value; the DB access and orchestration stay in the plexams package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyBooking

func ApplyBooking(need *model.PreplanKindNeed, bookedSeats int, rooms []RoomCapacity, bookedRooms map[string]bool)

ApplyBooking fills the booked seats and the still-to-book rooms for one kind.

func KindNeed

func KindNeed(exams []*model.PreplanExam, kind string, rooms []RoomCapacity) *model.PreplanKindNeed

KindNeed sums the seat demand of the pre-exams of one kind in a slot and greedily picks rooms (largest first) to cover it, honouring per-exam room restrictions.

func NormRoomName

func NormRoomName(s string) string

NormRoomName upper-cases a room name and strips spaces, so "t 3.014" and "T3.014" compare equal.

func ProgramConflicts

func ProgramConflicts(exams []*model.PreplanExam) []*model.PreplanProgramConflict

ProgramConflicts finds study programs that appear in more than one pre-exam of the same slot (a possible student clash, since Primuss conflicts aren't known yet).

func RoomsToBook

func RoomsToBook(rooms []RoomCapacity, gap int, booked map[string]bool) []string

RoomsToBook greedily picks rooms (largest first) that are NOT yet booked for the slot, enough to cover the still-missing seats (gap). Empty when nothing is missing.

func TotalSeats

func TotalSeats(rooms []RoomCapacity) int

TotalSeats sums the seats of the given rooms.

Types

type RoomCapacity

type RoomCapacity struct {
	Name  string
	Seats int
}

RoomCapacity is one room usable for a given kind, with its seat count.

func RoomsForKind

func RoomsForKind(exams []*model.PreplanExam, kind string, rooms []RoomCapacity) []RoomCapacity

RoomsForKind restricts the candidate rooms by the per-exam allowedRooms of the slot's exams of that kind: only when every such exam restricts its rooms is the pool narrowed to the union of their allowedRooms (an exam without a restriction may use any room, so the full set is kept).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL