0

Dears,
I'm wondering if CP-SAT as any built-in function that allow me to balance the number of tasks assigned to the users.
Now I'm calculating the variance and I'm minimizing it in the objective function, so it would be great to have the possibility to calculate the variance with a built-in function, but I'm wondering if I have alternatives.

Thanks

1 Answers1

1

There are no alternative.

If the number of tasks and of workers is fixed. You can compute the average, and using an epsilon, add the following constraints:

for all workers:
  model.Add(sum(assigned_tasks) <= average + epsilon)
  model.Add(sum(assigned_tasks) >= average - epsilon)

model.Minimize(epsilon)

This is less precise, but much faster.

Laurent Perron
  • 8,594
  • 1
  • 8
  • 22