I have a number of sets, each containing items with a numerical value and a string.
I want to choose one item out of each set, so that: 1. the strings of the chosen items form a set (i.e. the strings are not equal to any of the strings from the other chosen items) 2. the numerical values of the chosen items are as high as possible
It is not always possible to satisfy 1., e.g. two sets may contain only one item each, both with the same string. When not possible to satisfy 1., the optimal solution is the one that is closest to satisfy 1., 2. is not as important.
How do I find the optimal solution? Are there any widely known algorithms for performing this or something similar?