We analyze theoretically a network of all-to-all coupled polariton modes, realized by a trapped polariton condensate excited by a multifrequency laser source. In the low-density regime the system dynamically finds a state with maximal gain defined by the average intensities (weights) of the different source frequency components, analogous to active mode locking in lasers, and thus solves a maximum eigenvalue problem set by the matrix of weights. The method opens the possibility to tailor condensed polariton populations in different trapped modes by appropriate choice of the excitation source.