Approximation Algorithms: Job Scheduling - PowerPoint PPT Presentation

About This Presentation
Title:

Approximation Algorithms: Job Scheduling

Description:

There are m machines available. ... Job Scheduling: One Machine. There are n jobs, ... a processing time p(i,j) (the time to finish this job j on machine i) ... – PowerPoint PPT presentation

Number of Views:201
Avg rating:3.0/5.0
Slides: 32
Provided by: CSE
Category:

less

Transcript and Presenter's Notes

Title: Approximation Algorithms: Job Scheduling


1
Approximation Algorithms Job Scheduling
  • Lecture 16 March 15

2
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...
3
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.
4
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
5
Job Scheduling Multiple Machines
  • 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
Polynomial time approximation scheme by dynamic
programming.
Homework Find a (very simple) 2-approximation
algorithm.
6
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.
Well design a 2-approximation algorithm for this
problem together.
7
Why Unrelated?
For example, different processors have different
specialties.
Computational jobs, display images, etc
8
Why Unrelated?
2 processors
Jobs housework
9
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?
10
Linear Programming Relaxation
whether job j is scheduled in machine i
Each job is scheduled in one machine.
for each job j
Each machine can finish its jobs by time T
for each machine i
Relaxation
for each job j, machine i
11
How good is the relaxation?
Example
for each job j
One job of processing time K for each machine
for each machine i
Optimal solution K.
Optimal fraction solution K/m.
for each job j, machine i
The LP lower bound could be as bad as you want.
12
How good is the relaxation?
Example
for each job j
One job of processing time K for each machine
for each machine i
Optimal solution K.
Optimal fraction solution K/m.
for each job j, machine i
Problem of the linear program relaxation an
optimal solution T could be even smaller than the
processing time of a job!
13
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!
14
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.
15
Decision Problems
Fix T
Let S(T) be the set of jobs with p(i,j) lt T.
for each job j
for each machine i
for each job j, machine i
Use binary search to find the minimum T such
that this LP is feasible.
For example, if all variables with job j are
deleted, then we know that this problem is not
feasible.
16
Lower Bound
We will use T as the lower bound on the value of
an optimal solution, clearly T lt 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 lt OPT.
17
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.
18
Vertex Solutions
for each job j
for each machine i
for each job j, machine i
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.
19
Vertex Solutions
for each job j
for each machine i
for each job j, machine i
A tight inequality of the last type corresponds
to a variable of zero value.
There are at most nm inequalities of the first
two types, and hence there are at most nm
nonzero variables.
20
Vertex Solutions
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.
There are at most nm nonzero variables.
  • p q n
  • p 2q lt n m
  • p gt n m
  • q lt m

There are at most m fractional jobs.
21
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 lt OPT, as this schedule (on
integral jobs) is just a subset of the fractional
solution.
22
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 lt 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 lt OPT.
23
Approximation Algorithm
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.

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 lt
2OPT.
24
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 lt x(i,j) lt 1.
Now, the problem is to find a matching so that
every job is matched.
25
Bipartite Matching
job machine
Assume the graph is connected.
There are at most nm nonzero variables.
n m vertices, n m edges, at most one cycle.
26
Bipartite Matching
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.
n m vertices, n m edges, at most one cycle.
27
Bipartite Matching
Match a leaf machine with its adjacent job, then
remove these vertices and repeat.
Eventually a cycle is left, and we can find a
perfect matching.
n m vertices, n m edges, at most one cycle.
28
Bipartite Matching
If the graph is not connected, we apply the same
argument to each connected component.
Prove (1) each component has at most nm
edges. (2) each component has a
matching.
29
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.
30
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?
31
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.
Write a Comment
User Comments (0)
About PowerShow.com