back to indexRichard Karp: Algorithms and Computational Complexity | Lex Fridman Podcast #111
Chapters
0:0 Introduction
3:50 Geometry
9:46 Visualizing an algorithm
13:0 A beautiful algorithm
18:6 Don Knuth and geeks
22:6 Early days of computers
25:53 Turing Test
30:5 Consciousness
33:22 Combinatorial algorithms
37:42 Edmonds-Karp algorithm
40:22 Algorithmic complexity
50:25 P=NP
54:25 NP-Complete problems
70:29 Proving P=NP
72:57 Stable marriage problem
80:32 Randomized algorithms
93:23 Can a hard problem be easy in practice?
103:57 Open problems in theoretical computer science
106:21 A strange idea in complexity theory
110:49 Machine learning
116:26 Bioinformatics
120:37 Memory of Richard's father
00:00:00.000 |
The following is a conversation with Richard Karp, 00:00:02.920 |
a professor at Berkeley and one of the most important figures 00:00:06.320 |
in the history of theoretical computer science. 00:00:12.680 |
for his research in the theory of algorithms, 00:00:15.140 |
including the development of the admirance Karp algorithm 00:00:18.420 |
for solving the max flow problem on networks, 00:00:24.380 |
maximum cardinality matchings in bipartite graphs, 00:00:31.000 |
called "Reducibility Among Combinatorial Problems," 00:00:35.320 |
in which he proved 21 problems to be NP-complete. 00:00:39.040 |
This paper was probably the most important catalyst 00:00:41.880 |
in the explosion of interest in the study of NP-completeness 00:00:58.820 |
and downloading Cash App and using code LEXPODCAST. 00:01:04.600 |
It really is the best way to support this podcast. 00:01:08.080 |
If you enjoy this thing, subscribe on YouTube, 00:01:23.000 |
This show is sponsored by 8Sleep and its Pod Pro mattress 00:01:27.380 |
that you can check out at 8sleep.com/lex to get $200 off. 00:01:41.040 |
Research shows that temperature has a big impact 00:01:45.020 |
Anecdotally, it's been a game changer for me. 00:01:52.520 |
both in the fact that I'm getting better sleep 00:02:06.440 |
in one of the most important aspects of life, 00:02:08.400 |
which is sleep, I think has a lot of potential 00:02:15.320 |
that track heart rate, heart rate variability, 00:02:17.760 |
and respiratory rate, showing it all in their app. 00:02:24.360 |
but the cooling alone is honestly worth the money. 00:02:32.000 |
Check it out at 8sleep.com/flex to get $200 off. 00:02:39.080 |
and considering the purchase helps convince the folks 00:02:50.580 |
and powerful Cash App, the number one finance app 00:03:08.520 |
To me, good design is when everything is easy and natural. 00:03:23.160 |
Anyway, there's a big part of my brain and heart 00:03:27.400 |
and also to appreciate great design by others. 00:03:39.600 |
an organization that is helping to advance robotics 00:03:42.320 |
and STEM education for young people around the world. 00:03:45.720 |
And now, here's my conversation with Richard Karp. 00:04:00.260 |
Are there problems, proofs, properties, ideas 00:04:07.860 |
or just enjoying to go through to prove various aspects? 00:04:15.200 |
about an experience he had when he was a young student 00:04:19.480 |
who was tossed out of his classroom for bad behavior 00:04:25.400 |
and was wandering through the corridors of his school 00:04:45.860 |
"You take the straight line between the two centers 00:04:52.520 |
"and the segment between the two circles is the shortest 00:04:56.240 |
"because a straight line is the shortest distance 00:05:13.000 |
that pure reasoning could come up with such a result. 00:05:21.240 |
from the two centers of the circles is a straight line. 00:05:24.820 |
Could you once again say what's the next step in that proof? 00:05:36.840 |
if you extend it by taking the radius on each side, 00:05:48.560 |
And this has to be at least as long as the shortest path, 00:06:09.760 |
about geometry beyond dispute by pure reasoning. 00:06:23.520 |
It was much more fun than the earlier mathematics courses 00:06:27.600 |
which were mostly about arithmetic operations 00:06:38.280 |
that you can visualize? - Oh, yes, absolutely. 00:06:44.280 |
I wasn't very good at three-dimensional vision. 00:06:47.440 |
- You mean being able to visualize three-dimensional objects? 00:07:01.880 |
but for example, the fact that the sum of the angles 00:07:06.880 |
of a triangle is 180 degrees is proved convincingly, 00:07:12.160 |
and it comes as a surprise that that can be done. 00:08:15.760 |
and the angles, by the equality of alternate angles, 00:08:45.000 |
yeah, being able, the puzzles, the visual aspects 00:09:01.860 |
but those require high-dimensional visualization, 00:09:08.020 |
and so I tend to go by the algebraic properties. 00:09:19.580 |
- Well, the interpretation in terms of, for example, 00:09:31.140 |
but again, I don't have the high-dimensional intuition 00:09:58.120 |
- What's inside your mind when you're thinking 00:10:02.260 |
Or even just tackling any mathematical problem? 00:10:24.240 |
from the desired solution as iteratively reducing 00:10:33.360 |
- And try to take steps that get you closer to the-- 00:10:41.280 |
So it's basically the mechanics of the algorithm 00:10:48.080 |
but especially when you're trying something out 00:10:58.960 |
and I could see there was a particular function 00:11:04.680 |
and it was fascinating to see the successive approaches 00:11:13.020 |
traveling salesman problem is where you have to visit 00:11:22.420 |
Find the shortest path through a set of cities. 00:11:34.460 |
about being able to think about the objective function there 00:11:41.540 |
- Well, it's just that as the algorithm proceeded, 00:11:45.220 |
you were making progress, continual progress, 00:12:17.740 |
or is it in the messy details of actually showing 00:12:22.100 |
that it is going to get to the exact solution 00:12:34.800 |
that the gap from the optimum decreases monotonically, 00:12:48.720 |
are improving all along until finally you hit the optimum. 00:12:53.680 |
Perhaps later we'll talk about the assignment problem, 00:13:03.120 |
Don Knuth has called attention to a breed of people 00:13:10.520 |
from contemplating the structure of computational processes. 00:13:25.720 |
So perhaps you can explain what the assignment problem is 00:14:04.320 |
such that the sum of the associated costs will be minimized. 00:14:08.760 |
So the best way to match the boys with the girls 00:14:21.840 |
- All one-to-one correspondences are permissible. 00:14:26.840 |
If there is a connection that is not allowed, 00:14:29.480 |
then you can think of it as having an infinite cost. 00:14:32.960 |
- So what you do is to depend on the observation 00:15:06.680 |
between the different assignments is not changed by that. 00:15:30.280 |
and keep subtracting from rows or entire columns 00:15:36.280 |
in such a way that you subtract the same constant 00:16:04.280 |
is find small moves which will decrease the total cost 00:16:09.680 |
while subtracting constants from rows or columns. 00:16:28.520 |
until you finally get a full permutation of zeros 00:16:34.920 |
and then you know that that has to be the cheapest. 00:16:42.560 |
So the shortest path through the matrix part? 00:16:59.120 |
and adding the same constant back to other rows and columns. 00:17:04.120 |
So as not to reduce any of the zero elements, 00:17:29.800 |
that made you go, "Aha, this is a beautiful," 00:17:35.680 |
something so simple can solve a problem like this. 00:17:44.800 |
or other activities where you sort of shape something 00:17:58.360 |
systematic nature of that iterative algorithm 00:18:05.560 |
- So what do you think about this idea of geeks, 00:18:15.560 |
to a mindset that allows you to discover the elegance 00:18:19.880 |
in computational processes, or is this all of us? 00:18:28.480 |
- I think so, I always like to play with numbers. 00:18:35.640 |
by multiplying four-digit decimal numbers in my head. 00:18:40.280 |
And putting myself to sleep by starting with one 00:18:44.400 |
and doubling the number as long as I could go. 00:18:59.840 |
by, I believe, multiplying four-digit numbers. 00:19:25.680 |
"Come one, come all, come in and play skee-ball. 00:19:28.160 |
"Five cents to play, a nickel to win," and so on. 00:19:31.080 |
- That's what a barker, I wasn't sure if I should know, 00:19:33.860 |
but barker, you're the charming, outgoing person 00:19:41.240 |
- Yeah, well, I wasn't particularly charming, 00:19:46.180 |
And the other employees were sort of juvenile delinquents 00:19:57.360 |
but somehow I found that I could impress them 00:20:08.340 |
Some of the most popular videos on the internet is, 00:20:21.280 |
- There's still something really profoundly interesting 00:20:36.400 |
Any lessons you drew from your early teen years 00:20:40.540 |
when you were showing off to your friends with the numbers? 00:20:50.480 |
The general population, not just the computer scientists 00:20:59.600 |
You can test whether large numbers are prime. 00:21:14.000 |
- And there's a kind of achievement, it's puzzle solving. 00:21:19.000 |
And at a higher level, the fact that you can do 00:21:24.600 |
in an absolutely ironclad way that some of the angles 00:21:31.540 |
- Yeah, it's a nice escape from the messiness 00:21:35.320 |
of the real world where nothing can be proved. 00:21:38.120 |
So, and we'll talk about it, but sometimes the ability 00:21:55.480 |
And so they can live in a world of abstractions 00:22:57.960 |
So I never used that machine for any practical purpose. 00:23:19.840 |
- There was already commercial computers in the-- 00:23:21.800 |
- Yeah, we had a UNIVAC with 2,000 words of storage. 00:23:34.920 |
from one word to another depended on the number 00:23:44.880 |
the storage allocation to make fetching data rapid. 00:23:49.880 |
- Were you attracted to this actual physical world 00:23:58.180 |
So it's a mathematical machine that's actually 00:24:04.840 |
I think I was attracted to the underlying algorithms. 00:24:22.040 |
we'd have billions of these computers all over the world? 00:24:38.480 |
She told me that data processing was gonna be really big 00:24:49.040 |
And there was just a feeling that this was going 00:24:53.040 |
to change the world, but I didn't think of it 00:24:57.120 |
I had no anticipation that we would be walking around 00:25:02.120 |
with computers in our pockets or anything like that. 00:25:16.560 |
or as the AI folks, which is an entire other community 00:25:33.960 |
- The Turing test, computing and intelligence? 00:26:01.040 |
- But to linger on that, do you think it's part, 00:26:03.220 |
because you've come up with some incredible tests 00:26:13.360 |
across a bunch of different classes of algorithms. 00:26:16.520 |
But returning to this emotional mess that is intelligence, 00:26:21.240 |
do you think it's possible to come up with a test 00:26:42.080 |
do you think it's possible to create algorithms 00:26:51.320 |
to have the same kind of intelligence as human beings? 00:27:03.140 |
have operate within a very limited set of ground rules 00:27:17.560 |
from the processes that go on in the minds of humans, 00:27:27.740 |
They have emotions, they have physical attributes 00:27:38.980 |
They have intuition, they have desires, emotions. 00:27:44.620 |
And I don't see anything in the current achievements 00:27:52.100 |
of what's called AI that come close to that capability. 00:28:09.040 |
- Do you think this complexity of human intelligence, 00:28:15.580 |
all the cognitive abilities we have, all the emotion, 00:28:27.260 |
So can a Turing machine achieve human-level intelligence? 00:28:50.760 |
And if you buy the premise that the human brain 00:28:54.300 |
is just an enormous interconnected set of switches, 00:29:29.360 |
So there is, however, an existence proof that 00:29:32.460 |
if you believe that the brain is just a network 00:29:44.280 |
I guess you could say that that's an existence proof 00:30:04.300 |
Do you think, what do you make of consciousness, 00:30:13.180 |
the fact that we have this subjective experience. 00:30:26.860 |
- Yeah, to know the algorithm, to know itself. 00:30:32.140 |
I think if you try to define that rigorously, 00:30:45.100 |
believe that general intelligence can be achieved, 00:31:01.740 |
which will then learn more and more about themselves 00:31:08.640 |
I am doubtful that this will ever be achieved. 00:31:20.900 |
that are extremely worried about this existential threat 00:31:25.220 |
of artificial intelligence, of us being left behind 00:31:32.340 |
What's your intuition why that's not quite likely? 00:31:41.420 |
in speech or robotics or natural language processing 00:32:02.300 |
if we look at Moore's law, an exponential improvement 00:32:20.220 |
that goes from the Mark I computer to an iPhone 10. 00:32:27.540 |
- So do you think we could be really surprised 00:32:37.540 |
that also intelligence is actually way, way, way, way harder 00:32:42.220 |
even with exponential improvement to be able to crack? 00:32:47.100 |
- I don't think any constant factor improvement 00:33:04.900 |
it seems to me that multiplying the speed of the switches 00:33:10.940 |
will not be useful until we really understand 00:33:16.580 |
the organizational principle behind the network of switches. 00:33:21.260 |
- Well, let's jump into the network of switches 00:33:25.420 |
and talk about combinatorial algorithms if we could. 00:33:36.980 |
- A combinatorial algorithm is one which deals 00:33:52.340 |
or take on various values from a discrete set of values 00:33:59.740 |
and need to be arranged or selected in such a way 00:34:04.740 |
as to achieve some, to minimize some cost function 00:34:19.980 |
So an example would be coloring the vertices of a graph. 00:34:36.140 |
the most basic questions in the beginning of most books. 00:34:41.380 |
but in general how you think about it, what is a graph? 00:34:57.820 |
in different applications represent the interconnections 00:35:07.700 |
interconnections between switches in a digital circuit 00:35:12.460 |
or interconnections indicating the communication patterns 00:35:57.260 |
the efficiency of such networks or learning about 00:36:11.340 |
So it could be scheduling classes at a school 00:36:20.780 |
are the individual classes and the edges indicate 00:36:25.780 |
the constraints which say that certain classes 00:36:38.460 |
Or I talked earlier about the assignment problem 00:37:02.900 |
you might want to find a set of so-called gates, 00:37:11.940 |
which can be interconnected to realize some function. 00:37:20.140 |
in order to, for a circuit to give a yes output 00:37:27.020 |
if at least a given number of its inputs are ones 00:37:42.980 |
- My favorite is probably all the work with network flows. 00:37:46.620 |
So anytime you have, I don't know why it's so compelling, 00:37:50.780 |
but there's something just beautiful about it. 00:38:09.540 |
and intellectually compelling to me about it. 00:38:14.660 |
- Yeah, so there the edges represent channels 00:38:29.900 |
- Maybe supply chain as well, like products being-- 00:38:33.860 |
- Products flowing from one operation to another. 00:38:40.280 |
which is the rate at which the commodity can flow. 00:38:51.660 |
in this case, the edges are communication channels. 00:39:01.300 |
at which the information can flow along these channels 00:39:09.180 |
And that's a fundamental combinatorial problem 00:39:19.100 |
we, I think we're the first to give a formal proof 00:39:22.460 |
that this maximum flow problem through a network 00:39:30.740 |
- Which I remember the first time I learned that, 00:39:33.940 |
just learning that in maybe even grad school, 00:39:43.400 |
Do network flows get taught in basic algorithms courses? 00:39:51.140 |
- Okay, so yeah, I remember being very surprised 00:39:53.780 |
that max flow is a polynomial time algorithm. 00:39:57.420 |
- That there's a nice, fast algorithm that solves max flow. 00:40:00.140 |
But, so there is an algorithm named after you in Edmonds. 00:40:12.580 |
and trying to arrive at a polynomial time solution? 00:40:17.180 |
maybe you can describe what's the running time complexity 00:40:34.180 |
What are the major classes of algorithm complexity? 00:40:38.220 |
So we, in a problem like the assignment problem 00:40:41.860 |
or scheduling schools or any of these applications, 00:40:51.460 |
which might, for example, be a set of vertices 00:41:01.900 |
you're given for each edge, the capacity of the edge. 00:41:10.980 |
which are, think of them as computer programs 00:41:14.740 |
with operations such as addition, subtraction, 00:41:18.540 |
multiplication, division, comparison of numbers and so on. 00:41:35.020 |
of computational steps, the answer to the problem. 00:41:52.460 |
And an algorithm is said to run in polynomial time 00:42:04.980 |
the number of vertices, the number of edges and so on. 00:42:15.200 |
A linear algorithm would execute a number of steps 00:42:24.700 |
Quadratic algorithm would be steps proportional 00:42:53.260 |
And we're interested in which problems can be solved 00:43:02.280 |
One can argue whether that's the right definition 00:43:04.920 |
of efficient because you could have an algorithm 00:43:26.900 |
that you wanna make to allow a real world system 00:43:50.000 |
- Okay, so that's polynomial time algorithms. 00:44:24.560 |
Then the class of such algorithms is called P. 00:44:29.400 |
- In the worst case, by the way, we should say, right? 00:44:33.100 |
- Yes, that's right, and that's very important 00:44:36.560 |
when we measure the complexity of an algorithm, 00:44:45.040 |
the growth of the number of steps in the worst case. 00:45:00.160 |
that would increase the computational complexity 00:45:15.600 |
from the point of view of their worst case performance 00:45:24.360 |
the class of problems solvable in polynomial time. 00:45:27.580 |
Then there's NP, which is the class of problems 00:45:38.880 |
but where the, where when confronted with a solution, 00:45:56.000 |
the number of numbers that you need to write down 00:46:11.560 |
And Jack Edmonds and I were the first to show 00:46:23.900 |
So as a polynomial function of the size of the input, 00:46:33.280 |
the question is how long would it take to verify 00:46:47.680 |
we might want to find the largest clique in the graph, 00:46:53.160 |
or a clique is a set of vertices such that any vertex, 00:46:58.520 |
each vertex in the set is adjacent to each of the others. 00:47:08.960 |
- Yeah, so if it's a Facebook social network, 00:47:14.960 |
- No, that would be what's called a complete graph, 00:47:28.840 |
- Is everybody is friends with everybody, yeah. 00:47:35.480 |
whether in a given graph there exists a clique 00:47:41.920 |
- Well, that turns out to be a very hard problem, 00:47:52.040 |
hands you a set of vertices and asks you to check 00:47:56.160 |
whether it's a clique, you could do that simply 00:48:10.480 |
- That's a polynomial, so the problem of finding the clique 00:48:21.680 |
to see if it reaches a target number of vertices 00:48:31.640 |
So finding the clique is hard, checking it is easy. 00:48:39.000 |
non-deterministic polynomial time algorithms, 00:49:04.140 |
It's clear that every problem in NP is also in NP. 00:49:17.500 |
On the other hand, there are problems in the class NP. 00:49:22.500 |
This is the class of problems that are easy to check, 00:49:29.660 |
It's not at all clear that problems in NP lie in P. 00:49:33.740 |
So for example, if we're looking at scheduling classes 00:49:47.980 |
that doesn't mean that you can find the schedule rapidly. 00:49:51.380 |
So intuitively, NP, non-deterministic polynomial, 00:50:06.140 |
Checking is easier, and therefore the class of problems 00:50:08.820 |
that can be checked appears to be much larger 00:50:11.940 |
than the class of problems that can be solved. 00:50:21.500 |
that designate that we don't know for sure yet. 00:50:27.020 |
which is considered to be the most central problem 00:51:05.780 |
we expect that if somebody hands you a satisfying schedule, 00:51:18.960 |
So intuitively, NP encompasses a lot more problems than P. 00:51:30.480 |
So do you, first of all, think that the biggest 00:51:55.960 |
and have been studied intensively in mathematics, 00:52:05.600 |
And no polynomial time algorithms have been found 00:52:19.880 |
who was interested in factoring large numbers. 00:52:35.120 |
So if we can factor a number like 91, it's seven times 13. 00:52:41.360 |
But if I give you 20 digit or 30 digit numbers, 00:52:52.560 |
to have any idea whether they can be factored. 00:52:55.460 |
So the problem of factoring very large numbers 00:53:00.080 |
does not appear to have an efficient solution. 00:53:09.600 |
expressed the number as a product of two smaller numbers, 00:53:16.560 |
you can quickly verify that they are factors of the number. 00:53:19.960 |
- And your intuition is a lot of people finding, 00:53:25.720 |
This one particular problem, there's many others like it 00:53:30.560 |
and it would be great to find an efficient algorithm for. 00:53:43.460 |
following up on work by the mathematician Stephen Cook, 00:53:55.820 |
there's a huge number that are equivalent in the sense 00:53:59.380 |
that either all of them or none of them lie in P. 00:54:10.900 |
that virtually all the standard combinatorial problems, 00:54:22.460 |
none of them can be solved in polynomial time. 00:54:28.500 |
to tie together so many problems in a nice bunch 00:54:32.240 |
that if one is proven to be efficient, then all are? 00:54:36.540 |
- The first and most important stage of progress 00:54:49.660 |
called the satisfiability problem of propositional logic 00:55:00.140 |
So the propositional logic problem is expressed 00:55:05.140 |
in terms of expressions involving the logical operations 00:55:19.200 |
So an instance of the problem would be some formula 00:55:26.740 |
And the question would be whether there is an assignment 00:55:31.140 |
of truth values to the variables in the problem 00:55:42.360 |
and A or not B and not A or B and not A or not B 00:55:54.580 |
you can determine that no assignment of truth values 00:55:59.020 |
to the variables A and B will allow that conjunction 00:56:08.860 |
So that's an example of a formula in propositional logic 00:56:14.160 |
involving expressions based on the operations and or and not. 00:56:21.900 |
That's an example of a problem which is not satisfiable. 00:56:32.880 |
and fundamental problems in computer science. 00:56:35.300 |
It's like a nice statement of a really hard problem. 00:56:37.680 |
- It's a nice statement of a really hard problem. 00:56:39.960 |
And what Cook showed is that every problem in NP 00:57:17.800 |
can be translated into an equivalent algorithm 00:57:37.800 |
which say if you're reading a particular symbol on the tape 00:57:53.760 |
the cell of the tape that you were looking at. 00:57:55.720 |
- And that was like a metaphor and a mathematical construct 00:58:29.220 |
any possible non-deterministic polynomial time algorithm, 00:59:07.640 |
can be described by a list of such instructions, 00:59:15.840 |
into the language of the satisfiability problem. 00:59:20.360 |
if you take yourself back when you were first thinking 00:59:40.760 |
It tells us that this, of all the problems in NP, 00:59:46.280 |
all the problems where solutions are easy to check, 01:00:13.720 |
as simply asking whether the satisfiability problem 01:00:17.560 |
of propositional logic is solvable in polynomial time. 01:00:30.320 |
when he published it in a conference in 1971. 01:00:37.720 |
and saw this reduction of each of the problems in NP 01:00:44.360 |
by a uniform method to the satisfiability problem 01:00:57.640 |
And it occurred to me through experience I had had 01:01:04.080 |
in trying to solve other combinatorial problems 01:01:10.380 |
which seemed to have that universal structure. 01:01:53.620 |
- Integers, in fact, must be either zero or one. 01:02:07.340 |
that the satisfiability problem can be restated 01:02:35.180 |
is whether a graph contains a clique of a given size. 01:02:46.700 |
can we reduce the propositional logic problem 01:02:56.720 |
Well, if you look at the propositional logic problem, 01:03:10.460 |
where A is either one of the variables in the problem 01:03:20.860 |
And an instance of the propositional logic problem 01:03:30.220 |
can be rewritten using operations of Boolean logic. 01:03:35.220 |
Can be rewritten as the conjunction of a set of clauses, 01:04:01.220 |
is whether those clauses can be simultaneously satisfied. 01:04:09.100 |
you have to find one of the terms in each clause, 01:04:13.100 |
which is going to be true in your truth assignment, 01:04:18.940 |
but you can't make the same variable both true and false. 01:04:29.580 |
and you want to satisfy that clause by making A true, 01:04:39.700 |
- And so the goal is to make every single clause true 01:04:58.420 |
to something called the independent set problem, 01:05:01.180 |
where you're just sort of asking for a set of vertices 01:05:06.180 |
in a graph such that no two of them are adjacent, 01:05:11.060 |
So we've seen that we can now express that as... 01:05:39.020 |
Because if the variable is assigned the truth value, 01:05:42.860 |
the negated variable has to have the opposite truth value. 01:05:50.420 |
where the vertices are the terms in all of the clauses. 01:06:17.020 |
because you're only picking one element from each clause. 01:06:23.380 |
if they represent opposite values of the same variable, 01:06:27.300 |
because you can't make a variable both true and false. 01:06:32.460 |
where you have all of these occurrences of variables. 01:06:35.460 |
You have edges, which mean that you're not allowed 01:06:53.180 |
sort of to zoom out, that's a really powerful idea 01:07:03.940 |
And do that mapping for all possible formulations 01:07:11.020 |
- I mean, that still is hard for me to believe 01:07:24.860 |
there's such a friendship among all these problems across 01:07:28.780 |
that somehow are akin to combinatorial algorithms, 01:07:35.940 |
I know it can be proven, but what do you make of it, 01:07:41.740 |
- Well, that they just have the same expressive power. 01:07:49.580 |
and translate it into the terms of the other. 01:07:53.460 |
- The fact that they have the same expressive power 01:07:55.580 |
also somehow means that they can be translatable. 01:08:24.300 |
that any of those have the same expressive power. 01:08:30.340 |
- And that was like throwing down the gauntlet 01:08:31.980 |
of saying there's probably many more problems like this. 01:08:45.180 |
whether they are rich enough to express any of the others. 01:08:57.780 |
But what we can say is that either all of these problems 01:09:02.220 |
or none of them are solvable in polynomial time. 01:09:05.820 |
- Yeah, so where does NP completeness and NP hard 01:09:14.060 |
So when we're talking about decision problems, 01:09:17.300 |
that means that the answer is just yes or no. 01:09:25.540 |
On the other hand, an optimization problem would be asking, 01:09:41.300 |
when you're putting a valuation on the different solutions 01:09:46.660 |
and you're asking for the one with the highest valuation, 01:09:55.420 |
But the counterpart of being the hardest decision problem, 01:10:19.900 |
those are called NP hard rather than NP complete. 01:10:47.260 |
- All I can say is that it will involve concepts 01:10:52.220 |
that we do not now have and approaches that we don't have. 01:11:01.980 |
inside of computational analysis of algorithms? 01:11:09.140 |
- I think that if there is a proof that P is equal to NP 01:11:15.040 |
it'll depend on concepts that are now outside the box. 01:11:21.320 |
- Now if that's shown, either way, P equals NP or P not, 01:11:28.240 |
what impact, you kind of mentioned a little bit, 01:11:42.180 |
- Well, I think it would have enormous impact 01:11:49.160 |
If P is unequal to NP, which is what we expect, 01:12:11.620 |
in that it may be that we can solve most instances. 01:12:16.580 |
All we know is that if a problem is not in P, 01:12:19.860 |
then it can't be solved efficiently on all instances. 01:12:35.300 |
to get the optimal solutions to these problems. 01:12:45.820 |
- So we would turn our eye towards the heuristics 01:12:52.220 |
with a little bit more acceptance and comfort on our hearts. 01:12:57.580 |
- Okay, so let me ask a romanticized question. 01:13:04.460 |
or the most beautiful combinatorial algorithm 01:13:47.400 |
And each girl also has an ordering of the boys, 01:14:03.460 |
a one-to-one matching of the boys with the girls is stable 01:14:18.660 |
prefers the girl in the second couple to her mate 01:14:27.060 |
In other words, if there is, the matching is stable 01:14:31.300 |
if there is no pair who want to run away with each other, 01:14:44.940 |
- Actually, this is relevant to matching residents 01:14:49.100 |
with hospitals and some other real-life problems, 01:14:52.300 |
although not quite in the form that I described. 01:14:59.780 |
that for any set of preferences, a stable matching exists. 01:15:04.780 |
And moreover, it can be computed by a simple algorithm 01:15:14.020 |
in which each boy starts making proposals to girls. 01:15:23.940 |
she accepts it tentatively, but she can drop it if, 01:15:32.780 |
if she gets a better proposal from her point of view. 01:15:39.000 |
proposing to their first, second, third choices 01:15:46.980 |
But the girls, meanwhile, are watching the proposals 01:16:03.500 |
- And the boys never go back through the list? 01:16:14.640 |
because the girls are always improving their status 01:16:28.580 |
And one can prove that the process will come to an end 01:16:39.540 |
where everybody will get matched with somebody, 01:16:43.460 |
and you won't have any pair that want to abscond 01:16:50.420 |
- Do you find the proof or the algorithm itself beautiful, 01:16:59.540 |
I mean, the simplicity of the underlying rule 01:17:01.780 |
of the algorithm, is that the beautiful part? 01:17:07.540 |
And you also have the observation that you might ask, 01:17:11.740 |
who is better off, the boys who are doing the proposing 01:17:17.740 |
And it turns out that it's the boys who are doing the best, 01:17:45.120 |
but certainly seems like a compelling notion. 01:17:51.340 |
of actual real-world problems that this could be mapped to. 01:17:58.620 |
For example, what happens when a husband and wife 01:18:03.740 |
So you have to take those constraints into account. 01:18:13.100 |
- Why is it a problem for the husband and wife 01:18:27.380 |
- If you're assigning residents to hospitals. 01:18:32.100 |
for the husband and wife or for the hospitals. 01:18:47.700 |
But if resident A, the boy, is going to Philadelphia, 01:18:52.700 |
then you'd like his wife also to be assigned to a hospital. 01:19:01.220 |
- To be assigned to a hospital in Philadelphia. 01:19:04.420 |
- Which step makes it a NP-hard problem that you mentioned? 01:19:08.020 |
- The fact that you have this additional constraint. 01:19:11.140 |
That it's not just the preferences of individuals, 01:19:15.020 |
but the fact that the two partners to a marriage 01:19:30.780 |
No, not the perfect, stable matching is what you refer to. 01:19:36.060 |
- Okay, what's confusing you is that in the first 01:20:11.500 |
My friend David Gale passed away before he could get part 01:20:16.860 |
of the Nobel Prize, but his partner Shapley shared 01:20:31.540 |
- So you've also developed yourself some elegant, 01:20:37.340 |
Again, picking your children, so the Robin Karp algorithm 01:20:42.340 |
for string searching, pattern matching, Edmund Karp 01:20:46.860 |
Hopcroft Karp algorithm for finding maximum cardinality 01:20:55.460 |
ones you're most proud of, or just whether it's beauty, 01:21:05.740 |
development in your life that you're especially proud of? 01:21:08.740 |
- I like the Robin Karp algorithm because it illustrates 01:21:17.500 |
So the problem there is to decide whether a given long string 01:21:22.500 |
of symbols from some alphabet contains a given word, 01:21:38.220 |
whether a particular word occurs within some very much 01:21:42.940 |
longer word, and so the idea of the algorithm 01:21:47.940 |
is to associate with the word that we're looking for, 01:21:57.180 |
a fingerprint, some number or some combinatorial object 01:22:02.180 |
that describes that word, and then to look for an occurrence 01:22:12.260 |
of that same fingerprint as you slide along the longer word. 01:22:15.660 |
And what we do is we associate with each word a number. 01:22:23.500 |
So we, first of all, we think of the letters that occur 01:22:29.660 |
in a word as the digits of, let's say, decimal 01:22:33.620 |
or whatever base here, whatever number of different symbols 01:22:44.340 |
- Right, so every word can then be thought of as a number 01:22:48.180 |
with the letters being the digits of that number. 01:22:52.380 |
And then we pick a random prime number in a certain range 01:23:03.260 |
and take the remainder on dividing that number by the prime. 01:23:26.380 |
- It's very different than other algorithms of its kind 01:23:31.060 |
that were trying to do search, string matching. 01:23:38.060 |
and don't involve the idea of taking a random fingerprint. 01:23:43.620 |
- And doing the fingerprinting has two advantages. 01:23:51.580 |
digit by digit, we keep a window of a certain size, 01:24:00.660 |
And we compute the fingerprint of every stretch 01:24:05.780 |
of that length and it turns out that just a couple 01:24:11.900 |
from the fingerprint of one part to what you get 01:24:18.740 |
So the computation of all the fingerprints is simple. 01:24:24.540 |
And secondly, it's unlikely if the prime is chosen randomly 01:24:32.780 |
from a certain range that you will get two of the segments 01:24:48.740 |
because you're working with these fingerprints 01:24:54.640 |
- So that's the magical thing about randomized algorithms 01:24:58.040 |
is that if you add a little bit of randomness, 01:25:02.460 |
it somehow allows you to take a pretty naive approach, 01:25:18.340 |
- Well, it's just the ability to draw a random number 01:25:22.460 |
from some range or to associate a random number 01:25:30.480 |
with some object or to draw at random from some set. 01:26:00.160 |
And if it was of substantial size, say a few thousand 01:26:05.160 |
then the most popular candidate in that group 01:26:08.920 |
would be very likely to be the correct choice 01:26:12.280 |
that would come out of counting all the millions of votes. 01:26:18.440 |
everybody has to feel that his or her vote counted. 01:26:21.920 |
And secondly, we can't really do a purely random sample 01:26:28.000 |
And I guess thirdly, there could be a tie in which case 01:26:37.560 |
if you didn't have all that messiness of human beings, 01:26:40.480 |
you could prove that that kind of random picking would-- 01:26:43.320 |
- You guess that random picking would solve the problem 01:26:51.360 |
Another example is testing whether a number is prime. 01:27:31.000 |
and raise it to the N minus one power modulo N, 01:27:57.360 |
the probability that you will get a value unequal, 01:28:05.280 |
you will get a violation of Fermat's result is very high 01:28:14.320 |
and so this gives you a way of rapidly proving 01:28:26.320 |
where something a little more elaborate has to be done 01:28:34.920 |
and therefore if it ever fails on any instance 01:28:39.500 |
for a non-prime, you know that the number is not prime. 01:28:50.920 |
of what's your intuition why randomness works so well 01:28:56.460 |
- Well, the example of conducting an election 01:29:00.840 |
where you could take in theory, you could take a sample 01:29:17.760 |
And I actually exploited that sort of random sampling idea 01:29:22.760 |
in designing an algorithm for counting the number 01:29:28.120 |
of solutions that satisfy a particular formula 01:30:02.480 |
and you want to count the number of solutions 01:30:23.480 |
that satisfy any particular one of the formulas, 01:30:29.920 |
that that solution might be counted many times 01:30:40.840 |
And so what you do is you sample from the formulas 01:30:55.640 |
but then you correct by looking at the number of formulas 01:31:00.200 |
that satisfy that random solution and don't double count. 01:31:20.600 |
And you can count in each row how many ones there are. 01:31:31.680 |
If a row has more ones, it gets drawn more frequently. 01:31:42.580 |
where that same one is repeated in different rows 01:31:51.260 |
if it's the earliest row that contains the one. 01:31:55.680 |
- And that gives you a robust statistical estimate 01:32:13.340 |
Another viewpoint is that if you have a phenomenon 01:32:21.400 |
then if you sample one of the occasions where it occurs, 01:32:27.580 |
you're most likely to, and you're looking for an occurrence, 01:32:42.660 |
You get two formulas that may look very different. 01:33:10.600 |
And if there are many ways for the two to disagree, 01:33:23.540 |
so we've just talked about randomized algorithms, 01:33:26.020 |
but we can look at the probabilistic analysis 01:33:29.700 |
And that gives us an opportunity to step back. 01:33:34.260 |
everything we've been talking about is worst case analysis. 01:33:45.420 |
versus best case analysis, average case, probabilistic? 01:33:52.760 |
of theoretical computer science, computer science, 01:34:11.580 |
that an algorithm is always good, that's fine. 01:34:23.580 |
that the problem, that the solution is not always good, 01:34:28.580 |
then you have to step back and do something else to ask, 01:34:58.860 |
There are very powerful programs called SAT solvers, 01:35:04.500 |
which in practice fairly reliably solve instances 01:35:12.480 |
in a digital design or in proving programs correct 01:35:34.820 |
that the people in that discipline tend to think 01:35:50.540 |
in designing digital circuits or other applications 01:35:54.380 |
are such that satisfiability is not hard to check. 01:36:27.040 |
and you want to find a tour through all the cities 01:36:31.460 |
that minimizes the total cost of all the edges traversed, 01:36:56.600 |
where the cities are, let's say, points in the plane, 01:37:19.200 |
even though, again, we know that it's unlikely 01:37:59.760 |
on getting, showing all these problems to be NP-complete, 01:38:09.740 |
shed some positive light on combinatorial algorithms, 01:38:16.140 |
problems, behavior on the average or with high probability, 01:38:48.920 |
by simply choosing one edge at a time at random 01:39:10.640 |
So we could show that we know exactly how many edges 01:39:24.060 |
that's a cycle that visits each vertex exactly once. 01:39:47.880 |
And we got the community in which I was working, 01:40:07.340 |
because we were making such a simplistic assumption 01:40:09.900 |
about the kinds of graphs that we would be dealing with. 01:40:13.980 |
So we could show all kinds of wonderful things, 01:40:16.020 |
it was a great playground, I enjoyed doing it, 01:40:31.320 |
- Okay, so there's too much into the world of toy problems. 01:40:36.140 |
- Okay, but all right, is there a way to find 01:40:41.140 |
nice representative real-world impactful instances 01:40:45.100 |
of a problem on which demonstrate that an algorithm is good? 01:40:48.840 |
So this is kind of like the machine learning world, 01:40:51.380 |
that's kind of what they at its best tries to do 01:41:02.780 |
on beating the performance on that real-world dataset. 01:41:07.180 |
Is there an equivalent in the complexity analysis? 01:41:12.840 |
Don Knuth started to collect examples of graphs 01:41:21.620 |
so he would have a whole zoo of different graphs 01:41:27.260 |
and he could study the performance of algorithms 01:41:31.660 |
- But there it's really important and compelling 01:42:03.820 |
has given you a bunch of examples to work with. 01:42:14.580 |
for combinatorial problems on graphs and networks. 01:42:23.980 |
Do you think some aspect of theoretical computer science, 01:42:28.180 |
I might be contradicting my own question while saying it, 01:42:33.400 |
an empirical aspect of theoretical computer science 01:42:36.900 |
which will allow the fact that these data sets are huge, 01:42:45.660 |
- If you want to say something about a graph algorithm, 01:42:48.980 |
you might take a social network like Facebook 01:43:01.860 |
in the theoretical computer science community. 01:43:10.280 |
Is it impossible to publish a successful paper 01:43:14.580 |
in the theoretical computer science community 01:43:17.060 |
that shows some performance on a real world data set? 01:43:22.060 |
Or is that really just those are two different worlds? 01:43:35.300 |
sometimes they're given some family of examples. 01:43:51.580 |
that the sample is representative of anything at all. 01:43:56.700 |
- So let me ask in terms of breakthroughs and open problems, 01:44:02.500 |
what are the most compelling open problems to you 01:44:05.620 |
and what possible breakthroughs do you see in the near term 01:44:15.460 |
among complexity classes that can be studied. 01:44:30.940 |
If you take a problem, a combinatorial problem in NP, 01:44:51.540 |
say it's a traveling salesman problem, but of size 52. 01:45:03.460 |
a small Boolean circuit tailored for that size, 52, 01:45:35.380 |
then in fact, these problems will have small circuits, 01:45:53.420 |
as a single uniform algorithm good for all sizes. 01:46:10.100 |
Is that a trivial problem for a particular instance? 01:46:13.620 |
So coming up, an automated way of coming up with a circuit, 01:46:25.340 |
Everybody talks nowadays about existential questions, 01:46:55.620 |
depending on the size and get polynomial size? 01:47:08.660 |
- Yeah, what we proved is that if that were possible, 01:47:13.660 |
then something strange would happen in complexity theory. 01:47:18.140 |
Some high-level class, which I could briefly describe, 01:47:28.420 |
So I'll take a stab at describing what I mean by that. 01:47:37.740 |
in which the first level of the hierarchy is P 01:47:48.300 |
there exists a something such that something holds. 01:47:56.740 |
there exists a coloring such that a graph can be colored 01:48:24.660 |
Now you could imagine a more complicated expression, 01:48:37.700 |
such that some proposition holds involving both X and Y. 01:48:43.700 |
So that would say, for example, in game theory, 01:48:55.020 |
there exists a strategy for the second player 01:48:59.660 |
That would be at the second level of the hierarchy. 01:49:06.100 |
such that for all B, there exists a C that something holds. 01:49:09.340 |
And you can imagine going higher and higher in the hierarchy 01:49:28.940 |
- Sorry, they'd get harder and harder to solve. 01:49:41.700 |
then this hierarchy would collapse down to the second level. 01:49:45.500 |
In other words, you wouldn't get any more mileage 01:49:48.500 |
by complicating your expressions with three quantifiers 01:50:19.700 |
I mean, that's proof by the lack of bizarreness 01:50:27.980 |
just the very notion of P equals NP would be bizarre. 01:50:40.880 |
For whatever it's worth, that's what we proved. 01:50:59.780 |
and the current progress of machine learning field 01:51:22.380 |
algorithmic performance tend to be empirical. 01:51:28.980 |
where we observe that for formulas arising in practice, 01:51:45.420 |
Now, it's clear that there've been huge successes 01:51:52.860 |
natural language processing, a little less so, 01:51:55.500 |
but across the spectrum of game playing is another one. 01:52:02.780 |
And one of those effects is that it's not too hard 01:52:09.220 |
to become a millionaire if you can get a reputation 01:52:11.860 |
in machine learning and there'll be all kinds 01:52:13.700 |
of companies that will be willing to offer you the moon 01:52:16.700 |
because they think that if they have AI at their disposal, 01:52:56.220 |
even for inputs that are outside the training set. 01:52:59.220 |
But we don't have any theoretical understanding 01:53:07.580 |
Secondly, the solutions, the networks that you get 01:53:18.900 |
So yeah, yeah, they may seem to work on your training set 01:53:24.020 |
and you may be able to discover whether your photos occur 01:53:37.560 |
We don't know the features that distinguish the photographs 01:53:46.700 |
- Well, it's interesting 'cause you mentioned 01:53:56.420 |
It seems that neural networks are kind of small circuits. 01:54:02.860 |
Sort of like the things you've designed are algorithms, 01:54:08.980 |
Neural networks aren't able to develop algorithms 01:54:15.860 |
- They are algorithms, it's just that they're-- 01:54:18.460 |
- But sort of, yeah, it could be a semantic question, 01:54:37.120 |
- It feels a lot more like a function of the input. 01:54:40.520 |
- It's a function, it's a computable function. 01:54:43.220 |
Once you have the network, you can simulate it 01:54:56.280 |
then you don't know what features of the image 01:55:13.980 |
and it's not clear that the simple characteristics 01:55:18.980 |
that you're looking for, the edges of the objects 01:55:23.940 |
or whatever they may be, they're not emerging 01:55:34.860 |
I mean, it's not clear to sort of the elephant 01:55:39.860 |
how the human brain works, but it's clear to us humans, 01:55:52.740 |
Maybe the whole thing of being explainable to humans 01:55:59.740 |
I guess you can say the same thing about our brain, 01:56:15.220 |
we do get some understanding of the principles 01:56:28.580 |
- You've also been doing work on bioinformatics. 01:56:33.020 |
Does it amaze you that the fundamental building blocks, 01:56:37.020 |
so if we take a step back and look at us humans, 01:56:51.900 |
is that we are beginning to learn how to edit, 01:56:57.420 |
how to edit DNA, which is very, very fascinating, 01:57:10.580 |
find it in the genome, and do something to it. 01:57:18.980 |
- I mean, that's really taking our biological system 01:57:27.140 |
You have to distinguish between doing it on an individual 01:57:35.740 |
which means that all of their descendants will be affected. 01:57:42.180 |
- Yeah, so it raises very severe ethical questions, 01:57:58.760 |
that you can assume that knocking out a particular gene 01:58:04.200 |
is going to be beneficial because you don't know 01:58:08.120 |
So we have this wonderful new world of gene editing, 01:58:27.320 |
it could be used in medicine in various ways, 01:58:35.560 |
- What are, to you, the most interesting places 01:58:55.560 |
So is there areas where you see exciting possibilities 01:59:05.120 |
- Yeah, I mean, we can certainly analyze genomic data 01:59:11.720 |
to figure out which genes are operative in the cell 01:59:35.920 |
or is that still fundamentally a biology problem? 01:59:41.600 |
it's a statistical big data problem for sure. 01:59:48.480 |
are increasing our ability to study our ancestry, 01:59:59.940 |
to personalize treatment according to what's in our genomes 02:00:09.320 |
to be able to predict what troubles might come upon us 02:00:21.100 |
for a woman, whether her proclivity for breast cancer 02:00:29.340 |
is so strong enough that she would want to take action 02:00:36.640 |
- You dedicate your 1985 Turing Award lecture 02:00:56.160 |
at the blackboard, drawing perfect circles by hand, 02:01:00.840 |
and showing his ability to attract the interest 02:01:11.420 |
of the motley collection of eighth grade students 02:01:32.480 |
And I think he was at his best in the classroom. 02:02:01.920 |
I retired recently and a lot of my former students came, 02:02:11.240 |
or who had read my papers or who had been in my classes. 02:02:19.860 |
they talked not about my 1979 paper or my 1992 paper, 02:02:33.600 |
And not just the details, but just the approach 02:02:43.600 |
at least in my early years as a faculty member at Berkeley, 02:03:16.480 |
So preparation is one thing you've mentioned, 02:03:34.400 |
to deal with any situation that comes up in the classroom. 02:03:38.680 |
And if you discover that you're not getting through 02:03:53.960 |
the students of what they're struggling with, 02:04:11.680 |
- Are there, in particular, ideas and algorithms 02:04:19.960 |
where they, for some reason, once they got it, 02:04:26.680 |
Or is it individual, is it different for everybody? 02:04:57.200 |
So you have to deal with each student as a human being 02:05:11.240 |
If you could relive a moment in your life outside of family 02:05:17.440 |
or perhaps because it changed the direction of your life 02:05:19.920 |
in a profound way, what moment would you pick? 02:05:24.640 |
- I was kind of a lazy student as an undergraduate 02:05:28.280 |
and even in my first year in graduate school. 02:05:32.500 |
And I think it was when I started doing research. 02:05:37.360 |
I had a couple of summer jobs where I was able to contribute 02:05:47.800 |
on mathematical methods and operations research 02:05:53.640 |
and I scored 20 points higher than anybody else in the class 02:06:00.720 |
And it made me realize that I had some ability 02:06:06.160 |
- You realize you're pretty good at this thing. 02:06:11.560 |
I don't think there's a better way to end it, Richard. 02:06:25.880 |
Thanks for listening to this conversation with Richard Karp 02:06:29.640 |
and thank you to our sponsors, Eight Sleep and Cash App. 02:06:41.960 |
and downloading Cash App and using code LEXPODCAST. 02:06:46.080 |
Click the links, buy the stuff, even just visiting the site 02:06:49.840 |
but also considering the purchase helps them know 02:06:52.440 |
that this podcast is worth supporting in the future. 02:06:55.880 |
It really is the best way to support this journey I'm on. 02:06:59.680 |
If you enjoy this thing, subscribe on YouTube, 02:07:04.120 |
support it on Patreon, connect with me on Twitter 02:07:07.360 |
at Lex Friedman if you can figure out how to spell that. 02:07:11.320 |
And now let me leave you with some words from Isaac Asimov. 02:07:19.820 |
Thank you for listening and hope to see you next time.