approximation algorithms: job scheduling

Post on 15-Jan-2016

54 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Approximation Algorithms: Job Scheduling. Lecture 16: March 15. Job Scheduling: General Setting. There are n jobs , each job has: a processing time p(i) (the time to finish this job) a release time r(i) (can only process this job after time r(i)) - PowerPoint PPT Presentation

TRANSCRIPT

Approximation Algorithms: Job Scheduling

Lecture 16: March 15

Job Scheduling: General Setting

There are n jobs, each job has:• a processing time p(i) (the time to finish this job)• a release time r(i) (can only process this job after time r(i))• a deadline d(i) (have to finish this job before time d(i))• a weight w(i) (e.g. the profit of finishing job i)

There are m machines available.

Task: to scheduling the jobs to optimize the following criterion.-To minimize the completion time of all jobs (the makespan)-To finish as many jobs as possible meeting their deadlines-To minimize the weighted average completion time, etc…

Practically infinitely many possibilities...

Job Scheduling: One Machine

There are n jobs, each job has:• a processing time p(j) (the time to finish this job)

There are 1 machine available.

Task: to scheduling the jobs to -To minimize the completion time of all jobs (the makespan)

Trivial: just find an arbitrary ordering of the jobs.

Job Scheduling: One Machine

There are n jobs, each job has:• a processing time p(j) (the time to finish this job)

There are 1 machine available.

Task: to scheduling the jobs to

-To minimize the average completion time of all jobs

Optimal solution: Find an ordering which schedules long jobs first.

Proof: swapping

There are n jobs, each job has:• a processing time p(j) (the time to finish this job)

There are m machines available.

Task: to scheduling the jobs-To minimize the completion time of all jobs (the makespan)

NP-hard even for 2 machines: Partition problem

Homework: Find a (very simple) 2-approximation algorithm.

Polynomial time approximation scheme by dynamic programming.

Job Scheduling: Multiple Machines

Job Scheduling: Unrelated Multiple Machines

There are n jobs, each job has:• a processing time p(i,j) (the time to finish this job j on machine i)

There are m machine available.

Task: to scheduling the jobs-To minimize the completion time of all jobs (the makespan)

NP-hard to approximate within 1.5 times of the optimal solution.

We’ll design a 2-approximation algorithm for this problem together.

Why Unrelated?

For example, different processors have different specialties.

Computational jobs, display images, etc…

Why Unrelated?

2 “processors”

Jobs: housework

Job Scheduling: Unrelated Multiple Machines

There are n jobs, each job has:• a processing time p(i,j) (the time to finish this job j on machine i)

There are m machine available.

Task: to scheduling the jobs-To minimize the completion time of all jobs (the makespan)

Approach: Linear Programming.

How to formulate this problem into linear program?

Linear Programming Relaxation

whether job j is scheduled in machine i

for each job jEach job is scheduledin one machine.

for each machine iEach machine canfinish its jobs by time T

for each job j, machine i Relaxation

How good is the relaxation?

for each job j

for each machine i

for each job j, machine i

Example

One job of processingtime K for each machine

Optimal solution = K.

Optimal fraction solution = K/m.

The LP lower bound could be as bad as you want.

How good is the relaxation?

for each job j

for each machine i

for each job j, machine i

Example

One job of processingtime K for each machine

Optimal solution = K.

Optimal fraction solution = K/m.

Problem of the linear program relaxation:

an optimal solution T could be even smaller than the processing time of a job!

How to tackle this problem?

Problem of the linear program relaxation:

an optimal solution T could be even smaller than the processing time of a job!

Ideally, we could write the following constraint:

but this is not a linear constraint…

Idea? To enforce this constraint by hand!

Preprocessing

Fix T.

Consider the decision problem instead of an optimization problem

Call the resulting linear program LP(T).

Note that different T have different linear programs.

Fancy name: parametric pruning.

Decision Problems

for each job j

for each machine i

for each job j, machine i

Fix T Let S(T) be the set of jobs with p(i,j) < T.

For example, if all variables with job j are deleted,

then we know that this problem is not feasible.

Use binary search to find the minimum T* such that this LP is feasible.

Lower Bound

We will use T* as the lower bound on the value of an optimal solution,

clearly T* <= OPT, since LP(OPT) is feasible.

Observation:

Suppose there are m machines and at most m jobs.

If we can assign all jobs to the m machines so that

each machine is assigned at most 1 job,

