Applying a genetic algorithm to the quadratic assignment problem in C#
Some sample C# code on how a genetic algorithm can be applied to the quadratic assignment problem. The quadratic assignment problem (QAP) is a combinatorial optimization problem that models the following real-life problem: Given a set of n facilities and a set of n locations, specify a distance for each pair of locations and a flow for each pair of facilities, the objective is to assign each facility to a different location such that the sum of the distances multiplied by the corresponding flows is minimised. The problem statement resembles that of the assignment problem, except that the cost function is expressed in terms of quadratic inequalities, hence the name. This example is implemented as a simple console application using C# code developed in Microsoft Visual Studio. To help break down the problem a little, I develop a number of classes for the purposes of encoding potential solutions as chromosomes, maintaining a population of chromosome and applying genetic oper...