Skip to content
Projekte

Über uns

JavaScript-Visualisierungen der Algorithmen aus „Artificial Intelligence: A Modern Approach“ von Russell und Norvig

KI und maschinelles Lernen

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
-2
in 15 days
-3
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

aima-javascript tests license

Visualizations of concepts from the book Artificial Intelligence: A Modern Approach, and JavaScript code for its algorithms. Unlike aima-python, aima-java, and other sibling projects, this project is primarily about the visualizations and secondarily about the code.

Installation

The code of the algorithms is the library in aima/: plain ES modules with no dependencies, tested with the test runner of Node 22.

git clone --recurse-submodules https://github.com/aimacode/aima-javascript.git
cd aima-javascript
npm test              # run the tests of the library

Each module can then be imported directly, e.g., import { astarSearch } from './aima/search.js'.

Visualizations

The visualizations are on the project site, one page per chapter; their code is in the folders of the chapters.

Some Javascript visualizations that I admire, and would like to see similar kinds of things here:

Index of algorithms

The table has one row per algorithm, in the order of the book, and the same rows in all the aimacode repositories. The column Figure gives the figure of the 4th edition or, followed by "(3e)", the one of the 3rd edition when the pseudocode of the algorithm is only there; § gives the section of the 4th edition of an algorithm described in the text, and — marks an algorithm that is not in the book. The names link to the pseudocode in aima-pseudocode.

