Dijkstra's shortest path algorithm • This algorithm is a “greedy” one ...

Dijkstra's shortest path algorithm • This algorithm is a “greedy” one ... Dijkstra's shortest path algorithm • This algorithm is a “greedy” one ...

ai.eecs.umich.edu
from ai.eecs.umich.edu More from this publisher
09.07.2015 Views

What’s coming up after 203?• EECS 281 is about algorithms and data structures. You learn about concretestorage structures like linked lists, arrays, and the like.• You also learn about more abstract structures such as priority queues.• Ideally with these abstract structures, you can define them using structuralinduction, and prove properties about them the same way.• An example would be “binary trees”.• EECS 376 is about models of computation. You learn about finite-statemachines, which are really useful in modelling all sorts of computationalsystems.• You also learn about undecidability, uncomputability, and computationalcomplexity, including more about P and NP.16

How do you prove that there isn’t any algorithm to solve a problem?• The basic method is to prove it by contradiction.• The method also assumes that algorithms can all be coded as programs ina single programming language.• It then uses the fact that all programs are just strings over an alphabet.• It is assumed that (arbitrary length) strings are a datatype in the programminglanguage.• We then consider a specific property P of programs. The set of strings representingprograms with that property, as it turns out, cannot be recognizedby any one program in the language. Since each algorithm is representableby one program in the language, this means that no algorithm can solve thequestion: does a given program have property P ?• What’s the magic property P ? A program x has the property if x goes intoan infinite loop when fed the string x (its own encoding) as an input.• If there was a program p that recognized this property of other programs,then we could alter it so that it went into an infinite loop whenever it wouldhave answered “no.” (Just change the print “no” statement into a loop.)• Then we give this altered program p a its own program as input. If the run isinfinite, that means that the unaltered program p predicted that the answerwas “no” – p a did not go into an infinite loop on its own input. But p a justdid, so it can’t be the case that p a went into an infinite loop on itself asinput.• So p a says “yes” to its own input, which means that the original programp predicted that p a went into an infinite loop on its own input. But p a juststopped and said “yes”, so this case can’t happen either.• Other properties can be shown not to have an algorithm by proving that ifthey did, then there would be an algorithm to solve property P of programs.17

How do you prove that there <strong>is</strong>n’t any <strong>algorithm</strong> to solve a problem?• The basic method <strong>is</strong> to prove it by contradiction.• The method also assumes that <strong>algorithm</strong>s can all be coded as programs ina single programming language.• It then uses the fact that all programs are just strings over an alphabet.• It <strong>is</strong> assumed that (arbitrary length) strings are a datatype in the programminglanguage.• We then consider a specific property P of programs. The set of strings representingprograms with that property, as it turns out, cannot be recognizedby any <strong>one</strong> program in the language. Since each <strong>algorithm</strong> <strong>is</strong> representableby <strong>one</strong> program in the language, th<strong>is</strong> means that no <strong>algorithm</strong> can solve thequestion: does a given program have property P ?• What’s the magic property P ? A program x has the property if x goes intoan infinite loop when fed the string x (its own encoding) as an input.• If there was a program p that recognized th<strong>is</strong> property of other programs,then we could alter it so that it went into an infinite loop whenever it wouldhave answered “no.” (Just change the print “no” statement into a loop.)• Then we give th<strong>is</strong> altered program p a its own program as input. If the run <strong>is</strong>infinite, that means that the unaltered program p predicted that the answerwas “no” – p a did not go into an infinite loop on its own input. But p a justdid, so it can’t be the case that p a went into an infinite loop on itself asinput.• So p a says “yes” to its own input, which means that the original programp predicted that p a went into an infinite loop on its own input. But p a juststopped and said “yes”, so th<strong>is</strong> case can’t happen either.• Other properties can be shown not to have an <strong>algorithm</strong> by proving that ifthey did, then there would be an <strong>algorithm</strong> to solve property P of programs.17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!