Artifical Intelligence
Module 1: Search Problems and Uninformed (Blind) Search
A search problem is formally defined by five components: a complete set of possible world states , a successor function yielding possible actions and resulting states, an initial starting state, a goal test, and action costs. The objective is to find an optimal solution, which is a sequence of actions from the initial state to a goal state that minimises the total cost.
Breadth-First Search (BFS):
BFS expands nodes level by level using a First-In-First-Out (FIFO) queue. It is complete and optimal only if action costs are constant. The total number of nodes generated in the worst case is given by the formula:
where is the branching factor and is the depth of the shallowest goal node. Consequently, its space complexity is also .
Uniform Cost Search (UCS):
UCS expands the node with the lowest path cost using a priority queue. It is complete if all step costs are strictly greater than , and it is always optimal. If is the cost of the optimal solution and is the minimum action cost, the worst-case time and space complexity is:
which can be significantly greater than .
Depth-First Search (DFS) & Iterative Deepening (IDS):
DFS always expands the deepest node in the current fringe using a Last-In-First-Out (LIFO) stack. It is not complete and not optimal, possessing a time complexity of and a space complexity of , where is the maximum path length. Iterative Deepening Search (IDS) mitigates the lack of completeness by repeatedly applying Depth-Limited Search with increasing depth limits. Despite regenerating upper levels multiple times, its asymptotic time complexity remains , calculated as:
IDS achieves space complexity while ensuring completeness and optimality (for uniform step costs).
Module 2: Informed (Heuristic) Search
Informed search leverages problem-specific knowledge encapsulated in an evaluation function to estimate a node's promise. A crucial component is the heuristic function , which estimates the cost of the cheapest path from node to a goal node.
Greedy Best-First Search:
This strategy directly relies on the heuristic function, selecting the node that appears closest to the goal. The evaluation function is:
Greedy search is neither complete nor optimal and has a worst-case complexity of .
A Search:*
A* search aims to minimise the total estimated solution cost by combining the path cost and the heuristic . Its evaluation function is:
A heuristic function is termed admissible if it never overestimates the true cost to the goal:
If is admissible, A* search is guaranteed to be complete and optimal.
Heuristic Dominance & Effective Branching Factor:
If two admissible heuristics and exist, and for all nodes , then strictly dominates and will never expand more nodes than . Furthermore, an elegant way of combining heuristics is to take their maximum:
The performance of a heuristic is measured using the Effective Branching Factor , defined by the total number of generated nodes at solution depth :
Module 3: Adversarial Search and Games
In two-player, perfect information, zero-sum games, an agent aims to find an optimal strategy against an infallible opponent.
Minimax and Alpha-Beta Pruning:
The Minimax algorithm computes the best move by assuming the opponent (MIN) will play optimally to minimise the utility of the agent (MAX). Alpha-beta ( - ) pruning improves the efficiency of Minimax by maintaining two parameters during tree traversal:
- : the best (highest) value found so far for MAX along the path.
- : the best (lowest) value found so far for MIN along the path.
If a minimax value below a MIN node falls below , or a value below a MAX node rises above , the remaining subtrees are ignored (pruned).
Monte Carlo Tree Search (MCTS):
MCTS explores the search space without a heuristic function by running random simulations from nodes. It balances the exploitation of promising moves and the exploration of unvisited moves using the UCT (Upper Confidence Bound applied to Trees) formula:
where is the number of wins from node , is the number of simulations from , is the total number of simulations from the parent node, and is the exploration parameter.
Module 4: Reinforcement Learning
Reinforcement Learning (RL) involves an agent learning optimal actions by interacting with an environment, observing states , executing actions , and receiving immediate rewards . A central challenge is the Temporal Credit Assignment Problem due to delayed rewards.
Q-Learning & Temporal Difference (TD):
Q-learning estimates training values through iterative approximations of the function. The incremental Temporal Difference (TD) update adjusts the current Q-value closer to the newly backed-up target:
where is the learning rate, is the discount factor, and represents the new experience observation.
Module 5: Propositional Logic and Inference
Propositional logic relies on elementary truth values and proposition symbols connected by logical operators. Logical inference determines whether a sentence is entailed by a knowledge base , denoted as .
Standard Inference Rules:
- Modus Ponens:
- AND-Elimination:
Logical Equivalences:
- Commutativity:
- Double-negation elimination:
- Contraposition:
- Implication elimination:
- Biconditional elimination:
- DeMorgan's Laws: and
- Distributivity:
Resolution Rule:
A complete inference rule applied to clauses (disjunctions of literals). The Unit Resolution Rule is defined as:
where or .
The General Resolution Rule takes two clauses and produces a new resolvent:
Module 6: Neural Networks and Deep Learning
Modern neural networks utilise gradient descent to optimise parameters by minimising a loss function over training data .
Softmax Normalisation & Categorical Cross-Entropy:
To generalise logistic regression to multiple classes, network outputs must form a valid probability distribution using softmax normalisation:
The corresponding loss function for classes is Categorical Cross-Entropy, which evaluates the one-hot encoded true classes against the predicted distributions :