I thought I’d follow up on recent postings about artificial intelligence (AI) – Watson supercomputer beats game show contestants and the growth of artificial intelligence – by looking at the topic of parallel programming languages for AI.
To start with AI has become such a huge field that it’s very difficult to point to any one language that is suitable for it. AI consists of many sub-fields such as machine learning, search, robotics, natural language processing, computer vision and so on.
The field you plan to work in should determine the type of language you will use. However, there are also other considerations that need to be factored in. For example, are you going into algorithm development or do you plan to build a production system, such as computer vision system, a robot, or a game?
To provide a bit more detail, intelligent systems can have huge backend databases so they appear ‘knowledgeable’, the Watson supercomputer for example. In video games the aim is to make the AI entity behave in an engaging and intelligent way. While other forms of AI simply search a problem domain for an answer.
For this latter point languages such as Haskell and Erlang are quite strong because they are declarative. Some developers favour Haskell saying that its lazy evaluation and LogicT monads make it easy to express non-deterministic algorithms. While apparently its infinite data structures are ideal for search trees. Haskell’s features also enable a compositional way of expressing the algorithms though working with graphs can initially be a bit harder.
For algorithmic development Parallel Computing Toolbox is a good starting point. It’s designed to solve computationally and data-intensive problems using multicore processors as well as GPUs and computer clusters. It also runs with Matlab which is the AI language of choice for many developers. For example, the toolbox provides Matlab computational engines to execute applications locally on a multicore desktop.
Production system languages, however, will be constrained by the speed requirements and platform on which the system will work. For example, with a vision-based system, C++ could be used, though it may be possible to use Java. However, Lisp may not be suitable because it is mostly restricted to solving particular kinds of problems.
Video game AI tends towards the stateful where you decide to do something, sample inputs, and if the inputs trigger a change you start to do something else. As a result, languages that support continuations make implementations easier as they can be updated and retain their state.
Lua is widely used in video games because it is easy to embed, is fast and lightweight and has co-operative software threading. And there is a case for Lua parallel processing. Python is also widely used in games because it is easy to learn and Parallel Python, as the name implies, is specifically designed for concurrent processing.
Prolog is also used for AI because it is declarative so you simply specify the problem rather than explicitly state what to do. However, like Lisp, its use is constrained by the fact that it is mostly used for specific problems. But, that said, Parallel Prolog is also proving to be useful in many implementations that make use of concurrency.
In general views on the best language to use for AI tend to differ. Some developers prefer fast programming languages such as C++ while others will opt for Clojure, because of its homoiconic qualities, that is, code and data have the same internal representations.
At the end of the day the use of languages for AI parallel processing will be determined by the task in hand. But as one developer recently said to me, ‘Good ideas can be implemented in almost any language; it’s the idea that is important.’ You can’t argue with that but if you have any input into languages for AI parallel programming I’d be keen to hear from you.