๐ง What Are Intelligent Systems?
Intelligent systems solve problems autonomously โ with reduced or no human intervention. Classical algorithm design fails when problems are too complex, when solution spaces are astronomically large, or when no known algorithm can solve them in acceptable time.
Find the right molecule from trillions of candidates
Navigate 3D space with real-time decisions
Maximize returns subject to risk constraints
๐ฟ Bioinspired Algorithms
Inspired by the human brain
Darwin's theory of evolution
Bird flocking & fish schooling
Metallurgical heat treatment
๐ Topics Covered
๐ฏ Optimization Problems
An optimization problem is defined by a search space S and a fitness function f. The goal: find s* โ S that maximizes or minimizes f(s*).
S = search space (all feasible solutions)
f : S โ โ = fitness function
Goal: s* = argmax f(s) or argmin f(s)
๐ Knapsack Problem Interactive
Select items to maximize value without exceeding 15 kg capacity.
๐บ๏ธ Travelling Salesman Problem Interactive
Click to place cities, then solve the shortest tour.
๐ Why Exhaustive Search Fails
Solution space size grows exponentially โ heuristics are essential
๐ฝ๏ธ No Free Lunch Theorem
Wolpert & Macready (1997): when averaged over all possible problems, any two algorithms perform identically. No universal "best" algorithm exists.
โ Specialized algorithms beat general ones on specific problems
โ But lose on other problems
๐ Algorithm Performance Trade-off
A wins on some problems, B wins on others โ they balance out overall
๐ก Consequences
| Statement | True? |
|---|---|
| "Algorithm X is always best" | โ False |
| "SA beats HC on rugged landscapes" | โ True (on average) |
| "No single best algorithm exists" | โ True (NFL theorem) |
| "Problem-specific algorithms can win" | โ True |
| "Weka/Scikit-learn compare algorithms" | โ Motivated by NFL |
โฐ๏ธ Hill Climbing
The simplest local search algorithm. Start at a random solution, move to a better neighbor, repeat until no improvement is possible.
๐ฎ Hill Climbing Simulator Live
โ vs โ Strengths & Weaknesses
| Property | Result |
|---|---|
| Simple to implement | โ Very |
| Fast per iteration | โ O(|N(i)|) |
| Works for any N | โ General |
| Escapes local optima | โ Never |
| Finds global optimum | โ No guarantee |
| Deceptive problems | โ Very poor |
๐บ๏ธ Fitness Landscapes
A Fitness Landscape (FL) visualizes the relationship between solution structure and fitness value. The shape of the landscape determines how hard a problem is for local search algorithms.
๐ Landscape Explorer Interactive
๐ Why We Can't Draw FLs
- Vast search space: 2ยนโฐโฐ solutions โ impossible to enumerate
- High dimensionality: Neighborhood of size k โ k-dimensional FL
- Dynamic problems: Some fitness functions change over time
๐ก Landscape โ Algorithm Choice
๐ก๏ธ Simulated Annealing
SA (Kirkpatrick et al. 1983) extends HC using inspiration from metallurgical annealing โ slowly cooling a material to reach its minimum energy state. The key idea: accept worse solutions with decreasing probability to escape local optima.
๐ Acceptance Probability Explorer Interactive
๐ฎ SA Live Simulator Interactive
๐ Theory: Asymptotic Convergence
Lemma 2.1 (Stationary probability): After many transitions with constant c, SA stabilizes on solution i with probability:
Theorem 2.3 (Asymptotic Convergence): As c โ 0, SA stabilizes on global optima with probability 1, uniformly distributed over all global optima.
โ๏ธ HC vs SA Comparison
| Property | Hill Climbing | Simulated Annealing |
|---|---|---|
| Accepts worse solutions? | โ Never | โ With prob e^(โฮf/c) |
| Escapes local optima? | โ No | โ Yes |
| Global optimum guarantee? | โ Local only | โ Asymptotically |
| Neighbor selection | Best neighbor | Random neighbor |
| Parameters | โ None | โ ๏ธ c, L, schedule |
๐งฌ Genetic Algorithms
GAs (Holland 1975, Goldberg 1989) are Evolutionary Computation methods inspired by Darwin's theory of natural selection. Unlike HC/SA, GAs work with a population of solutions and evolve them through selection, crossover, and mutation.
GA vs SA vs HC
| Feature | HC | SA | GA |
|---|---|---|---|
| Solution count | 1 | 1 | Population N |
| Inspiration | โ | Metallurgy | Evolution |
| Operators | Neighbor move | Random neighbor | Crossover + Mutation |
| Selection | โ | โ | Fitness-based |
๐ The GA Algorithm
๐ฏ Selection Algorithms Interactive
Fitness Proportionate Selection: Each individual's selection probability is proportional to its fitness.
Spin the roulette wheel! Fitter individuals occupy larger segments.
Population (fitness values)
Ranking Selection: Sort individuals by fitness; selection probability is based on rank position, not raw fitness value.
P(select rank r) = ฯ(r) / ฮฃ_j ฯ(j)
ฯ can be linear, logarithmic, or exponential
Tournament Selection: Pick k random individuals; select the best among them. Repeat for each parent needed.
๐ Genetic Operators Interactive
Standard (1-point) Crossover: Pick a random crossover point; swap substrings between two parents to create two children.
Standard Mutation: For each gene, replace with a random character with probability p_m (the mutation rate).
๐ฌ GA Population Simulator Live
Watch a population evolve to maximize f(x) = number of 1-bits in a binary string.
๐ Schema Theorem
A schema H is a pattern over {0,1,*} where * is a wildcard. E.g., H = 1**0* matches any 5-bit string starting with 1 and having 0 in position 4.
โ๏ธ Advanced GA Methods
Premature convergence occurs when the population loses diversity too quickly โ all individuals become similar before finding a good solution.
Causes: Too high selection pressure ยท Small population ยท High crossover rate ยท Low mutation rate
Fitness Sharing: Reward diversity by reducing fitness of similar individuals. Individuals in dense clusters compete for a shared "fitness resource".
Other methods: Restricted mating (only mate similar individuals) ยท Diploid chromosomes (two copies, dominant/recessive) ยท Novelty search (replace fitness with novelty measure)
3.7 Genetic Algorithms for Continuous Optimization
Continuous optimization is a very frequent class of problems โ e.g. optimizing parameters of a device or another algorithm. Standard GA operators designed for discrete alphabets are weak here: bit-flip crossover cannot generate new allele values, it only swaps existing ones.
1011010 โ alleles โ {0,1}.Standard crossover swaps substrings โ fine for discrete problems.
[xโ, xโ, โฆ, xโ] where xแตข โ [ฮฑแตข, ฮฒแตข] โ โ.Each individual = a point in m-dimensional Cartesian space.
Geometric Crossover
Given parents Pโ = [xโ,โฆ,xโ] and Pโ = [yโ,โฆ,yโ], one offspring is produced:
Geometric Mutation (Box Mutation)
Given an individual [xโ,โฆ,xโ], produces:
๐ฎ Interactive: Geometric Crossover & Mutation in 2D
Drag Parent 1 (blue) and Parent 2 (green) on the canvas. Use the buttons to generate offspring using geometric crossover or box mutation.
Continuous vs. Discrete GA โ Key Differences
How to fairly compare algorithm configurations:
๐ฆ Particle Swarm Optimization
PSO (Kennedy & Eberhart, 1995) is inspired by the social behavior of bird flocking and fish schooling. Particles move through the search space, guided by their own best position and the swarm's best position.
๐ PSO Algorithm & Equations
โข
wยทv_i โ inertia (keep moving in same direction)โข
cโยทrโโ(b_iโx_i) โ cognitive term (attract to own best)โข
cโยทrโโ(gโx_i) โ social term (attract to swarm best)โข w โ 1 (inertia weight)
โข cโ โ cโ โ 2 (learning factors)
โข Swarm size: 20โ40 particles (fewer than GA pop)
โข Iterations: thousands to millions (more than GA gens)
๐ฎ PSO 2D Simulator Live
Particles search for the minimum of a 2D surface. Watch them swarm toward the global optimum!
๐ง Parameter Setting & Variants
Parameter Guidelines
| Parameter | Typical Range | Effect |
|---|---|---|
| Swarm size n | 20โ40 | More particles โ better coverage |
| Inertia w | โ 1 | Higher โ more exploration |
| cโ, cโ | โ 2 | cโ high โ self-reliant; cโ high โ social |
| Max velocity | ฮฒ_j โ ฮฑ_j | Prevents "jumping over" optima |
| Iterations | 1000s โ millions | More โ better convergence |
Variants
๐ Glossary of Key Terms
๐ง Self-Assessment Quiz
Test your understanding across all chapters.