<p>I'm trying to write an automatic assignment algorithm for the following problem:</p>
<p>I have <span class="math-container">$N$</span> tasks and <span class="math-container">$M$</span> users. For each task, I have a ranking for each user for &quot;how related it is to that user&quot;. The ranking is a floating-point number in the <code>[0, 1.0]</code> range. The sum of all ranks is 1. I need to write an algorithm that will create the overall based assignment for all tasks. It has 2 constraints:</p>
<ol>
<li>Overall best correctness of assignment.</li>
<li>Properly balanced - I can't have 1 user assigned 20 tasks while all others are assigned 1-2.</li>
</ol>
<p>So far, from studying multiple input sets, I found that a task that has a user with a rank over 0.7 should be assigned to that user no matter what, because it's a really strong indicator of a correct assignment. After that, I tried to balance all the remaining tasks.</p>
<p>So, for the input of:</p>
<ol>
<li><code>tasks = [t1, t2, t3,... , tn]</code></li>
<li><code>task_user_scores = [[s11, s12,...s1m], [s21, s22, ..., s2m],..., [sm1, sm2, ..., smm]]</code></li>
<li><code>first_iteration_limit = float</code>, <code>[0, 1.0]</code>, I use <code>0.7</code>, as I described earlier.</li>
<li><code>per_user_limit = int</code>, how many tasks to strive to assign per user.</li>
</ol>
<p>I do:</p>
<p>Step 1</p>
<pre><code>for ti in tasks 
    if some sij &gt; 0.7 
        assign ti to user j
</code></pre>
<p>Step 2</p>
<pre><code>for ti in unassigned tasks 
    compute user deviation(max deviation is abs(n - per_user_limit), udj is abs(assigned_to_j - per_user_limit) from per_user_limit(ud), 
    compute adjusted scores as follows sij * (1 - udj). 
    Select the user from the list using weighted random, if selected user already has more assigned tasks than per_user_limit, select again(the random select happens a finite number of times, I found that 10 is fine). 
    Otherwise, if the user didn't reach per_user_limit assign ti to user j.
</code></pre>
<p>Step 3</p>
<pre><code>for ti in unassigned tasks
    assign ti to the user in the top 5 with the least number of tasks assigned to it.
</code></pre>

CC BY-SA 4.0
2021-12-10T09:24:30.473Z
I tried to format your post to improve the clarity, but the pseudocode is still not very clear. I would recommend that you improve that part even further (so that we don't have very long lines). Anyway, just to clarify, when you say you have a "ranking", you mean that you have a ranking for each user of the tasks that they prefer. So, if task 3 is the more preferred task for user 1, then task 3 will have the highest score for user 1, e.g. 0.9.  If, after task 3, we have task 5, then the score will be like 0.8 for user 1. Right?
nbro
CC BY-SA 4.0
2021-12-15T10:38:18.743Z
Although you didn't answer to my question above, you may want to look into linear programming, constrained satisfaction problems and constrained optimization.
nbro
<constrained-optimization>
How to assign tasks to users with ranking?
Bob Sacamano
# How to assign tasks to users with ranking?

(Asked by: username_0 on 2021-12-06)

I'm trying to write an automatic assignment algorithm for the following problem:
I have $N$ tasks and $M$ users. For each task, I have a ranking for each user for "how related it is to that user". The ranking is a floating-point number in the [0, 1.0] range. The sum of all ranks is 1. I need to write an algorithm that will create the overall based assignment for all tasks. It has 2 constraints:

Overall best correctness of assignment.
Properly balanced - I can't have 1 user assigned 20 tasks while all others are assigned 1-2.

So far, from studying multiple input sets, I found that a task that has a user with a rank over 0.7 should be assigned to that user no matter what, because it's a really strong indicator of a correct assignment. After that, I tried to balance all the remaining tasks.
So, for the input of:

tasks = [t1, t2, t3,... , tn]
task_user_scores = [[s11, s12,...s1m], [s21, s22, ..., s2m],..., [sm1, sm2, ..., smm]]
first_iteration_limit = float, [0, 1.0], I use 0.7, as I described earlier.
per_user_limit = int, how many tasks to strive to assign per user.

I do:
Step 1
for ti in tasks 
    if some sij > 0.7 
        assign ti to user j

Step 2
for ti in unassigned tasks 
    compute user deviation(max deviation is abs(n - per_user_limit), udj is abs(assigned_to_j - per_user_limit) from per_user_limit(ud), 
    compute adjusted scores as follows sij * (1 - udj). 
    Select the user from the list using weighted random, if selected user already has more assigned tasks than per_user_limit, select again(the random select happens a finite number of times, I found that 10 is fine). 
    Otherwise, if the user didn't reach per_user_limit assign ti to user j.

Step 3
for ti in unassigned tasks
    assign ti to the user in the top 5 with the least number of tasks assigned to it.

**Tags:** constrained-optimization

> **Comments:**
> **username_1**: I tried to format your post to improve the clarity, but the pseudocode is still not very clear. I would recommend that you improve that part even further (so that we don't have very long lines). Anyway, just to clarify, when you say you have a "ranking", you mean that you have a ranking for each user of the tasks that they prefer. So, if task 3 is the more preferred task for user 1, then task 3 will have the highest score for user 1, e.g. 0.9.  If, after task 3, we have task 5, then the score will be like 0.8 for user 1. Right?  
> **username_1**: Although you didn't answer to my question above, you may want to look into linear programming, constrained satisfaction problems and constrained optimization.  

---

## 0 answers

