|
153 | 153 | "StrongConnectivityAugmentation": [Strong Connectivity Augmentation], |
154 | 154 | "SubgraphIsomorphism": [Subgraph Isomorphism], |
155 | 155 | "SumOfSquaresPartition": [Sum of Squares Partition], |
| 156 | + "TimetableDesign": [Timetable Design], |
156 | 157 | "TwoDimensionalConsecutiveSets": [2-Dimensional Consecutive Sets], |
157 | 158 | ) |
158 | 159 |
|
@@ -3582,6 +3583,53 @@ A classical NP-complete problem from Garey and Johnson @garey1979[Ch.~3, p.~76], |
3582 | 3583 | ) <fig:staff-scheduling> |
3583 | 3584 | ] |
3584 | 3585 |
|
| 3586 | +#{ |
| 3587 | + let x = load-model-example("TimetableDesign") |
| 3588 | + let assignments = x.optimal_config.enumerate().filter(((idx, value)) => value == 1).map(((idx, value)) => ( |
| 3589 | + calc.floor(idx / (x.instance.num_tasks * x.instance.num_periods)), |
| 3590 | + calc.floor(calc.rem(idx, x.instance.num_tasks * x.instance.num_periods) / x.instance.num_periods), |
| 3591 | + calc.rem(idx, x.instance.num_periods), |
| 3592 | + )) |
| 3593 | + let fmt-assignment(entry) = $(c_#(entry.at(0) + 1), t_#(entry.at(1) + 1))$ |
| 3594 | + let period-0 = assignments.filter(entry => entry.at(2) == 0) |
| 3595 | + let period-1 = assignments.filter(entry => entry.at(2) == 1) |
| 3596 | + let period-2 = assignments.filter(entry => entry.at(2) == 2) |
| 3597 | + [ |
| 3598 | + #problem-def("TimetableDesign")[ |
| 3599 | + Given a set $H$ of work periods, a set $C$ of craftsmen, a set $T$ of tasks, availability sets $A_C(c) subset.eq H$ for each craftsman $c in C$, availability sets $A_T(t) subset.eq H$ for each task $t in T$, and exact workload requirements $R: C times T -> ZZ_(>= 0)$, determine whether there exists a function $f: C times T times H -> {0, 1}$ such that: |
| 3600 | + $ |
| 3601 | + f(c, t, h) = 1 => h in A_C(c) inter A_T(t), |
| 3602 | + $ |
| 3603 | + $ |
| 3604 | + forall c in C, h in H: sum_(t in T) f(c, t, h) <= 1, |
| 3605 | + $ |
| 3606 | + $ |
| 3607 | + forall t in T, h in H: sum_(c in C) f(c, t, h) <= 1, |
| 3608 | + $ |
| 3609 | + and |
| 3610 | + $ |
| 3611 | + forall c in C, t in T: sum_(h in H) f(c, t, h) = R(c, t). |
| 3612 | + $ |
| 3613 | + ][ |
| 3614 | + Timetable Design is the classical timetabling feasibility problem catalogued as SS19 in Garey & Johnson @garey1979. Even, Itai, and Shamir showed that it is NP-complete even when there are only three work periods, every task is available in every period, and every requirement is binary @evenItaiShamir1976. The same paper also identifies polynomial-time islands, including cases where each craftsman is available in at most two periods or where all craftsmen and tasks are available in every period @evenItaiShamir1976. The implementation in this repository uses one binary variable for each triple $(c, t, h)$, so the registered baseline explores a configuration space of size $2^(|C| |T| |H|)$. |
| 3615 | + |
| 3616 | + *Example.* The canonical instance has three periods $H = {h_1, h_2, h_3}$, five craftsmen, five tasks, and seven nonzero workload requirements. The satisfying timetable stored in the example database assigns #period-0.map(fmt-assignment).join(", ") during $h_1$, #period-1.map(fmt-assignment).join(", ") during $h_2$, and #period-2.map(fmt-assignment).join(", ") during $h_3$. Every listed assignment lies in the corresponding availability intersection $A_C(c) inter A_T(t)$, no craftsman or task appears twice in the same period, and each required pair is scheduled exactly once, so the verifier returns YES. |
| 3617 | + |
| 3618 | + #figure( |
| 3619 | + align(center, table( |
| 3620 | + columns: 2, |
| 3621 | + align: center, |
| 3622 | + table.header([Period], [Assignments]), |
| 3623 | + [$h_1$], [#period-0.map(fmt-assignment).join(", ")], |
| 3624 | + [$h_2$], [#period-1.map(fmt-assignment).join(", ")], |
| 3625 | + [$h_3$], [#period-2.map(fmt-assignment).join(", ")], |
| 3626 | + )), |
| 3627 | + caption: [Worked Timetable Design instance derived from the canonical example DB. Each row lists the craftsman-task pairs assigned in one work period.], |
| 3628 | + ) <fig:timetable-design> |
| 3629 | + ] |
| 3630 | + ] |
| 3631 | +} |
| 3632 | + |
3585 | 3633 | #{ |
3586 | 3634 | let x = load-model-example("MultiprocessorScheduling") |
3587 | 3635 | let lengths = x.instance.lengths |
|
0 commit comments