@@ -12,7 +12,7 @@ This code is in Python 3.4. (Of course, the current version, Python 3.5, also wo
12
12
When complete, this project will have Python code for all the pseudocode algorithms in the book. For each major topic, such as ` logic ` , we will have the following three files in the main branch:
13
13
14
14
- ` logic.py ` : Implementations of all the pseudocode algorithms, and necessary support functions/classes/data.
15
- - ` logic.ipynb ` : A Jupyter notebook that explains and gives examples of how to use the code.
15
+ - ` logic.ipynb ` : A Jupyter notebook that explains and gives examples of how to use the code.
16
16
- ` tests/logic_test.py ` : A lightweight test suite, using ` assert ` statements, designed for use with [ ` py.test ` ] ( http://pytest.org/latest/ ) .
17
17
18
18
@@ -22,99 +22,100 @@ When complete, this project will have Python code for all the pseudocode algorit
22
22
Here is a table of algorithms, the figure and page where they appear in the book, and the file where they appear in the code. Unfortuately, this chart was made for the old second edition; and has only been partially upfdated to third edition, and not at all to fourth edition. We could use help fixing up the table, based on the figures in [ algorithms.pdf] ( https://github.com/aimacode/aima-pseudocode/blob/master/algorithms.pdf ) . Empty implementations are a good place for contributors to look for an iassue.
23
23
24
24
25
- | ** Fig** | ** Page** | ** Name (in book )** | ** Name (in code)** | ** File**
25
+ | ** Fig** | ** Page** | ** Name (in 3< sup >rd</ sup > edition )** | ** Name (in code)** | ** File**
26
26
| :--------| :---------| :-------------------| :---------| :-----------|
27
- | 2 | 32 | Environment | ` Environment ` | [ ` agents.py ` ] ( ../master/agents.py ) |
28
- | 2.1 | 33 | Agent | ` Agent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
29
- | 2.3 | 34 | Table-Driven-Vacuum-Agent | ` TableDrivenVacuumAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
30
- | 2.7 | 45 | Table-Driven-Agent | ` TableDrivenAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
31
- | 2.8 | 46 | Reflex-Vacuum-Agent | ` ReflexVacuumAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
32
- | 2.10 | 47 | Simple-Reflex-Agent | ` SimpleReflexAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
33
- | 2.12 | 49 | Model-Based-Reflex-Agent | ` ReflexAgentWithState ` | [ ` agents.py ` ] ( ../master/agents.py ) |
34
- | 3.1 | 61 | Simple-Problem-Solving-Agent | ` SimpleProblemSolvingAgent ` | [ ` search.py ` ] ( ../master/search.py ) |
27
+ | 2.1 | 36 | Environment | ` Environment ` | [ ` agents.py ` ] ( ../master/agents.py ) |
28
+ | 2.1 | 36 | Agent | ` Agent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
29
+ | 2.3 | 37 | Table-Driven-Vacuum-Agent | ` TableDrivenVacuumAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
30
+ | 2.7 | 48 | Table-Driven-Agent | ` TableDrivenAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
31
+ | 2.8 | 49 | Reflex-Vacuum-Agent | ` ReflexVacuumAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
32
+ | 2.10 | 50 | Simple-Reflex-Agent | ` SimpleReflexAgent ` | [ ` agents.py ` ] ( ../master/agents.py ) |
33
+ | 2.12 | 52 | Model-Based-Reflex-Agent | ` ReflexAgentWithState ` | [ ` agents.py ` ] ( ../master/agents.py ) |
34
+ | 3.1 | 69 | Simple-Problem-Solving-Agent | ` SimpleProblemSolvingAgent ` | [ ` search.py ` ] ( ../master/search.py ) |
35
35
| 3 | 62 | Problem | ` Problem ` | [ ` search.py ` ] ( ../master/search.py ) |
36
- | 3.2 | 63 | Romania | ` romania ` | [ ` search.py ` ] ( ../master/search.py ) |
36
+ | 3.2 | 70 | Romania | ` romania ` | [ ` search.py ` ] ( ../master/search.py ) |
37
37
| 3 | 69 | Node | ` Node ` | [ ` search.py ` ] ( ../master/search.py ) |
38
38
| 3 | 71 | Queue | ` Queue ` | [ ` utils.py ` ] ( ../master/utils.py ) |
39
- | 3.7 | 70 | Tree-Search | ` tree_search ` | [ ` search.py ` ] ( ../master/search.py ) |
40
- | 3.7 | 72 | Graph-Search | ` graph_search ` | [ ` search.py ` ] ( ../master/search.py ) |
41
- | 3.11 | 72 | Breadth-First-Search | ` breadth_first_search ` | [ ` search.py ` ] ( ../master/search.py ) |
42
- | 3.13 | 72 | Uniform-Cost-Search | ` uniform_cost_search ` | [ ` search.py ` ] ( ../master/search.py ) |
43
- | 3.16 | 77 | Depth-Limited-Search | ` depth_limited_search ` | [ ` search.py ` ] ( ../master/search.py ) |
44
- | 3.14 | 79 | Iterative-Deepening-Search | ` iterative_deepening_search ` | [ ` search.py ` ] ( ../master/search.py ) |
39
+ | 3.7 | 79 | Tree-Search | ` tree_search ` | [ ` search.py ` ] ( ../master/search.py ) |
40
+ | 3.7 | 79 | Graph-Search | ` graph_search ` | [ ` search.py ` ] ( ../master/search.py ) |
41
+ | 3.11 | 84 | Breadth-First-Search | ` breadth_first_search ` | [ ` search.py ` ] ( ../master/search.py ) |
42
+ | 3.14 | 86 | Uniform-Cost-Search | ` uniform_cost_search ` | [ ` search.py ` ] ( ../master/search.py ) |
43
+ | 3.17 | 90 | Depth-Limited-Search | ` depth_limited_search ` | [ ` search.py ` ] ( ../master/search.py ) |
44
+ | 3.18 | 91 | Iterative-Deepening-Search | ` iterative_deepening_search ` | [ ` search.py ` ] ( ../master/search.py ) |
45
45
| 3.19 | 83 | Graph-Search | ` graph_search ` | [ ` search.py ` ] ( ../master/search.py ) |
46
46
| 4 | 95 | Best-First-Search | ` best_first_graph_search ` | [ ` search.py ` ] ( ../master/search.py ) |
47
47
| 4 | 97 | A\* -Search | ` astar_search ` | [ ` search.py ` ] ( ../master/search.py ) |
48
- | 4.5 | 102 | Recursive-Best-First-Search | ` recursive_best_first_search ` | [ ` search.py ` ] ( ../master/search.py ) |
49
- | 4.11 | 112 | Hill-Climbing | ` hill_climbing ` | [ ` search.py ` ] ( ../master/search.py ) |
50
- | 4.14 | 116 | Simulated-Annealing | ` simulated_annealing ` | [ ` search.py ` ] ( ../master/search.py ) |
51
- | 4.17 | 119 | Genetic-Algorithm | ` genetic_algorithm ` | [ ` search.py ` ] ( ../master/search.py ) |
52
- | 4.20 | 126 | Online-DFS-Agent | ` online_dfs_agent ` | [ ` search.py ` ] ( ../master/search.py ) |
53
- | 4.23 | 128 | LRTA\* -Agent | ` lrta_star_agent ` | [ ` search.py ` ] ( ../master/search.py ) |
48
+ | 3.26 | 101 | Recursive-Best-First-Search | ` recursive_best_first_search ` | [ ` search.py ` ] ( ../master/search.py ) |
49
+ | 4.2 | 125 | Hill-Climbing | ` hill_climbing ` | [ ` search.py ` ] ( ../master/search.py ) |
50
+ | 4.5 | 129 | Simulated-Annealing | ` simulated_annealing ` | [ ` search.py ` ] ( ../master/search.py ) |
51
+ | 4.8 | 132 | Genetic-Algorithm | ` genetic_algorithm ` | [ ` search.py ` ] ( ../master/search.py ) |
52
+ | 4.21 | 153 | Online-DFS-Agent | ` online_dfs_agent ` | [ ` search.py ` ] ( ../master/search.py ) |
53
+ | 4.24 | 155 | LRTA\* -Agent | ` lrta_star_agent ` | [ ` search.py ` ] ( ../master/search.py ) |
54
54
| 5 | 137 | CSP | ` CSP ` | [ ` csp.py ` ] ( ../master/csp.py ) |
55
- | 5.3 | 142 | Backtracking-Search | ` backtracking_search ` | [ ` csp.py ` ] ( ../master/csp.py ) |
56
- | 5.7 | 146 | AC-3 | ` AC3 ` | [ ` csp.py ` ] ( ../master/csp.py ) |
57
- | 5.8 | 151 | Min-Conflicts | ` min_conflicts ` | [ ` csp.py ` ] ( ../master/csp.py ) |
58
- | 6.3 | 166 | Minimax-Decision | ` minimax_decision ` | [ ` games.py ` ] ( ../master/games.py ) |
59
- | 6.7 | 170 | Alpha-Beta-Search | ` alphabeta_search ` | [ ` games.py ` ] ( ../master/games.py ) |
55
+ | 5.3 | 169 | Minimax-Decision | ` minimax_decision ` | [ ` games.py ` ] ( ../master/games.py ) |
56
+ | 5.7 | 173 | Alpha-Beta-Search | ` alphabeta_search ` | [ ` games.py ` ] ( ../master/games.py ) |
60
57
| 7 | 195 | KB | ` KB ` | [ ` logic.py ` ] ( ../master/logic.py ) |
61
- | 7 .1 | 196 | KB-Agent | ` KB_Agent ` | [ ` logic.py ` ] ( ../master/logic.py ) |
62
- | 7 .7 | 205 | Propositional Logic Sentence | ` Expr ` | [ ` logic.py ` ] ( ../master/logic.py ) |
63
- | 7 .10 | 209 | TT-Entails | ` tt_entials ` | [ ` logic.py ` ] ( ../master/logic.py ) |
58
+ | 6 .1 | 208 | KB-Agent | ` KB_Agent ` | [ ` logic.py ` ] ( ../master/logic.py ) |
59
+ | 6 .7 | 216 | Propositional Logic Sentence | ` Expr ` | [ ` logic.py ` ] ( ../master/logic.py ) |
60
+ | 6 .10 | 220 | TT-Entails | ` tt_entials ` | [ ` logic.py ` ] ( ../master/logic.py ) |
64
61
| 7 | 215 | Convert to CNF | ` to_cnf ` | [ ` logic.py ` ] ( ../master/logic.py ) |
65
- | 7.12 | 216 | PL-Resolution | ` pl_resolution ` | [ ` logic.py ` ] ( ../master/logic.py ) |
66
- | 7.14 | 219 | PL-FC-Entails? | ` pl_fc_resolution ` | [ ` logic.py ` ] ( ../master/logic.py ) |
67
- | 7.16 | 222 | DPLL-Satisfiable? | ` dpll_satisfiable ` | [ ` logic.py ` ] ( ../master/logic.py ) |
68
- | 7.17 | 223 | WalkSAT | ` WalkSAT ` | [ ` logic.py ` ] ( ../master/logic.py ) |
69
- | 7.19 | 226 | PL-Wumpus-Agent | ` PLWumpusAgent ` | [ ` logic.py ` ] ( ../master/logic.py ) |
62
+ | 6.12 | 227 | PL-Resolution | ` pl_resolution ` | [ ` logic.py ` ] ( ../master/logic.py ) |
63
+ | 6.15 | 230 | PL-FC-Entails? | ` pl_fc_resolution ` | [ ` logic.py ` ] ( ../master/logic.py ) |
64
+ | 6.17 | 233 | DPLL-Satisfiable? | ` dpll_satisfiable ` | [ ` logic.py ` ] ( ../master/logic.py ) |
65
+ | 6.18 | 235 | WalkSAT | ` WalkSAT ` | [ ` logic.py ` ] ( ../master/logic.py ) |
66
+ | 6.20 | 242 | Hybrid-Wumpus-Agent | ` HybridWumpusAgent ` | [ ` logic.py ` ] ( ../master/logic.py ) |
67
+ | 6.22 | 244 | SATPlan | |
68
+ | 7.3 | 265 | AC-3 | ` AC3 ` | [ ` csp.py ` ] ( ../master/csp.py ) |
69
+ | 7.5 | 271 | Backtracking-Search | ` backtracking_search ` | [ ` csp.py ` ] ( ../master/csp.py ) |
70
+ | 7.8 | 277 | Min-Conflicts | ` min_conflicts ` | [ ` csp.py ` ] ( ../master/csp.py ) |
70
71
| 9 | 273 | Subst | ` subst ` | [ ` logic.py ` ] ( ../master/logic.py ) |
71
- | 9.1 | 278 | Unify | ` unify ` | [ ` logic.py ` ] ( ../master/logic.py ) |
72
- | 9.3 | 282 | FOL-FC-Ask | ` fol_fc_ask ` | [ ` logic.py ` ] ( ../master/logic.py ) |
73
- | 9.6 | 288 | FOL-BC-Ask | ` fol_bc_ask ` | [ ` logic.py ` ] ( ../master/logic.py ) |
72
+ | 9.1 | 334 | Unify | ` unify ` | [ ` logic.py ` ] ( ../master/logic.py ) |
73
+ | 9.3 | 338 | FOL-FC-Ask | ` fol_fc_ask ` | [ ` logic.py ` ] ( ../master/logic.py ) |
74
+ | 9.6 | 344 | FOL-BC-Ask | ` fol_bc_ask ` | [ ` logic.py ` ] ( ../master/logic.py ) |
74
75
| 9.14 | 307 | Otter | |
75
- | 11.2 | 380 | Airport -problem | |
76
- | 11.3 | 381 | Spare-Tire-Problem | |
77
- | 11.4 | 383 | Three-Block-Tower | |
76
+ | 10.1 | 376 | Air-Cargo -problem | |
77
+ | 10.2 | 377 | Spare-Tire-Problem | |
78
+ | 10.3 | 378 | Three-Block-Tower | |
78
79
| 11 | 390 | Partial-Order-Planner | |
79
- | 11.11 | 396 | Cake-Problem | |
80
- | 11.13 | 399 | Graphplan | |
81
- | 11.15 | 403 | SATPlan | |
80
+ | 10.7 | 387 | Cake-Problem | |
81
+ | 10.9 | 390 | Graphplan | |
82
82
| 12.1 | 418 | Job-Shop-Problem | |
83
- | 12.3 | 421 | Job-Shop-Problem-With-Resources | |
83
+ | 11.1 | 409 | Job-Shop-Problem-With-Resources | |
84
84
| 12.6 | 424 | House-Building-Problem | |
85
85
| 12.10 | 435 | And-Or-Graph-Search | ` and_or_graph_search ` | [ ` search.py ` ] ( ../master/search.py ) |
86
86
| 12.22 | 449 | Continuous-POP-Agent | |
87
87
| 12.23 | 450 | Doubles-tennis | |
88
- | 13.1 | 466 | DT-Agent | ` DTAgent ` | [ ` probability.py ` ] ( ../master/probability.py ) |
88
+ | 13.1 | 492 | DT-Agent | ` DTAgent ` | [ ` probability.py ` ] ( ../master/probability.py ) |
89
89
| 13 | 469 | Discrete Probability Distribution | ` DiscreteProbDist ` | [ ` probability.py ` ] ( ../master/probability.py ) |
90
90
| 13.4 | 477 | Enumerate-Joint-Ask | ` enumerate_joint_ask ` | [ ` probability.py ` ] ( ../master/probability.py ) |
91
- | 14.10 | 509 | Elimination-Ask | ` elimination_ask ` | [ ` probability.py ` ] ( ../master/probability.py ) |
92
- | 14.12 | 512 | Prior-Sample | ` prior_sample ` | [ ` probability.py ` ] ( ../master/probability.py ) |
93
- | 14.13 | 513 | Rejection-Sampling | ` rejection_sampling ` | [ ` probability.py ` ] ( ../master/probability.py ) |
94
- | 14.14 | 515 | Likelihood-Weighting | ` likelihood_weighting ` | [ ` probability.py ` ] ( ../master/probability.py ) |
91
+ | 14.11 | 537 | Elimination-Ask | ` elimination_ask ` | [ ` probability.py ` ] ( ../master/probability.py ) |
92
+ | 14.13 | 540 | Prior-Sample | ` prior_sample ` | [ ` probability.py ` ] ( ../master/probability.py ) |
93
+ | 14.14 | 542 | Rejection-Sampling | ` rejection_sampling ` | [ ` probability.py ` ] ( ../master/probability.py ) |
94
+ | 14.15 | 543 | Likelihood-Weighting | ` likelihood_weighting ` | [ ` probability.py ` ] ( ../master/probability.py ) |
95
95
| 14.15 | 517 | MCMC-Ask | |
96
- | 15.4 | 546 | Forward-Backward | ` forward_backward ` | [ ` probability.py ` ] ( ../master/probability.py ) |
97
- | 15.6 | 552 | Fixed-Lag-Smoothing | ` fixed_lag_smoothing ` | [ ` probability.py ` ] ( ../master/probability.py ) |
98
- | 15.15 | 566 | Particle-Filtering | ` particle_filtering ` | [ ` probability.py ` ] ( ../master/probability.py ) |
99
- | 16.8 | 603 | Information-Gathering-Agent | |
100
- | 17.4 | 621 | Value-Iteration | ` value_iteration ` | [ ` mdp.py ` ] ( ../master/mdp.py ) |
101
- | 17.7 | 624 | Policy-Iteration | ` policy_iteration ` | [ ` mdp.py ` ] ( ../master/mdp.py ) |
102
- | 18.5 | 658 | Decision-Tree-Learning | ` DecisionTreeLearner ` | [ ` learning.py ` ] ( ../master/learning.py ) |
103
- | 18.10 | 667 | AdaBoost | ` AdaBoost ` | [ ` learning.py ` ] ( ../master/learning.py ) |
104
- | 18.14 | 672 | Decision-List-Learning | |
105
- | 19.2 | 681 | Current-Best-Learning | |
106
- | 19.3 | 683 | Version-Space-Learning | |
107
- | 19.8 | 696 | Minimal-Consistent-Det | |
108
- | 19.12 | 702 | FOIL | |
96
+ | 15.4 | 586 | Forward-Backward | ` forward_backward ` | [ ` probability.py ` ] ( ../master/probability.py ) |
97
+ | 15.6 | 590 | Fixed-Lag-Smoothing | ` fixed_lag_smoothing ` | [ ` probability.py ` ] ( ../master/probability.py ) |
98
+ | 15.17 | 608 | Particle-Filtering | ` particle_filtering ` | [ ` probability.py ` ] ( ../master/probability.py ) |
99
+ | 16.9 | 643 | Information-Gathering-Agent | |
100
+ | 17.4 | 664 | Value-Iteration | ` value_iteration ` | [ ` mdp.py ` ] ( ../master/mdp.py ) |
101
+ | 17.7 | 668 | Policy-Iteration | ` policy_iteration ` | [ ` mdp.py ` ] ( ../master/mdp.py ) |
102
+ | 18.5 | 713 | Decision-Tree-Learning | ` DecisionTreeLearner ` | [ ` learning.py ` ] ( ../master/learning.py ) |
103
+ | 18.11 | 728 | Decision-List-Learning | |
104
+ | 18.24 | 745 | Back-Prop-Learning | |
105
+ | 18.34 | 762 | AdaBoost | ` AdaBoost ` | [ ` learning.py ` ] ( ../master/learning.py ) |
106
+ | 19.2 | 783 | Current-Best-Learning | |
107
+ | 19.3 | 785 | Version-Space-Learning | |
108
+ | 19.8 | 798 | Minimal-Consistent-Det | |
109
+ | 19.12 | 805 | FOIL | |
109
110
| 20.21 | 742 | Perceptron-Learning | ` PerceptronLearner ` | [ ` learning.py ` ] ( ../master/learning.py ) |
110
- | 20.25 | 746 | Back-Prop-Learning | |
111
- | 21.2 | 768 | Passive-ADP-Agent | ` PassiveADPAgent ` | [ ` rl.py ` ] ( ../master/rl.py ) |
112
- | 21.4 | 769 | Passive-TD-Agent | ` PassiveTDAgent ` | [ ` rl.py ` ] ( ../master/rl.py ) |
113
- | 21.8 | 776 | Q-Learning-Agent | |
111
+ | 22.2 | 877 | Passive-ADP-Agent | ` PassiveADPAgent ` | [ ` rl.py ` ] ( ../master/rl.py ) |
112
+ | 22.4 | 880 | Passive-TD-Agent | ` PassiveTDAgent ` | [ ` rl.py ` ] ( ../master/rl.py ) |
113
+ | 22.8 | 887 | Q-Learning-Agent | |
114
114
| 22.2 | 796 | Naive-Communicating-Agent | |
115
115
| 22.7 | 801 | Chart-Parse | ` Chart ` | [ ` nlp.py ` ] ( ../master/nlp.py ) |
116
116
| 23.1 | 837 | Viterbi-Segmentation | ` viterbi_segment ` | [ ` text.py ` ] ( ../master/text.py ) |
117
117
| 24.21 | 892 | Align | |
118
+ | 25.9 | 999 | Monte-Carlo-Localization| |
118
119
119
120
120
121
# Acknowledgements
0 commit comments