The multidimensional knapsack problem (MKP) can be stated as:
Each of the m constraints described in (1b) is called a knapsack constraint. A set of n items with profits and m resources with are given. Each item j con- sumes an amount from each resource i. The 0-1 decision variables indicate which items are selected. A well-stated MKP also assumes that and for all, , since any violation of these condi- tions will result in some constraints being eliminated or some’s being fixed.
The MKP degenerates to the knapsack problem when in Equation (1b). It is well known that the knapsack problem is not a strong -hard problem and solvable in pseudo-polynomial time. However, the situation is different to the general case of. Garey and Johnson (1979)  proved that it is strongly -hard and exact techniques are in practice only applicable to instances of small to moderate size.
A real-world application example of MKP is selecting projects to fund. Assume there are n different projects and we need to select some projects and fund them for m years. Each project provides a profit and each of them has a budget determined for each year. Our objective is to maximize the total profit and not exceed yearly budgets. This problem can be formulated as Equation (1). What is more, many practical problems such as the capital budgeting problem  , allocating processors and databases in a distributed computer system  , project selection and cargo loading  , and cutting stock problems  can be formulated as an MKP. The MKP is also a sub problem of many general integer programs.
Given the theoretical and practical importance of the MKP, a large number of papers have devoted to the problem. It is not the place here to recall all of these papers. We refer to the papers of Chu and Beasley (1998)  , Fréville (2004)  and the monograph of Kellerer (2004)  for excellent overviews of theoretical analysis, exact methods, and heuristics of the MKP. Recently, some new algorithms for the MKP have been proposed such as some variants of the genetic algorithm  , the ant colony algorithm  , the scatter search method  , and some new heuristics  -  . Some studies on analysis of the MKP  ,  and generalizations of the MKP  -  have also been put forward.
An Evolutionary algorithm (EA) is a generic population-based metaheuristic optimization algorithm. Candidate solutions to the optimization problem play the role of individuals (parents) in a population. Some mechanisms inspired by biological evolution: selection, crossover and mutation are used. The fitness function determines the environment within which the solutions “survive”. Then new groups of the population (children) are generated after the repeated application of the above operators. EAs have found application in computational science, engineering, economics, chemistry, and many other fields (see  -  ).
In the last two decades EAs were studied for solving the MKP. Although the early works do not successfully show that genetic algorithms (GAs) were an effective tool for the MKP, the first successful GA’s implementation was proposed by Chu and Beasley (1998)  . Extended numerical comparisons with CPLEX (version 4.0) and other heuristic methods showed that Chu and Beasley’s GA has a robust behavior and can obtain high-quality solutions within a reasonable amount of computational time. Raidl and Gottlieb (2005)  introduced and compared six different EAs for the MKP, and performed static and dynamic analyses explaining the success or failure of these algorithms, respectively. They concluded that an EA based on direct representation, combined with local heuristic improvement (referred to as DIH in  , i.e., GA of Chu and Beasley (1998)  with slight revision), can achieve better performance than other EAs mentioned in  from empirical analysis.
The best success for solving the MKP, as far as we known, has been obtained with tabu-search algorithms embedding effective preprocessing  ,  . Recently, impressive results have also been obtained by an implicit enumeration  , a convergent algorithm  , and an exact method based on a multi-level search strategy  . Compared with EAs, the methods mentioned above can yield better results when excellent solutions are required. But they are more complicated to implement or their computation takes extremely long time. Since EAs are simple to implement and their computation time are easy to control, they are good alternatives if the quality requirement of solutions of the MKP is not very strict.
In this paper, we will consider a variant of EA to solve the MKP. This EA will use a special encoding technique which is called weight-coding (or weight-biasing). We will revise a weight-coded EA (WCEA) proposed by Raidl (1999)  and propose a revised weight-coded EA (RWCEA). The numerical experiments of some benchmarks will show that the RWCEA performs better than the WCEA. Moreover, this RWCEA can compete with DIH in some benchmarks.
2. An Introduction to the Weight-Coding and Its Application to the MKP
When combinatorial optimization problems are solved by an EA, the coding of candi- date solutions is a preliminary step. Direct coding such as the binary coding is an intui- tive method. The main drawback of this coding lies in that many infeasible solutions may be generated by EA’s operators. To avoid that, the basic idea of the weight-coding is to represent a candidate solution by a vector of real-valued weights. The phenotype that a weight vector represents is obtained by a two-step process.
Step (a): (biasing) The original problem P is temporarily modified to by biasing problem parameters of P according to the weights;
Step (b): (decoding heuristic) A problem-specific decoding heuristic is used to gene- rate a solution to. This solution is interpreted and evaluated for the original (unbia- sed) problem P.
The weight-coding is an interesting approach because it can eliminate the necessity of an explicit repair algorithm, a penalization of infeasible solutions, or special crossover and mutation operators. It has already been successfully used for a variety of problems such as an optimum communications spanning tree problem  , problem  , the traveling salesman problem  , and the multiple container packing problem  .
To the best of the authors’ knowledge, the work of Raidl (1999)  is the first to use weight-coded EA (WCEA) to deal with the MKP. In that paper, some variants of WCEAs were proposed and compared. And Raidl finally suggested one of them and compared the WCEA with other EAs in  . In this WCEA, is set to be the weight vector representing a candidate solution. Weight is associated with item j of the MKP. Corresponding to Step (a), the original MKP is biased by multiplying of profits in (1a) with log-normally distributed weights:
where denotes a normally distributed random number with mean 0 and stan- dard deviation 1, and is a strategy parameter that controls the average intensity of biasing. Raidl (1999)  suggested that. Since the resource consumption values and resource limits are not modified, all feasible solutions of the biased MKP are feasible to (1).
Corresponding to Step (b), the decoding heuristic which Raidl (1999)  suggested is making use of the surrogate relaxation (see  ,  ). The m resource constraints (1b) are aggregated into a single constraint using surrogate multipliers,:
where are obtained by solving the linear programming (LP) of the relaxed MKP, in which the variables may get real values from. The values of the dual varia- bles are then used as surrogate multipliers, i.e. is set to the shadow price of the i-th constraint in the LP-relaxed MKP. Pseudo-utility ratios are defined as:
A higher pseudo-utility ratio heuristically indicates that an item is more efficient. After the items are sorted by decreasing order of, the first-fit strategy used as decoder in the permutation representation is applied. All items are checked one by one and each item’s variable is set to 1 if no resource constraint is violated, otherwise, is set to 0. The computational effort of the decoder is for sorting the plus for the first-fit strategy, yielding in total.
Raidl’s WCEA can be described as follows (we will explain the details of Steps 6, 7, and 8 afterward):
Algorithm of Raidl’s WCEA
Step 1: set;
Step 2: initialize, where is a random va- lue following log-normally distribution as (2);
Step 3: evaluate;
3-1: bias original MKP;
3-2: use decoding heuristic as in  (described above) to get phenotype
3-3: substitute into (1a) to obtain;
Step 4: find s.t.,; do
Step 5: select from;
Step 6: crossover and to generate a child C;
Step 7: mutate C;
Step 8: evaluate C as Step 3, get and;
Step 9: if any then (that means C is a duplicate of a member of the population)
Step 10: discard C and goto Step 6;
Step 11: find s.t. and replace; (steady-state replacement, i.e., the worst individual of population is replaced).
Step 12: if then
Step 13:; (update best solution found)
Step 15: return,.
In Step 6, a binary tournament selection is used. That is, two pools of individuals, which consist of 2 individuals drawn from the population randomly, are formed re- spectively at first. Then two individuals with the best fitness, each taken from one of the two tournament pools, are chosen to be parents.
In Step 7, Raidl (1999)  suggested a uniform crossover instead of one- or two- point crossover. In the uniform crossover two parents have one child. Each
in the child is chosen randomly by copying the corresponding weight from one or the other parent.
Once a child has been generated through the crossover, a mutation step in Step 8 is performed. Each of the child is reset to a new random value observing log-normal distribution with a small probability (3/n per weight as in  or one random position in  ).
In numerical experiments, the N in Step 2 is taken as 100 and in Step 5 is taken 106. Raidl and Gottlieb (2005)  compared this WCEA with other five EAs for the MKP. From empirical analysis, this WCEA outperformed all of them except DIH (The meaning of DIH is given in Section 1) on average.
3. Our Revised WCEA for the MKP
The core of Raidl’s WCEA is the surrogate relaxation based heuristic in decoding. In our points of view, this heuristic has two drawbacks. First, the dual variables of an LP- relaxed MKP used in heuristic decoding step are just good approximations of optimal surrogate multipliers and it may mislead the search  . LP-relaxed MKP used in heuristic decoding step are just approximations of optimal surrogate multipliers. And deriving optimal surrogate multipliers is a difficult task in practice  . Secondly, the heuristic decoding might mislead the search if the optimal solution is not very similar to the solution generated by applying the greedy heuristic  .
In order to avoid using surrogate multipliers, we set to let every observe uniform distribution on, where. The profits of the original MKP are biased by multiplying weights:
as mentioned in Section II, all feasible solutions of this biased MKP are feasible to (1). In decoding heuristic, we also use first-fit strategy, i.e., the items are sorted by de- creasing order of (not by pseudo-utility ratio in (4)) and traversed. Each item’s variable is set to 1 if no resource constraint is violated. The computational effort of the decoder is also in total.
This form of is similar to the idea of Random-key Representation  . Surro- gate multipliers can be avoided but the efficiency of the EA will be reduced  . To overcome this disadvantage, our thought is to obtain a “good” initial population. In the following we first introduce an idea proposed by Vasquez and Hao  and then propose our method.
It is well known that only relaxing the integrality constraints in an MKP may not be sufficient because its optimal solution may be far away from the optimal binary solution. However, Vasquez and Hao in  observed when the integrality constraints was replaced by a hyperplane constraint, the corresponding linear pro- gramming solution may often be close to the optimal binary solution. For example in  , in (1) we let, , , ,. The relax linear programming problem leads to the fractional optimal solution
while the optimal binary solution is. If we replace the integrality constraints by, this linear programming problem leads to the optimal binary solution.
In the above example, if we take and substitute it to (5), the optimal binary solution can be obtained by first-fit heuristic mentioned above. Moreover, if we do not restrict k as an integer, we may also obtain some corresponding linear program- ming solutions from which some good binary solutions may be obtained by first-fit heuristic. We use these linear programming solutions as a “good” initial population. So the disadvantage of Random-key Representation may be overcome. The experimental results presented later have confirmed this hypothesis. Naturally, the hypothesis does not exclude the possibility that there exists a certain MKP whose optimal binary solution cannot be obtained from linear programming solutions.
Inspired by this idea, initialization is guided by the LP relaxation with a hyperplane constraint. To begin with, we use some simple heuristic (such as a greedy algorithm) to obtain a 0 - 1 lower bound z. Next, the two following problems:
are solved to obtain and.
Then, N linear programming problems
are solved where is a real number generated randomly from in each computation. So the N linear programming solutions are generated as the initial popu- lation.
The scheme of the RWCEA is as follows:
Algorithm of the RWCEA
Step 1: set;
Step 2: initialize by solving N linear programming problems of (6),.
3-1: bias original MKP;
3-2: use decoding heuristic as in  (described in Section 2) to get phenotype
3-3: substitute into (1a) to obtain;
Step 3: find s.t.,; do
Step 4: select from;
Step 5: crossover and to generate a child C;
Step 6: mutate C: one random of the child is reset to a new random value ob- serving uniform distribution on;
Step 7: evaluate C as Step 3, get and;
Step 8: if any then (that means C is a duplicate of a member of the population);
Step 9: discard C and goto Step 6;
Step 10: find s.t. and replace; (steady-state replacement, i.e., the worst individual of population is replaced).
Step 11: if then
Step 12:; (update best solution found)
Step 14: return,.
The scheme of the RWCEA is similar to Raidl’s WCEA. And we take the same values of N and as the WCEA. The differences between the two algorithms lie in the following aspects:
1) The initial population in Raidl’s WCEA is generated randomly, while in the RWCEA, N linear programming problems should be solved;
2) Each in Raidl’s WCEA observes log-normal distribution, while in RWCEA it observes a uniform distribution on, where;
3) Raidl’s WCEA sorts items by pseudo-utility ratios in heuristic decoding step while the RWCEA sorts items by biased profits directly;
4) In the mutation step, one random of the child is reset to a new random value observing uniform distribution on instead of log-normal distribution in the RWCEA.
In summary, we revised Raidl’s WCEA by avoiding using surrogate multipliers and using “good” initial population. We think this RWCEA can yield better result than WCEA in some instances of MKP. The performance of RWCEA is shown in the next section.
4. Experimental Comparison
As in  , two test suites of MKP’s benchmark instances for experimental comparison are used in this paper. The first one, referred to as CB-suite in this paper, is introduced by Chu and Beasley (1998)  and is available in the OR-Library1. This test suite contains 270 instances for each 10 ones are combination of constraints, items, and tightness ratio. Each problem has been generated randomly such that for all. Chu and Beasley used their GA (i.e., DIH) to solve these instances and reported their results in the OR- library. The second MKP’s benchmark suite2 used in  was first referenced by  and originally provided by Glover and Kochenberger. These instances, called GK01 to GK11, range from 100 to 2500 items and from 15 to 100 constraints. We call this suite GK-suite in this paper.
Although some commercial integral linear programming (ILP) solvers, such as CPLEX, can solve ILP problems with thousands of integer variables or even more, it seems that the MKP remains rather difficult to handle when an optimal solution is wanted. To CB- suit, the results in  showed that major instances of this suit cannot be solved in a reasonable amount of CPU time and memory by CPLEX. To GK-suit, which includes still more difficult instances with n up to 2500, Fréville (2004) in  mentioned that CPLEX cannot tackle these instances. Therefore, it appears that the MKP continues to be a challenging problem for commercial ILP solvers.
The best known solutions to these benchmarks, as far as we known, were obtained by Vasquez and Hao (2001)  and was improved by Vasquez and Vimont (2005)  . Their method is based on tabu search and time-consuming compared with EA.
Raidl and Gottlieb (2005)  tested six different variants of EAs, which are called Permutation Representation (PE), Ordinal Representation (OR), Random-Key Represen- tation (RK), Weight-Biased Representation (WB), i.e. Raidl’s WCEA, and Direct Repre- sentation (DI and DIH). We compare the RWCEA with these EAs except DIH first. We use all GK-suite and draw out nine instances (called CB1 to CB9) from CB-suite, which are the first instances with for each combination of m and n.
For a solution x, the gap is defined as:
where is the optimum of the LP-relaxed problem to measure the quality of x.
We implement the RWCEA on a personal computer (Inter CoreTM Duo T5800, 2 GHz, 1.99 GB main memory, Windows XP) using DEV-C++. The initial population is generated by MATLAB. The population size is 100, and each run was terminated after 106 created solution candidates; rejected duplicates were not counted.
Table 1 shows the average gaps of the final solutions and their standard deviations obtained from independent 30 runs per problem instance obtained by the RWCEA and other six variants. The results of other six variants come from  . In the last column, bold fonts mean that the results of RWCEA is the best (or equally best) in the seven EAs. Italics in the last column mean that the results of RWCEA is better or equal than PE, OR, RK, DI, and WCEA but slightly worse than DIH. From this table we can draw the conclusion that the RWCEA is an improvement of WCEA. Especially in GK02 to GK11, the RWCEA performed much better than Raidl’s method.
Table 1 also shows that the RWCEA performed averagely slightly worse than DIH. But we will point out that can yield better results than DIH in some instances. Since the best results can be obtained by CPLEX in CB-suite when, , and, we tested the other 180 instances in CB-suite. Each instance was com- puted 30 times and the best results were compared with the results reported in OR- library. The data of the numbers that the RWCEA yielded better, equal or worse results than the results reported in OR-library is shown in Table 2. Tables 3-8 show the com- parison of each instance. These tables show that the results of more than 50% instances can be improved by the RWCEA.
We have proposed a RWCEA for solving multidimensional knapsack problems. This
Table 1. Average gaps of best solutions and their standard deviations of the RWCEA and other EAs.
Table 2. The data of the numbers that the RWCEA yielded better, equal and worse results than the results reported in OR-library.
Table 3. The results of CB-suite reported in OR-library (ORCB) and the ones obtained by the RWCEA (,).
Table 4. The results of CB-suite reported in OR-library (ORCB) and the ones obtained by the RWCEA (,).
Table 5. The results of CB-suite reported in OR-library (ORCB) and the ones obtained by the RWCEA (,).
Table 6. The results of CB-suite reported in OR-library (ORCB) and the ones obtained by the RWCEA (,).
Table 7. The results of CB-suite reported in OR-library (ORCB) and the ones obtained by the RWCEA (,).
Table 8. The results of CB-suite reported in OR-library (ORCB) and the ones obtained by the RWCEA (,).
RWCEA has been different from Raidl’s WCEA in the ways that surrogate multipliers are not used and a heuristic method is incorporated in initialization. Experimental com- parison has shown that the RWCEA can yield better results than Raidl’s WCEA in  and better results than the ones reported in the OR-library to some existing benchmarks. So we think this RWCEA is a good opinion in solving MKPs. A more detailed investigation of the working mechanism of the RWCEA and the application of RWCEA to other variants of knapsack problems (such as multiple choice multidimensional knapsack problems) will be the subjects of further work.