ADVANCED ALGORITHMS 2 LECTURE 8 ANNOUNCEMENTS Homework 2 out - - PowerPoint PPT Presentation

advanced algorithms
SMART_READER_LITE
LIVE PREVIEW

ADVANCED ALGORITHMS 2 LECTURE 8 ANNOUNCEMENTS Homework 2 out - - PowerPoint PPT Presentation

1 r LECTURE 8: GREEDY, LOCAL SEARCH ADVANCED ALGORITHMS 2 LECTURE 8 ANNOUNCEMENTS Homework 2 out Wednesday Friday Contacting the TAs: adv-algorithms-ta-fall18@googlegroups.com 3 LECTURE 8 LAST CLASS Greedy algorithm


slide-1
SLIDE 1

ADVANCED ALGORITHMS

LECTURE 8: GREEDY, LOCAL SEARCH

1

r

slide-2
SLIDE 2

LECTURE 8

ANNOUNCEMENTS

▸ Homework 2 out Wednesday Friday ▸ Contacting the TAs: adv-algorithms-ta-fall18@googlegroups.com

2

slide-3
SLIDE 3

LECTURE 8

LAST CLASS

3

▸ Greedy algorithm for minimum spanning tree ▸ Simple algorithm — add one edge at a time, add one vertex to

connected component

▸ Analysis tricky (see lecture notes) ▸ Meta argument — useful strategy to analyze greedy — inductively

prove that there exists an optimal solution that includes all greedy choices.

post

a link to Jeff Erickson's notes

Interval scheduling

slide-4
SLIDE 4

LECTURE 8

MAXIMUM COVERAGE

4

Hiring problem: suppose we have n people, each with a set of skills from some universe {1,…,m}. Pick k people so as to maximize the total # of distinct skills

▸ Each person — set ▸ Want to maximize union of chosen sets Si ⊆ {1,2,…, m}

k

partofthe input

Gree.dz

thni

start

with person

with most

skills

f

  • l
  • h

update the value of r

7

all the others

vi

3

s

  • pick person with

in

Max

valve 5 5

n

jrm

Repeat

times

slide-5
SLIDE 5

LECTURE 8

GREEDY ALGORITHM — BUILDING A SOLUTION

5

Value of

i

number of elements in Si that

are not in

thesets chosen

so far

Say

we picked

5

K S

so far

valli

I si l

s U5331

Break

ties arbitrarily

slide-6
SLIDE 6

LECTURE 8

OPTIMAL?

6

▸ {1,2,3}, {4}, {1,2,4}, {3,5}

S

S

53 Sg k

2

greedy

union has size _4

S

S

1

7

  • ptimum

Sz

Sa

ri

  • pt _5
slide-7
SLIDE 7

LECTURE 8

CAN GREEDY BE REALLY BAD?

7

No

slide-8
SLIDE 8

LECTURE 8

CAN GREEDY BE REALLY BAD?

8

  • Theorem. “Value” of solution chosen by greedy is at least (1/2) *

value of optimal solution.

▸ Example of “approximation algorithm”

sizeof the union ofthechosen sets

I Ie

O63

Last class argument

F

an optimum soles

for

the

full problem

that

includes the choices we've made

so far

slide-9
SLIDE 9

LECTURE 8

HOW TO PROVE THIS? WHAT ABOUT THE FIRST STEP?

9

Greedy

value ofsolution

Si

Y

Let the

union of the option

L

Y

sets

be denoted U

Sistax

f

I

au

Sik

Yj

Si Us u

us

claim

slide-10
SLIDE 10

Claim

14,1

3

lutz

lute

Isr It

Israel

Say S

  • ne ofthem r is

3

lutz

Choice of the greedy alg

isonly better

ie

Isi Is

Is't

1413

IYal

3

Claim

1

1 z ly l t

l U 141

animism

above but with

just the

RED portion

slide-11
SLIDE 11

LECTURE 8

KEY OBSERVATION — CAN ALWAYS MAKE “PROGRESS”

10

I

  • claim

tj

1

1314g.lt

uYI1usYjlzlul

lYgjl1Yj.l3lYil

l E

t

f lull

Tu

ftpt

Hit f

114

slide-12
SLIDE 12

LECTURE 8

INDUCTIVE CLAIM

11

IYj l

t.ly It t.lu I

stowed 1

ly

Yjl

l t

tIuttiInductinedaim

lyj1

l

Ll told

1H

I I

1

Intuitively distance

1481 1 to lul drops

by atleast

afactor

A E

slide-13
SLIDE 13

LECTURE 8

APPROXIMATION

12

I

14h13

l

fi EY

I Ul

Tu

E

I E lul

t

  • 631ul
slide-14
SLIDE 14

LECTURE 8 13

WHAT TO DO WHEN WE DON’T FIND AN OPTIMAL SOLUTION?

Can we improve it?

slide-15
SLIDE 15

LECTURE 8

EXAMPLE — MATCHING

14

Matching: suppose we have n children, n gifts and “happiness” values Hij. Assign gifts to children to maximize “total happiness”

▸ We saw: greedy does not give optimal cost

slide-16
SLIDE 16

LECTURE 8

IMPROVING A SOLUTION

15

y

Check if

F children

i

j

such that

swapping the gifts

improves total

is

m

in

Heta

thn

slide-17
SLIDE 17

LECTURE 8

WHAT IF WE CANNOT IMPROVE?

16

Children

Gifts

I

e

we

are at

a solution where

I

  • l

J

2

A i j

swapping gifts dadoes not

it

F

  • z

make the solution better

n

  • n

child i

fi

where4 is a

permutation

Hip

t Hj Pj 3

Hi pj

Hj ti

slide-18
SLIDE 18

LECTURE 8

WHAT IF WE CANNOT IMPROVE?

17

  • Theorem. Consider any solution that is “locally optimum”. Its cost is at

least (1/2) * OPT

OPT

assignment

9

i 921

En

l

H p

1 Hap 1

Hmp

Ii

3 f H

Hag

1

t Hn g

slide-19
SLIDE 19

LECTURE 8

APPROXIMATION

18

slide-20
SLIDE 20

LECTURE 8

CLASSIC EXAMPLE — GRADIENT DESCENT

19 Warning: multivariate calculus coming up

  • Problem. Given a convex function f over a domain D, find

D ⊆ ℝn

argminx∈D f(x)

slide-21
SLIDE 21

LECTURE 8

LOCAL SEARCH

20

  • Problem. Given a convex function f over a domain D, find

argminx∈D f(x)

slide-22
SLIDE 22

LECTURE 8

LOCAL SEARCH

21

  • Problem. Given a convex function f over a domain D, find

argminx∈D f(x)

▸ What is a good direction to move? ▸ Need domain D to be convex