Since the first proposal requires many changes here’s a simplified solution. @Cosmin_Ion_Nicolae
At this stage they are quick proposals and will be refined.
Solution 1
Step 1. Link processes with queues
P1 - Q1
P2 - Q2
P3 - Q3
Step 2. Assign priorities to queues based on the number of items
Q1 - [1 - 9] - 2
Q2 - [1 - 9] - 3
Q3 - [1 - 29] - 4
Q1 - [10 - 99] - 11
Q2 - [10 - 49] - 12
Q3 - [30 - 149] - 13
Q1 - [100 - ] - 23
Q2 - [50 - ] - 26
Q3 - [150 - ] - 20
where [n1 - n2]
is the min number - max number
of items in queue and the last number is a priority manually assigned per interval.
Step 3. Every x minutes an algorithm will poll the server and based on the number of items in each queue will stop/start processes.
Let’s say that we have 73 Q2 items, 80 Q3 items and 80 Q1 items therefore
PriQ1 = 11, PriQ2 = 26, PriQ1 = 13
P1 will be scheduled to run as it has the highest Pri number.
Solution 2
Assign a polynomial formula to calculate priorities (…and - to think about it - take into consideration the queue item prioritiy)
PriQ1 = n1*n1 + 10
PriQ2 = 3*n2 + 100
PriQ3 = n3 + 200
Solution 3
These processes will run against the same environment and it contains n
robots.
Divide the robots within the environment proportionally according to the previous calculated score.