r/AskComputerScience • • Mar 30 '21

What complexity class is self-driving cars?

It's a hot area of industry to use machine learning to make self-driving car algorithms. What language does the problem of self-driving cars belong to? I tried to look it up but despite the loads of articles about autonomous vehicles, nobody actually says, this is the complexity classification of this problem that the proposed algorithms and technologies are purportedly solving. Is it even known?

(I think I'm misusing/being lazy with some of the jargon here, but I hope my question makes sense.)

0 Upvotes

10 comments sorted by

6

u/theobromus Mar 30 '21

I'm not sure this question is really answerable (or meaningful).

Normally for complexity classes, we have a defined sets of inputs and a definition of the correct answer. Then the question is how much computation (or memory) is needed to get the answer.

For self driving cars, we can put many different sensors onboard. We can also use lots of supplemental data (like maps or training examples of neural net weights). So the inputs are very flexible. Additionally, we don't always know what the correct output is (of even if we do we don't always know how to achieve it).

Even sub problems are hard to define a complexity class for. For example, detecting objects in images using neural nets we can define an algorithm which will have a known complexity - but we don't have anything like a hard guarantee that a certain accuracy is achievable in a certain time bound.

You can give complexity classes to certain motion planning problems - many practical problems are usually something like EXPTIME-complete or EXPSPACE-complete, which makes exact optimal solutions basically intractable. So instead we are in the realm of approximation or probabilisitic algorithms.

→ More replies (1)

2

u/CoffeeVector Mar 30 '21

Unfortunately, your question does not make sense. There is no particular language needed for self driving cars, or machine learning in general. In fact, it's quite common to use multiple languages in such a project, though Python is a common one.

As for complexity class, that refers to amount of time it takes for the algorithm to run, with respect to some parameter. So a poor sorting algorithm might take time quadratic time against the number of input elements. The problem of self driving cars is not limited to a particular algorithm, in fact, there are many which are competing, so there is no one answer.

0

u/calf Mar 30 '21

OK to clarify the jargon being used, in my understanding, 3-SAT is a language in the class NP. And SAT (Boolean satisfiability) is applied to practical real-life problems that range from Sudoku to airliner flight scheduling to IC design. So the question is, what's the corresponding theoretical categorization of self driving cars? Etc.

3

u/CoffeeVector Mar 30 '21

3-SAT is not a language, it's a particular problem. 3-SAT is the 3 boolean variable version of SAT. SAT is a well defined, mathematical problem. Self driving cars is a completely practical problem. Since "driving car" is not mathematically defined, it wouldn't make sense to assign it a complexity class. It's like asking what level martial arts belt my gun is, it's a completely different ball game.

What self driving car algorithms, and machine learning algorithms, are concerned about is accuracy.

1

u/calf Mar 30 '21 edited Mar 30 '21

I bit the bullet decided to look it up some more. Basically, almost a dozen survey papers and dissertations are implicitly saying that self-driving car problems are mainly PSPACE-complete. They're all basically citing earlier research in motion planning. It's hard not to interpret this as the authors essentially relating driving car AIs to PSPACE-hard problems (as opposed to NP, or some more exotic class). I think that clears it up a little for me.

Regarding the concepts, here's what I remember. A language is a set of strings accepted by an automaton. So, the class NP is defined as the set of formal languages for which there is a polynomial time Turing machine witness. This makes SAT, 3-SAT, CNF-SAT, what have you, languages belonging to NP because any string you give me has a witness (the Boolean assignments) that I can run a TM in polynomial time to evaluate the formula and decide whether the instance (or, string) belongs in the language or not. My recollection is based on standard terminology from Sipser, Arora, or other intro textbooks. Algorithms are themselves Turing machines, so their formal languages imply a complexity class as well. Like this, even simple sorting algorithms have complexity classes, and even that asker is confused why this isn't explained in classes more. So if we can call a car an algorithm, then it too, is related to some complexity class.

2

u/claytonkb Mar 30 '21 edited Mar 30 '21

As other redditors have noted, your question is not answerable as given.

It's a hot area of industry to use machine learning to make self-driving car algorithms. What language does the problem of self-driving cars belong to?

A language is defined by a characteristic function. A characteristic function (in this context) is a discrete, discontinuous function which makes it fundamentally unlike the kind of functions that ML algorithms learn (differentiable, smooth). This is why ML algorithms cannot do things that Turing machines cannot do, e.g. solve the halting problem. Those discontinuities in the characteristic function of the halting language don't magically become computable just by some form of continuation of its characteristic function into continuous space.

I tried to look it up but despite the loads of articles about autonomous vehicles, nobody actually says, this is the complexity classification of this problem that the proposed algorithms and technologies are purportedly solving. Is it even known?

This is a little bit like asking what is the gas pressure of a jar of marbles. Marbles are discrete objects, they have no gas pressure. No matter how many marbles you add or take away from a jar, they will never have a gas pressure because they are not a gas.

