Professional Documents
Culture Documents
Advanced Algorithms CS 539/441 OR in Search of Efficient General Solutions
Advanced Algorithms CS 539/441 OR in Search of Efficient General Solutions
Joe Hoffert
Joseph.W.Hoffert@Boeing.com
Bold Stroke
Outline
General Techniques For Polynomial Time Solutions
Greedy Algorithms
Dynamic Programming
Linear Programming
Bold Stroke
Greedy Algorithms
Locally optimal choice leads to globally optimal solution.
Will not often yield optimal solution.
Framework
Prove Greedy Choice Property Holds:
first step g made by greedy algorithm is part of some optimal
solution (i.e., using g does no worse than an arbitrary optimal
solution)
Bold Stroke
Job
Job
Job
Job
Job Job
1
Schedule job
with shortest
deadline first
Job Job
1
Job
Job
Job
Job
Job
Job
Bold Stroke
Dynamic Programming
Locally optimal choice doesnt lead to a globally optimal
solution but there is still optimal substructure
Framework
Try all possible first choices:
One of these must be the correct first choice
Bold Stroke
a1,1
e1
a1,2
t1,1
chassis
enters
a1,3
a1,n-1
t1,2
t2,1
a1,n
x1
t1,n-1
t2,2
completed
auto exits
t2,n-1
e2
assembly line 2
x2
a2,1
a2,2
a2,3
assembly line 1
chassis
enters
4
1
a2,n-1
a2,n
completed
auto exits
4
assembly line 2
2
8
Bold Stroke
Linear Programming
Problem defined by set of linear equations (equalities or
inequalities)
Poly-time but high exponent on time complexity (e.g., n8 to n10)
Proves poly-time solution, more efficient solutions might be found
x2
capacity = 1
cost = 3
y
Minimize cost for flow of 4 units from s to t
x
s
x2 >= 0
x1
x1
1 of 1
cost = 3
Bold Stroke
NP-Complete Problems
NP complete problems are:
Complexity class Non-deterministic Polynomial (NP), i.e., solution
to NP problem can be verified in polynomial time
NP-hard, i.e., reducible from all other NP problems in poly-time
Job
2
Job
3
Job Job
n-1 n
Is there a schedule in
which all jobs are processed
by specified time?
January 13, 2003
Processor Processor
1
2
Job
Job
3
2
Processor Processor
1
2
Processor
m
Job
Job Job
n
n-1 1
Processor Processor
m-1
m
Bold Stroke
Bold Stroke
Approximation Algorithms
Poly-time algorithms with provable bounds relative to
optimal solution
If approximation bound is some constant n then the algorithm is
said to be an n-approximation
Item 2
Item 3
Item 4
Sort items by value per
unit quantity (i.e., total
value/amount) and start
filling up the knapsack
Item 3
Item 1
Item 5
Item 2
Item 4
Item 5
Bold Stroke
Adversary strategy
Devise a strategy that makes it hard for any algorithm to find a
solution (i.e., maximize the number of steps needed for any solution)
Example: merging two sorted arrays
Bold Stroke
b1 b2 b3 b4
an-1 an
Adversary strategy
a1 b1 a2 b2 a3 b3
If < 2n 1 comparisons are made
more than one possible answer
left (i.e., adversary can switch the
elements that have not been
compared)
ai-1 bi-1 ai
i-1
bi-1 ai
bi ai+1 bi+1
a 4 b4
bn-1 bn
an-1 bn-1 an bn
bi ai+1 bi+1
i-1
bi-1 bi
ai ai+1 bi+1
Bold Stroke
On-Line/Dynamic Algorithms
Algorithms that dont have knowledge of future
requests/input
Compare to off-line algorithms that have complete knowledge of
input
Provable bound compared to off-line solution
Bold Stroke
Conclusion
Techniques exist for:
Provable poly-time algorithms
Determining unlikely poly-time algorithms
Next best solutions with provable bounds