• No results found

2.2 Sequential approach

2.2.2 Clustering

The cabinet clustering problem is defined as follows: how to divide the cabinets in a number of clusters, where all cabinets in one cluster are connected in one circuit? When the telecom operator wants to connect the cabinets in a ring structure, he has to decide how to divide cabinets over a number of rings, taking into account a maximum number of customers per ring. In this section a model is developed and formulated and the results

of extensive testing is shown. The method seems to be accurate and fast. Finally, the method is demonstrated on a real life case.

2.2.2.1 Problem definition

The starting point here is a collection of cabinets that have to be activated. These cabinets should be partitioned in groups, where all cabinets in one group have to be connected in one fibre ring. Mathematically this can be formulated as follows. Given is a set D = {xi}mi=1of m points in R2, the location of the cabinets. These cabinets in have to be partitioned into k (k ≤ m) groups each of which forms a ring. The cluster centres are centres of gravity, C1, C2, . . . , Ck. We define for i = 1, . . . , m and h = 1, . . . , k:

The problem that has to be solved is:

min

This means that we look for the T that minimizes the sum of the quadratic distances, expressed in the sum of the squared 2-norm distance:

kxk2 := x21+ x22+ · · · + x2n12

. (2.9)

In practice in this problem each ring has a maximum number of households that can be connected. This is modeled by assuming each cabinet has a weight (a natural number) ui and there is a limit τ to the total weight on one ring. This gives the constraint:

m

X

i=1

Ti,hui ≤ τ (h = 1, . . . , k). (2.10)

Each point is assigned to only one ring:

k

X

h=1

Ti,h = 1 (i = 1, . . . , m), (2.11)

Ti,h ∈ {0, 1} (i = 1, . . . , m h = 1, . . . , k). (2.12) This problem is a clustering problem, more specifically ‘Centroid-based’ clustering. In centroid-based clustering, a centre point for every cluster is created, and points (cabinets in this case) are appointed to the closest centre point, in which the quadratic distance

is minimized. If a number of k clusters is searched for, the method is called ‘K-means’

clustering. In the problem described above there is a maximum number of cabinets that can be placed in one circuit. This gives a constrained K-means clustering problem. In the literature much has been published about the unconstrained version of the problem,

‘Centroid-based’ or ‘K-means’ clustering, mostly in the applications of data-clustering.

The name goes back to 1967, where MacQueen presents the problem in his article [101].

An nice overview of 50 years of ‘K-means’ clustering was presented by Jain [70]. That this optimization problem is NP-hard was proven by Aloise et al. [5]. Usually these problems are therefore solved via an approximation algorithm. In special cases the problem can be solved in polynomial time, see for example Inaba et al. [67]. For other cases a known method is Lloyd’s algorithm [97]. However, this method is not guaranteed to find a global optimum, but usually finds a local optimum. Bradley et al. [16] create an extension to this algorithm to handle constrained K-Means Clustering. The constraint here is a minimum number of items in a cluster. In the cabinet clustering problem there is a maximum number of items in a cluster. We call this the max-constrained K-Means Clustering Problem.

Theorem 2.2.2. The max-constrained K-Means Clustering problem is NP-hard.

Proof. Setting τ = m, the total number of points to be clustered, results in the standard K-Means Clustering Problem as defined and proven NP-hard in Aloise et al. [5].

2.2.2.2 Solution

In this section first the approaches by Lloyd [97] and Bradley et al. [16] are presented for later reference.

Algorithm 2 Lloyd’s based on [97].

Require: A random distribution of the cabinets T0. This results in an initial value of C0. Ensure: A set cluster points Ct,1, . . . , Ct,k that minimizes the distance of squared distances.

1: for i = 1, . . . , m do

The algorithm of Lloyd is an iterative algorithm where Tt represents the assignment of the cabinets to the clusters in iteration t ∈ N, resulting in cluster points Ct,1, . . . , Ct,k

in iteration t. The steps in the algorithm are presented in Algorithm 2. An often named disadvantage of this algorithm is that k needs to specified in advance. However, this is not a disadvantage in our clustering problem, here k is known beforehand. Also, it has been shown that the worst case running time of the algorithm is super-polynomial in the input size and the approximation found can be arbitrarily bad with respect to the objective function compared to the optimal clustering. Finding a good starting solution can be helpful here, as shown in [8]. This will be the case mainly in big data clustering problems, not in the limited problems that is discussed here. Another often mentioned disadvantage is that the algorithm tries to create clusters of approximately similar values. Here, this is not a problem either; on the contrary, it is a requirement.

The cabinet cluster problem has an upper limit to the number of cabinets, or total weight of these cabinets, in a ring, as described in the constraint in Equation (2.10).

Bradley gives an extension to this algorithm to handle constrained K-Means Clus-tering. The constraint is a minimum number of items in a cluster, instead of a maximum as in the problem in this thesis, due to Equation (2.10). The algorithm of Bradley is presented in Algorithm 3.

Algorithm 3 Bradley’s based on [16].

Require: A random distribution of the cabinets T0. This results in an initial value of C0. Ensure: A set cluster points Ct,1, . . . , Ct,k that minimizes the distance of squared distances.

1: Let Ti,ht be a solution to the following linear program with Ch,t fixed:

min

Replacing equation (*) in line 1 of the Algorithm by Equation (2.10) gives a solution method for our problem. However, as is shown later, the proposed heuristic performs better.

The algorithm proposed starts with Lloyd’s algorithm. The found solution is adjusted

