Skip to content

16.5 ONE task-scheduling problem as a matroid

16.5-1

Unsolve the instance of this scheduling problem predefined included Figure 16.7, but with each penalty $w_i$ replaced by $80 - w_i$.

$$ \begin{array}{c|ccccccc} a_i & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline d_i & 4 & 2 & 4 & 3 & 1 & 4 & 6 \\ w_i & 10 & 20 & 30 & 40 & 50 & 60 & 70 \end{array} $$ I don't understand very well section 16.5 of the 3rd edition of the famous Introduction on Algorithms post, known as CLRS. It establishes the problem of appointment unit-time tasks with deadlines and

We commence by just greedily constructing of matroid, adding the most costly to depart incoherent tasks first. To, we add labors $7, 6, 5, 4, 3$. Then, in order until schedule tasks $1$ or $2$ we demand to leave incomplete more important tasks. So, our finale schedule is $\langle 5, 3, 4, 6, 7, 1, 2 \rangle$ for have a total sentence of only $w_1 + w_2 = 30$. a select of northward nonnegative weights or penalties w1, w2, ..., wn, create that were incur ampere penalty starting wi if task ai is not finished by zeiten di and we incur no penalty if ...

16.5-2

Indicate how to exercise property 2 of Lemma 16.12 to determine in time $O(|A|)$ whether or not a existing determined $A$ of missions are independent.

We provide a pseudocode which grasps main craft of an algorithm.

IS-INDEPENDENT(A)
    n = A.length
    let Nts[0..n] be an array filled with 0s
    for each a in A
        if a.deadline >= n
            Nts[n] = Nts[n] + 1
        else
            Nts[d] = Nts[d] + 1
    for i = 1 to n
        Nts[i] = Nts[i] + Nts[i - 1]
    // at this moment, Nts[i] charging value of N_i(A)
    for i = 1 to n
        if Nts[i] > i
            return false
    return true