each of the capacity constraints. Let us consider the minimum of these values denoted by t = min(k∗1, ..., kM∗ ). Then, the following constraint is added without loss of generality to the model:
yl= 0 ∀l ∈ [t,...,h] (3.12)
Henceforth we will indicate model (3.4), (3.6)–(3.9), (3.11)–(3.12) as model M-CKPa.
In the following, we analyze structure and properties of model CKPa. We first devise a simple reduction procedure that shows up to effectively restrict the solution space and improve the performance of CPLEX 12.5. Then, we propose an exact solution approach that takes in input the output of the reduction procedure and related reduced ILP model and provides in output the optimal solution. The approach is outlined for CKP (the extension to M-CKP being generally straightforward) with few integrations for M-CKP when required.
3.3 A reduction procedure for CKP
We propose a reduction procedure that consists in finding a first solution and correspondingly reducing the relevant sums of items that may lead to an optimal solution. A further step seeks for variables to be univocally fixed to 0 or 1 without loss of optimality. Each step of the procedure is detailed in the following.
3.3.1 Computing a first solution
The goal of this step is to effectively compute a first solution for CKP strongly based on the optimal solution of the related continuous relaxation.
First, we consider and solve the continuous relaxation CKPaLP of model CKPa. Flooring the optimal sum of items of this problem provides a possible value S of the total number of items in the optimal solution of CKPa : S′=
⌊Pn
i=1
xLPi ⌋. We remark that S′ always constitutes a feasible sum of items for
CKPa, given the initial computation of the upper bound on the number of items obtained by means of Property 1. Then, we consider again model CKPa where, however, we add the constraint yS′ = 1, that is: Pn
i=1
xi= S′. This corresponds to solve the following model (denoted by CKPa(S′)).
CKPa(S′):
Model CKPa(S′) is a KP with the additional constraint that the number of items is given (for a discussion of knapsack problems with cardinality constraints see [12]). We first consider its continuous relaxation CKPa(S′)LP.
The following Lemma holds.
Lemma 1. The optimal solution of CKPa(S′)LP has either zero or two frac-tional variables.
Proof. It is well known from standard textbooks of linear programming (see, for instance, [68]) that for any continuous LP model with p constraints and bounded variables, there exists at least one optimal basic solution with p basic variables where only the basic variables can have a value that differs from the bounds. Hence, in this case, with 2 constraints at most 2 variables can have fractional value. Besides, the optimal solution of CKPa(S′)LP cannot have just one fractional variable or else Pn
i=1
xi would not be integer violating constraint (3.15) as S′ is integer.
If the optimal solution of CKPa(S′)LP has zero fractional variables, it constitutes an optimal integer solution of CKPa(S′) as well. Alternatively, there are two fractional variables xi, xj and a feasible solution for CKPa(S′) can be obtained by taking between i and j the item with the lowest weight
3.3 A reduction procedure for CKP 77
and discarding the other one (see Lemma 1 in [12]). Denote the value of this heuristic solution as LB′.
For M-CKP, the following Corollary holds.
Corollary 1. The optimal solution of M-CKPa(S′)LP has either zero or from 2 to M+ 1 fractional variables.
Proof. By applying the same reasoning of Lemma 1, the result holds.
In this latter case, a feasible integer solution can be found by trying to insert in the solution either one or more of the fractional items. This is done by solving model M-CKPa(S′) modified by adding constraints
xi= xLPi (S′) ∀i: xLPi (S′) is integer (3.17)
and by replacing equation (3.15) with inequality
n X i=1
xi≤ S′ (3.18)
where xLPi (S′) denote the optimal values of variables xi in M-CKPa(S′)LP. Due to Corollary 1, the additional constraints induce a resulting model with at most M + 1 variables that is therefore immediate to solve in practice when M is limited by means of a MIP solver like CPLEX 12.5. Notice also that, even if none of the fractional variables can be selected, we still get a feasible solution for M-CKPa by simply keeping the rest of the solution, as the value of the sum of the items in this case is less than S′.
3.3.2 Limiting the relevant range of sums of items
After the computation of the first solution LB′, the possible sums of the items in an optimal solution can be straightforwardly limited by solving other two
continuous problems. More precisely, we minimize and maximize the sum of items Pxi subject to constraints (3.5)–(3.7), (3.10) and to an additional constraint ensuring that the total profit must be strictly greater than the current solution value. Notice also that the sum S′ of the items in the first solution provides an upper bound and a lower bound for the minimization and maximization problem respectively. Thus further constraints on the yi variables can be added. The corresponding models to solve (denoted by CKPmin and CKPmax respectively) are as follows.
CKPmin:
Ceiling and flooring the optimal solution values of CKPmin and CKPmax
yield the extremes of the range of the number of items possibly leading to
3.3 A reduction procedure for CKP 79
an optimal solution of CKP. Let us denote these extremes by Smin and Smax. At the end of this step, the following constraints are added without loss of optimality:
yj= 0 ∀j ∈ [1,...,Smin−1] (3.29) yj= 0 ∀j ∈ [Smax+ 1,...,h] (3.30)
3.3.3 Variables fixing
We get back then to model CKPaLP. Let indicate the optimal value of CKPaLP by zLP and the optimal values of variables xi and yi by xLPi and yLPi , respec-tively. Let rxi and ryi be the reduced costs of non basic variables in the optimal solution of CKPaLP. We apply then the standard variable-fixing techniques from Integer Linear Programming as shown for KPS in Section 2.3.2. Thus, the following constraints are added to the models.
∀ i: |rxi| ≥ zLP− LB′, xi= xLPi (3.31)
∀ j : |ryj| ≥ zLP− LB′, yj= yjLP (3.32)
This step is fast, since it relies on solving continuous problems with a limited number of constraints. At the same time, it shows up to be very effective in reducing the problem size and in our case (in general, fixing variables may sometimes generate instances that are more difficult to solve than the original ones) also in strongly improving the performance as indicated in the computational results section. The pseudo code of the reduction procedure is outlined in Algorithm 3.
Algorithm 3 Reduction procedure
1: Input: CKP instance.
2: ◃ Finding an initial feasible solution
3: xLP ← solve model CKPaLP; 4: S′← ⌊Pn
i=1
xLPi ⌋;
5: LB′← solve model CKPa(S′)LP and apply Lemma 1;
6: ◃ Identifying the relevant sums of items
7: zmin← solve model CKPmin; 8: zmax← solve model CKPmax; 9: Smin= ⌈zmin⌉;
10: Smax= ⌊zmax⌋;
11: Set in model CKPa: yj = 0 ∀j ∈ [1, ..., Smin− 1] and 12: yj= 0 ∀j ∈ [Smax+ 1, ..., h];
13: ◃ Variables fixing
14: Apply (3.31,3.32) and fix variables in model CKPa; 15: return LB′;