such that no more than weight τ is placed in one ring, due to Equation (2.10), while Lloyd’s algorithm does not have this check or constraint. The final step is trying to improve the solution using a 2-opt improvement, like originally presented in solving the Travelling Salesman Problem (TSP), see [32]. This is depicted in Figure 2.10 and in more detail in Algorithm 4. Some explanation, referring to the lines in the of the Algorithm, follows:

Figure 2.10: Flow diagram of the proposed heuristic.

1. Initial allocation according to Lloyd’s algorithm, with k = dPni=1ui/τ e. 5

2. (Line 1-11) If a ring h is present with higher allocated weight than allowed, then choose the cabinet which can be moved to another with the least expenses. If no

5Note that the ratio between the values of ui and k can lead to insolvable problems, as a simple example shows. Let us say that we have 5 cabinets with weight 4. We want to create rings with maximum weight 10. The definition of k says that 2 rings are needed (4×510 ). Only we cannot divide the 5 cabinets over 2 rings, not violating the constraint. However, if the maximum value of u is small related to k and there is a big variation in number and place of the size of the cabinets (as in our practice) this problem never occurs.

Algorithm 4 Clustering

Require: Initial allocation according to Lloyd’s algorithm, with k = dPn

i=1ui/τ e.

Ensure: A set cluster points Ct,1, . . . , Ct,k that minimizes the distance of squared distances.

1: for h = 1, . . . , k do

22: If no swap occurred stop, else go to step 11;

solution can be found to remove the constraint using a single swap, a double swap must be found.

3. (Line 12-21) Try to improve the solution by pair swapping until no improvement can be found any more. Determine for every combination of cabinets within two separate rings the current score (total sum of quadratic distances) and the score af-ter exchanging these two combinations. If the exchange results in an improvement, apply this exchange to the solution.

4. (Line 22) If no swap occurred stop, else go to step 3a.

2.2.2.3 Evaluation

In this section the performance of the proposed heuristic is discussed. First the effect of the swapping operation (step 3 in the heuristic) is shown. Next the performance against the method of Bradley is presented and finally the application of the method to the case Amstelveen is presented.

2.2.2.3.1 Swapping operation

The swapping operation, step 3 in the proposed heuristic, results in a clear improvement of the solution and a quicker convergence to the best solution. To illustrate this, 1000

Figure 2.11: Iterations until best solution.

Figure 2.12: Performance improvement of swapping.

cases were generated each having 40 cabinets which need to be allocated to four circuits.

The maximum number of cabinets per circuit is 10. The (x, y)-coordinates are arbitrarily drawn from the range (0,100) per cabinet. These cases were solved 1000 times, each time with an arbitrarily generated starting solution (like Lloyd’s algorithm prescribes). For each case, the iteration for which the best solution is found and solution were saved.

The algorithm was executed twice, with and without step 3 (the swap).

Figure 2.11 shows the number of iteration at which the best solution was found.

The heuristic with swap finds the solution far quicker; in 452 of the 1000 cases the best solution is already found within the first iteration. The remaining 999 iterations offer no improvement. Without swap this is the case only 228 times.

The final solution found with swap is better than the heuristic without swap in 312 cases. In about 200 cases this improvement is 1%, in 60 cases 2% and in two cases even 10% and 11%, see Figure 2.12.

The question arises whether the swap method also results in an improvement of the classic clustering problem without the constraint. In the tested 1000 cases this shows to be only a minor improvement. In only a few cases the number of iterations is smaller and only in 38 cases an improvement of 1-2% is realized.

Figure 2.13: Deviation from optimal solution.

2.2.2.3.2 Numerical results

To evaluate the performance of the heuristic it was tested against the LP-based method proposed by Bradley [16]. To illustrate this, again 1000 cases were generated, in which there are 40 cabinets which need to be allocated to 4 circuits. The maximum number of cabinets per circuit is 10. The (x, y)-coordinates are arbitrarily drawn from the range (0,100) per cabinet. Per case we generated 20 starting solutions at random and looked at the solution found by each method for this starting solution. So we got 20,000 results per method. Per case the best solution found by both methods6 and the relative deviation of the other solutions were saved. These results are depicted in Figure 2.13. We see that in 37% of all problems the heuristic found, starting with a arbitrary solution, the best solution against 11% in case of the LP-based method. The method of Bradley was implemented using AIMMS that solved the linear program using the solver CPLEX 12.4.

The test version of the heuristic was implemented in Delphi.

Per case, having 20 starting solutions, the heuristic found in 81% the optimal solution against 33% in case of the LP-based method, as shown in Figure 2.14.

2.2.2.3.3 Real life case

Recall that that the calculation time is important in the real life use of the method presented. The implementation that was made in Matlab uses relatively much time for updating the cluster centres, especially due to the third step of the heuristic. Neverthe-less, the calculation times are low. Take for example Amsterdam, where 235 activated cabinets of a total of 528 cabinets have to be clustered, which is one of the biggest central office of the Netherlands, it still can be calculated within 12 seconds. The results of all the cases are presented in Table 2.5.

Here the results of the Amstelveen case are presented. In Amstelveen there are 180 cabinets, belonging to 1 CO, serving 38,868 subscribers. The first step, activation, leaves 87 activated cabinets that have to be distributed over, in this case, 11 rings. A result of

6Note that this is not necessarily the global optimum, but only the best solution found by both methods.

Figure 2.14: Performance of the heuristic.

City Cabinets Activated Time

Venray 54 30 0.1s

Delft 130 60 0.8s

Amstelveen 180 87 0.9s

Amsterdam 528 212 11.4s

Den Haag 866 421 24.3s

Table 2.5: The results of the clustering for the cases.

the clustering of the Amstelveen case is shown in Figure 2.15, also showing the cascades resulting from solving the activation problem.