• No results found

Core based algorithms

1.5 Core based algorithms

The most successful algorithms for KP are based on the core concept introduced in Section1.2.7. As said, the definition of the core is based on the knowledge of the optimal solution. The core is only guessed by algorithms usually through the choice of 2δ delta items around the split item. The initial step of the algorithms is the search of an approximated core.

The first methods for finding a core were presented in [6] and [60]. In [75], a modification of the classical quicksort algorithm ([38]) effectively determines a core C = {s − δ,...,s + δ} around the split item s of size 2δ + 1. The algorithm, denoted as Find–Core, recursively partitions intervals of items considering their efficiency levels. The algorithm resembles the quicksort algorithm except for the fact that only the intervals including the split item are partitioned further. This characteristic reduces the complexity of the algorithm to O(n).

The discarded intervals constitute a partial ordering of the items by efficiency and this information may be also used in algorithmic frameworks. Items in any interval are not sorted but there is an ordering among the intervals. The final outcome of the Find–Core procedure is the core C and intervals of items saved in two stacks H and L. Items in an interval H have a higher efficiency than the one of the items in the core while items in L have a lower efficiency.

The ordering of the intervals by non–increasing efficiency of the items may be represented as follows:

H

z }| {

H1, H2, . . . , HH, C,

L

z }| {

Ll, . . . , L2, L1 (1.33) Some of the main algorithms based on the core concept are discussed in the following.

1.5.1 MT2 algorithm

The MT2 algorithm is introduced in [60]. The algorithm is based on computing and exploiting a fixed core. Its main steps can be summarized as follows:

1. An approximated core C = {s − δ,...,s + δ} is first computed. The core size | C | is equal to n for n < 100, otherwise we set | C |=

n.

2. Items in the core are ordered by efficiency and the core problem is solved by MT1 algorithm. Let denote by zC the corresponding optimal solution value.

3. The enumerative upper bound UC is calculated (as UM in Section 1.2.5).

If UCs−δ−1P

j=1

pj+ zC the core solution is optimal and the algorithm terminates.

4. The reduction scheme in [60] fixes the variables outside the core. If not all variables can be fixed, the remaining variables are sorted by efficiency and the induced sub–problem is solved by MT1 algorithm.

Other algorithms with a fixed core are presented in [6] and [29]. A description of all these algorithms and some computational tests are provided in [61]. A special variant of MT2 algorithm, called MTh, is proposed in [62]. For this algorithm, the use of cardinality constraints and other techniques may allow a drastic improvement the computational performance of MT2.

1.5.2 Minknap algorithm

Since the core is hard to estimate, algorithms based on a variable expanding core have been proposed in [75] and in [76]. We provide here a more detailed description of the Minknap algorithm in [76] which constitutes also the backbone of the current state-of-the-art Combo algorithm. The main idea is to compute a core with only the split item through the Find–Core procedure and to iteratively add items considering the intervals in stacks H and L. The solution space of the expanding core is explored by a dynamic programming with states. An effective procedure for analyzing dominance among states combined with the use of suitable upper bounds makes the algorithm very effective. Moreover, reduction and sorting operations are performed only when they are needed.

We sketch the main features of the algorithm in the following:

1.5 Core based algorithms 27

1. First, the Find–Core algorithm finds the core C = {s} as well as the stacks of intervals H and L.

2. At each iteration, two items h and l are considered for expanding the core to the left and to the right respectively. These items belong to the current set of items sorted by efficiency outside the core: h is the item in H with the smallest efficiency while l is the item in L with the largest efficiency. The corresponding variables are equal to the value in the split solution, namely xh= 1 and xl = 0. A dynamic programming with states alternatively evaluates the insertion of item l in the knapsack or the removal of item h. Each state is denoted as a triple representing the profit, the weight and a partial representation of the corresponding solution set of packed items. The third element is used to efficiently recover the optimal solution set. Basically, the dynamic program implements the recursions (1.31) and (1.32) and adds items h and l to the core. If there is no such item h or l in the set of sorted variables, the next interval respectively from H or L is selected. The reduction scheme in [27] is applied to fix variables in the interval. If there are variables not fixed, these are ordered and added to the set of sorted items.

3. Before the inclusion in the recursions of item h or l, an enumerative upper bound is computed considering all undominated states. A reduction test is then performed in order to avoid the inclusion of the items in the core.

Computing this upper bound is time–consuming since we have to go through all states of the dynamic program. At the same time, it may limit the size of the core considerably thus yielding savings in the overall running time.

4. States within dynamic programming can be eliminated by the dominance criterion or by an upper bound test. Upper bounds on states are computed in constant time by considering the most effective items on the right or on left of the core according to whether the weight of the state is less or greater than the capacity value.

5. The algorithm terminates when all states have been eliminated or all items outside the core have been fixed. The optimal solution vector is

reconstructed by an efficient procedure based on consecutively solving a limited number of knapsack problems.

The Minknap algorithm is proven to yield the smallest symmetrical core around the split item with respect to a fixed–core algorithm ([76]).

Finally, we cite the Expknap algorithm provided in [75]. The algorithm is very similar to Minknap and relies on the use of the primal–dual branch algorithm instead of dynamic programming. Minknap can be seen as a breadth–first search variant of Expknap and this feature is crucial for properly handling the structure of the expanding core.

1.5.3 Combo algorithm

The current state-of-the-art algorithm for KP is presented in [57]. The algorithm is called Combo since it combines different techniques and methods previously developed and it is very effective in solving large KP instances. We just mention the features of the algorithm since essentially it is based on the structure of Minknap. The dynamic programming introduced in Minknap starts with an initial core with up to eight items. This core is built with some heuristic rules.

The core is then expanded and additional techniques are further introduced if the problem seems to become difficult to solve. These techniques rely on the greatest common divisor of the weights of the items, on the introduction of minimum and maximum cardinality constraints and on pairing the dynamic programming states with items not included in the core.

The criterion used as measure of the problem hardness is the number of states in the dynamic program. The comparison with three threshold values establishes which technique should be employed during the iterations of the algorithm.

In [57], an extensive performance analysis of the most effective exact algo-rithms for KP is presented. More precisely, algoalgo-rithms Minknap, MTh and Combowere tested over several classes of instances with up to 10000 items. The results showed a comparable performance of Minknap and MTh which solved many instances in limited computational time (less than one second). However, there are instances where the algorithms ran into difficulties (e.g. in strongly correlated instances for Minknap and in even-odd instances for MTh). Combo