• No results found

PHASE ONE: using the QIP solver to compute initial solutions

5.3 A Three-Phase Hybrid Heuristic

5.3.1 PHASE ONE: using the QIP solver to compute initial solutions

PHASE ONE makes use of a decision tree with k branches (where k is a parameter to be defined experimentally) to seek promising intervals. Starting from the initial interval [2, n], it is split into k intervals of equal width, where an evaluation value is computed for each interval. Then, the interval with the best evaluation is expanded at each step, resulting in a best first expansion of the decision tree. The evaluation of an interval [m1, m2] is performed by considering the quality of the solution provided

by the QIP solver after a fixed amount of time, using QIP Formulation1 with m =

m1 and m = m2. Thus, we evaluate a set of contiguous values of m by computing

two solutions at its extreme points and summing their objectives. Call h(m) the result provided by the solver after Ts seconds. The evaluation λ(m1, m2) ∈ R, with

m1, m2 ∈ N such that 2 ≤ m1 ≤ m2 ≤ n, of an interval [m1, m2] can be computed

as:

λ(m1, m2) = h(m1) + h(m2) (5.44)

A set S1 of feasible solutions for the Max−MeanDP is computed in PHASE ONE,

during the evaluations of intervals thanks to the computation of function h. In other words, the output of PHASE ONE is not limited to the definition of C, but for each value m0 ∈ C a solution S

1 with m = m0 is computed, included in S1 and provided

as output.

Figure5.1 shows how the decision tree is expanded during PHASE ONE, under the assumption that gray nodes are associated to the intervals with the highest evaluation λ at each step. Only the initial three steps of the expansion are depicted. Table 5.1 enumerates solutions computed in these steps in order to expand nodes. These solutions are indicated with the notationxbm0 where m

0 is the value of m for

the solution. In the example, PHASE ONE yields the following sets C and S1 after

the initial three steps.

C = {2,100,120,140,144,148,152,156,160,180,200,300,400,499} (5.45) S = {xb2,xb100,xb120,xb140,xb144,xb148,xb152,xb156,xb160,xb180,xb200,xb300,xb400,xb500} (5.46) In general, PHASE ONE ends as soon as a specific time limit T1 is achieved. We

Figure 5.1: An example showing three steps of PHASE ONE

refer to the number of solutions computed in the end of PHASE ONE as γ.

Algorithm 12 PHASE ONE

Input: M ax − M eanDP instance

Compute xb2 and xbn by solving to optimality Max − SumDP for m = 2 and

m= n

C ← {2, n} S1 ← {xb2,xbn} Set I ← {[2, n]}

while time limit T1 is not reached do

Extract best valued interval from I

Split the selected interval [m0, mk] in k intervals [m0, m1] · · · [mk−1, mk]

By running the QIP solver for Ts seconds:

Compute k − 1 solutionsxbm1· · ·xbmk−1 with m = m1· · · mk−1

I ← I ∪ {[m0, m1] · · · [mk−1, mk]} C ← C ∪ {m1· · · mk−1}

S1 ← S1∪ {xbm1· · ·xbmk−1} end while

First step Second step Third step b x2 xb120 xb144 b x100 xb140 xb148 b x200 xb160 xb152 b x300 xb180 xb156 b x400 b x500

Table 5.1: Solutions computed in PHASE ONE

5.3.2

PHASE TWO: local branching

PHASE TWO applies a local branching scheme [43] to each solution in S1 and

provides in output a set S2 of new solutions. A general description of the method

is provided in Section 1.1.1. For each solution xbm0, a local search is performed, considering as a neighborhood of xbm0 the set Ψ(xbm0) of solutions whose Hamming distance fromxbm0 is less than or equal to a parameter δ, while the overall number of selected items is kept constant. This local search is carried out by running the QIP solver on an extension of QIP formulation 1 for TLS seconds. Recall that in QIP

formulation1the value of m is fixed a priori, here m = m0. The following constraint

is added to the formulation, in order to take into account the Hamming distance constraint: 2H(x,xb) = n X i=1 (xi(1 −xbi) +xbi(1 − xi)) ≤ 2δ (5.47) where H(x,xb) is the Hamming distance between x and xb.