Figure Name (in 4th edition) Code Tests
2.7 TABLE-DRIVEN-AGENT TableDrivenAgentProgram agents.test.js
2.8 REFLEX-VACUUM-AGENT ReflexVacuumAgent agents.test.js
2.10 SIMPLE-REFLEX-AGENT SimpleReflexAgentProgram agents.test.js
2.12 MODEL-BASED-REFLEX-AGENT ModelBasedReflexAgentProgram agents.test.js
§2.1 Table-Driven-Vacuum-Agent TableDrivenVacuumAgent agents.test.js
§2.4.2 Random-Agent-Program RandomAgentProgram agents.test.js
§2.4.2 Random-Vacuum-Agent RandomVacuumAgent agents.test.js
§2.4.3 Model-Based-Vacuum-Agent ModelBasedVacuumAgent agents.test.js
— Environment-Simulator Environment.run agents.test.js
3.7 BEST-FIRST-SEARCH bestFirstGraphSearch search.test.js
3.9 BREADTH-FIRST-SEARCH breadthFirstGraphSearch search.test.js
3.9 UNIFORM-COST-SEARCH uniformCostSearch search.test.js
3.12 DEPTH-LIMITED-SEARCH depthLimitedSearch search.test.js
3.12 ITERATIVE-DEEPENING-SEARCH iterativeDeepeningSearch search.test.js
3.14 BIBF-SEARCH bidirectionalSearch search.test.js
3.22 RECURSIVE-BEST-FIRST-SEARCH recursiveBestFirstSearch search.test.js
3.1 (3e) SIMPLE-PROBLEM-SOLVING-AGENT SimpleProblemSolvingAgentProgram search.test.js
3.7 (3e) TREE-SEARCH breadthFirstTreeSearch, depthFirstTreeSearch search.test.js
3.7 (3e) GRAPH-SEARCH breadthFirstGraphSearch, depthFirstGraphSearch search.test.js
§3.1 Romania romaniaMap search.test.js
§3.2.1 Eight-Puzzle EightPuzzle search.test.js
§3.2.1 N-Queens-Problem NQueensProblem search.test.js
§3.2.2 Traveling-Salesman-Problem TravelingSalesman search.test.js
§3.4.3 Depth-First-Search depthFirstGraphSearch search.test.js
§3.4.5 Bidirectional-Search bidirectionalBreadthFirstSearch search.test.js
§3.5.1 Greedy-Best-First-Search greedyBestFirstGraphSearch search.test.js
§3.5.2 A*-Search astarSearch search.test.js
§3.5.5 SMA* smaStarSearch search.test.js
§3.5.5 Iterative-Deepening-A*-Search iterativeDeepeningAstarSearch search.test.js
— Pour-Problem PourProblem search.test.js
— Grid-Problem GridProblem search.test.js
4.2 HILL-CLIMBING hillClimbing search.test.js
4.4 SIMULATED-ANNEALING simulatedAnnealing search.test.js
4.7 GENETIC-ALGORITHM geneticAlgorithm search.test.js
4.10 AND-OR-GRAPH-SEARCH andOrGraphSearch search.test.js
4.20 ONLINE-DFS-AGENT OnlineDFSAgent search.test.js
4.23 LRTA*-AGENT LRTAStarAgent search.test.js
§4.1.1 Stochastic-Hill-Climbing stochasticHillClimbing search.test.js
§4.1.1 First-Choice-Hill-Climbing firstChoiceHillClimbing search.test.js
§4.1.1 Random-Restart-Hill-Climbing randomRestartHillClimbing search.test.js
§4.1.3 Local-Beam-Search localBeamSearch search.test.js
§4.3.1 Erratic-Vacuum-World vacuumWorld search.test.js
§4.5.1 Online-Search-Problem OnlineSearchProblem search.test.js
§4.5.3 One-Dimensional-State-Space oneDimStateSpace search.test.js
— Peak-Finding-Problem PeakFindingProblem search.test.js
5.3 MINIMAX-SEARCH minmaxDecision games.test.js
5.7 ALPHA-BETA-SEARCH alphaBetaSearch games.test.js
5.11 MONTE-CARLO-TREE-SEARCH monteCarloTreeSearch games.test.js
§5.3.2 Alpha-Beta-Cutoff-Search alphaBetaCutoffSearch games.test.js
§5.3.2 Iterative-Deepening-Alpha-Beta iterativeDeepeningAlphaBetaSearch games.test.js
§5.5 Expectiminimax expectMinmax games.test.js
— Random-Player randomPlayer games.test.js
— Play-Game Game.playGame games.test.js
— Tic-Tac-Toe TicTacToe games.test.js
6.3 AC-3 AC3 csp.test.js
6.5 BACKTRACKING-SEARCH backtrackingSearch csp.test.js
6.9 MIN-CONFLICTS minConflicts csp.test.js
6.11 TREE-CSP-SOLVER treeCspSolver csp.test.js
§6.1.1 Map-Coloring-CSP MapColoringCSP csp.test.js
§6.1.3 Cryptarithmetic twoTwoFour, sendMoreMoney csp.test.js
§6.2.6 Sudoku Sudoku csp.test.js
§6.3.1 Variable-And-Value-Ordering mrv, lcv csp.test.js
§6.3.2 Forward-Checking forwardChecking csp.test.js
§6.3.2 Maintaining-Arc-Consistency mac csp.test.js
§6.4 N-Queens-CSP NQueensCSP csp.test.js
§6 Zebra Zebra csp.test.js
— AC-3b AC3b csp.test.js
— AC-4 AC4 csp.test.js
— Arc-Heuristics noArcHeuristic, domJUp csp.test.js
— N-ary-CSP NaryCSP, Constraint csp.test.js
— GAC-Domain-Splitting ACSolver csp.test.js
— AC-Search-Solver ACSearchSolver csp.test.js
— GAC-Heuristics noHeuristic, satUp csp.test.js
— Crossword Crossword csp.test.js
— Kakuro Kakuro csp.test.js
7.1 KB-AGENT KBAgentProgram logic.test.js
7.10 TT-ENTAILS ttEntails logic.test.js
7.13 PL-RESOLUTION plResolution logic.test.js
7.15 PL-FC-ENTAILS? plFcEntails logic.test.js
7.17 DPLL-SATISFIABLE? dpllSatisfiable logic.test.js
7.18 WALKSAT WalkSAT logic.test.js
7.20 HYBRID-WUMPUS-AGENT HybridWumpusAgent logic.test.js
7.22 SATPLAN satPlan logic.test.js
§7.5.2 Convert-to-CNF toCnf logic.test.js
— DPLL-Branching-Heuristics moms, momsf, posit, zm, dlis, dlcs, jw, jw2 logic.test.js
— CDCL cdclSatisfiable logic.test.js
— Restart-Strategies noRestart, luby, glucose logic.test.js
— Map-Coloring-SAT MapColoringSAT logic.test.js
9.1 UNIFY unify logic.test.js
9.3 FOL-FC-ASK folFcAsk logic.test.js
9.6 FOL-BC-ASK folBcAsk logic.test.js
9.8 APPEND append logic.test.js
§9.1 Subst subst logic.test.js
§9.5.1 Convert-to-CNF-FOL folToCnf logic.test.js
§9.5.2 FOL-Resolution folResolution logic.test.js
§9.5.5 Demodulation demodulate logic.test.js
§9.5.5 Paramodulation paramodulate logic.test.js
§9.5.6 Subsumption subsumes logic.test.js
— Unify-MM unifyMm logic.test.js
— Symbolic-Differentiation diff, simp, d logic.test.js
11.1 AIR-CARGO-TRANSPORT-PROBLEM airCargo planning.test.js
11.2 SPARE-TIRE-PROBLEM spareTire planning.test.js
11.4 BLOCKS-WORLD blocksWorld, threeBlockTower planning.test.js
11.7 REFINEMENT-HIGH-LEVEL-ACTIONS RealWorldPlanningProblem.refinements planning.test.js
11.8 HIERARCHICAL-SEARCH RealWorldPlanningProblem.hierarchicalSearch planning.test.js
11.11 ANGELIC-SEARCH RealWorldPlanningProblem.angelicSearch planning.test.js
11.13 JOB-SHOP-SCHEDULING-PROBLEM jobShopProblem planning.test.js
10.7 (3e) HAVE-CAKE-AND-EAT-CAKE-TOO-PROBLEM haveCakeAndEatCakeToo planning.test.js
10.9 (3e) GRAPHPLAN GraphPlan planning.test.js
§11.1.3 Three-Block-Tower threeBlockTower planning.test.js
§11.2.1 Forward-State-Space-Search ForwardPlan planning.test.js
§11.2.2 Backward-State-Space-Search BackwardPlan planning.test.js
§11.2.4 Partial-Order-Planner PartialOrderPlanner planning.test.js
§11.3 Planning-Heuristics ForwardPlan.h planning.test.js
§11 Planning-Graph Graph planning.test.js
— SATPlan-Planning SATPlan planning.test.js
— CSPlan CSPlan planning.test.js
— Linearize Linearize planning.test.js
12.1 DT-AGENT DTAgentProgram probability.test.js
§12.3 Enumerate-Joint-Ask enumerateJointAsk probability.test.js
13.11 ENUMERATION-ASK enumerationAsk probability.test.js
13.13 ELIMINATION-ASK eliminationAsk probability.test.js
13.16 PRIOR-SAMPLE priorSample probability.test.js
13.17 REJECTION-SAMPLING rejectionSampling probability.test.js
13.18 LIKELIHOOD-WEIGHTING likelihoodWeighting probability.test.js
13.20 GIBBS-ASK gibbsAsk probability.test.js
§13.2.3 Hybrid-Bayesian-Network ContinuousBayesNode probability.test.js
— Read-BIF readBif probability.test.js
14.4 FORWARD-BACKWARD forwardBackward probability.test.js
14.6 FIXED-LAG-SMOOTHING fixedLagSmoothing probability.test.js
14.17 PARTICLE-FILTERING particleFiltering probability.test.js
§14.2.3 Viterbi viterbi probability.test.js
§14.4 Kalman-Filter kalmanFilter, KalmanFilter probability.test.js
§14.5.3 DBN-Unrolling DynamicBayesNet.unroll probability.test.js
15.5 OUPM generateCitationWorld probability.test.js
15.6 NET-VISA generateSeismicWorld probability.test.js
15.9 RADAR generateRadarWorld probability.test.js
15.11 GENERATE-IMAGE generateImage probability.test.js
15.15 GENERATE-MARKOV-LETTERS generateMarkovLetters probability.test.js
16.9 INFORMATION-GATHERING-AGENT InformationGatheringAgent probability.test.js
§16.5 Decision-Network DecisionNetwork probability.test.js
17.6 VALUE-ITERATION valueIteration mdp.test.js
17.9 POLICY-ITERATION policyIteration mdp.test.js
17.16 POMDP-VALUE-ITERATION pomdpValueIteration mdp.test.js
§17.1 Sequential-Decision-Environment sequentialDecisionEnvironment mdp.test.js
§17.2.2 Policy-Evaluation policyEvaluation mdp.test.js
§17.5.2 Dynamic-Decision-Network pomdpLookahead mdp.test.js
18.1 DOUBLES-TENNIS-PROBLEM doubleTennisProblem planning.test.js
§18.2.1 Dominant-Strategy dominantStrategy game_theory.test.js
§18.2.1 Iterated-Dominance iteratedDominance game_theory.test.js
§18.2.1 Pure-Nash-Equilibria pureNashEquilibria game_theory.test.js
§18.2.1 Zero-Sum-Game solveZeroSumGame game_theory.test.js
§18.3.2 Shapley-Value shapleyValue game_theory.test.js
§18.3.2 Core isInCore game_theory.test.js
§18.4.1 Contract-Net-Protocol contractNet game_theory.test.js
§18.4.2 Vickrey-Auction vickreyAuction game_theory.test.js
§18.4.3 Voting pluralityWinner, bordaWinner, condorcetWinner game_theory.test.js
§18.4.4 Alternating-Offers-Bargaining alternatingOffersBargaining game_theory.test.js
19.5 LEARN-DECISION-TREE DecisionTreeLearner learning.test.js
19.8 MODEL-SELECTION crossValidationWrapper, crossValidation learning.test.js
19.11 DECISION-LIST-LEARNING DecisionListLearner learning.test.js
19.25 ADABOOST adaBoost learning.test.js
19.2 (3e) CURRENT-BEST-LEARNING currentBestLearning learning.test.js
19.3 (3e) VERSION-SPACE-LEARNING versionSpaceLearning learning.test.js
19.8 (3e) MINIMAL-CONSISTENT-DET minimalConsistentDet learning.test.js
19.12 (3e) FOIL FOILContainer learning.test.js
§19.2.1 Restaurant-Data RestaurantDataSet learning.test.js
§19.6.1 Linear-Regression LinearLearner learning.test.js
§19.6.4 Perceptron-Learning PerceptronLearner learning.test.js
§19.6.5 Logistic-Regression LogisticLinearLearner learning.test.js
§19.7.1 K-Nearest-Neighbors NearestNeighborLearner learning.test.js
§19.7.5 Support-Vector-Machine SVC, MultiClassLearner learning.test.js
§19.8 Ensemble-Learning EnsembleLearner learning.test.js
§19.8.2 Random-Forest RandomForest learning.test.js
§19.8.6 Weighted-Majority weightedMajority learning.test.js
§19 Learning-Curve learningCurve learning.test.js
— Support-Vector-Regression SVR learning.test.js
— Weighted-Replicate weightedReplicate learning.test.js
§20.2.2 Naive-Bayes NaiveBayesLearner learning.test.js
§20.3.1 EM-Gaussian-Mixture gaussianMixtureEM learning.test.js
§20.3.2 EM-Bayes-Net-Hidden-Variable naiveBayesEM learning.test.js
§20.3.3 Baum-Welch baumWelch learning.test.js
— Gaussian-Naive-Bayes NaiveBayesContinuous learning.test.js
18.24 (3e) BACK-PROP-LEARNING BackPropagationLearner learning.test.js
§21.1 Dense-Network NeuralNetworkLearner, DenseLayer deep_learning.test.js
§21.3 Convolution-Pooling-Batch-Normalization ConvLayer1D, MaxPoolingLayer1D, BatchNormalizationLayer deep_learning.test.js
§21.4 Stochastic-Gradient-Descent stochasticGradientDescent deep_learning.test.js
§21.4 Adam-Optimizer adam deep_learning.test.js
§21.6 Recurrent-Neural-Network SimpleRNNLearner deep_learning.test.js
§21.7.1 Autoencoder AutoencoderLearner deep_learning.test.js
22.2 PASSIVE-ADP-AGENT PassiveADPAgent reinforcement_learning.test.js
22.4 PASSIVE-TD-AGENT PassiveTDAgent reinforcement_learning.test.js
22.8 Q-LEARNING-AGENT QLearningAgent reinforcement_learning.test.js
§22.2.1 Direct-Utility-Estimation PassiveDUEAgent reinforcement_learning.test.js
§22.3.1 Exploratory-ADP-Agent ExploratoryADPAgent reinforcement_learning.test.js
§22.3.3 SARSA-Agent SARSALearningAgent reinforcement_learning.test.js
23.5 CYK-PARSE CYKParse nlp.test.js
23.8 SENTENCE-TREE sentenceTree, parseTreebank nlp.test.js
22.1 (3e) HITS HITS nlp.test.js
§23.1 Viterbi-Segmentation viterbiSegment nlp.test.js
§23.1.2 N-Gram-Models NgramWordModel, UnigramWordModel nlp.test.js
§23.1.3 N-Gram-Char-Model NgramCharModel nlp.test.js
§23.3 Chart-Parse Chart nlp.test.js
§23.3 Parsing-As-Search astarSearchParsing, beamSearchParsing nlp.test.js
§23 IR-System IRSystem nlp.test.js
— Shift-Decoder ShiftDecoder nlp.test.js
— Permutation-Decoder PermutationDecoder nlp.test.js
§25.3.1 Edge-Detection gradientEdgeDetector, gaussianDerivativeEdgeDetector, laplacianEdgeDetector perception.test.js
§25.3.3 Optical-Flow sumSquaredDifference perception.test.js
§25.3.4 Segmentation probabilityContourDetection, groupContourDetection, imageToGraph perception.test.js
§25.5 ROI-Pooling poolRois perception.test.js
§25 Histogram-Of-Oriented-Gradients hog perception.test.js
26.6 MONTE-CARLO-LOCALIZATION monteCarloLocalization robotics.test.js
29.1 (3e) POWERS-OF-2 powersOf2 robotics.test.js

