# Objective function for employee assignation problem solved with simulated annealing

Imagine you have a total number of employees assigned to a task. Each task requires N quantity of employees for it to be 100% efficient, something like this:

Each employee is assigned to a task in this way:

Where in the metaheuristic, you make changes on the assigned tasks an employee has. Once you group by task you get the total quantity of employees currently working on the task. My question is, if you want to allocate the maximum possible quantity of workers in each task in the best possible way, which objective function will you use? I was thinking on minimizing the sum of the differences but I ran into an issue: some differences might be positive and others negative, the total sum of differences can lead to a total of zero:

Are there any other kinds of objective functions to use in this kind of problem?

• When the difference is positive, multiply the difference by a big number
• Use the absolute value of the differences
• Use a weighted sum of percentages (instead of differences)
• Without knowing what the "owner" of the problem wants, you can make your objective function pretty much anything.
– prubin
Sep 21, 2022 at 3:13