aima-python documentation
Python implementations of the algorithms from Artificial Intelligence: A Modern Approach (AIMA). This site is the API reference, generated from the in-source docstrings; it complements the per-module Jupyter notebooks in the repository.
The 3rd- and 4th-edition module pairs have been merged into a single version per
topic (4th-edition content, no 4e suffixes), all importable from the aima
package.
API reference
- Agents & Environments
ThingAgentTraceAgent()TableDrivenAgentProgram()RandomAgentProgram()SimpleReflexAgentProgram()ModelBasedReflexAgentProgram()rule_match()RandomVacuumAgent()TableDrivenVacuumAgent()ReflexVacuumAgent()ModelBasedVacuumAgent()EnvironmentDirectionXYEnvironmentObstacleWallGraphicEnvironmentContinuousWorldPolygonObstacleDirtVacuumEnvironmentTrivialVacuumEnvironmentGoldBumpGlitterPitBreezeArrowScreamWumpusStenchExplorerWumpusEnvironmentcompare_agents()test_agent()
- Search
ProblemNodeSimpleProblemSolvingAgentProgrambreadth_first_tree_search()depth_first_tree_search()depth_first_graph_search()breadth_first_graph_search()best_first_graph_search()best_first_tree_search()uniform_cost_search()uniform_cost_tree_search()depth_limited_search()iterative_deepening_search()bidirectional_search()greedy_best_first_graph_search()greedy_best_first_tree_search()astar_search()astar_tree_search()iterative_deepening_astar_search()EightPuzzleNPuzzleTravelingSalesmanDisjointSetsPlanRouterecursive_best_first_search()hill_climbing()stochastic_hill_climbing()first_choice_hill_climbing()random_restart_hill_climbing()local_beam_search()exp_schedule()simulated_annealing()simulated_annealing_full()and_or_graph_search()PourProblemPeakFindingProblemGridProblemOnlineDFSAgentOnlineSearchProblemLRTAStarAgentgenetic_search()genetic_algorithm()fitness_threshold()init_population()select()recombine()recombine_uniform()mutate()GraphUndirectedGraph()RandomGraph()vacuum_worldGraphProblemGraphProblemStochasticNQueensProblemrandom_boggle()print_boggle()boggle_neighbors()exact_sqrt()WordlistBoggleFinderboggle_hill_climbing()mutate_boggle()InstrumentedProblemcompare_searchers()compare_graph_searchers()
- Games & Game Theory
GameStateStochasticGameStateminmax_decision()expect_minmax()alpha_beta_search()alpha_beta_cutoff_search()monte_carlo_tree_search()query_player()random_player()alpha_beta_player()minmax_player()expect_minmax_player()mcts_player()GameStochasticGameFig52GameFig52ExtendedTicTacToeConnectFourGomokuBackgammondominates()dominant_strategy()iterated_dominance()pure_nash_equilibria()solve_zero_sum_game()shapley_value()is_in_core()plurality_winner()borda_winner()condorcet_winner()vickrey_auction()contract_net()alternating_offers_bargaining()
- Constraint Satisfaction
CSPno_arc_heuristic()dom_j_up()AC3()revise()AC3b()partition()AC4()first_unassigned_variable()mrv()num_legal_values()unordered_domain_values()lcv()no_inference()forward_checking()mac()backtracking_search()min_conflicts()min_conflicts_value()tree_csp_solver()topological_sort()build_topological()make_arc_consistent()assign_value()UniversalDictdifferent_values_constraint()MapColoringCSP()parse_neighbors()queen_constraint()NQueensCSPSudokuZebra()solve_zebra()NaryCSPConstraintall_diff_constraint()is_word_constraint()meet_at_constraint()adjacent_constraint()sum_constraint()is_constraint()ne_constraint()no_heuristic()sat_up()ACSolverpartition_domain()ACSearchSolverac_solver()ac_search_solver()CrosswordKakuro
- Logic & Knowledge
KBPropKBKBAgentProgram()is_symbol()is_var_symbol()is_prop_symbol()gensym()variables()is_definite_clause()parse_definite_clause()tt_entails()tt_check_all()prop_symbols()constant_symbols()predicate_symbols()tt_true()pl_true()to_cnf()eliminate_implications()move_not_inwards()distribute_and_over_or()associate()dissociate()conjuncts()disjuncts()pl_resolution()pl_resolve()PropDefiniteKBpl_fc_entails()wumpus_world_inferenceno_branching_heuristic()min_clauses()moms()momsf()posit()zm()dlis()dlcs()jw()jw2()dpll_satisfiable()dpll()find_pure_symbol()find_unit_clause()unit_clause_assign()inspect_literal()no_restart()luby()glucose()cdcl_satisfiable()assign_decision_literal()unit_propagation()conflict_analysis()pl_binary_resolution()backjump()TwoWLClauseDatabaseWalkSAT()MapColoringSAT()facing_east()facing_west()facing_north()facing_south()wumpus()pit()breeze()stench()wumpus_alive()have_arrow()percept_stench()percept_breeze()percept_glitter()percept_bump()percept_scream()move_forward()shoot()turn_left()turn_right()ok_to_move()location()implies()equiv()new_disjunction()WumpusKBWumpusPositionHybridWumpusAgentSAT_plan()unify()is_variable()unify_var()occur_check()subst()cascade_substitution()unify_mm()term_reduction()vars_elimination()standardize_variables()parse_clauses_from_dimacs()FolKBfol_fc_ask()fol_bc_ask()fol_bc_or()fol_bc_and()diff()simp()d()current_best_learning()specializations()generalizations()add_or()version_space_learning()version_space_update()all_hypotheses()values_table()build_attr_combinations()build_h_combinations()minimal_consistent_det()consistent_det()FOILContainercheck_all_consistency()check_negative_consistency()disjunction_value()guess_value()is_consistent()false_positive()false_negative()
- Planning
PlanningProblemActiongoal_test()air_cargo()spare_tire()three_block_tower()simple_blocks_world()have_cake_and_eat_cake_too()shopping_problem()socks_and_shoes()logistics_problem()blocks_world()rush_hour()rush_hour_optimized()double_tennis_problem()ForwardPlanBackwardPlanCSPlan()SATPlan()predicate_negate()LevelGraphGraphPlanLinearizelinearize()PartialOrderPlannerspare_tire_graph_plan()three_block_tower_graph_plan()air_cargo_graph_plan()have_cake_and_eat_cake_too_graph_plan()shopping_graph_plan()socks_and_shoes_graph_plan()simple_blocks_world_graph_plan()HLARealWorldPlanningProblemjob_shop_problem()go_to_sfo()AngelicHLAAngelicNode
- Probability, MDPs & Decisions
DTAgentProgram()ProbDistJointProbDistevent_values()enumerate_joint_ask()enumerate_joint()is_independent()gen_possible_events()BayesNetDecisionNetworkInformationGatheringAgentBayesNodeDiscreteBayesNodeDiscreteBayesNetread_bif()insurance()gaussian_probability()logistic_probability()ContinuousBayesNodeenumeration_ask()enumerate_all()elimination_ask()is_hidden()make_factor()pointwise_product()sum_out()Factorall_events()prior_sample()rejection_sampling()consistent_with()likelihood_weighting()weighted_sample()gibbs_ask()markov_blanket_sample()HiddenMarkovModelforward()backward()forward_backward()viterbi()baum_welch()fixed_lag_smoothing()particle_filtering()KalmanFilterkalman_filter()DynamicBayesNetMCLmapmonte_carlo_localization()ContinuousMCLmapMDPMDP2GridMDPgen_grid()q_value()value_iteration()best_policy()expected_utility()policy_iteration()policy_evaluation()POMDPMatrixpomdp_value_iteration()update_belief()pomdp_lookahead()DecisionNetworkInformationGatheringAgent
- Learning
DataSetparse_csv()err_ratio()grade_learner()train_test_split()cross_validation_wrapper()cross_validation()leave_one_out()learning_curve()PluralityLearner()DecisionForkDecisionLeafDecisionTreeLearner()information_content()DecisionListLearner()NearestNeighborLearner()LinearLearner()LogisticLinearLeaner()NeuralNetLearner()BackPropagationLearner()PerceptronLearner()NNUnitnetwork()init_examples()find_max_node()SVCSVRMultiClassLearnerEnsembleLearner()ada_boost()weighted_majority()weighted_mode()RandomForest()WeightedLearner()replicated_dataset()weighted_replicate()accuracy_score()r2_score()RestaurantDataSet()T()SyntheticRestaurant()Majority()Parity()Xor()ContinuousXor()gaussian_mixture_em()naive_bayes_em()compare()CountingProbDistNaiveBayesLearner()NaiveBayesSimple()NaiveBayesDiscrete()NaiveBayesContinuous()element_wise_product()vector_add()scalar_vector_product()NodeLayerActivationSigmoidReLUELULeakyReLUTanhSoftMaxSoftPlusLinearInputLayerOutputLayerDenseLayerConvLayer1DMaxPoolingLayer1DBatchNormalizationLayerinit_examples()stochastic_gradient_descent()adam()BackPropagation()get_batch()NeuralNetworkLearnerPerceptronLearnerkeras_dataset_loader()SimpleRNNLearner()AutoencoderLearner()PassiveDUEAgentPassiveADPAgentPassiveTDAgentQLearningAgentSARSALearningAgentrun_single_trial()array_normalization()gradient_edge_detector()gaussian_derivative_edge_detector()hog()laplacian_edge_detector()show_edges()sum_squared_difference()gen_gray_scale_picture()probability_contour_detection()group_contour_detection()image_to_graph()generate_edge_weight()Graphgen_discs()load_MINST()simple_convnet()train_model()selective_search()pool_rois()pool_roi()
- Natural Language
Rules()Lexicon()GrammarProbRules()ProbLexicon()ProbGrammarChartCYK_parse()Treesubspan()TextParsingProblemastar_search_parsing()beam_search_parsing()load_page_html()init_pages()strip_raw_html()determine_inlinks()find_outlinks()only_wikipedia_urls()expand_pages()relevant_pages()normalize()ConvergenceDetectorget_in_links()get_out_links()PageHITS()UnigramWordModelNgramWordModelNgramCharModelUnigramCharModelviterbi_segment()IRSystemUnixConsultantDocumentwords()canonicalize()shift_encode()rot13()translate()maketrans()encode()bigrams()ShiftDecoderall_shifts()PermutationDecoderPermutationDecoderProblem
- Utilities & Notebook Helpers
sequence()remove_all()unique()count()multimap()multimap_items()product()first()is_in()mode()power_set()extend()flatten()identity()argmin_random_tie()argmax_random_tie()shuffled()histogram()dot_product()element_wise_product()matrix_multiplication()vector_add()scalar_vector_product()probability()weighted_sample_with_replacement()weighted_sampler()weighted_choice()rounder()num_or_str()euclidean_distance()manhattan_distance()hamming_distance()cross_entropy_loss()mean_squared_error_loss()rms_error()ms_error()mean_error()mean_boolean_error()normalize()random_weights()sigmoid()sigmoid_derivative()elu()elu_derivative()tanh()tanh_derivative()leaky_relu()leaky_relu_derivative()relu()relu_derivative()step()gaussian()linear_kernel()polynomial_kernel()rbf_kernel()turn_heading()turn_right()turn_left()distance()distance_squared()injectionmemoize()name()isnumber()issequence()print_table()open_data()failure_test()ExprSymbol()symbols()subexpressions()arity()PartialExprexpr()expr_handle_infix_ops()defaultkeydicthashabledictPriorityQueueBoolgaussian_kernel()gaussian_kernel_1D()gaussian_kernel_2D()conv1D()map_vector()MCT_Nodeucb()pseudocode()psource()show_iris()load_MNIST()show_MNIST()show_ave_MNIST()make_plot_grid_step_function()make_visualize()Canvasdisplay_html()Canvas_TicTacToeCanvas_min_maxCanvas_alpha_betaCanvas_fol_bc_askshow_map()final_path_colors()display_visual()plot_NQueens()heatmap()gaussian_kernel()plot_pomdp_utility()plot_model_boundary()grid_search_steps()plot_grid_search()ContinuousWorldViewGridWorldView
