private void CopyTopCoverLevelPayout() { //top level cover payouts will be copied to allocated payouts int[] ParentLevelChildrenMap = ParentCoverLevelAggInfo.GetChildrenMap(); int numOfParents = ParentLevelChildrenMap.Length; for (int i = 0; i < numOfParents; i++) //loop through each Parent cover { TotalAllocatedPayoutState[ParentLevelChildrenMap[i]] = TotalPayoutState[ParentLevelChildrenMap[i]]; } }
private void AllocateToOneCoverLevel() { int[] ParentLevelChildrenMap = ParentCoverLevelAggInfo.GetChildrenMap(); int[] ChildrenMap = ChildrenCoverLevelAggInfo.GetChildrenMap(); int[] MapPartitions = ChildrenCoverLevelAggInfo.GetCoverAggregationPartitions(); //int numOfParents = ParentLevelChildrenMap.Length; int numOfParents = ParentCoverLevelAggInfo.NumOfNodes; int MapPosition = 0; for (int i = 0; i < numOfParents; i++) //loop through each Parent cover { for (int j = MapPosition; j < MapPartitions[i]; j++) //loop throught each child of this parent cover { TotalAllocatedPayoutState[ChildrenMap[j]] += TotalAllocatedPayoutState[ParentLevelChildrenMap[i]] * ChildrenCoverLevelAllocationState.GetCoverAllocationRatioP()[j]; } MapPosition = MapPartitions[i]; } }
private void AllocateToLowestCoverLevel() { int[] ParentLevelChildrenMap = ParentCoverLevelAggInfo.GetChildrenMap(); //using this ParentLevelChildrenMap will not work here, because some leaf nodes will be top nodes as well, //so those leaf nodes will not appear in this list //all other cover nodes (except the top nodes) will be in this ParentLevelChildrenMap //because it must aggregate to some top level cover nodes int parentPosition = 0; //first leaf node is indexed 0 in TotalCoverState int[] ResidulePartitions = ResiduleInfo.GetResiduleSubAggPartitions(); int[] AritePartitions = AriteInfo.GetARiteAggregationPartitions(); float[] ResiduleAllocatedArr = ResiduleState.GetAllocatedPayout(); float[] aRiteAllocatedArr = AriteState.GetAllocatedPayout(); float[] residualRatio = LowestCoverLevelResidualAllocationRatio.GetCoverAllocationRatioP(); float[] aRiteRatio = LowestCoverLevelAriteAllocationRatio.GetCoverAllocationRatioP(); int numOfParents = ResidulePartitions.Length; int MapPosition = 0; int MapPosition2 = 0; //loop through each parent leaf cover for (int i = 0; i < numOfParents; i++) //loop through each Parent cover { for (int j = MapPosition; j < AritePartitions[i]; j++) //loop throught each child of this parent cover { aRiteAllocatedArr[j] += TotalAllocatedPayoutState[parentPosition] * aRiteRatio[j]; } MapPosition = AritePartitions[i]; for (int j = MapPosition2; j < ResidulePartitions[i]; j++) //loop throught each child of this parent cover { ResiduleAllocatedArr[j] += TotalAllocatedPayoutState[parentPosition] * residualRatio[j]; } MapPosition2 = ResidulePartitions[i]; parentPosition++; } }