function computeQuality(team)
local skillsMatrix = getPlayerCovarianceMatrix(team)
local meanVector = getPlayerMeansVector(team)
local meanVectorTranspose = meanVector:transpose()
local playerTeamAssignmentsMatrix = createPlayerTeamAssignmentMatrix(team, meanVector.rowCount)
local playerTeamAssignmentsMatrixTranspose = playerTeamAssignmentsMatrix:transpose()
local betaSquared = 250 * 250
local start = matrixmult(meanVectorTranspose, playerTeamAssignmentsMatrix)
local aTa = matrixmult(scalarMultiply(playerTeamAssignmentsMatrixTranspose, betaSquared), playerTeamAssignmentsMatrix)
local tmp = matrixmult(playerTeamAssignmentsMatrixTranspose, skillsMatrix)
local aTSA = matrixmult(tmp, playerTeamAssignmentsMatrix)
local middle = matrixAdd(aTa, aTSA)
if middle:getDeterminant() == 0 then return -1 end
local middleInverse = matrixInvert(middle)
local theend = matrixmult(playerTeamAssignmentsMatrixTranspose, meanVector)
local part1 = matrixmult(start, middleInverse)
local part2 = matrixmult(part1, theend)
local expPartMatrix = scalarMultiply(part2, -0.5)
local expPart = expPartMatrix:getDeterminant()
local sqrtPartNumerator = aTa:getDeterminant()
local sqrtPartDenominator = middle:getDeterminant()
local sqrtPart = sqrtPartNumerator / sqrtPartDenominator
local result = math.exp(expPart) * math.sqrt(sqrtPart)
return round((result * 100), 2)
end
Statistics: Posted by thecore — 15 Nov 2019, 14:38
Statistics: Posted by thecore — 15 Nov 2019, 14:03
Statistics: Posted by nine2 — 15 Nov 2019, 13:50
Foreach player ordered by rating descending
Put them in the team with the lowest total rating (that is not full)
Players: 1200, 1100, 900, 900, 800, 800, 700, 700, 500, 500, 500, 300
Team 1 Team 2
Total 4400 4500
-----------------------------------------------------------------------------
Slot 1 1200 1100
Slot 2 900 900
Slot 3 800 800
Slot 4 700 700
Slot 5 500 500
Slot 6 300 500
Team 1 Team 2 Team 3
Total 3000 2900 3000
-----------------------------------------------------------------------------
Slot 1 1200 1100 900
Slot 2 800 800 900
Slot 3 500 700 700
Slot 4 500 300 500
Team 1 Team 2 Team 3 Team 4
Total 2200 2300 2200 2200
-----------------------------------------------------------------------------
Slot 1 1200 1100 900 900
Slot 2 700 700 800 800
Slot 3 300 500 500 500
Team 1 Team 2 Team 3 Team 4 Team 5 Team 6
Total 1500 1600 1400 1400 1500 1500
-----------------------------------------------------------------------------
Slot 1 1200 1100 900 900 800 800
Slot 2 300 500 500 500 700 700
Players: 2000, 900, 900, 50
Team 1 Team 2
Total 2050 1800
-----------------------------------------------------------------------------
Slot 1 2000 900
Slot 2 50 900
Players: 2000, 1800, 1200, 1150
Team 1 Team 2
Total 3150 3000
-----------------------------------------------------------------------------
Slot 1 2000 1800
Slot 2 1150 1200
Players: 2000, 1800, 1800, 1700, 1200, 10
Team 1 Team 2
Total 3710 4800
-----------------------------------------------------------------------------
Slot 1 2000 1800
Slot 2 1700 1800
Slot 3 10 1200
Players: 2000, 1800, 1800, 1600, 1200, 10
Team 1 Team 2
Total 4800 3610
-----------------------------------------------------------------------------
Slot 1 2000 1800
Slot 2 1600 1800
Slot 3 1200 10
Players: 2000, 1800, 1800, 1200, 100, 10
Team 1 Team 2
Total 3300 3610
-----------------------------------------------------------------------------
Slot 1 2000 1800
Slot 2 1200 1800
Slot 3 100 10
Statistics: Posted by nine2 — 15 Nov 2019, 13:40
Statistics: Posted by nine2 — 15 Nov 2019, 12:53
Statistics: Posted by thecore — 15 Nov 2019, 09:39
Statistics: Posted by nine2 — 02 Nov 2019, 05:58