Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello I am having difficult time to think on a solution for this algorithm my work asked me to create.

A little background to understand what the algorithm is supposed to do: there are shift types: morning, late morning, noon, late noon, evening, etc.

.

each agent is working on a subset of shifts, regularly.

for example, agent smith is working only on morning shifts, while agent Neo is working on morning and evening as well.

the current solution (which is not good), is that whenever a new meeting is created, it is assigned based on the agents who work on that specific shift when the meeting needs to occur, and we select the a random agent from a list of agents that available for that shift BUT also has the least of meeting on that specific date.

the problem that happens due to this current solution is that for example if the morning shift had exactly 3 agents: x, y, z and noon shift had 4 agents (for example): q, x, y, z and for example 4 new meetings needs to be assigned now 3 for noon shift and 1 for morning shift and lets assume that first the algorithm received the noon meetings first to assign and also lets assume the algorithm chosen to assign those to users x, y, z because they each have 0 meetings before assigning those new meetings for that date.

and now the morning meeting is needed to be assigned for the same date, but x,y,z agents already have 1 meeting each scheduled, however they are the only ones who can take morning shift meeting.

So now I will have to assign the new morning meeting to x or y or z, while agent q doesn’t get a meeting.

This cause unfairness.

the process doesn’t receives all the meetings at once so each time it is needed to run the algorithm on new meetings that is being inserted to the system, and assign it as fair as possible.

What I have tried:

I wrote already in the problem section.
Posted
Updated 27-Oct-22 2:17am

1 solution

It sounds like you need to recalculate the assignments of agents to meetings when a new meeting is added. Think of the agents and meetings as vertices in a bipartite graph, where each meeting has one edge going to one agent. There are also constraints on which edges are legal, based on the shift(s) that an agent works.

What you need to do is generate all possible mappings of meetings to agents and select one that is the most balanced.

If you keep track of the best mapping so far, you should be able to prune many of the mappings before completing them. You also know that the best possible mapping from M meetings to A agents is one where each agent has M/A meetings, rounded up or down, so you can stop once you find such a mapping.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900