Data structures

Figure Name (in 4th edition) Code Tests
§2 Agent Agent agents.test.js
§2 Environment Environment agents.test.js
§2 XY-Environment XYEnvironment agents.test.js
§2 Vacuum-World TrivialVacuumEnvironment, VacuumEnvironment agents.test.js
§3 Problem Problem search.test.js
§3 Node Node search.test.js
§3 Queue KeyedPriorityQueue search.test.js
§5 Stochastic-Game StochasticGame games.test.js
§5 Game Game games.test.js
§6 CSP CSP csp.test.js
§7 Wumpus-World WumpusEnvironment logic.test.js
§7 KB KB logic.test.js
§7 Propositional-Logic-Sentence Expr logic.test.js
§11 Planning-Problem PlanningProblem planning.test.js
§12 Probability-Distribution ProbDist probability.test.js
§13 Bayesian-Network BayesNet probability.test.js
§14 Hidden-Markov-Model HiddenMarkovModel probability.test.js
§14 Dynamic-Bayesian-Network DynamicBayesNet probability.test.js
§17 Markov-Decision-Process MDP mdp.test.js
§19 Data-Set DataSet learning.test.js
§20 Counting-Probability-Distribution CountingProbDist learning.test.js
§23 Grammar Grammar nlp.test.js
§23 Probabilistic-Grammar ProbGrammar nlp.test.js