At this point, the QIP solver can provide two different results: • an improving solution xb

m0 ∈ Ψ(xbm0) is found and can be used as a starting point for the subsequent local search;

• no improving solution is found in Ψ(xbm0).

In the first case, PHASE TWO continues by discarding Constraint5.47and forcing the exploration of the remaining solution space. To this end, the following constraint

is kept:

n

X

i=1

(xi(1 −xbi) +xbi(1 − xi)) ≥ 2δ (5.48) Accordingly, a new constraint that indicates the maximum Hamming distance from b

xm0 is added, the solver is run on the resulting model and the process is iterated. In the second case, Constraint 5.47 is replaced by:

2δ <Xn

i=1

(xi(1 −xbi) +xbi(1 − xi)) ≤ 4δ (5.49) and the solver is run again on the resulting model. If an improved solution is found, PHASE TWO proceeds as in the first case. Otherwise, it moves to the next initial solution in S1. Each solution provided by the local branching step is included in the

set S2. PHASE TWO stops when a time limit T2 is reached, or when the whole set

S1 is scanned.

Algorithm13 depicts the pseudocode of PHASE TWO.

Algorithm 13 PHASE TWO

Input: M ax − M eanDP instance, S1

S2 ← ∅

while S1 = ∅ and time limit T/ 2 is not reached do

Extract best solution xb in S1 Compute xb

0 with a Local Branching procedure starting from

b x S2 ← S2∪ {xb 0} end while Output: S2

5.3.3

PHASE THREE: path relinking

Path relinking [52] is a technique that has been proved to be computationally effec- tive for many combinatorial optimization problems. It takes as input an initial set of feasible solutions, called the elite set E. We build such a set by scanning S2 in non-

whose Hamming distance fromxb is less than or equal to 1. This step is iterated until all solutions in S2 are considered. Recall that solutions provided by PHASE TWO

have different values of m, thus E is constructed by considering solutions which are sufficiently different from one to another. Correspondingly, we generate a vector CE containing all couples of solutions (xb,yb) (with x,b y ∈ Eb and x /b = yb) sorted in nonincreasing order of f(xb) + f(yb). Then, we scan the sorted vector CE considering one at a time (until all couples are considered or a time limit T3 is met) each couple

(xb,yb) and we determine a sequence of moves that leads from xb toyb and viceversa. In this context, a move is determined by an item deletion or insertion such that a decrease in the Hamming distance between the solutions occurs. At each step, the move leading to the best solution (ties broken at random) is picked and the process is iterated until the destination is reached. The final solution returned by PHASE THREE is the best of those in E and those computed along the paths.

Algorithm14 depicts the pseudocode of PHASE THREE.

Algorithm 14 PHASE THREE

Input: M ax − M eanDP instance, S2

while S2 = ∅ and T/ 3 is not reached do

Extract best solution xb in S2 if @be ∈ E : H(be,xb) ≤ 1 then

E ← E ∪xb end if

end while

Create set CE and sort it in increasing order of f(xb) + f(yb) for all sorted couples (xb,yb) ∈ CE do

Perform path relinking from xb toyb end for

Output: Best solution found

5.4

Computational Experiments

The aim of this section is to show the practical efficiency of the branch and bound algorithm and of the matheuristic described so far. The instances used for the tests have different sizes, we distinguish small instances (n = 20,25,30,35), medium

size instances (n = 50,75,100) and large size instances (n = 150,500). Small in- stances and large instances are the ones introduced in [76], while the medium size instances are randomly generated following the same lines. The instances belong to two classes:

Type I distances di,js are uniformly distributed in [−10,10];

Type II distances di,js are uniformly distributed in [−10, −5] ∪ [5,10].

Since 10 instances are considered for every different type and size, the whole dataset that we adopted is formed by 180 different instances. All the proposed approaches were tested on an Intel Core i5-3550 3.30GHz with 4GB of RAM, and they were implemented in C++. Cplex 12.5 was used as a QIP solver. In the following, the tests performed for the exact method will regard only small and medium instances. Contrarily, the heuristic is only tested on large instances, for which the exact method is not practical.

Related documents