Reputation: 11
"As staff members become available, they select from the pool of waiting requests according to their priority list of topics. All requests arriving at time t are available for allocation at time t. If two staff members are simultaneously available, scheduling preference is given to the one whose most recent job was scheduled earliest. If there is still a tie, scheduling preference is given to the person whose id number appears earlier in the input list of staff people."
how do I implement this? I'm having trouble with implementing the service agents that get priority. For ex: Ill be defining two agents. Agent 1 can do topics math, science. Agent 2 can do science, math.
given a topic named "Science" if these two agents are available, how do i pick agent 2? because he prioritizes science topics more than Agent 1. ...
I had no trouble with the if two agents are available at the same time, it will be given to the agent whose most recent job was scheduled earliest. I just sorted the agents through an attribute i gave them. Any tips will be helpful.
Upvotes: 0
Views: 131
Reputation: 1733
Look for Priority Queue in Java - It retrieves element in sorted (natural or customized) order irrespective of their insertion order.
Upvotes: 0
Reputation: 5565
A priority queue is implemented via a heap. It's a datastructure that's worth learning.
Check it out:
http://pages.cs.wisc.edu/~vernon/cs367/notes/11.PRIORITY-Q.html
http://algs4.cs.princeton.edu/24pq/
Upvotes: 5