Lecture 2 Notes: Evolutionary Algorithms & Optimization Problems

Evolutionary Algorithms: A Framework

  • Evolutionary algorithms aren't a single algorithm but a framework with a family of algorithms.

Optimization

  • Evolutionary algorithms solve optimization problems.

  • Any problem needs to be cast as an optimization problem before applying an evolutionary algorithm.

Types of Optimization Problems:

  • Computational Complexity Perspective:

    • Hard problems.

    • Easy problems.

  • Algorithm Side:

    • Exact algorithms: Find optimal solutions.

    • Approximate algorithms: Find good, but not necessarily optimal, solutions.

Evolutionary Algorithms as Approximate Algorithms

  • Evolutionary algorithms are approximate algorithms applicable to hard problems.

Generic Evolutionary Algorithm

  • Given a candidate solution ss, there is a fitness function f(s)f(s) that measures how good ss is.

  • The goal is to find the best solution ss^* that maximizes or minimizes the fitness.

Steps:

  1. Initialization:

    • Start with an initial population populated with random solutions.

    • The population is typically large (hundreds to thousands).

    • Example: A population of 10 (though populations are usually much larger).

  2. Evaluation:

    • Evaluate the fitness (quality) of all solutions in the initial population.

  3. Iteration (repeat until convergence or a set number of generations):

    • Selection:

      • Probabilistic operator: Solutions with higher fitness have a higher chance of being selected.

      • Example: Select s<em>5s<em>5 (highest fitness) and s</em>9s</em>9.

    • Variation:

      • Recombination (crossover) and mutation to generate offspring solutions.

      • Example: Recombine and mutate to get offspring s<em>11s<em>{11} and s</em>12s</em>{12}.

      • s11s_{11} has a higher fitness than its parents (beneficial mutation).

      • s12s_{12} has a low fitness (bad mutation/recombination).

    • Population Update:

      • Replace some solutions with the new offspring solutions to maintain a fixed population size.

      • Example: Replace the two worst solutions (s<em>1s<em>1 and s</em>10s</em>{10}) with s<em>11s<em>{11} and s</em>12s</em>{12}.

Variations in Evolutionary Algorithms

  • Different schemes for selection, crossover, mutation, and updating result in different algorithms within the evolutionary algorithm framework.

Main Components

Selection

  • Methods:

    • Fitness proportion selection (probabilistic based on fitness).

    • Truncation selection (select the best 10%).

    • Rank-based selection (selection proportional to rank, ignoring fitness value).

Variation

  • Crossover and mutation introduce variability.

  • Two levels:

    • Encoding of solution (genotype - DNA).

    • The solution itself (phenotype - creature).

  • Recombination works on the genotype.

  • Solutions can be represented in various ways (binary strings, permutations, trees, etc.).

  • Different representations require different crossover and mutation operators.

Population Update

  • Schemes:

    • Replace the worst parents with offspring.

    • Generational scheme: Completely replace the previous population with offspring.

Parameter Tuning

  • Choosing the right schemes for selection, variation and update is a research topic.

  • Trial and error is often needed for specific problems.

Selection Strategies
  • Deterministic Selection (Always selecting the best):

    • Bad because it leads to premature convergence (loss of diversity, population becomes the same, and evolution stops).

  • Random Selection (Ignoring fitness):

    • Bad because it becomes pure random search and goes nowhere (like a monkey typing on a typewriter).

  • Need to pick something between these two extremes.

Encoding
  • Various ways of encoding solutions (binary strings, permutations, trees, real vectors, graphs, etc.).

  • Choosing the right encoding is key; wrong encoding breaks everything.

Mutation and Recombination
  • Based on the specific encoding used.

  • Mutation should be a small change; a big change is bad because it resets the search.

  • Crossover (recombining two different solutions) can be viewed as a big step mutation.

Parameters (Hyperparameters)
  • Population size, mutation rates, recombination rate, selection intensity.

  • Finding good parameters is empirical science (trial and error).

  • Another option is to evolve the parameters themselves, but it can be tricky (loss of control).

Applications of Evolutionary Algorithms

  • University lecture timetable, pipe network design, antenna design, machine learning, placement for mobile for mast, orbits of satellites, strategy for flying fighter aircraft, design of neural networks, treatment for cancer, and so on.

  • Applied to almost anything; Google "problem + genetic algorithm" to find relevant papers.

