Exemple #1
0
        public override void CalculateLoss(SimulationMsg cdlMsg, bool bDebug)
        {
            //process children node payouts.
            for (int cIdx = 0; cIdx < base.m_vChildNode.Count; ++cIdx)
            {
                CoverNode cn = (CoverNode)base.m_vChildNode[cIdx];
                cn.CalculateLoss(cdlMsg, bDebug);
            }

            List <CalcState> vResolvedCalcState = new List <CalcState>();
            _Schedule        sar = this.m_subject.Schedule;

            foreach (RiskItem riskItem in sar.SetSchedule)
            {
                if (this.m_resolution != ENUM_RESOLUTION_TYPE.NONE)
                {
                    List <RiskItem> vResolvedRiskItem = ApplyResolution(riskItem, this.m_resolution);

                    #region debug output
                    if (bDebug)
                    {
                        cdlMsg.SendMessage(string.Format("RiskItems resolved for RiskItem: \r\n{0}", riskItem));
                        for (int rIdx = 0; rIdx < vResolvedRiskItem.Count; ++rIdx)
                        {
                            cdlMsg.SendMessage(string.Format("\t{0}", vResolvedRiskItem[rIdx]));
                        }
                    }
                    #endregion

                    //each resolved risk item is effectively treated as a subcover
                    for (int rIdx = 0; rIdx < vResolvedRiskItem.Count; ++rIdx)
                    {
                        RMS.ContractObjectModel.CalcState calcState = new CalcState();

                        calcState.S = vResolvedRiskItem[rIdx].GetLossState();

                        this.m_calcState.S += DetermineCoverPayout(calcState);
                    }

                    this.m_payout += this.m_calcState.S;
                }
                else
                {
                    this.m_calcState.S += riskItem.GetLossState();
                }
            }

            if (this.m_resolution == ENUM_RESOLUTION_TYPE.NONE)
            {
                this.m_payout += DetermineCoverPayout(this.m_calcState);
            }
        }
Exemple #2
0
        //TODO
        public virtual CoverNode GetCoverNodeByName(string name)
        {
            InitCheck();

            string extnId = string.Format("{0}-{1}", this.m_extnId, name);
            int    intId  = this.m_trCoverNode.GetNodeIntIdByExtnId(extnId);

            CoverNode cn;

            if (intId == -1)
            {
                cn        = new CoverNode();
                cn.ExtnId = extnId;
            }
            else
            {
                cn = this.m_trCoverNode.GetNodeByIntId(intId);
            }

            return(cn);
        }
Exemple #3
0
        //TODO
        public virtual CoverNode GetCoverNodeBySubject(__Subject subject)
        {
            InitCheck();

            string extnId = string.Format("{0}-{1}", this.m_extnId, subject.ToShortString());

            int       intId = this.m_trCoverNode.GetNodeIntIdByExtnId(extnId);
            CoverNode cn;

            if (intId == -1)
            {
                cn         = new CoverNode();
                cn.Subject = subject;
                cn.ExtnId  = extnId;
            }
            else
            {
                cn = this.m_trCoverNode.GetNodeByIntId(intId);
            }

            return(cn);
        }
Exemple #4
0
        public override void CalculateLoss(SimulationMsg cdlMsg, bool bDebug)
        {
            //process children node payouts.
            for (int cIdx = 0; cIdx < base.m_vChildNode.Count; ++cIdx)
            {
                CoverNode cn = (CoverNode)base.m_vChildNode[cIdx];
                cn.CalculateLoss(cdlMsg, bDebug);
            }

            List <CalcState> vResolvedCalcState = new List <CalcState>();
            _Schedule        sar = this.m_subject.Schedule;

            foreach (RiskItem riskItem in sar.SetSchedule)
            {
                if (riskItem is ReinCoverNode)
                {
                    this.m_calcState.S += riskItem.GetLossState();
                }
                else
                {
                    if (this.m_resolution != ENUM_RESOLUTION_TYPE.NONE)
                    {
                        //each resolved risk item is effectively treated as a subcover to the current cover
                        List <RiskItem> vResolvedRiskItem = ApplyResolution(riskItem, this.m_resolution);

                        #region debug output
                        if (bDebug)
                        {
                            cdlMsg.SendMessage(string.Format("RiskItems resolved for ReinCoverNode: \r\n{0}", riskItem));
                            for (int rIdx = 0; rIdx < vResolvedRiskItem.Count; ++rIdx)
                            {
                                cdlMsg.SendMessage(string.Format("\t{0}", vResolvedRiskItem[rIdx]));
                            }
                        }
                        #endregion

                        //temporary calculation state for the resolved risk items.
                        //RMS.ContractObjectModel.CalcState resCalcState = new CalcState();

                        for (int rIdx = 0; rIdx < vResolvedRiskItem.Count; ++rIdx)
                        {
                            RiskItem resRiskItem = vResolvedRiskItem[rIdx];

                            RMS.ContractObjectModel.CalcState calcState = new CalcState();

                            //reinsurance cover operating on allocated loss
                            switch (base.m_contract.AllocType)
                            {
                            case ENUM_ALLOCATION_TYPE.ALLOC_TYPE_PROPORTIONAL:
                                calcState.S = Math.Min(resRiskItem.GetLossState(), resRiskItem.GetAllocLossState());
                                break;

                            case ENUM_ALLOCATION_TYPE.ALLOC_TYPE_PERRISK:
                                calcState.S = resRiskItem.GetAllocLossState();
                                break;

                            case ENUM_ALLOCATION_TYPE.ALLOC_TYPE_NONE:
                                calcState.S = resRiskItem.GetLossState();
                                break;
                            }

                            double prelimReSar = DetermineCoverPayout(calcState);
                            if (resRiskItem is TermNode)
                            {
                                TermNode resTermNode = (TermNode)resRiskItem;
                                resTermNode.PrelimReSar = prelimReSar;
                            }

                            //this.m_calcState.S += prelimReSar;

                            this.m_payout += prelimReSar;

                            //resCalcState.S += prelimReSar;

                            //resCalcState.S += calcState.S;
                            //resCalcState.D += calcState.D;
                            //resCalcState.X += calcState.X;
                        }

                        //this.m_calcState.S += resCalcState.S;
                        //this.m_calcState.D += resCalcState.D;
                        //this.m_calcState.X += resCalcState.X;
                    }
                    else
                    {
                        switch (base.m_contract.AllocType)
                        {
                        case ENUM_ALLOCATION_TYPE.ALLOC_TYPE_PROPORTIONAL:
                            this.m_calcState.S = Math.Min(riskItem.GetLossState(), riskItem.GetAllocLossState());
                            break;

                        case ENUM_ALLOCATION_TYPE.ALLOC_TYPE_PERRISK:
                            this.m_calcState.S = riskItem.GetAllocLossState();
                            break;

                        case ENUM_ALLOCATION_TYPE.ALLOC_TYPE_NONE:
                            this.m_calcState.S = riskItem.GetLossState();
                            break;
                        }
                        ;
                    }
                }
            }

            if (this.m_resolution == ENUM_RESOLUTION_TYPE.NONE)
            {
                this.m_payout += DetermineCoverPayout(this.m_calcState);
            }
        }
Exemple #5
0
 public virtual void AddCoverNode(CoverNode coverNode)
 {
     this.InitCheck();
     this.m_trCoverNode.AddNodeToTree(coverNode, false);
 }