You have tasks, and must find an order in which to execute them with minimum cost. Task takes time , and making task wait for time units incurs cost .
Formally, given functions and numbers , find a permutation minimizing
Special Cost Functions
Linear Cost Functions
First, consider the case where all functions are linear, namely , where is a nonnegative integer. Clearly, we can add all constant terms in advance, so the functions reduce to the form .
Consider two permutations and , where is obtained by swapping the numbers at positions and in . Then
Therefore, we can sort by repeatedly swapping whenever . Written as , this means sorting the permutation in ascending order of .
Our approach is to consider the effect of a local perturbation and greedily choose the optimal solution.
Exponential Cost Functions
Consider cost functions of the form , where .
Following the previous approach, consider the change in cost caused by swapping the numbers at positions and . The resulting algorithm is to sort the permutation in ascending order of .
The Same Increasing Function
Suppose all are the same increasing function. Then it is clear that we should sort the permutation in ascending order of .
Livshits–Kladov Theorem
The Livshits–Kladov theorem holds if and only if the cost functions fall into one of the following three cases:
- Linear functions: , where ;
- Exponential functions: , where ;
- The same increasing function: , where is an increasing function.
The theorem is proved under the assumption that the cost functions are sufficiently smooth (their third derivatives exist). In all three cases, the optimal solution can be found by simple sorting in time.
This page is mainly translated from the blog post Задача Джонсона с одним станком and its English version Scheduling jobs on one machine. The Russian version is licensed under Public Domain + Leave a Link; the English version is licensed under CC-BY-SA 4.0.