The problem of scheduling unit-time tasks with deadlines and penalities for a single processor has following inputs

S={a1,a2,...,an} of n unit-time task. A unit-time task requires exactly 1 unit of time to complete

deadlines d1,d2,...,dn, 1<=di<=n

penalities w1,w2,...,wn. A penality wi is incurred if task ai is not finished by time di, and no penality if task finishes at deadline

The **problem **is to find a schedule for S that minimizes the total penalty incurred for missed deadlines

I got a problem regarding this . It is as follows

ai 1 2 3 4 5 6 7

di 4 2 4 3 1 4 6

wi 70 60 50 40 30 20 10

The **solution** to this problem is {a2,a4,a1,a3,a7,a5,a6}

penality , w5+w6=50

I tried for a long time and couldnt get this solution

Can anybody help me find a way to solve the problem.