**A Genetic Algorithm for the Multidimensional Knapsack Problem**

By now we are all familiar with formulation of the one-dimensional knapsack problem: given a set of items, each with value and cost , select a subset of maximal value without exceeding a budget . That is,

max such that

We can extend this problem to several dimensions, considering, for example, a set of projects , each of which consumes resources and produces profit . We want to invest in the set of projects that produces maximal value without exhausting our budget, which consists of a set of resources, . Mathematically,

max such that

for

for

This problem is NP-hard, so most approaches involve solving the LP-relaxation of the multidimensional knapsack problem through branch-and-bound techniques, dynamic programming, and heuristics. Chu and Beasley (1998) propose a genetic algorithm heuristic that, they contend, dominates the existing solutions on the set of 57 canonical multidimensional knapsack problems and on a set of more complex problems they invented to assess their algorithm’s efficacy.

A genetic algorithm is an algorithm that applies the principles of evolution through natural selection to optimization. The algorithm initializes a population of candidate so- lutions, then evaluates the solutions’ fitness according to an objective function. Highly fit solutions, selected according to specific protocols, reproduce by blending their charac- teristics. The ‘child’ solution is then subjected to mutation via the alteration of various components in a randomized procedure. Offspring then replace the least-fit solutions in the current population and the process is repeated until the new child’s fitness exceeds the fitness of all existing solutions.

Chu and Beasley (1998) propose a genetic algorithm for the multidimensional knapsack problem. Each candidate solution is a string of length of binary variables, where a 1 in position indicates that in the solution , etc. It is important to note that a randomly-generated -bit string may not represent a feasible solution; the authors choose to address this problem by using a heuristic operator to convert infeasible solutions to feasible solutions.

After generating a random population of solutions, the algorithm proceeds to evaluate fitness to select the parents of the next generation. Chu and Beasley apply the binary tournament method, forming two groups of solutions each and selecting the solution in each group with the highest objective function value as a parent. A binary random number generator then determines which bits of each parent solution will be copied into the child solution. If the random number generator has a 0 in position , for example, then bit in the child solution is copied from parent 2, and vice versa. After creating the blended child solution in this way, the algorithm introduces mutation by randomly flipping a few bits in the child solution.

At this stage, the child solution may not be feasible, as previously discussed. The authors propose a repair operator that relies on the surrogate LP-relaxation of the multidimensional knapsack problem to convert the child solution to a feasible solution. This algorithm guarantees a feasible solution regardless of input.

To assess the computational efficiency of the algorithm, Chu and Beasley test it against CPLEX on 55 known test problems. Their GA approach finds the optimal solution to all these problems, but the problems are too simple to permit any efficiency distinctions between CPLEX and the GA. To determine whether their algorithm improves computational efficiency, therefore, they generated 270 new problems with larger variable and constraint sets.

Since these problems were generated at random, their solutions are not known. Assessment of the algorithm’s performance therefore depends on the gap between the algorithm’s optimal solution and the solution to the LP-relaxation of the problem in question. In gen- eral, the GA produced solutions at least as good as those produced by CPLEX, with an average percentage gap of 0.54% compared to 3.14% for CPLEX. The GA also performs well compared to other heuristics, but the time complexity of the GA per iteration is ap- proximately O(mn). The authors nonetheless contend that the dramatically higher quality of solutions obtained from the GA validate its computational intensiveness.

References: P.C. Chu and J.E. Beasley. “A Genetic Algorithm for the Multidimensional Knapsack Problem.” Journal of Heuristics 4: 63-86, 1998.