You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"SumOfSquaresPartition": [Sum of Squares Partition],
136
138
"SequencingWithinIntervals": [Sequencing Within Intervals],
@@ -2932,6 +2934,14 @@ A classical NP-complete problem from Garey and Johnson @garey1979[Ch.~3, p.~76],
2932
2934
]
2933
2935
}
2934
2936
2937
+
#problem-def("Partition")[
2938
+
Given a finite set $A = {a_0, dots, a_(n-1)}$ with sizes $s(a_i) inZZ^+$, determine whether there exists a subset $A' subset.eq A$ such that $sum_(a in A') s(a) = sum_(a in A without A') s(a)$.
2939
+
][
2940
+
One of Karp's 21 NP-complete problems @karp1972, listed as SP12 in Garey & Johnson @garey1979. Partition is the special case of Subset Sum where the target equals half the total sum. Though NP-complete, it is only _weakly_ NP-hard: a dynamic-programming algorithm runs in $O(n dot B_"total")$ pseudo-polynomial time, where $B_"total" = sum_i s(a_i)$. The best known exact algorithm is the $O^*(2^(n slash 2))$ meet-in-the-middle approach of Schroeppel and Shamir (1981).
2941
+
2942
+
*Example.* Let $A = {3, 1, 1, 2, 2, 1}$ ($n = 6$, total sum $= 10$). Setting $A' = {3, 2}$ (indices 0, 3) gives sum $3 + 2 = 5 = 10 slash 2$, and $A without A' = {1, 1, 2, 1}$ also sums to 5. Hence a balanced partition exists.
Given a set $T$ of $n$ tasks, a precedence relation $prec.eq$ on $T$, an integer cost function $c: T -> ZZ$ (negative values represent profits), and a bound $K inZZ$, determine whether there exists a one-machine schedule $sigma: T -> {1, 2, dots, n}$ that respects the precedence constraints and satisfies
3539
+
$sum_(sigma(t') lt.eqsigma(t)) c(t') lt.eq K$
3540
+
for every task $t in T$.
3541
+
][
3542
+
Sequencing to Minimize Maximum Cumulative Cost is the scheduling problem SS7 in Garey & Johnson @garey1979. It is NP-complete by transformation from Register Sufficiency, even when every task cost is in ${-1, 0, 1}$@garey1979. The problem models precedence-constrained task systems with resource consumption and release, where a negative cost corresponds to a profit or resource refund accumulated as the schedule proceeds.
3543
+
3544
+
When the precedence constraints form a series-parallel digraph, #cite(<abdelWahabKameda1978>, form: "prose") gave a polynomial-time algorithm running in $O(n^2)$ time. #cite(<monmaSidney1979>, form: "prose") placed the problem in a broader family of sequencing objectives solvable efficiently on series-parallel precedence structures. The implementation here uses Lehmer-code enumeration of task orders, so the direct exact search induced by the model runs in $O(n!)$ time.
3545
+
3546
+
*Example.* Consider $n = #ntasks$ tasks with costs $(#costs.map(c=>str(c)).join(", "))$, precedence constraints #{precs.map(p=> [$t_#(p.at(0) +1) prec.eq t_#(p.at(1) +1)$]).join(", ")}, and bound $K = #bound$. The sample schedule $(#schedule.map(t=>$t_#(t+1)$).join(", "))$ has cumulative sums $(#prefix-sums.map(v=>str(v)).join(", "))$, so every prefix stays at or below $K = #bound$.
text(7pt, [prefix sums after each scheduled task]),
3577
+
))
3578
+
},
3579
+
caption: [A satisfying schedule for Sequencing to Minimize Maximum Cumulative Cost. Orange boxes add cost, teal boxes release cost, and the displayed prefix sums $(#prefix-sums.map(v=>str(v)).join(", "))$ never exceed $K = #bound$.],
3580
+
) <fig:seq-max-cumulative>
3581
+
]
3582
+
]
3583
+
}
3584
+
3501
3585
#problem-def("DirectedTwoCommodityIntegralFlow")[
3502
3586
Given a directed graph $G = (V, A)$ with arc capacities $c: A -> ZZ^+$, two source-sink pairs $(s_1, t_1)$ and $(s_2, t_2)$, and requirements $R_1, R_2 inZZ^+$, determine whether there exist two integral flow functions $f_1, f_2: A -> ZZ_(>= 0)$ such that (1) $f_1(a) + f_2(a) <= c(a)$ for all $a in A$, (2) flow $f_i$ is conserved at every vertex except $s_1, s_2, t_1, t_2$, and (3) the net flow into $t_i$ under $f_i$ is at least $R_i$ for $i in {1, 2}$.
0 commit comments