Example #1
0
        public void Run()
        {
            //Get GULoss for Residule subjects for the lowest cover level
            float[] GULossVector = Event.LossVector;

            int NumOfResidules = graph.GetCoverResiduleInfo().NumOfResidules;

            int[] ResiduleIndicies = graph.GetCoverResiduleInfo().GetGULossIndicies();
            int   uniqueIndex;

            float[] ResiduleSubjectLoss = graphstate.GetLowestCoverLevelResiduleState().GetSubjectLoss();

            for (int i = 0; i < NumOfResidules; i++)
            {
                uniqueIndex            = ResiduleIndicies[i];
                ResiduleSubjectLoss[i] = GULossVector[uniqueIndex];
            }

            //Get Recoverable for Arite subjects for the lowest cover level
            float[] AriteSubjectLoss = graphstate.GetLowestCoverLevelAriteState().GetSubjectLoss();
            int     NumOfArites      = graph.GetCoverAriteInfo().NumOfARITEs;

            int[] RecoverLevelIndex = graph.GetCoverAriteInfo().GetRecoverableLevelIndex();
            int[] RecoverIndices    = graph.GetCoverAriteInfo().GetRecoverableIndicies();
            int[] AriteGULosses     = new int[NumOfArites];

            for (int i = 0; i < NumOfArites; i++)
            {
                AriteSubjectLoss[i] = graphstate.GetARITELevelState(RecoverLevelIndex[i]).GetRecoverable()[RecoverIndices[i]];
                AriteGULosses[i]    = graph.GetAtomicRITEInfo(RecoverLevelIndex[i]).GetGULossIndicies()[RecoverIndices[i]];
            }
        }
        public void DoLowestLevel(float[] FactorVector) //only having AtomicRites
        {
            int level = graph.NumOfTermLevels;
            ILevelAtomicRITEInfo lowestaRiteInfor = graph.GetAtomicRITEInfo(level);
            int NumOfaRites = lowestaRiteInfor.NumOfARITEs;

            int[]   aRiteFactorsIndex = lowestaRiteInfor.GetaRiteInfo().FactorsIndex;
            float[] aRiteFactors      = graphstate.GetARITELevelState(level).GetFactors();

            //translate the FactorsIndex to Factors
            for (int i = 0; i < NumOfaRites; i++)
            {
                int uniqueIndex = aRiteFactorsIndex[i];
                if (uniqueIndex == -1)
                {
                    aRiteFactors[i] = 1;
                }
                else
                {
                    aRiteFactors[i] = FactorVector[uniqueIndex];
                }
            }
        } //DoLowestLevel
Example #3
0
        public float TestRun(IGraphState graphState)
        {
            int numBldgs = 22704;

            float[] covA_GU    = graphState.GetARITELevelState(2).GetSubjectLoss();
            float[] covC_GU    = graphState.GetARITELevelState(3).GetSubjectLoss();
            float[] covA_Alloc = new float[numBldgs];
            float[] covC_Alloc = new float[numBldgs];

            float covCSubLim = 444846.7230f;
            float locDed     = 296564.4820f;

            float payout = 0;

            for (int i = 0; i < numBldgs; i++)
            {
                float covCGU     = covC_GU[i];
                float covAGU     = covA_GU[i];
                float LocGroupUp = covCGU + covAGU;

                float X = Math.Max(covCGU - covCSubLim, 0);
                float D = Math.Min(LocGroupUp, locDed);

                //float X = -(-LocGroupUp - locDed - Math.Abs(-LocGroupUp + locDed)) / 2;
                //float D = (LocGroupUp + locDed  - Math.Abs(LocGroupUp - locDed))/2;

                float totalR = LocGroupUp - X;
                payout += totalR - D;

                covA_Alloc[i] = covAGU / totalR * payout;
                covC_Alloc[i] = (covCGU - X) / totalR * payout;
            }

            return(payout);

            //return 0;
        }
        public void Run()
        {
            //1.Loop through the levels and allocate till the last Term Level
            int LastLevelinTermLevels = Graph.NumOfTermLevels - 1;

            for (int i = 0; i < LastLevelinTermLevels; i++)
            {
                ParentTermLevelState    = graphState.GetTermLevelState(i);
                ChildrenTermLevelState  = graphState.GetTermLevelState(i + 1);
                ChildrenLevelAriteState = graphState.GetARITELevelState(i + 1);
                ParentLevelAggInfo      = Graph.GetNodeAggInfo(i);
                ChildrenLevelAggInfo    = Graph.GetNodeAggInfo(i + 1);
                ChildrenLevelAriteInfo  = Graph.GetAtomicRITEInfo(i + 1);

                AllocateToOneTermLevel();
            }

            //2.Allocate to the lowest level (All Atomic Rites)
            ParentTermLevelState    = graphState.GetTermLevelState(LastLevelinTermLevels);
            ChildrenLevelAriteState = graphState.GetARITELevelState(LastLevelinTermLevels + 1);
            ChildrenLevelAriteInfo  = Graph.GetAtomicRITEInfo(LastLevelinTermLevels + 1);

            AllocateToLowestLevel();
        }
Example #5
0
        public void Run()
        {
            float[] GULossVector = Event.LossVector;

            for (int level = 0; level < graph.NumOfLevels; level++)
            {
                int     NumOfARTIEs        = graph.GetAtomicRITEInfo(level).NumOfARITEs;
                int[]   AtomicRITEIndicies = graph.GetAtomicRITEInfo(level).GetGULossIndicies();
                int     uniqueIndex;
                float[] AtomicRITESubjectLoss = graphstate.GetARITELevelState(level).GetSubjectLoss();

                for (int i = 0; i < NumOfARTIEs; i++)
                {
                    uniqueIndex = AtomicRITEIndicies[i];
                    AtomicRITESubjectLoss[i] = GULossVector[uniqueIndex];
                }
            }
        }