Welcome to my personal webpage. Here, you'll find information on my research, publications, and teaching.
If you would like to contact me, arrange a visit, or are interested in pursuing a PhD, please contact me using the email address above.
• Evolutionary Computation in Combinatorial Optimisation (EVOCOP)
• The Practice and Theory of Automated Timetabling (PATAT)
• The Genetic and Evolutionary Computation Conference (GECCO)
• Algorithmic graph theory and combinatorial optimisation
• Graph colouring (including vertex colouring, edge colouring and happy colouring)
• The application and analysis of metaheuristic and integer programming algorithms
• Vehicle routing and arc routing, particularly dynamic variants of the problem
• Shortest path algorithms
• School bus routing
• Automated timetabling (course and exam) and related problems
• Grouping and partitioning problems
• Operating theatre scheduling
• Sports scheduling
• Solving Latin square and Sudoku problems
• Bin packing, trapezoid (trapezium) packing, and the equal-piles problem.
I am a fellow of the Higher Education Academy. Currently, I am teaching the following modules at Cardiff University: MA3602 Algorithms and Heuristics, and MA2760 Mathematical Investigations in Python. Previous modules that I have taught include: MAT002 Statistical Methods; MA0276 Visual Basic for Operational Research; MAT004 Computational Methods; MA0105 Foundations of Probability; BSP658 Business Statistics; BS0511 Quantitative Methods for Business; and BS1501 Applied Statistics and Mathematics for Economics and Business.
The following subsections give "beginner's guides" to some of my research interests. Further information can be found by following the links and consulting the relevant publications above.
Graph colouring is the task of painting all the vertices of a graph so that (a) all pairs of adjacent vertices are assigned different colours, and (b) the number of different colours used is minimal. For example, the image on the right shows a solution using just three colours, which is actually the minimum number for this particular graph. The graph colouring problem has applications in many practical areas including university timetabling, sports scheduling, creating seating plans, and solving Sudoku puzzles. It is also related to the four colour theorem which, for over one hundred years, was one of the most famous unsolved problems in all of mathematics.
For further information on graph colouring and its applications, please refer to my book A Guide to Graph Colouring: Algorithms and Applications. The suite of graph colouring algorithms used in this book is available here. These have been coded in C++, and the resource also contains compilation and usage instructions.
Some short introductory videos on graph colouring can also be found at the following links:
The school bus routing problem involves compiling a list of eligible students, and then efficiently organising their transport to school. This process requires the selection of a suitable set of pick-up points (bus stops), the assignment of students to these pick-up points, and the creation of bus routes that visit these stops while getting students to school on time. In doing this, four factors should be considered: (1) We should try to reduce economic costs by minimising the number of vehicles used; (2) Bus journeys should not be too long for students; (3) Pick-up points should be close to people’s houses; (4) Buses should not be over-filled.
This problem is an interesting mix of vehicle routing, set covering, and the bin packing problem and it can be very difficult to find solutions for. Some of my publications above have looked at producing effective heuristics for this problem. Further details, including visualisations of problems and a suite of benchmark problem instances, can be found on a dedicated webpage here.
The Trapezoid Packing Problem is closely related to the one-dimensional bin packing problem. Here, items are trapezoidal in shape with a fixed height and variable width. A practical application arises in the roofing industry, where large numbers of roof trusses of different lengths and different "end angles" have to be cut from boards of a given length such that wastage is minimised. Though similar to one-dimensional bin packing, the problem is complicated by the fact that the ends of the trapezoids need to be "nested" so that wastage between consecutive shapes is kept to a minimum.
In our 2016 publication 'How to Pack Trapezoids: Exact and Evolutionary Algorithms' we gave the first polynomial-time exact algorithm for packing items optimally into a single bin. This exact algorithm was then used as part of a wider algorithm for finding high-quality solutions to the multi-bin problem. The source code and a detailed breakdown of the results of this work is available here. Some of these algorithms have since been used in the AutoBarSizer software created by the Fraunhofer Institute for Algorithms and Scientific Computing.
In this problem we want to construct fixed-length round trips on street networks. This has several real-world applications such as planning a jogging route, organising a cycling tour, or determining a walk that allows a user to complete their daily steps quota. Although quite simple sounding, this problem can be very difficult to solve, particularly if users want to avoid visiting the same locations again and again. If routes cover large geographical areas, the underlying road networks can also be very large, making computation slow. Adjustments also need to be made for different modes of travel modes such as walking, cycling, and driving.
In recent work (currently under review) several effective and fast fast-acting heuristics have been designed for this problem. The table below links to solutions produced by these algorithms for some famous landmarks.
|Arc de Triomphe, France
|Niagara Falls, Canada
|Cardiff Castle, Wales
|Melbourne Cricket Ground, Australia
The shortest path problem involves finding the most efficient way of travelling between two points in a network. It is most commonly used in online mapping tools and vehicle navigation systems, although applications also exist in social network analysis, currency exchange, and arbitrage.
Several well-known polynomial-time methods are available for the shortest path problem, including the Bellman-Ford algorithm, Dijkstra's algorithm, and the A* algorithm. In many real-world applications, however, complications can arise due to the occurrence of "transfer penalties" at the vertices. Consider the graph on the right, which depicts a small public transport system with edge colours representing transport lines and weights representing travel times. Suppose that we want to find the shortest path from vertex v1 to v9 in this graph. By inspection, this is (v1, v4, v5, v9) with a length of 2 + 1 + 2 = 5. However, this path involves changing lines at v4 which, might incur some time penalty (e.g., if the commuter needs to change vehicles). If this penalty is more than three units, then the shortest path from v1 to v9 now becomes (v1, v4, v7, v8, v9) with a length of eight.
In this 2020 paper, several polynomial-time algorithms are proposed that efficiently solve this extension to the shortest path problem.
When a patient enters a hospital for an elective operation, a bed must be available for them to be put into after surgery. However, sometimes all beds in the ward will be occupied, meaning that the operation will have to be cancelled. Our research has shown that cancellations occur far less frequently if operations are scheduled throughout the week according to a strategically designed master surgery schedule. As part of this, we also must take into account various hospital requirements, the unexpected arrival or emergency patients, and the variability in the time patients take to recover after their operations. Further information can be found in this paper.
Another problem that involves colouring vertices in a graph is the Maximum Happy Vertices problem. Here, we are given a graph in which some of the vertices are already coloured (as with the left graph in the figure). Our task is to then colour the remaining vertices so that they are given the same colour as all of their neighbours. In the example solution on the right, we see that most vertices are "happy" because they are the same colour as their neighbours. However, because of the colourings specified in the original graph, it is not possible for all vertices to be happy. (Unhappy vertices are marked with a "U".) This sort of problem is useful in identifying community structures in social networks, amongst other things.
In the mid-2010's I was involved in the creation of the commercial website www.weddingseatplanner.com. This service provides an interactive online tool for designing optimal seating plans for weddings and other large gatherings. The optimisation algorithms used for this tool were originally programmed in ActionScript and are described in my 2021 book A Guide to Graph Colouring: Algorithms and Applications. The descriptions can also be found in this 2016 paper.
Since 2020, Adobe has removed all support for Flash Player, meaning that this tool no longer runs on most web browsers. We have therefore made available a C++ version of the same optimisation algorithm, which can be downloaded from here. This implementation allows a repetition of all of the experiments reported in the above publications.
Some of my research has focussed on the production of efficient algorithms for timetabling problems. A large number of timetabling problem instances are available for this problem due to the International Timetabling Competition. Some hard timetabling instances can also be found here. This latter set contains sixty problem instances of varying sizes that are intended to be more difficult than the competition instances with regards to both finding feasibility and satisfying soft constraints. Source code and results for the algorithm presented in Lewis, R. and J. Thompson (2015) 'Analysing the Effects of Solution Space Connectivity with an Effective Metaheuristic for the Course Timetabling Problem'. European Journal of Operational Research, vol. 240, pp. 637-648 can be found here
Some of my work has concerned the use of metaheuristics to help solve Sudoku puzzles. The C++ code used for experiments described in "Lewis, R. (2007). 'Metaheuristics can Solve Sudoku Puzzles' Journal of Heuristics, vol. 13 (4), pp. 387-401", can be downloaded here. Code for the random sudoku problem instance generator used in this research can be downloaded here.
Regarding Sudoku, here is a very useful Sudoku to Graph Colouring Converter. This program reads in a single Sudoku problem (from a text file) and converts it into the equivalent graph colouring problem. The output file appears in the DIMACS format which can then be used as the input file for any suitable graph colouring algorithm. If a solution using the correct number of colours is found, this can then be easily converted back into the Sudoku representation, giving a valid solution to the original problem.
The travelling salesman problem (TSP) asks the following: "Given a set of cities with distances between each pair, what is the shortest tour that visits each city exactly once?" This is a famous example of an NP-hard problem that is often used in teaching to help motivate the use of heuristics and metaheuristics. To these ends, here is a simple Microsoft Excel program for finding approximate solutions to randomly generated Euclidean TSPs. This program is intended to show the run-time characteristics of (1) random descent, (2) simulated annealing, (3) steepest descent, (4) tabu search, and (5) evolutionary algorithms. Animated charts are also included in the program to help illustrate algorithm behaviour.
Many transportation problems in operational research, such as the travelling salesman problem and vehicle routing problem, make use of a distance matrix. This is a matrix that gives the optimal driving distance (or travel time) between all pairs of locations being considered. A small number of online services exist for producing distance matrices, such as the Google Maps Distance Matrix API, but the sizes of matrices offered are usually very limited. To these ends, here is my own program for producing large distance matrices and travel time matrices. This program is coded in C# and uses Bing Maps to produce matrices of up to 1079x1079 entries in a single sitting. Larger matrices can also be produced, though users should ensure they do not exceed the Bing daily usage limit (see the instructions within the attachment).
A sociogram is a graphical representation of social links between people. The example on the right shows data collected in a small classroom. Each node represents a student and arrows indicate friendships. Black arrows indicate that A likes B, and double-headed blue arrows indicate that both A and B like each other. Colours on the nodes are also used it indicate students that are popular (green), rejected (grey), controversial (orange) and neglected (pink). These classifications are based on the work of Robin Banerjee, found here.
An easy-to-use Excel-based tool for creating sociogram visualisations can be found by following this link. When drawing the network, the program uses a variant of simulated annealing to decide where to place each node on the plane, making the network easier to interpret visually. The cost function of this algorithm seeks to ensure a suitable balance between five criteria: (a) the arrows should not be too long; (b) pairs of arrows should not cross; (c) nodes should be spread out evenly; (d) nodes should not be too close to the border; and (e) arrows should not pass too closely to other nodes. If you want to know more about this optimisation algorithm, please contact me.
In many countries, school students entering their final years of study will be asked to choose a small set of elective subjects. In places such as the United States (APs), Germany (Arbiturs), England and Wales (GCSEs and A-levels), and Australia (HSEs), these choices will be given in a set of "options columns".
The way that subjects are split into options columns is important for schools and students for several reasons.
• Where schools compete for numbers, students are more likely to choose institutions that allow them to study their favoured combination of subjects.
• Allowing students to select their preferred subjects is beneficial for their studies.
• Maximizing the number of students whose choices are satisfied reduces the need for schools to be forced into creating additional classes (and incur the associated financial costs).
In 2020 I published a paper on the topic of optimising subject options columns for schools so that the number of students whose preferences are met is maximised. This research involved creating a free, easy-to-use Excel tool, which can be downloaded here. Further information on this topic can be found on this page.
Previous work has also looked at the scheduling of sports events, in particular round-robin leagues and tournaments. Here is a link to the ten sports scheduling benchmark problem files used in the paper "Lewis, R. and J. Thompson (2011) 'On the Application of Graph Colouring Techniques in Round-Robin Sports Scheduling'. Computers and Operations Research, vol. 38(1), pp. 190-204". The source code (C++) for the round-robin to graph colouring program, which was used to generate many of the graphs in the paper, can be found here.