Artificial Intelligence: A Modern Approach

Online Code Repository

The goal is to have working code for all the algorithms in the book in a variety of languages. So far, we have Java, Lisp and Python versions of most of the algorithms. There is also some old code in C++, C# and Prolog, but these are not being maintained. We also have a directory full of data files. Let peter@norvig.com know what languages you'd like to see, and if you're willing to help.

Supported Implementations

We offer the following three language choices, plus a selection of data that works with all the implementations:

Unsupported Implementations

AIMA PrologAIMA C++AIMA C#
Maintainers Larry Holder Larry Holder Kris Noesgaard
Years Developed 1995-961995-962005-2007
AIMA Code Overview Prolog Overview C++ Overview C# Overview
Download Prolog download C++ download C# download

Implementation Choices

What languages are instructors recommending? To get an approximate idea, I gave the query norvig russell "Modern Approach" 2005..2007 along with the names of various languages and looked at the estimated counts of results on various dates:

Language23 Sep 20042 Feb 200515 Jun 2007
none 8,08020,10075,200
java 1,9904,93044,200
c++ 8751,82035,300
lisp 84497430,100
prolog 7892,01023,200
python 7851,24018,400

Of course, neither recall nor precision is perfect for these queries, nor is the estimated number of results guaranteed to be accurate, but they offer a rough estimate of popularity. Also, the links in the table let you investigate individual courses using each language.

Index of Pseudocode in Book

Fig.PageName (in Book)Kind
232Environmenttype
2.133Agentfn
2.334Table-Driven-Vacuum-Agentfn
2.745Table-Driven-Agentfn
2.846Reflex-Vacuum-Agentfn
2.1047Simple-Reflex-Agentfn
2.1249Reflex-Agent-With-Statefn
3.161Simple-Problem-Solving-Agentfn
362Problemtype
3.263Romaniadata
369Nodetype
3.770Tree-Searchfn
371Queuetype
3.972Tree-Searchfn
3.1377Depth-Limited-Searchfn
3.1479Iterative-Deepening-Searchfn
3.1983Graph-Searchfn
495Best-First-Searchfn
497A*-Searchfn
4.5102Recursive-Best-First-Searchfn
4.11112Hill-Climbingfn
4.14116Simulated-Annealingfn
4.17119Genetic-Algorithmfn
4.20126Online-DFS-Agentfn
5137CSPtype
5.3142Backtracking-Searchfn
5.7146AC-3fn
5.8151Min-Conflictsfn
6.3166Minimax-Decisionfn
6.7170Alpha-Beta-Searchfn
7195KBtype
7.1196KB-Agentfn
7.7205Propositional Logic Sentencetype
7.10209TT-Entailsfn
7215Convert to CNFfn
7.12216PL-Resolutionfn
7.14219PL-FC-Entails?fn
7.16222DPLL-Satisfiable?fn
7.17223WalkSATfn
7.19226PL-Wumpus-Agentfn
9273Substfn
9.1278Unifyfn
9.3282FOL-FC-Askfn
9.6288FOL-BC-Askfn
9.14307Otterfn
11.2380Airport-problemdata
11.3381Spare-Tire-Problemdata
11.4383Three-Block-Towerdata
11390Partial-Order-Plannerfn
11.11396Cake-Problemdata
11.13399Graphplanfn
11.15403SATPlanfn
12.1418Job-Shop-Problemdata
12.3421Job-Shop-Problem-With-Resourcesdata
12.6424House-Building-Problemdata
12.10435And-Or-Graph-Searchfn
12.22449Continuous-POP-Agentfn
12.23450Doubles-tennisdata
13.1466DT-Agentfn
13469Discrete Probability Distributionfn
13.4477Enumerate-Joint-Askfn
14.10509Elimination-Askfn
14.12512Prior-Samplefn
14.13513Rejection-Samplingfn
14.14515Likelihood-Weightingfn
14.15517MCMC-Askfn
15.4546Forward-Backwardfn
15.6552Fixed-Lag-Smoothingfn
15.15566Particle-Filteringfn
16.8603Information-Gathering-Agentfn
17.4621Value-Iterationfn
17.7624Policy-Iterationfn
18.5658Decision-Tree-Learningfn
18.10667AdaBoostfn
18.14672Decision-List-Learningfn
19.2681Current-Best-Learningfn
19.3683Version-Space-Learningfn
19.8696Minimal-Consistent-Detfn
19.12702FOILfn
20.21742Perceptron-Learningfn
20.25746Back-Prop-Learningfn
21.2768Passive-ADP-Agentfn
21.4769Passive-TD-Agentfn
21.8776Q-Learning-Agentfn
22.2796Naive-Communicating-Agentfn
22.7801Chart-Parsefn
23.1837Viterbi-Segmentationfn
24.21892Alignfn

    

Index of Programming Exercises in Book

Ex.PageDescription
2.757Environment simulator for vacuum world (partially implemented)
3.990Missionaries and Cannibals
3.1091Successor function for 8-puzzle
3.1191Iterative Lengthening Search
3.1491Path connecting two web pages
3.15-1691Shortest path in plane with polygonal obstacles
3.1993Search agents for vacuum world
4.4134Suboptimal admissible but inconsistent h(n)
4.8135Travelling Salesperson via Minimum Spanning Tree
4.10135Improved 8-puzzle heuristics
4.15136Local search to solve Travelling Salesperson
4.16136Compare hill-climbing, annealing on 8-puzzle, 8-queens
4.17136Hill-climbing for robot navigation
4.18136Compare A* and RBFS on 8-puzzle
5.7159Compare CSP algorithms on map-coloring
5.12159Find minimal cycle cutset
6.4191Move generator and evaluation functions for board games
6.6191Expectiminimax and *-alpha-beta for games with chance nodes
7.15239Extend PL-Wumpus-Agent to track all facts within the KB
8.11269Tell and Ask facts about family tre ein Fig. 8.5
8.17270Define addition for n-bit numbers; verify adder is correct.
9.14317Sorting in Prolog
9.15318Recursive rewrite rules (demodulators) in Logic programming
12.16460Modify And-Or-Graph-search to generate a cyclic plan
14.12536Relational Probabilistic Model of Soccer League
16.5611Determine utility of money for subjects
16.8611Model of airport-siting problem
17.6647Policy iteration on 4x3 (and larger) world
17.7647Find threshold values for R(s)
18.12677Decision-Tree-Learning with missing attribute values
19.5711Inverse resolution in Logic Programming
20.15761Perceptron and Decision-tree learning on a data set
21.1788Compare algorithms for passive learning agent
21.7789Exploring RL agent that uses direct utility estimation
21.11789Two RL agents learning to play a game
21.12789Reinforce and Pegasus algorithms for 4x3 world
22.10832Chart-parsing with a packed tree representation
22.11832Chart-parsing with a partial packed tree representation
23.1861Stylometry: determining authorship
23.2861Statistics of n-gram models
23.3861Detection of spam email
23.7862Regular expression or program to extract company names
25.2943Monte Carlo localization
25.4943Voronoi diagram

AI: A Modern Approach by Stuart Russell and Peter NorvigModified: Jun 19, 2008