1. Home
  2. Explore
  3. Computer Science
  4. Introduction to AI

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to AI

  • 33Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Search Problem Fundamentals

Define an agent in the context of artificial intelligence.

33 questions

  1. 1

    Define an agent in the context of artificial intelligence.

    Model answer

    An agent is an entity that perceives its environment and acts upon that environment.

    Explanation

    In AI, an agent is the decision-maker that senses the surroundings and takes actions to achieve goals.

  2. 2

    What is a state in a search problem?

    Model answer

    A state is a configuration of the agent and its environment at a given time.

    Explanation

    States represent snapshots of the problem at various points; each state is unique and leads to different possible actions.

  3. 3

    Explain the purpose of the actions function in a search problem.

    Model answer

    The actions function takes a state as input and returns the set of all possible actions that can be executed in that state.

    Explanation

    This function formalizes what moves are available to the agent from a given state, enabling the search algorithm to consider options.

  4. 4

    What does the result function represent in a search problem?

    Model answer

    The result function takes a state and an action as input and returns the new state that results from performing that action in that state.

    Explanation

    This transition model defines how actions affect the state, allowing the algorithm to predict outcomes.

  5. 5

    Define the state space of a search problem.

    Model answer

    The state space is the set of all states reachable from the initial state via any sequence of actions.

    Explanation

    It encompasses all possible configurations the agent can encounter, often visualized as a graph of nodes and edges.

  6. 6

    What is a goal test in a search problem?

    Model answer

    A goal test is a function that determines whether a given state is a goal state.

    Explanation

    It tells the AI when it has reached a solution, such as checking if all tiles are in order in a puzzle or if the agent is at the destination.

  7. 7

    Describe the concept of path cost in a search problem.

    Model answer

    Path cost is a numerical value assigned to each path, representing the cost of taking that sequence of actions (e.g., time, distance, money).

    Explanation

    Path costs allow the algorithm to compare different solutions and seek the optimal one with the lowest cost.

  8. 8

    Differentiate between a solution and an optimal solution.

    Model answer

    A solution is any sequence of actions from the initial state to a goal state; an optimal solution is a solution with the lowest path cost among all possible solutions.

    Explanation

    While any solution works, optimal solutions are preferred when minimizing cost is important.

  9. 9

    What information does a node in a search algorithm typically store?

    Model answer

    A node stores the state, the parent node (the node that generated it), the action taken to reach it, and the path cost from the initial state to this node.

    Explanation

    This data structure enables the algorithm to reconstruct the solution path and track costs.

  10. 10

    What is the frontier in a search algorithm?

    Model answer

    The frontier is a data structure that contains all nodes that have been discovered but not yet explored.

    Explanation

    It represents the boundary of the searched area, from which the algorithm picks nodes to expand next.

  11. 11

    Describe the basic loop of a generic search algorithm.

    Model answer

    The algorithm repeatedly: 1) checks if frontier is empty (no solution), 2) removes a node from the frontier, 3) checks if it is a goal (return solution), 4) expands the node and adds resulting nodes to the frontier.

    Explanation

    This iterative process systematically explores states until a solution is found or all possibilities are exhausted.

  12. 12

    Why is an explored set necessary in search algorithms?

    Model answer

    The explored set prevents the algorithm from revisiting states that have already been processed, avoiding infinite loops in graphs with cycles.

    Explanation

    Without it, the algorithm could get stuck going back and forth between states, especially when actions are reversible.

  13. 13

    How does a stack data structure determine the order of node expansion?

    Model answer

    A stack is last-in, first-out (LIFO), so the most recently added node is removed and expanded next.

    Explanation

    This leads to depth-first search behavior, where the algorithm goes deep along one path before backtracking.

  14. 14

    How does a queue data structure determine the order of node expansion?

    Model answer

    A queue is first-in, first-out (FIFO), so the node that was added earliest is removed and expanded next.

    Explanation

    This results in breadth-first search, which explores all nodes at one depth level before moving deeper.

  15. 15

    What is the key difference between depth-first search (DFS) and breadth-first search (BFS) in terms of frontier data structure?

    Model answer

    DFS uses a stack (LIFO), while BFS uses a queue (FIFO).

    Explanation

    This difference determines the order of exploration: DFS goes deep, BFS explores broadly.

  16. 16

    Is depth-first search guaranteed to find a solution in a finite state space?

    Model answer

    Yes, DFS will find a solution if one exists in a finite state space because it will eventually explore all reachable states.

    Explanation

    However, it may not find the optimal solution; it can get stuck on a long path and miss a shorter one.

  17. 17

    Is breadth-first search guaranteed to find an optimal solution?

    Model answer

    Yes, BFS finds the optimal solution when all actions have the same cost (e.g., unit steps), as it expands nodes in order of increasing depth.

    Explanation

    By exploring all nodes at depth d before depth d+1, the first goal found is at the shallowest depth, hence optimal under uniform cost.

  18. 18

    What is a potential drawback of breadth-first search compared to depth-first search?

    Model answer

    BFS often requires more memory because it must store all nodes at the current depth level, which can be very large.

    Explanation

    DFS only needs to store the current path, typically using less memory, but may not find the optimal solution.

  19. 19

    Define a heuristic function in the context of informed search.

    Model answer

    A heuristic function, denoted h(n), estimates the cost from a given state to the goal state.

    Explanation

    It provides problem-specific knowledge to guide the search toward promising states, without guaranteeing accuracy.

  20. 20

    What is the Manhattan distance heuristic?

    Model answer

    Manhattan distance is the sum of the absolute differences in x and y coordinates between a cell and the goal, ignoring obstacles.

    Explanation

    It is a common heuristic for grid-based mazes, as it estimates the minimum number of horizontal and vertical steps needed.

  21. 21

    How does greedy best-first search (GBFS) choose which node to expand?

    Model answer

    GBFS always expands the node with the smallest heuristic value h(n), i.e., the node estimated to be closest to the goal.

    Explanation

    It is greedy because it makes locally optimal choices based solely on the heuristic, without considering path cost so far.

  22. 22

    Why might greedy best-first search fail to find an optimal solution?

    Model answer

    GBFS can get stuck on a suboptimal path because it only considers the heuristic estimate and ignores the actual cost incurred so far.

    Explanation

    A node with a low heuristic might be far from the start, leading to a longer overall path than a node with a slightly higher heuristic but much closer start distance.

  23. 23

    What function does A* search minimize when selecting a node to expand?

    Model answer

    A* expands the node with the smallest value of f(n) = g(n) + h(n), where g(n) is the cost to reach node n and h(n) is the heuristic estimate to the goal.

    Explanation

    By combining actual cost and heuristic estimate, A* balances exploring promising directions and avoiding paths that have already cost too much.

  24. 24

    What does it mean for a heuristic to be admissible?

    Model answer

    A heuristic is admissible if it never overestimates the true cost to reach the goal from any state.

    Explanation

    Admissibility ensures that A* is guaranteed to find an optimal solution, as the heuristic is always optimistic.

  25. 25

    What does it mean for a heuristic to be consistent (monotonic)?

    Model answer

    A heuristic is consistent if for every node n and its successor n' with step cost c, h(n) ≤ h(n') + c.

    Explanation

    Consistency ensures that the f(n) values are non-decreasing along any path, which simplifies A* implementation and guarantees optimality.

  26. 26

    In game theory, what does the term 'terminal test' refer to?

    Model answer

    A terminal test determines whether a given state is a terminal state, i.e., the game is over (e.g., checkmate or board full in tic-tac-toe).

    Explanation

    It is essential for knowing when to stop recursive search and evaluate the utility of the state.

  27. 27

    What is a utility function in adversarial search?

    Model answer

    A utility function assigns a numerical value to a terminal state, representing the outcome from the perspective of a player (e.g., +1 for win, 0 for draw, -1 for loss).

    Explanation

    It translates game outcomes into numbers that the algorithm can use to compare states and make decisions.

  28. 28

    In the Minimax algorithm, who is the max player and who is the min player?

    Model answer

    The max player aims to maximize the utility value (e.g., X wants high scores), while the min player aims to minimize it (e.g., O wants low scores).

    Explanation

    This adversarial setup models competitive games where one player's gain is the other's loss.

  29. 29

    How does the Minimax algorithm compute the value of a state?

    Model answer

    If terminal, return its utility. Otherwise, for max states, return the maximum of the min values of successors; for min states, return the minimum of the max values of successors.

    Explanation

    This recursive process simulates optimal play from both sides, assuming each player chooses the best move for themselves.

  30. 30

    What is alpha-beta pruning in the context of Minimax?

    Model answer

    Alpha-beta pruning is an optimization that eliminates branches of the search tree that cannot possibly affect the final decision, by keeping track of the best achievable value for max (alpha) and min (beta).

    Explanation

    It reduces computation without affecting the outcome, as nodes that are worse than already guaranteed options are ignored.

  31. 31

    Why is full Minimax infeasible for complex games like chess?

    Model answer

    The number of possible game states is astronomically large (e.g., > 10^29000 chess games), making it computationally impossible to explore the entire tree.

    Explanation

    Full Minimax requires enumerating all possible moves until terminal states, which is intractable for complex games.

  32. 32

    How does depth-limited Minimax address computational intractability?

    Model answer

    Depth-limited Minimax stops the recursive search after a fixed depth (e.g., 10 moves) and uses an evaluation function to estimate the utility of non-terminal states.

    Explanation

    This limits the search to a manageable number of moves, trading optimality for speed.

  33. 33

    What is an evaluation function in depth-limited Minimax?

    Model answer

    An evaluation function estimates the expected utility of a game state from a given perspective, used to assign values to non-terminal states at the search depth limit.

    Explanation

    It approximates how good a position is, based on features like material advantage in chess, to guide move selection.

1 of 33
Question 1 of 33

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent