a
Describe the concept of genetic algorithms (GA) and list TWO typical applications of this technique in AI (conceptual idea only, not "how" it works) [4 marks]
4 marks
›
Model Answer
Genetic algorithms are a family of search and optimisation methods inspired by biological evolution. The core idea is that good solutions to a problem can be found by mimicking natural selection: starting from a population of candidate solutions, repeatedly selecting the better ones (those with higher 'fitness'), combining them to produce offspring, and occasionally introducing random variation. Over many generations the population tends to converge toward increasingly good solutions, just as a species adapts to its environment over time. The algorithm never needs an explicit formula for the answer — it discovers it through selection pressure and variation.
Two typical applications:
1. Engineering design optimisation — for example, evolving the shape of an aeroplane wing or antenna to maximise lift or signal strength, where the search space of possible shapes is too large to explore exhaustively.
2. Scheduling and routing problems — such as finding near-optimal solutions to the Travelling Salesman Problem, job-shop scheduling in manufacturing, or timetabling in schools and universities, where the number of possible arrangements is combinatorially vast.
b
What are TWO advantages and TWO disadvantages of using genetic algorithms? [4 marks]
4 marks
›
Model Answer
Advantages:
1. No requirement for a mathematical gradient — GAs can optimise functions that are discontinuous, noisy, or have no closed-form derivative, making them applicable to black-box problems where gradient-based methods fail entirely.
2. Global search — by maintaining a diverse population, GAs explore many regions of the search space simultaneously and are less likely to get permanently stuck in a poor local optimum than simple hill-climbing methods.
Disadvantages:
1. Computational cost — evaluating fitness for each individual in a large population over many generations can be extremely slow, especially when each evaluation requires a simulation or real-world trial.
2. Premature convergence / no guarantee of optimality — the population can lose diversity early and converge on a suboptimal solution; there is no proof that the best individual found is the global optimum, and tuning parameters (population size, mutation rate, crossover operator) requires significant expertise and experimentation.
c
Explain the role of crossover and mutation in genetic algorithms. How do they complement each other? [2 marks]
2 marks
›
Model Answer
Crossover (recombination) takes two parent solutions and combines segments of their genomes to produce offspring that inherit good 'building blocks' from both parents. It is the primary mechanism for exploiting already-discovered good structure — mixing parts of solutions that are individually fit in the hope that their combination will be even better.
Mutation introduces small random changes to an individual's genome (flipping a bit, changing a value). It is the primary mechanism for exploration — it prevents the population from converging entirely to one region of the search space and can introduce novel genetic material that crossover alone could never recover once lost.
They complement each other because crossover is good at exploitation (rapidly improving solutions by combining known-good parts) but cannot recover diversity once it is lost, while mutation maintains diversity and enables escape from local optima but is too slow on its own to locate good solutions in a large space. Together they balance exploration and exploitation.
d
Discuss a potential ethical concern in applying genetic algorithms and a challenge in their real-world implementation. [4 marks]
4 marks
›
Model Answer
Ethical concern — bias in the fitness function: A GA optimises exactly what you tell it to. If the fitness function encodes historical data or human-designed objectives that contain bias (e.g. optimising a hiring algorithm on past hiring decisions that were themselves discriminatory), the GA will faithfully evolve solutions that perpetuate or amplify that bias. The algorithm produces no explanation for why a solution is fit, making it very difficult to audit or challenge. This is especially serious when GAs are used in high-stakes domains such as credit scoring, medical diagnosis, or criminal justice, where opaque and biased decisions can cause serious harm to individuals.
Real-world implementation challenge — the reality gap (sim-to-real transfer): GAs are usually run inside a simulator because evaluating thousands of candidates in the real world is too slow or dangerous. However, the fitness a solution achieves in simulation often does not transfer to the physical world: simulators cannot perfectly model friction, material properties, sensor noise, or manufacturing tolerances. The evolved solution may be highly fit in simulation but fail completely on real hardware. Bridging this gap requires careful simulator calibration, domain-randomisation techniques, or hybrid evaluation strategies, all of which add significant engineering cost.
e
Describe how GAs can be applied to solve the Travelling Salesman Problem (TSP). [8 marks]
8 marks
›
Model Answer
Representation (genotype): Each individual in the population is a permutation of the city indices — e.g. [3, 1, 4, 2, 5] meaning 'visit city 3 first, then 1, then 4…'. This permutation encoding directly represents a complete tour.
Fitness function: The fitness of a tour is (typically) the reciprocal of its total distance, so shorter tours have higher fitness. The total distance is computed by summing the distances between consecutive cities in the permutation, plus the return leg to the start.
Initialisation: A population of N random permutations is generated. Diversity at the start is important so the GA can explore a wide range of tours.
Selection: Parents are chosen from the population in proportion to their fitness (roulette-wheel selection) or via tournament selection (pick the best of k randomly chosen individuals). Fitter individuals are more likely to reproduce.
Crossover: Standard one-point crossover does not work on permutations because it can produce invalid tours with repeated or missing cities. Specialised operators are needed:
• Order crossover (OX): copy a segment from parent 1 into the child, then fill the remaining positions with the cities from parent 2 in the order they appear, skipping those already present.
• Partially-mapped crossover (PMX): establish a mapping between the two parents in the crossover segment and use it to resolve conflicts elsewhere in the genome.
Mutation: Again, standard bit-flip mutation is invalid. Permutation-preserving operators are used instead:
• Swap mutation: pick two positions at random and exchange the cities there.
• Inversion (2-opt) mutation: select a sub-sequence and reverse it — this is a powerful TSP move because reversing a segment often untangles crossing edges.
Replacement and termination: The new offspring replace (some or all of) the current population. The process repeats for a fixed number of generations or until improvement stalls. The best tour found across all generations is returned as the solution.
Why GAs are useful for TSP: The TSP has O(n!) possible tours, making exhaustive search infeasible for large n. GAs do not guarantee the global optimum but reliably find very good near-optimal solutions in reasonable time, often competitive with dedicated heuristics like 2-opt or Lin-Kernighan.
f
What is bio-inspired computing? Give an example of bio-inspired computing that is not a genetic algorithm. [2 marks]
2 marks
›
Model Answer
Bio-inspired computing is a broad field in which algorithms and computational systems are designed by drawing analogies from biological processes, structures, or behaviours found in nature. The underlying principle is that billions of years of evolution have produced remarkably effective solutions to complex problems, and abstracting those mechanisms into algorithms can yield powerful problem-solving techniques.
Example — Ant Colony Optimisation (ACO): inspired by the pheromone-laying behaviour of real ants searching for food. Artificial 'ants' traverse a graph, depositing virtual pheromone on edges proportional to the quality of the path found. Shorter, better paths accumulate more pheromone and are therefore more likely to be chosen by subsequent ants, gradually focusing the colony's search on high-quality routes. ACO is widely used for routing problems, including the TSP and network routing. Other valid examples include Particle Swarm Optimisation (flocking behaviour), Artificial Immune Systems, and neural networks (inspired by the brain).
g
Provide an example of how GAs are used in applications outside of robot design. Explain how GAs work in that application and the benefits they offer. [6 marks]
6 marks
›
Model Answer
Application: Drug discovery and molecular design.
How it works: A candidate drug molecule is encoded as a string or graph representation of its chemical structure (atoms and bonds). The GA maintains a population of candidate molecules and evaluates each one's fitness using a scoring function — typically a computational model of how well the molecule binds to a target protein (docking score), combined with desirable pharmacological properties such as solubility, low toxicity, and bioavailability.
Selection favours molecules with better binding and ADMET (absorption, distribution, metabolism, excretion, toxicity) profiles. Crossover combines fragments of two parent molecules to create novel hybrid structures (fragment-based drug design). Mutation makes small chemical changes — adding, removing, or substituting an atom or functional group — mirroring the chemical modifications a medicinal chemist would make by hand.
Over many generations the GA explores a vast chemical space — estimated at 10^60 drug-like molecules — and converges on candidates with increasingly good profiles. Shortlisted candidates are then synthesised and tested in the lab.
Benefits:
1. Scale — the search space of possible drug-like molecules is astronomically large and cannot be enumerated; GAs navigate it efficiently without needing an explicit formula for the optimal structure.
2. Multi-objective optimisation — fitness functions can simultaneously optimise for binding affinity, selectivity, solubility, and toxicity, allowing trade-offs to be explored systematically — something a human chemist working intuitively would struggle to do.
3. Speed and cost — computational screening with a GA can evaluate millions of virtual candidates in days and flag the most promising for wet-lab synthesis, dramatically reducing the time and cost of early-stage drug discovery. Projects like the evolution of new antibiotics and COVID-19 antivirals have used GA-based molecular optimisation.