9

We have $n$ customers, $(x_1, \dots, x_n)$, sorted on the read line. For convenience, we also use $x_i$ to denote its coordinate on the line. We need to locate $m$ facilities on the real line. We note that these facilities can be located anywhere on the real line. Each facility $j\in [m]$ is associated with an entrance fee $f_j$, such as the ticket money for a swimming pool. Given a location profile $(y_1, \dots, y_m)\in \mathcal{R}^m$ for the facilities($(y_1, \dots, y_m)$ is not necessarily ordered), the cost for customer $i$ at facility $j$ is $c_{ij} = |x_i- y_j|+f_j$, which can be understood as the aggregate money of the travelling cost and the entrance fee when you taxi to a swimming pool and purchase a ticket to swim inside. And the customer will always choose the facility so as to minimize her cost.

Our goal is to find a location profile $(y_1, \dots, y_m)$ for the given $m$ facilities such that the total minimum cost

$$\sum_{i\in [n]}\min_{j\in [m]}c_{ij}$$ is minimized.

An easy but critical obserbation is that there is an optimal solution where each facility is located in the median agent of the continuous region of agents it serves. If we have identical entrance fees, we only need to find the optimal $m$ continuous partitions, which can be solved by dynamic programming in $O(mn^2)$. For the general case, similar DP algortihm runs in $O(2^mn^2)$. The algorithm, however, is exponential in $m$ and only makes sense after we've proved the problem is NP-hard. Another observation which may be helpful is that for if we have known the optimal $m$ continuous partitions, we just assign the facility of the $k$-th smallest entrance fee to the partition of the $k$-th most customers.

So is this problem NP-hard? Or is there an algorithm running in polynomial time?

asdfqwer
  • 71
  • 7

2 Answers2

0

$\require{cancel}$

The answer shows a reduction to the rainbow path problem and thus doesn't prove anything about the complexity of the given problem. See this paper which contains hardness results for related problems (theorem 2.3 states that rainbow s-t path is hard).

The problem is $\cancel{\text{still polynomial}}$, as it can still be reduced to some version of shortest path. Observe that there always exists an optimal solution where the facilities are a subset of $\{x_1,...,x_n\}$ (given an optimal solution and a facility $y_j$ in it, let $A_j$ denote the set of clients attending $y_j$, then replacing $y_j$ with the median of $A_j$ does not increase the value of the solution). Now construct a directed graph whose vertices are $V=\{s,t, v_{il}| i\in[n], l\in[m] \}$ and whose edges are given by:

$$E=\{(v_{il},v_{jk})| i<j\in[n], \text{and } l,k\in[m]\}\cup\{(s,v_{il})|i\in[n],l\in[m]\}\\\cup\{(v_{n,l},t) |l\in[m]\}$$

Interpret the edge $(v_{il},v_{jk})$ as choosing a solution where the clients $x_{i+1},...,x_j$ are members of the facility $y_k$. With this in mind, we set the weights of the edges to be:

$$ w(v_{il},v_{jk})=\sum\limits_{q=i+1}^j |x_q-m_{ij}|+(j-i)f_k\\ w(s,v_{il})=\sum\limits_{q=1}^i|x_q-m_{0,i}|+if_l\\ w(v_{n,l},t)=0, \text{ for all $l\in[m]$} $$

Where $m_{ij}$ is the median of $x_{i+1},...,x_j$. An optimal solution for your problem is the weight of the lightest path from $s$ to $t$ of length $\le m$ which uses at most one edge from the set $E_i=\left\{(v,v_{l,i})|v\in V, l\in [n]\right\}$ for every $i\in[m]$ (this implies that we do not use the same facility twice). This version of shortest (lightest) path can be solved in polynomial time (think of it as having $m$ different color edges, and we want a path that does not use the same color twice, I believe that a sort of modified Dijkstra should work).

Ariel
  • 13,614
  • 1
  • 22
  • 39
0

This is not intended to be a full answer but rather to give a possible direction.

Assume $f_j$ are natural numbers. Then let $K = \sum_j f_j$.

Solve the following clustering problem for points $p_k$: $$ \arg\min_k \sum_i \min_k |x_i - p_k| $$

Then we need to assign each cluster a facility, such that facility $j$ is associated with $f_j$ clusters. Clearly, in order to minimize our objective these clusters need to be adjacent to each other.

Then, to determine facility $j$, we need to select the median point of clusters $c_j^1, c_j^2, \dots, c_j^{f_j}$.

Threats to validity: while $x_i$ may have belonged to a cluster, it is not guaranteed that it will be associated with the facility that that cluster is assigned to.

MotiNK
  • 553
  • 2
  • 12