then the completion time (makespan) is at most T* <= OPT.

Fractional Solutions

Fractional solutions could be very fractional.

What have we learnt in the last class?

Look at a vertex (basic) solution.

Very fractional solutions may only be the average of many solutions.

for each job j

for each machine i

for each job j, machine i

Vertex Solutions

What can we say about a vertex solution of this LP?

Basic solution:unique solution of n linearly independent tight inequalities,where n is the number of variables.

for each job j

for each machine i

for each job j, machine i

Vertex Solutions

A tight inequality of the last type corresponds to a variable of zero value.

There are at most n+m inequalities of the first two types,

and hence there are at most n+m nonzero variables.

Vertex Solutions

There are at most n+m nonzero variables.

Say a job is integral if it is assigned entirely to one machine;

otherwise a job is fractional.

Each fractional job is assigned to at least two machines.

Let p be the number of integral jobs,

and q be the number of fractional jobs.

p + q = n p + 2q <= n + m

p >= n – m q <= m

There are at most m fractional jobs.

Integral Jobs

How to handle integral jobs?

Just follow the optimal fractional solution.

And so we can schedule all the integral jobs in time at most T* <= OPT,

as this schedule (on integral jobs) is just a subset of the fractional solution.

Fractional Jobs

Remember this observation we made before.

Observation:

Suppose there are m machines and at most m jobs.

If we can assign all jobs to the m machines so that

each machine is assigned at most 1 job,

then the completion time (makespan) is at most T* <= OPT.

There are at most m fractional jobs.

If we could find such a “matching”, then we use this matching

to schedule all the fractional jobs in time at most T* <= OPT.

Goal: to design a 2-approximation algorithm for this problem

1) Do preprocessing (parametric pruning) and find a

smallest T* so that LP(T*) is feasible.

2) Find a vertex (basic) solution, say x, to LP(T*).

3) Assign all integral jobs to machines as in x.

4) Match the fractional jobs to the machines so that

each machine is assigned at most one job.

Approximation Algorithm

Proof (assuming a matching exists):

Schedule all integral jobs in time T*,

Schedule all fractional jobs in time T*,

Schedule all jobs in time 2T* <= 2OPT.

Bipartite Matching

Task: Match the fractional jobs to the machines

so that each machine is assigned at most one

job.

Create a vertex for each job j,

and create a vertex for each machine i,

add an edge between machine i and job j if 0 < x(i,j) < 1.

Now, the problem is to find a matching

so that every job is matched.

job

machine

Bipartite Matching

Assume the graph is connected.

There are at most n+m nonzero variables.

n + m vertices,

n + m edges,

at most one cycle.

Bipartite Matching

n + m vertices,

n + m edges,

at most one cycle.

Leaves must be machines, since each fractional job is adjacent to two machines.

Match a leaf machine with its adjacent job, then remove these vertices and repeat.

Bipartite Matching

n + m vertices,

n + m edges,

at most one cycle.

Eventually a cycle is left, and we can find a perfect matching.

Match a leaf machine with its adjacent job, then remove these vertices and repeat.

Bipartite Matching

If the graph is not connected,

we apply the same argument to each connected component.

Prove: (1) each component has at most n’+m’ edges.

(2) each component has a matching.

Bad Examples

m machines

m2 – m + 1 jobs:

1 job of processing time m on all machines

remaining jobs have processing time 1 on all

machines Optimal solution: the large job on one machine,

m small jobs on the remaining m-1 machines,

makespan = m

LP vertex solution: 1/m of the first job and

m-1 other jobs to each machine. Our rounding

procedure will produce a schedule of makespan 2m-1.

Bad Examples

Optimal solution: the large job on one machine,

m small jobs on the remaining m-1 machines,

makespan = m

LP vertex solution: 1/m of the first job and

m-1 other jobs to each machine. Our rounding

procedure will produce a schedule of makespan 2m-1.

Note that there is no integrality gap in this example.

Just that the rounding procedure produces the error.

Open question: Can we obtain a 3/2 approximation algorithm for this problem?

Quick Summary

1. Look at a vertex solution (not many fractional jobs).

2. Schedule all the integral jobs as in the fractional solution.

3. Schedule all the fractional jobs by a matching.

4. Each set can be scheduled in time at most OPT.

5. So we have a 2-approximation algorithm.

Get a feeling on job scheduling problems.

Linear programming is (again) a powerful tool.

top related