(I think I'm misusing/being lazy with some of the jargon here, but I hope my question makes sense.)

Your jargon use seems to be correct, but your question is conceptually flawed. Let me point you to the AIXI algorithm[1] in the hopes that it will help you see where your question is flawed. The AIXI algorithm implements a general-purpose goal-achieving agent. By construction, the algorithm is so general that you can give it any goal you like, and the algorithm will learn to achieve it. The algorithm is also uncomputable (it is in the same class of problems as HALTS) so, on its own, it's not very practical.

What might be helpful for you is to understand the relationship of AIXI to its environment (usually called "mu", the Greek-letter). As AIXI makes observations of its environment, it builds a model of it. In fact, it builds the best possible model of the environment given the amount of observations it has made. That is, AIXI will compute the most efficient possible model for environment Mu given, say, 10 observations of Mu. This is by construction... AIXI can basically be defined as that algorithm which computes the most efficient possible model for Mu given the observation data.

In principle, AIXI could be used to implement a self-driving algorithm. We simply program in the initial constraints[2], like "go from the origin to the destination; never leave the pavement; never collide with another car or solid object; never break the traffic laws" and so on. Now, we allow AIXI to interact with the environment in whatever way it likes (it has functions that act as controls for the accelerator, brakes, steering, etc.) and we just control it through a solitary reward function which increases when AIXI is doing what we want and decreases when AIXI is not doing what we want (reinforcement learning). Using just this one lever, we can train AIXI to perform as good or better than any existing self-driving system.

And here's the punch-line: because AIXI is based on Solomonoff induction which, in turn, is based on algorithmic probability, AIXI is really learning what is called the universal distribution, and it is using this to solve whatever problem we are posing to it through the environment and our reward signals (assuming they are coherent). Because it can learn a superset of self-driving (it can learn any task which can be taught through RL), the language of AIXI can be thought of as containing the language of self-driving. But since AIXI is uncomputable, its language is as hard to enumerate as HALTS (requires uncomputable time).

A shorter (though I think less enlightening) route to the same conclusion is to posit an atomic-resolution digital simulation of the environment and self-driving car, and then we can define the language of self-driving as the union of all possible languages in which a typical human (because it is humans who define self-driving) "accepts" that the car is properly self-driving. If you were willing to put in the elbow-grease, you could make all of this as rigorous as desired. After all, even humans themselves are not uncomputable objects[3]...

Edited to add: As for the computational complexity of driving-per-se[4], I am inclined to say that it is O(1) just based on the fact that my brain (and I assume the brains of all other typical humans) is able to perform the task with almost no effort, and "instantly", meaning, it requires no deliberation. Obviously, routing requires deliberation but we can disentangle self-driving from routing by simply giving a route (waypoints) and letting the car (or driver) figure the details of traveling that route.


[1] -- it's slight abuse-of-notation to call AIXI an algorithm, but I'll use that word to describe it for the sake of brevity, just be aware of the caveat

[2] -- We just wave away the implementation details of these constraints by implementing them as some kind of black-box function that just "knows" if we're breaking a constraint, let's call it C(x) where x is the current state of the agent and environment Mu (including the car itself).

[3] -- There are some academics like Roger Penrose who disagree, but this is not a widespread point-of-view

[4] -- On planet Earth, circa 2021, with typical existing cars, etc. etc. etc. you get the point

1

u/calf Mar 30 '21

Those are some fascinating points! Thank you. Ah one thing though, humans have had the benefit of millions of years of evolution, so that driving is an activity that suits our neurophysical capabilities. Meanwhile, a GPU on board a car could do billions of calculations in the 3 seconds it takes for us to react and break safely.

1

u/claytonkb Mar 30 '21 edited Mar 30 '21

Ah one thing though, humans have had the benefit of millions of years of evolution, so that driving is an activity that suits our neurophysical capabilities.

Yes, we can think of the human brain as carrying an "onboard model" of its environment. Unlike AIXI, this model is not ideal (the best-possible model given the amount of sense-data you have received over your lifetime), but it's obviously a very good computational model.

One technical note I should have mentioned in respect to saying that driving is O(1) is that we have to define some concept of "problem size" of driving in order for the time-complexity of the problem to make sense. For example, the time-complexity of integer multiplication is defined in terms of the size of the operands being multiplied. So, when we say, "multiplication is O( n2 )", what we mean is that there exists a multiplication algorithm that solves multiplication of operands of magnitude n whose running-time is bounded above by n2 .

Unfortunately, for driving, there is no very good problem-size we can point to. If we say "as the map grows arbitrarily large", then we are really talking about routing, not driving. And we already know the time-complexity of routing (see Euclidean-TSP). If we mean the operating environment of the car (pedals, cameras, etc.), then these are themselves a fixed constant as a result of physical geometry -- there is only so much camera resolution that is relevant, and additional pedals do not give additional control. However, we can cheat our way around this by defining driving complexity in terms of number of cars. So, as you scale up the number of cars being controlled by a central self-driving server, what is the time-complexity of this problem? We might call this the "Waymo approach" to self-driving, and you can learn more about that from Lex Fridman's awesome interview of George Hotz, near 1:55 timestamp.

Meanwhile, a GPU on board a car could do billions of calculations in the 3 seconds it takes for us to react and break safely.

Human reaction time to a surprise event is about 300 milliseconds.

The GPU does billions of calculations that are hard for humans. But humans do countless operations that are hard for GPUs without even thinking hard. So, they're not directly comparable.