def _createPlayerTeamAssignmentMatrix(self, teamAssignmentsList, totalPlayers): playerAssignments = list() totalPreviousPlayers = 0 for i in range(len(teamAssignmentsList)): currentTeam = teamAssignmentsList[i] currentRowValues = [0] * totalPreviousPlayers playerAssignments.append(currentRowValues) for currentRating in currentTeam: currentRowValues.append(getPartialPlayPercentage(currentRating[0])) totalPreviousPlayers += 1 nextTeam = teamAssignmentsList[i + 1] for nextTeamPlayerPair in nextTeam: currentRowValues.append(-1 * getPartialPlayPercentage(nextTeamPlayerPair[0])) return Matrix(totalPlayers, len(teamAssignmentsList) - 1, playerAssignments)
def _createPlayerToTeamSumFactor(self, teamMembers, sumVariable): partialPlayPercentages = list() for v in teamMembers: partialPlayPercentages.append(getPartialPlayPercentage(v.key)) return GaussianWeightedSumFactor(sumVariable, teamMembers, partialPlayPercentages)