Exercises

This table lists the exercises of aima-exercises whose answer a program can check, with the same tests in all the repositories; the chapters are those of the 3rd edition, as on that site.

Chapter Exercises Tests
2. Intelligent Agents 2, 11, 12, 13, 14, 15 exercises_ch02.test.js
3. Solving Problems by Searching 2, 3, 4, 5, 6, 7, 8, 9, 11, 17, 18, 19, 20, 21, 22, 24, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 exercises_ch03.test.js
4. Beyond Classical Search 1, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16 exercises_ch04.test.js
5. Adversarial Search 2, 3, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20 exercises_ch05.test.js
6. Constraint Satisfaction Problems 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 16, 19, 20 exercises_ch06.test.js
7. Logical Agents 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35 exercises_ch07.test.js
8. First-Order Logic 6, 13, 17, 18, 33, 34 exercises_ch08.test.js
9. Inference in First-Order Logic 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29 exercises_ch09.test.js
10. Classical Planning 1, 3, 4, 5, 8, 10, 11, 16, 18 exercises_ch10.test.js
11. Planning and Acting in the Real World 3, 5, 7, 9, 10, 14, 15 exercises_ch11.test.js
12. Knowledge Representation 15, 16, 22, 28, 29 exercises_ch12.test.js
13. Quantifying Uncertainty 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 22, 23, 25, 26, 27, 28, 29, 30, 31 exercises_ch13.test.js
14. Probabilistic Reasoning 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24 exercises_ch14.test.js
15. Probabilistic Reasoning over Time 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 20 exercises_ch15.test.js
16. Making Simple Decisions 1, 2, 3, 4, 6, 7, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 exercises_ch16.test.js
17. Making Complex Decisions 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 25 exercises_ch17.test.js
18. Learning from Examples 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 exercises_ch18.test.js
19. Knowledge in Learning 1, 5, 7, 8 exercises_ch19.test.js
20. Learning Probabilistic Models 1, 2, 3, 5, 6, 8, 10, 11 exercises_ch20.test.js
21. Reinforcement Learning 1, 3, 6, 7, 9, 10, 11 exercises_ch21.test.js
22. Natural Language Processing 1, 2, 3, 4, 5 exercises_ch22.test.js
23. Natural Language for Communication 2, 3, 4, 6, 7, 10, 11, 12, 13, 14, 15, 19, 20, 21 exercises_ch23.test.js
24. Perception 5, 8 exercises_ch24.test.js
25. Robotics 1, 2, 4, 5, 7, 9, 10 exercises_ch25.test.js

Contributing

See CONTRIBUTING.md.

Authors

In order of the lines they wrote in the current files: Donato Meoli, Rishav Agarwal, regalhotpocket, Jason Maa, Alireza Alidousti, Peter Norvig, Alexandr Zaytsev, Amit Patel; see also all the contributors.

I also thank, for their earlier contributions, Souradeep Nanda and Prakamya Mishra.

Other aimacode projects

aima-python · aima-java · aima-csharp · aima-scala · aima-julia · aima-lisp · aima-pseudocode · aima-exercises · aima-data · aima-glossary

Ähnliche Projekte entdecken

Wird geladen…