*(Guest post by Ryan Dolce)*

Today we started off by finishing off our run-time analysis discussion.

We review the run-time of the following algorithm:

- Set to be the empty set
- While is not empty
- Choose with the earliest start time
- Add to
- Remove all requests that conflict with from

- return

Before this takes place, we spend time to build an array that stores elements, is the start time for a particular job.

These jobs are sorted by their finishing time. This is so that .

As we proceed through the algorithm, we need to check if there are any conflicts with the first selected job. This is done by checking if the start time of the next job is greater than the finish time of the selected job. If we select job , then all conflicts can be shown by . This check can be performed in time.

Next we discussed a new proof technique for the end of semester blues problem. The idea of durations and deadlines were added. The goal of this new technique *[problem actually–Atri]* is to *minimize the maximum lateness*. That is, we want to have as little lateness as possible. Basically, all of the jobs are scheduled and then we check how late we are.

The new input for the algorithm is: jobs where .

- = the duration of the job
- = the deadline for the job
- = lateness of a job =

The output is still a schedule where no two jobs conflict.

In order to compute an optimal schedule, greedy algorithms need to be used. First, we need to order the jobs, and then schedule them in that order. Also, there can not be a gap between any of the jobs.

For example: Acceptable: [ job 1 ][ job 2 ][ job 3 ]

Not Acceptable: [ job 1 ] ______ [ job 2 ]

There were three different approaches that could be used with this scenario.

**Order by increasing **

job1: ;

job2: ;

So the obvious choice here would to be to schedule job 1 before job 2. However, although job 1 is done way before it deadline, job 2 ends late. This results in a lateness of 1. So technically, it would be better to schedule job 2 before job1. This is because job 1 has a slack of 99 and job 2 has a slack of 0.

**Schedule jobs in the order of the least amount of slack**

job1: ; implies slack =

job2: ; implies slack =

If job 2 is scheduled first, then it results in a lateness of . This is because job 1 now ends at instead of , so .

If job 1 is scheduled first, then it results in a lateness of . This is because job 2 now ends at instead of , so . This case actually is more acceptable because the maximum lateness is minimized.

**Order by increasing **

For this scenario, the jobs will be sorted by their deadlines in increasing order.

(i.e )

- For
- Schedule job $latex i$ from $latex s_i = f$ to $latex f_i = f + t_i$.

- return schedule ; () => A (the schedule)

To wrap class up, we began going over the proof for these scenarios. Only the proof ideas were laid down and the proof will be continued next class. Here is the proof thus far:

**Theorem:** Schedule output by the algorithm is optimal.

There exists some ; The minimum lateness of is the same as .

This proof will be done by “exchange argument.”

*Proof Idea:* We will start with and go through some transitions until we reach a final schedule.

ex. ; where is the final schedule and is the final transition made to obtain the final schedule. Note that and are the same.

## Leave a Reply