Example Problem: Subset Sum (Knapsack-like)

  • Given items with weights (20kg, 75kg, 60kg), find the subset with a total weight closest to 100kg.

  • Binary representation: 1 = item included, 0 = item excluded.

  • Example: 101 means item 1 and item 3 are included.

  • Best solution: 110 (20 + 75 = 95kg, closest to 100kg).

  • Fitness function: Minimize weightsubset100|weight_{subset} - 100|.

Optimization in General

  • Finding the best solution in a short amount of time.

  • SS: Set of all possible solutions (typically very large).

  • Example: Time-tabling problem for a university like Exeter: 103010^{30} possible timetables.

Fitness Function

  • Allows evaluating the quality of a solution.

  • Examples:

    • Time-tabling: Number of clashes (to minimize).

    • Car design: Distance covered on certain terrain.

    • Design: Measure how well the design fits the requirements.

Search Strategies

Exhaustive Search

  • Works for small search spaces (enumerate all solutions, compute fitness, pick the best).

  • Doesn't work for large problems (103010^{30} solutions).

Problems with Large Solution Spaces

  • Two categories:

    • Large but easy (polynomial/tractable).

    • Very large and hard (NP-hard/intractable).

  • Most real-world problems are hard.

Exact Algorithms

  • Guarantee finding the optimal solution.

  • Based on mathematical theory (e.g., mathematical programming).

  • Problems can be solved for different input sizes.

  • Input size: e.g., number of numbers to sort, number of vectors to compare.

  • Examples of complexities:\O(n \log n), \O(n^2), \O(2^n).

Complexity Classes

  • Polynomial time (tractable).

  • Exponential time (intractable).

Examples
  • Polynomial: n34n^{34}, nlognn \log n ,\O(n^{2.2}) .

  • Exponential: 1.1n1.1^n, n!n!, 2n2^n .

Differences in Growth

  • Exponential algorithms are better for small inputs but explode as the input size grows (combinatorial explosion).

Tractability
  • Problems with polynomial complexity are called tractable (solvable with exact methods).

  • Problems with exponential complexity are intractable (cannot be solved to optimality as they grow large).

Practical implications

  • Time needed on the fastest computer to search all protein structures with 500 amino acids is trillions of times longer than the estimated age of the universe (exponential problem).

Concrete Example: Minimum Spanning Tree Problem

  • Find a tree (connected graph without cycles) that connects all nodes in a graph.

  • Useful in communication networks, electricity distribution, water distribution networks.

Example

  • Given a graph with weighted edges, find a tree covering all five nodes of minimal cost.

  • The cost of the solution is the sum of the weights on the edges.

Algorithm to Approximate
  • Starting from an empty tree with no edges. We chose the cheapest edge.

    • Then extend it with neighbors edges that have a smaller weight and do not form a cycle.

    • Repeat n - 1 times, covering all nodes.

Real World problems
  • Real-world variations include constraints on the number of edges per node (degree), bandwidth requirements, etc.

  • Adding these constraints makes the problem exponential (NP-hard).

Real-World Example: New York Water Distribution Network

  • Optimize the water distribution network by finding the diameter of each section.

  • 21 pipes, 16 different diameters to choose from.

  • 162116^{21} possible solutions (102510^{25}), which is an extremely complex search space.

  • Choosing appropriate diameters is difficult, and the engineer decided that the problem was too hard.

Approximation Algorithms

  • Evolutionary algos can solve these types of problems.

  • Find good approximations in reasonable time (near-optimal solutions), but cannot guarantee optimality.

Running the Model
  • A bit time-intensive because they work with populations.

  • Slower than other algorithms but typically find better solutions over time.

  • They Follow this curve (Quality vs. Time). If you use other algorithms that are intensive at first you'll see that the quality grows quickly at the beginning, but then stuck in aging. They get stuck.

Conclusion

  • Evolutionary algorithms solve optimization problems.

  • Polynomial problems are easy; exponential problems are hard.

  • Real-world problems are hard, so approximate solutions are needed.

  • Evolutionary algorithms are excellent at approximation.