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)