User:Jesgadiaz/sandbox

= Vertex k-center problem = The vertex k-center problem is a classical NP-Hard problem in computer science. It has application in Facility Location and Clustering. Basically, the vertex k-center problem models the following real problem: given a city with $$n$$ facilities, find the best $$k$$ facilities where to build fire stations. Since firemen must attend any emergency as quickly as possible, the distance from the farthests facility to its nearest fire station has to be as small as possible. In other words, the position of the fire stations must be such that every possible fire is attended as quickly as possible.

Formal definition
The vertex k-center problem is a classical NP-Hard problem in computer science. It was first proposed by Hakimi in 1964. Formally, the vertex k-center problem consists in: given a complete undirected graph $$G=(V,E)$$ in a metric space, and a positive integer $$k$$, find a subset $$C \subseteq V$$such that $$|C| \le k$$and the objective function $$r(C) = \max_{v \in V}\{d(v,C)\}$$ is minimized. The distance $$d(v,C)$$ is defined as the distance from the vertex $$v$$to its nearest center in $$C$$.

Approximation algorithms
If $$P \neq NP$$, the vertex k-center problem can not be (optimally) solved in polynomial time. However, there are some polynomial time algorithms that get near optimal solutions. Specifically, 2-approximated solutions. Actually, if $$P \neq NP$$ the best possible solution that can be achieved by a polynomial time algorithm is a 2-approximated one. In the context of a minimization problem, such as the vertex k-center problem, a 2-appoximated solution is any solution $$C'$$ such that $$r(C') \le 2 \times r(OPT)$$, where $$OPT$$ is an optimal solution. An algorithm that guarantees to generate 2-approximated solutions is known as a 2-pproximation algorithm. The main 2-approximated algorithms for the vertex k-center problem reported in the literature are the Sh algorithm ,the HS algorithm, and the Gon algorithm. Even though these algorithms are the (polynomial) best possible ones, their performance on most benchmark datasets is very deficient. Because of this, many heuristics and metaheuristics have been developed through the time. Contrary to common sense, one of the most practical (polynomial) heuristics for the vertex k-center problem is based on the CDS algorithm, which is a 3-approximation algorithm.

The Sh algorithm
Formally characterized by David Shmoys in 1995, the Sh algorithm takes as input a complete undirected graph $$G=(V,E)$$, a positive integer $$k$$, and an assumption $$r$$ on what the optimal solution size is. The Sh algorithm works as follows: selects the first center $$c_1$$ at random. So far, the solution consists of only one vertex, $$C=\{c_1\}$$. Next, selects center $$c_2$$ at random from the set containing all the vertices whose distance from $$C$$ is greater than $$2 \times r$$. Now, $$C=\{c_1,c_2\}$$. Finally, selects the remaining $$k-2$$ centers the same way $$c_2$$ was selected. The complexity of the Sh algorithm is $$O(kn)$$, where $$n$$ is the number of vertices.

The HS algorithm
Proposed by Dorit Hochbaum and David Shmoys in 1985, the HS algorithm takes the Sh algorithm as basis. By noticing that the value of $$r(OPT)$$must equals the cost of some edge in $$E$$, and since there are $$O(n^2)$$ edges in $$E$$, the HS algorithm basically repeats the Sh algorithm with every edge cost. The complexity of the HS algorithm is $$O(n^4)$$. However, by running a binary search over the ordered set of edge costs, its complexity is reduced to $$O(n^2 \log n)$$.

The Gon algorithm
Proposed independently by Teofilo Gonzalez, and by Martin Dyer and Alan Frieze in 1985 , the Gon algorithm is basically a more powerfull version of the Sh algorithm. While the Sh algorithm requires a guess $$r$$ on $$r(OPT)$$, the Gon algorithm can prescind from such guess by noticing that if any set of vertices at distance greater than $$2 \times r$$ exists, then the farthest vertex must be inside such set. Therefore, instead of computing at each iteration the set of vertices at distance greater than $$2 \times r$$ and then selecting a random vertex, the Gon algorithm simply selects the farthest vertex from every partial solution $$C'$$. The complexity of the Gon algorithm is $$O(kn)$$, where $$n$$is the number of vertices.

The CDS algorithm
Proposed by García Díaz et al. in 2017, the CDS algorithm is a 3-approximation algorithm that takes ideas from the Gon algorithm (farthest point heuristic), the HS algorithm (parametric pruning), and the relationship between the vertex k-center problem and the Dominating Set problem. The CDS algorithm has a complexity of $$O(n^4)$$. However, by performing a binary search over the ordered set of edge costs, a more efficiente heuristic named CDSh is proposed. The CDSh algorithm complexity is $$O(n^2 \log n)$$. Despite the suboptimal performance of the CDS algorithm, and the heuristic performance of CDSh, both present a much better performance than the Sh, HS, and Gon algorithms.

Experimental performance
Some of the most widely used benchmark datasets for the vertex k-center problem are the pmed instances from OR-Lib, and some instances from TSP-Lib. Table 1 and Table 2 show the mean and standard deviation of the experimental approximation factors of the solutions generated by each algorithm over the 40 pmed instances from OR-Lib, and over the TSP-Lib instances, respectively.