Skip to contents

Builds a mixed-integer optimisation model for assigning TA, GR, and E units across students and courses.

Usage

prepare_phd_model(
  df_list,
  t_max_y1 = 1,
  e_max = NULL,
  ta_min = NULL,
  ta_max = NULL,
  gr_min = NULL,
  gr_max = NULL,
  e_min = NULL,
  alpha = 2,
  beta = 1,
  phi = 1,
  rho = 10,
  C = 4,
  protected_year = 1
)

Arguments

df_list

A list of model inputs, typically from extract_phd_info(). Required elements are:

  • Ns: number of students

  • Nj: number of courses

  • P: preference matrix [i, j]

  • d: demand matrix [j, r] where r = 1:3 for TA, GR, E

  • s: student-level E-allocation score vector

  • year: year-of-study vector, with values from 1 to 4

  • t1: past TA workload vector

  • g1: past GR workload vector

t_max_y1

Maximum current-semester TA load for students in the protected year before slack is used. The argument name is retained for backward compatibility.

e_max

Optional upper bound on per-student E units in current semester.

ta_min, ta_max

Optional lower/upper bounds on per-student TA units in current semester.

gr_min, gr_max

Optional lower/upper bounds on per-student GR units in current semester.

e_min

Optional lower bound on per-student E units in current semester.

alpha

Objective weight on TA spread (Tmax - Tmin).

beta

Objective weight on TA preference term.

phi

Objective weight on the score-weighted E term. When phi > 0, larger values in df_list$s make E allocation more attractive.

rho

Objective weight on protected-cohort TA slack penalties.

C

Semester workload capacity per student. The model fixes annual workload at 2 * C via T_i + G_i + e_i^(2) == 2 * C. Default is 4.

protected_year

A single whole number from 1 to 4 identifying the year-of-study cohort that receives the soft TA-load protection. Students from all other years are included in the TA fairness spread. Defaults to Year 1.

Value

An ompr model object ready for ompr::solve_model().

Details

Index alignment is critical: P[i, j], d[j, ], s[i], year[i], t1[i], and g1[i] must refer to the same student/course ordering. Protection and TA fairness groups are based on year; s is used only in the E-allocation objective term.