An algorithm for deriving a subset of A such that it maximizes the total pairwise sum

Suppose I have a set A={a_1, a_2, ..., a_n}. I also have a function f:AxA->Rthat assigns a pair of a Aspecific real value. I want to extract a subset of S_ksize kfrom Aso that it maximizes the total pair sum of all elements inS_k

Is there any known algorithm that will do this in a reasonable amount of time? polynomial / quasi-polynomial time, maybe?

Edit: processed example

Assume that A={a_1,a_2,a_3,a_4}c k=3and fis defined as:

f(a_1,a_2)=0, f(a_1,a_3)=0, f(a_1,a_4)=0, f(a_2,a_3)=1, f(a_2,a_4)=5, f(a_3,a_4)=10.

Then S_k={a_2,a_3,a_4}, since it maximizes the amount f(a_2,a_3)+f(a_2,a_4)+f(a_3,a_4). (i.e., the pairwise sum of all elements from S_k)

+4
source share
1 answer

It is unlikely that this problem generalizes the problem of finding a k-clique (sets weights for the graph adjacency matrix), for which the most well-known algorithms are exponential (see also the strong exponential time hypothesis).

+6
source

Source: https://habr.com/ru/post/1667573/


All Articles