optimize pairwise-f instead of s_f