# Employee allocation based on ranking: Mathematical Model

Suppose I have three employees and I have to assign three employees based on their ranks. If an employee has rank 1 that means he is best. Say, I have the following table

Name      Rank
Joe        3
Allen      1
Bob        2


I have make one parameter $$p_{e, rank}.$$ If I can not assign it based on rank then I have to give some penalty. This is a part of an employee allocation problem.

What I did, I make a binary variable $$x_{e, r, rank}$$ for Assignment of employees to restaurant $$r.$$ Then I create another variable $$\sum(x_{e, r, rank} \cdot p_{e, rank}).$$ I am minimizing this sum and this is my objective function.

My query is, is it correct? Or if there is any alternative way to write it in a mathematical program let me know.

• Minimizing the sum is a good starting point. One disadvantage is that it may penalize a single person or restaurant quite heavily. It is an interesting exercise to maintain some equality. Jun 16 '21 at 1:09

A) I think you might want to use a multi-level score (something like our BendableScore):

• SOFT: maximize rank 1 assignments
• SOFTER: maximize rank 2 assignments
• SOFTEST: maximize rank 3 assignments

Otherwise, three rank 2 assignments can be considered better than one rank 1 assignments (which I presume is not the requirement).

Where it gets more interesting is if your number or ranks is dynamic: One dataset can have 3 ranks, while another could have 3000 ranks. In that case, a fairness like squaring technique probably works too, to collapse it into a single score level.

B) If, on the other hand, outweighing is the requirement, just use a single score level (SOFT) with weighting (one weight between every two sequential ranks). In your current implementation: rank 1 is twice rank 2. Rank 2 is 1.5 times rank 3. That's weird. It would be more consistent weighting wise, to use rank 1 (penalty 1), rank 2 (penalty 2), rank 3 (penalty 4), rank 4 (penalty 8) and so forth.

• Can you suggest a formulation if we use consistent weighting, to use rank 1 (penalty 1), rank 2 (penalty 2), rank 3 (penalty 4), rank 4 (penalty 8) and so forth. @Geoffrey Jun 16 '21 at 3:49
• It depends on the solver of course, but something like 2^(rank - 1) so penalize("ranking constraint", SOFT, assignment -> 2^(assignment.getRank() - 1)) should get you those weights. Basically 2^0 is 1, 2^1 is 2, 2^2 is 4, etc. Jun 16 '21 at 15:29