Minimizing the overall cost over groups I am trying to solve the problem of minimizing the overall cost over several groups. The schema of the data goes something like this:

User (U) | Group (G) | Price (P)
================================
U1       | G1        | P11
U2       | G1        | P12
--------------------------------
U1       | G2        | P21
U2       | G2        | P22
--------------------------------
U3       | G3        | P33
U4       | G3        | P34
--------------------------------
U5       | G4        | P45


A user (U) can apply to be an admin of more than one Groups (G). There is a salary (P) that must be given to U if U is selected as the admin of G (U can demand any arbitrary number as salary for a group G).

The goal is to satisfy these conditions


Every group should have exactly 1 admin.
A User should not be the admin of more than 1 group.
Find admins for as many groups as possible.
The sum of salaries should be minimum.


Examples/Notes


If there are only two applications and are by the same user U (say for groups G1 and G2, expected salaries P1 and P2), only either of G1 and G2 will get an admin. If P1 > P2, U should be adjudged the admin of G1 (and not G2).


I'm not very sure which category of Assignment problem does this fall into. My approach was greedy and doesn't look optimal.


Group-wise sort (ascending) the expected salary.
Arbitrarily allocate a user to a group where there is only 1 admin-ship request. Remove this user from other group-admin requests.
Among the first request across groups, find the maximum and allocate the user to the group. Remove this user from other group admin-ship requests.
Repeat


Question: What is an optimal solution to this problem?
You are probably looking for a solution to the following optimization problem.

Weighted maximum biparite matching. Given a weighted bipartite graph $G=(U\cup V, E)$ with weights $w\colon U\times V \rightarrow \mathbb{N}$, find a set of edges $A\subseteq U\times V$ such that all edges in $A$ are disjoint (that is, no two edges are adjacent, that is, no group has two admins and no admin has two groups) and the sum $\sum_{a\in A}w(a)$ is minimized, and it is not possible to add another pair $(u,v)\in U\times V$ to $A$ without violating the non-adjacency constraint.

The sets $U$ and $V$ are the users and the groups, respectively. The set of edges $E$ is the set of applications (user-group pairs) and the set of weights is the salary of a given assignment. The Blossom algorithm (link) is a optimization algorithm that finds a maximum matching, and it can be adapted to solve the weighted case.

A final note: you seem to be optimizing two objectives at once: both the minimum salary, and the maximum number of covered groups. Obviously these objectives conflict: covering less groups gives a lower salary. Fortunately, the Bloom algorithm will find a maximum matching, so it will cover as many groups as is possible, and within the set of matchings that cover the maximum number of groups, it finds the one with the lowest sum salary.