Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

sorting

def SelectAgentAccordToBaFDivision (i, countOfAgents) {
    def chunk = i % (countOfAgents * 2)
	def agentIndex = i % countOfAgents

	if (chunk >= countOfAgents) agentIndex = (countOfAgents - 1) - agentIndex

	return agentIndex
}

def missionsTTC = [70,50,90,40]
def countOfAgents = missionsTTC.size()
def maxTimePerAgent = 100
def ttc = 60

def j = 0
def agentIndex = SelectAgentAccordToBaFDivision(j, countOfAgents)

def checks = 0;
def checksCount = (countOfAgents * 2)
while ((missionsTTC[agentIndex] + ttc) > maxTimePerAgent && checks < checksCount) {
	j++
	agentIndex = SelectAgentAccordToBaFDivision(j, countOfAgents)
    checks++
}

println agentIndex

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.