Пример #1
0
        //public override float GetFactor()
        //{
        //    return PrimarySubject.Schedule.Factor;
        //}

        public override long GetFirstRITEcharID()
        {
            CoverageAtomicRITE cRite = PrimarySubject.GetAtomicRites().First() as CoverageAtomicRITE;

            //return cRite.RITE.ExposureID;  //used to be GetFirstRITEID().
            return(cRite.RITCharacterisiticID);  //TODO: shouldreturn RiteID.
        }
Пример #2
0
        private Subject GetSubjectForCover(Dictionary <string, object> coverDict)
        {
            if (coverDict.ContainsKey("DerivedSubject"))
            {
                PrimarySubject thisNewSub = new PrimarySubject(null, null, null);
                thisNewSub.IsDerived = true;
                object component1;
                coverDict.TryGetValue("DerivedSubject", out component1);

                List <String> childrenList           = new List <String>();
                Dictionary <string, object> tempDict = component1 as Dictionary <string, object>;
                object component2;
                tempDict.TryGetValue("Value", out component2);
                object[] tempList2 = component2 as object[];
                foreach (object obj2 in tempList2)
                {
                    Dictionary <string, object> childrenCoverDict = obj2 as Dictionary <string, object>;
                    childrenList.Add(childrenCoverDict["Value"].ToString());
                }
                thisNewSub.ChildrenCoverNodeList = childrenList;
                return(thisNewSub);
            }
            else
            {
                return(GetSubjectForTerm(coverDict));
            }
        }
Пример #3
0
        public double[] GetGUForSubject(PrimarySubject sub)
        {
            int numBldgs = sub.Schedule.ActNumOfBldgs;

            double[] guloss = new double[numBldgs];

            foreach (string subperil in sub.CauseOfLossSet.GetSubperils())
            {
                foreach (RITCharacteristic RITChar in sub.Schedule.RITChars)
                {
                    if (sub.ExposureTypes.Contains(RITChar.ExpType))
                    {
                        double[] RITELoss;
                        uint     timestamp;
                        string   error;
                        if (GetRITCharacteristicLoss(RITChar, subperil, out RITELoss, out timestamp, out error, numBldgs))
                        {
                            guloss = guloss.Zip(RITELoss, (x, y) => x + y).ToArray();
                        }
                        else
                        {
                            throw new GUInputEngineException(error);
                        }
                    }
                }
            }

            return(guloss);
        }
Пример #4
0
        public HashSet <PrimarySubject> GetDistinctPerRiskSubjects()
        {
            HashSet <PrimarySubject> DistinctPerRiskSubjects = new HashSet <PrimarySubject>(OriginalPerRiskSubjects);
            HashSet <PrimarySubject> NewPerRiskSubjects      = new HashSet <PrimarySubject>();

            //remove children Per Risk Subjects
            foreach (PrimarySubject s1 in OriginalPerRiskSubjects)
            {
                foreach (PrimarySubject s2 in OriginalPerRiskSubjects)
                {
                    if (s1.ID == s2.ID)
                    {
                        continue;
                    }
                    else if (SubjectTreeMatrix[s1.ID, s2.ID] == SubjectCompareOutcome.Equal)
                    {
                        DistinctPerRiskSubjects.Remove(s1);
                    }
                    else if (CompareTwoCOLs(s1.CauseOfLossSet.Collection, s2.CauseOfLossSet.Collection) == SubjectCompareOutcome.Equal &&
                             CompareTwoExpTypes(s1.ExposureTypes.Collection, s2.ExposureTypes.Collection) == SubjectCompareOutcome.Equal)
                    {
                        if (SubjectTreeMatrix[s1.ID, s2.ID] == SubjectCompareOutcome.Child)
                        {
                            DistinctPerRiskSubjects.Remove(s2);
                        }
                        else if (SubjectTreeMatrix[s1.ID, s2.ID] == SubjectCompareOutcome.Parent)
                        {
                            DistinctPerRiskSubjects.Remove(s1);
                        }
                        else if (SubjectTreeMatrix[s1.ID, s2.ID] == SubjectCompareOutcome.Overlap)
                        {
                            //just merge the two schedules, form a new Subject with disjoined Schedules
                            HashSet <RITE> list1 = s1.Schedule.ScheduleList;
                            HashSet <RITE> list2 = s2.Schedule.ScheduleList;

                            list1.UnionWith(list2);
                            ScheduleOfRITEs newSchedule = new ScheduleOfRITEs(s1.Schedule.Name + s2.Schedule.Name, list1, new HashSet <RITCharacteristic> {
                            });
                            PrimarySubject newSubject   = FormNewSubject(s1, newSchedule);

                            DistinctPerRiskSubjects.Remove(s1);
                            DistinctPerRiskSubjects.Remove(s2);
                            DistinctPerRiskSubjects.Add(newSubject);
                            NewPerRiskSubjects.Add(newSubject);
                            //add to SubjectTree for this new Subject
                        }
                    }
                }
            }
            foreach (PrimarySubject newS in NewPerRiskSubjects)
            {
                foreach (PrimarySubject oldS in DistinctPerRiskSubjects)
                {
                    SubjectTreeMatrix[newS.ID, oldS.ID] = CompareTwoSubjects(newS, oldS);
                }
            }
            return(DistinctPerRiskSubjects);
        }
Пример #5
0
        protected override void SetContractSubject()
        {
            //Set Universal Subject
            if (Declarations.Schedule == null)
            {
                Declarations.Schedule = new ScheduleOfRITEs("TotalContractSchedule", ExpData.ContractRITES, ExpData.Characteristics);
            }

            contractSubject = new PrimarySubject(Declarations.Schedule, Declarations.ExposureTypes, Declarations.CausesofLoss);
        }
Пример #6
0
 public TermNode(PrimarySubject _subject) : base(_subject)
 {
     if (_subject.IsDerived)
     {
         throw new ArgumentOutOfRangeException("Terms Nodes cannot have a derivied subject!");
     }
     CurrentAllocationState = new AllocationStateCollection(_subject.Schedule.ActNumOfBldgs);
     Deductibles            = new DeductibleCollection();
     Limits = new LimitCollection();
 }
Пример #7
0
        public TermNode(PrimarySubject _subject, TermNode tNode) : base(_subject)
        {
            CurrentAllocationState = new AllocationStateCollection2(_subject.Schedule.ActNumOfBldgs);

            //Deductibles = tNode.Deductibles;
            //Limits = tNode.Limits;
            //should do shallow copy, not copy whole object
            Deductibles = new DeductibleCollection(tNode.Deductibles);
            Limits      = new LimitCollection(tNode.Limits);
        }
Пример #8
0
 public bool GetLimitsForSubject(PrimarySubject sub, out LimitCollection limits)
 {
     if (LimComponent.TryGetValue(sub, out limits))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #9
0
        protected override Subject GetSubjectForTerm(Dictionary <string, object> termDict)
        {
            string                 termSchedule = termDict["Schedule"].ToString();
            COLCollection          termCOL      = GetCOLHashSet(termDict["CausesOfLoss"].ToString());
            ExposureTypeCollection termExp      = GetExpTypeHashSet(termDict["ExposureTypes"].ToString());
            ScheduleOfRITEs        schedule     = GetSchedule(termSchedule);

            PrimarySubject sub = new PrimarySubject(schedule, termExp, termCOL);

            return(sub);
        }
Пример #10
0
 public bool GetDeductiblesForSubject(PrimarySubject sub, out DeductibleCollection deductibles)
 {
     if (DedComponent.TryGetValue(sub, out deductibles))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #11
0
        protected Subject GetSubjectForCover(Dictionary <string, object> coverDict)
        {
            if (coverDict.ContainsKey("DerivedSubject"))
            {
                bool isPerRisk = false;
                if (coverDict.ContainsKey("PerRisk") & coverDict["PerRisk"].ToString() == "True")
                {
                    isPerRisk = true;
                }

                //PrimarySubject thisNewSub = new PrimarySubject(null, null, null, isPerRisk);
                object component1;
                coverDict.TryGetValue("DerivedSubject", out component1);

                List <String> childrenList           = new List <String>();
                Dictionary <string, object> tempDict = component1 as Dictionary <string, object>;
                //parse the Subject FunctionName
                String       functionName;
                FunctionType functionType = FunctionType.Sum;
                if (tempDict.ContainsKey("FunctionName"))
                {
                    object comName;
                    tempDict.TryGetValue("FunctionName", out comName);
                    functionName = comName.ToString();
                    if (functionName == "Max")
                    {
                        functionType = FunctionType.Max;
                    }
                    else if (functionName == "Min")
                    {
                        functionType = FunctionType.Min;
                    }
                }
                PrimarySubject thisNewSub = new PrimarySubject(null, null, null, isPerRisk, functionType);
                thisNewSub.IsDerived = true;
                object component2;
                tempDict.TryGetValue("Value", out component2);
                object[] tempList2 = component2 as object[];
                foreach (object obj2 in tempList2)
                {
                    Dictionary <string, object> childrenCoverDict = obj2 as Dictionary <string, object>;
                    childrenList.Add(childrenCoverDict["Value"].ToString());
                }
                thisNewSub.ChildrenCoverNodeList = childrenList;
                return(thisNewSub);
            }
            else
            {
                return(GetSubjectForTerm(coverDict).First());
            }
        }
Пример #12
0
        protected override HashSet <Subject> GetSubjectForTerm(Dictionary <string, object> termDict)
        {
            string expTypes = termDict["ExposureTypes"].ToString();
            string COLTypes = termDict["CausesOfLoss"].ToString();

            ExposureTypeCollection termExp;
            COLCollection          termCOL;

            if (COLTypes == "")
            {
                termCOL = contractSubject.CauseOfLossSet;
            }
            else
            {
                termCOL = new COLCollection(COLTypes);
            }

            if (expTypes == "")
            {
                termExp = contractSubject.ExposureTypes;
            }
            else
            {
                termExp = ExposureTypeCollection.BuildFromString(expTypes);
            }

            string          termSchedule = termDict["Schedule"].ToString();
            ScheduleOfRITEs schedule     = ExpData.GetSchedule(termSchedule);

            bool isPerRisk = false;

            if (termDict.ContainsKey("PerRisk") & termDict["PerRisk"].ToString() == "True")
            {
                isPerRisk = true;
            }

            PrimarySubject sub = new PrimarySubject(schedule, termExp, termCOL, isPerRisk);

            //DO NOT Explode
            //if (termDict.ContainsKey("PerRisk")
            //    & termDict["PerRisk"].ToString() == "True")
            //    return new HashSet<Subject>(ExplodeSubjectForPerRisk(sub).Cast<Subject>());
            //else
            //    return new HashSet<Subject>(){sub};

            return(new HashSet <Subject>()
            {
                sub
            });
        }
Пример #13
0
        public SubjectCompareOutcome CompareTwoSubjects(PrimarySubject s1, PrimarySubject s2)
        {
            SubjectCompareOutcome colOut = CompareTwoCOLs(s1.CauseOfLossSet.Collection, s2.CauseOfLossSet.Collection);
            SubjectCompareOutcome expOut = CompareTwoExpTypes(s1.ExposureTypes.Collection, s2.ExposureTypes.Collection);
            SubjectCompareOutcome schOut = CompareTwoSchedules(s1.Schedule, s2.Schedule);

            if (colOut == SubjectCompareOutcome.Equal && expOut == SubjectCompareOutcome.Equal && schOut == SubjectCompareOutcome.Equal)
            {
                if (s1.IsPerRisk == s2.IsPerRisk)
                {
                    return(SubjectCompareOutcome.Equal);
                }
                else if (s1.IsPerRisk && !s2.IsPerRisk)
                {
                    return(SubjectCompareOutcome.Child);
                }
                else
                {
                    return(SubjectCompareOutcome.Parent);
                }
            }

            else if (colOut == SubjectCompareOutcome.Disjoin || expOut == SubjectCompareOutcome.Disjoin || schOut == SubjectCompareOutcome.Disjoin)
            {
                return(SubjectCompareOutcome.Disjoin);
            }

            else if ((colOut == SubjectCompareOutcome.Parent || colOut == SubjectCompareOutcome.Equal) &&
                     (expOut == SubjectCompareOutcome.Parent || expOut == SubjectCompareOutcome.Equal) &&
                     (schOut == SubjectCompareOutcome.Parent || schOut == SubjectCompareOutcome.Equal))
            {
                return(SubjectCompareOutcome.Parent);
            }

            else if ((colOut == SubjectCompareOutcome.Child || colOut == SubjectCompareOutcome.Equal) &&
                     (expOut == SubjectCompareOutcome.Child || expOut == SubjectCompareOutcome.Equal) &&
                     (schOut == SubjectCompareOutcome.Child || schOut == SubjectCompareOutcome.Equal))
            {
                return(SubjectCompareOutcome.Child);
            }

            else
            {
                return(SubjectCompareOutcome.Overlap);
            }
        }
Пример #14
0
        public void UpdateCoverGraphForReinstatements(NodeTree _completeGraph)
        {
            //for OccLimit Reinstatement cover, if it does not have any parents with AggLimit, then add a agg layer cover on top of it
            List <CoverNode> listOfCoverNodes = new List <CoverNode>();

            listOfCoverNodes.AddRange(_completeGraph.FinalDerivedCoverNodes);
            listOfCoverNodes.AddRange(_completeGraph.FinalLeafCoverNodes);

            foreach (CoverNode cNode in listOfCoverNodes)
            {
                if (cNode.Cover.LimitTimeBasis == TimeBasis.Occurrence && cNode.Cover.UnlimitedReinstatements == false && cNode.Cover.NumofReinstatements > 0)
                {
                    Boolean found = false;
                    foreach (CoverNode pCNode in _completeGraph.CoverNodeChildParentsMap[cNode])
                    {
                        if (pCNode.Cover.LimitTimeBasis == TimeBasis.Aggregate && pCNode.Cover.Unlimited == false)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found) //means: No aggLimit for this OccLimit with reinstatement, we need add aggLimit layer
                    {
                        List <string> _childrenCoverNodeList = new List <string>()
                        {
                            cNode.CoverName
                        };
                        PrimarySubject newSubject = new PrimarySubject(_childrenCoverNodeList);

                        Cover     newCover     = new Cover("Agg_on_" + cNode.CoverName, false, new ContractModel.MonetaryValue(0.0), new ContractModel.MonetaryValue(cNode.Cover.LimitAmount * (cNode.Cover.NumofReinstatements + 1)), new ContractModel.PercentValue(100), false, TimeBasis.Aggregate, TimeBasis.Aggregate, TermValueType.Numeric, 0, true);
                        CoverNode newCoverNode = new CoverNode(newSubject, newCover.CoverName);
                        newCoverNode.Cover = newCover;
                        //then add this Cover to completeGraph
                        _completeGraph.CoverNodeChildParentsMap[cNode].Add(newCoverNode);
                        _completeGraph.CoverNodeParentChildrenMap.Add(newCoverNode, new HashSet <CoverNode> {
                            cNode
                        });
                        _completeGraph.FinalDerivedCoverNodes.Add(newCoverNode);
                    }
                }
            }
        }
Пример #15
0
        //public override void BuildAtomicRITEs()
        //{
        //    _atomicCoverageRITEs = RecursiveGetAtomicRITEs(TopNode);
        //}

        //private HashSet<CoverageAtomicRITE> RecursiveGetAtomicRITEs(GraphNode node)
        //{
        //    if (node.AtomicRITEsAdded == true)
        //        return new HashSet<CoverageAtomicRITE>(node.AllAtomicRITEs.Cast<CoverageAtomicRITE>());

        //    //Get AtomicRites from Children
        //    HashSet<CoverageAtomicRITE> ARITEsFromChildren = new HashSet<CoverageAtomicRITE>();

        //    if (node.Subject.IsDerived)
        //    {
        //        foreach (GraphNode childNode in GetChildrenForNode(node))
        //        {
        //            ARITEsFromChildren.UnionWith(RecursiveGetAtomicRITEs(childNode));
        //        }

        //        node.ResidualAtomicRITEs = new HashSet<AtomicRITE>();
        //        node.AllAtomicRITEs = new HashSet<AtomicRITE>(ARITEsFromChildren.Cast<AtomicRITE>().ToList());
        //        node.AtomicRITEsAdded = true;

        //        return ARITEsFromChildren;
        //    }
        //    else
        //    {
        //        foreach (GraphNode childNode in GetChildrenForNode(node))
        //        {
        //            ARITEsFromChildren.UnionWith(RecursiveGetAtomicRITEs(childNode));
        //        }

        //        //Get Atomic Rites for subject of Node
        //        HashSet<CoverageAtomicRITE> SubjectARITEs = node.Subject.GetAtomicRites();
        //        //var ResidualARITEs = SubjectARITEs.Except(ARITEsFromChildren);
        //        HashSet<CoverageAtomicRITE> ResidualARITEs =  new HashSet<CoverageAtomicRITE>(SubjectARITEs.Except(ARITEsFromChildren));
        //        HashSet<CoverageAtomicRITE> AllARITEs = new HashSet<CoverageAtomicRITE>(ResidualARITEs.Union(ARITEsFromChildren));

        //        node.ResidualAtomicRITEs = new HashSet<AtomicRITE>(ResidualARITEs.Cast<AtomicRITE>());
        //        node.AllAtomicRITEs = new HashSet<AtomicRITE>(AllARITEs.Cast<AtomicRITE>());
        //        node.AtomicRITEsAdded = true;

        //        return AllARITEs;
        //    }
        //}

        public override LossTimeSeries GetNodeSubjectLoss(GraphNode node)
        {
            if (node.SubjectLoss != null)
            {
                return(node.SubjectLoss);
            }

            PrimarySubject priSub      = (PrimarySubject)node.Subject;
            Aggregation    aggType     = priSub.Schedule.IsLocation ? Aggregation.PerBuilding : Aggregation.Summed;
            LossTimeSeries subjectLoss = new LossTimeSeries(priSub.Schedule.ActNumOfBldgs);

            //Recursively gets subject loss for a Node

            foreach (AtomicRITE rite in node.AllAtomicRITEs)
            {
                subjectLoss.MergeTimeSeries(rite.SubjectLoss, aggType);
            }

            return(subjectLoss);
        }
Пример #16
0
 public int GetNumOfBuildingsActual()
 {
     //return PrimarySubject.Schedule.ActNumOfBldgs; //TODO: change to use factor
     if (Subject is PrimarySubject)
     {
         PrimarySubject ps    = Subject as PrimarySubject;
         AtomicRITE     aRite = Subject.GetAtomicRites().First();
         if (aRite is CoverageAtomicRITE)
         {
             CoverageAtomicRITE cRite = aRite as CoverageAtomicRITE;
             return(cRite.RITE.ActNumOfSampleBldgs);
         }
         else
         {
             return(1);
         }
     }
     else
     {
         return(1);
     }
 }
Пример #17
0
        private HashSet <PrimarySubject> ExplodeSubjectForPerRisk(PrimarySubject primarySub)
        {
            //Per Risk, expand the schedule to all location subschedules
            if (primarySub.Schedule.IsLocation)
            {
                return new HashSet <PrimarySubject>()
                       {
                           primarySub
                       }
            }
            ;

            HashSet <PrimarySubject> ExplodedSubjects = new HashSet <PrimarySubject>();

            foreach (RITE Rite in primarySub.Schedule.ScheduleList)
            {
                //Check if schedule already exists in exposure data with RITE
                ScheduleOfRITEs schedule;

                if (FindScheduleWithRite(Rite, out schedule))
                {
                    ExplodedSubjects.Add(new PrimarySubject(schedule, primarySub.ExposureTypes, primarySub.CauseOfLossSet));
                }
                else
                {
                    //Create new schedule in exposure data
                    string newScheduleName = primarySub.Schedule.Name + " ." + Rite.ExposureID;
                    ExpData.AddSchedule(newScheduleName, new HashSet <RITE>()
                    {
                        Rite
                    });
                    ExplodedSubjects.Add(new PrimarySubject(ExpData.GetSchedule(newScheduleName), primarySub.ExposureTypes, primarySub.CauseOfLossSet));
                }
            }

            return(ExplodedSubjects);
        }
Пример #18
0
        public override void Initialize()
        {
            //Create Schedules
            ScheduleOfRITEs S16_EQ      = expdata.Schedules.ToList()[0];
            ScheduleOfRITEs S16_EQ_5229 = expdata.Schedules.ToList()[1];
            ScheduleOfRITEs S16_EQ_5228 = expdata.Schedules.ToList()[2];
            ScheduleOfRITEs S16_EQ_46   = expdata.Schedules.ToList()[3];
            ScheduleOfRITEs S16_EQ_47   = expdata.Schedules.ToList()[4];
            ScheduleOfRITEs S16_EQ_48   = expdata.Schedules.ToList()[5];

            //Create Subjects
            PrimarySubject Node27BSub  = new PrimarySubject(S16_EQ, Building, EQ);
            PrimarySubject Node27CSub  = new PrimarySubject(S16_EQ, Contents, EQ);
            PrimarySubject Node27BISub = new PrimarySubject(S16_EQ, BI, EQ);

            PrimarySubject Node25Sub = new PrimarySubject(S16_EQ, Building_Contents, EQ);
            PrimarySubject Node26Sub = new PrimarySubject(S16_EQ, Contents_BI, EQ);
            PrimarySubject Node27Sub = new PrimarySubject(S16_EQ, Loss, EQ);

            PrimarySubject Node11Sub = new PrimarySubject(S16_EQ, Loss, EQ);


            //Create Nodes and Add to Node List
            CoverNode Node27B = new CoverNode(Node27BSub, "L939_27_Building");

            graphNodes.Add(Node27B);

            CoverNode Node27C = new CoverNode(Node27CSub, "L939_27_Contents");

            graphNodes.Add(Node27C);

            CoverNode Node27BI = new CoverNode(Node27BISub, "L939_27_BI");

            graphNodes.Add(Node27BI);

            CoverNode Node27 = new CoverNode(Node27Sub, "L939_27");

            graphNodes.Add(Node27);

            CoverNode Node26 = new CoverNode(Node26Sub, "L938_26");

            graphNodes.Add(Node26);

            CoverNode Node25 = new CoverNode(Node25Sub, "L937_25");

            graphNodes.Add(Node25);


            CoverNode Node11 = new CoverNode(Node11Sub, "Blanket_EQ");

            graphNodes.Add(Node11);

            //Build Parent to Child Mapping
            List <GraphNode> Node11Children = new List <GraphNode>()
            {
                Node25, Node26, Node27
            };

            parentToChildrenMap.Add(Node11, Node11Children);

            List <GraphNode> Node27Children = new List <GraphNode>()
            {
                Node27B, Node27C, Node27BI
            };

            parentToChildrenMap.Add(Node27, Node27Children);

            AssignLevelToNode();

            TopNodes = new List <GraphNode>()
            {
                Node11
            };

            BuildAtomicRITEs();

            GraphReady = true;
        } //end of Initialize
Пример #19
0
        public override void Initialize()
        {
            ////Build Graph here....
            //_graphNodes = new List<GraphNode>();
            //_parentToChildrenMap = new Dictionary<GraphNode, List<GraphNode>>();
            //_rites = new List<RITE>();
            //_schedules = new List<Schedule>();
            //_characteristics = new List<RITCharacteristic>();

            ////Add Contract Declarations
            //Declarations = new Declarations();

            ////Create RITECharacteristics
            //RITCharacteristic RITChar18 = new RITCharacteristic(19419518, ExposureType.Building, 100000);
            //RITCharacteristic RITChar19 = new RITCharacteristic(19419519, ExposureType.Contents, 10000);
            //RITCharacteristic RITChar20 = new RITCharacteristic(19419520, ExposureType.Building, 100000);
            //RITCharacteristic RITChar21 = new RITCharacteristic(19419521, ExposureType.Contents, 10000);
            //_characteristics.Add(RITChar18);
            //_characteristics.Add(RITChar19);
            //_characteristics.Add(RITChar20);
            //_characteristics.Add(RITChar21);

            ////Create RITEs
            //RITE rite57 = new RITE(11324657, 1);
            //rite57.AddCharacteristic(RITChar18);
            //rite57.AddCharacteristic(RITChar19);
            //RITE rite58 = new RITE(11324658, 1);
            //rite58.AddCharacteristic(RITChar20);
            //rite58.AddCharacteristic(RITChar21);
            //_rites.Add(rite57);
            //_rites.Add(rite58);

            ////Create Schedules
            //Schedule S2729_EQ = new Schedule("S2729.EQ");
            //S2729_EQ.AddRITE(rite57);
            //S2729_EQ.AddRITE(rite58);
            //_schedules.Add(S2729_EQ);

            //Schedule S2729_EQ_59491 = new Schedule("S2729.EQ.59491");
            //S2729_EQ_59491.AddRITE(rite57);
            //_schedules.Add(S2729_EQ_59491);

            //Schedule S2729_EQ_59492 = new Schedule("S2729.EQ.59492");
            //S2729_EQ_59492.AddRITE(rite58);
            //_schedules.Add(S2729_EQ_59492);

            //Create Schedules
            ScheduleOfRITEs S2729_EQ       = expdata.Schedules.ToList()[0];
            ScheduleOfRITEs S2729_EQ_59491 = expdata.Schedules.ToList()[1];
            ScheduleOfRITEs S2729_EQ_59492 = expdata.Schedules.ToList()[2];

            //Create Subjects
            PrimarySubject Node41Sub = new PrimarySubject(S2729_EQ_59491, Building, EQWS);
            PrimarySubject Node42Sub = new PrimarySubject(S2729_EQ_59491, Contents, EQWS);

            PrimarySubject Node31Sub = new PrimarySubject(S2729_EQ_59491, Loss, EQWS);
            PrimarySubject Node32Sub = new PrimarySubject(S2729_EQ_59492, Loss, EQWS);

            PrimarySubject Node21Sub = new PrimarySubject(S2729_EQ, Loss, EQWS);

            PrimarySubject Node01Sub = new PrimarySubject(null, null, null);

            Node01Sub.IsDerived = true;
            List <String> temp = new List <String>();

            temp.Add("Node11");
            Node01Sub.ChildrenCoverNodeList = temp;

            //TermNode Node41 = new TermNode(Node41Sub, false, false, 8000000, 10000000); //loccvg
            TermNode Node41 = new TermNode(Node41Sub); //loccvg

            graphNodes.Add(Node41);
            TermNode Node42 = new TermNode(Node42Sub);  //loccvg

            graphNodes.Add(Node42);

            //loc terms
            TermNode Node31 = new TermNode(Node31Sub); //loc

            graphNodes.Add(Node31);
            TermNode Node32 = new TermNode(Node32Sub); //loc

            graphNodes.Add(Node32);

            //policy term
            TermNode Node21 = new TermNode(Node21Sub);  //policy term, no limit term, so limit = 0?

            graphNodes.Add(Node21);

            //policy cover
            CoverNode Node11 = new CoverNode(Node21Sub, "L102_3222");  //policy layer

            graphNodes.Add(Node11);

            //treaty layer
            CoverNode Node01 = new CoverNode(Node01Sub, "OccLim");
            //_graphNodes.Add(Node01);

            //Build Parent to Child Mapping
            List <GraphNode> Node01Children = new List <GraphNode>()
            {
                Node11
            };

            parentToChildrenMap.Add(Node01, Node01Children);

            List <GraphNode> Node11Children = new List <GraphNode>()
            {
                Node21
            };

            parentToChildrenMap.Add(Node11, Node11Children);

            List <GraphNode> Node21Children = new List <GraphNode>()
            {
                Node31, Node32
            };

            parentToChildrenMap.Add(Node21, Node21Children);

            List <GraphNode> Node31Children = new List <GraphNode>()
            {
                Node41, Node42
            };

            parentToChildrenMap.Add(Node31, Node31Children);

            //raintest, add TopNode treaty term manually for now
            Cover topCover = new Cover("TreatyCover", false, new MonetaryValue(600.0), new MonetaryValue(1000000.0), new PercentValue(100), false, TimeBasis.Occurrence, TimeBasis.Occurrence, TermValueType.Numeric);

            Node01.Cover = topCover;
            //end of hack

            TopNodes = new List <GraphNode>()
            {
                Node01
            };
            GraphReady = true;
        } //end of Initialize
Пример #20
0
        public override void Initialize()
        {
            //Create Schedules
            ScheduleOfRITEs S16_EQ              = expdata.Schedules.ToList()[0]; //new Schedule("S16.EQ");
            ScheduleOfRITEs S16_EQ_5229         = expdata.Schedules.ToList()[1]; //new Schedule("S16.EQ.SubPolicy5229");
            ScheduleOfRITEs S16_EQ_5229_5228    = expdata.Schedules.ToList()[2]; //new Schedule("S16.EQ.SubPolicy5229.SubPolicy5228");
            ScheduleOfRITEs S16_EQ_5229_5228_46 = expdata.Schedules.ToList()[3]; //new Schedule("S16.EQ.SubPolicy5229.SubPolicy5228.46");
            ScheduleOfRITEs S16_EQ_5229_47      = expdata.Schedules.ToList()[4]; //new Schedule("S16.EQ.SubPolicy5229.47");
            ScheduleOfRITEs S16_EQ_48           = expdata.Schedules.ToList()[5]; //new Schedule("S16.EQ.48");

            //Create Subjects
            PrimarySubject Node53Sub = new PrimarySubject(S16_EQ_5229_5228_46, Building, EQ);
            PrimarySubject Node54Sub = new PrimarySubject(S16_EQ_5229_5228_46, Contents, EQ);
            PrimarySubject Node55Sub = new PrimarySubject(S16_EQ_5229_5228_46, BI, EQ);

            PrimarySubject Node56Sub = new PrimarySubject(S16_EQ_5229_47, Building, EQWS);
            PrimarySubject Node57Sub = new PrimarySubject(S16_EQ_5229_47, Contents, EQWS);
            PrimarySubject Node58Sub = new PrimarySubject(S16_EQ_5229_47, BI, EQWS);

            PrimarySubject Node59Sub = new PrimarySubject(S16_EQ_48, Building, EQWS);
            PrimarySubject Node60Sub = new PrimarySubject(S16_EQ_48, Contents, EQWS);
            PrimarySubject Node61Sub = new PrimarySubject(S16_EQ_48, BI, EQWS);

            PrimarySubject Node46Sub = new PrimarySubject(S16_EQ_5229_5228_46, Loss, EQ);
            PrimarySubject Node47Sub = new PrimarySubject(S16_EQ_5229_47, Loss, EQWS);
            PrimarySubject Node48Sub = new PrimarySubject(S16_EQ_48, Loss, EQWS);

            PrimarySubject NodeBSub = new PrimarySubject(S16_EQ, Building, EQWS);
            PrimarySubject NodeCSub = new PrimarySubject(S16_EQ, Contents, EQWS);

            PrimarySubject NodeBISub = new PrimarySubject(S16_EQ, BI, EQWS);

            PrimarySubject Node21Sub = new PrimarySubject(S16_EQ, Loss, EQWS);

            //Nodes
            TermNode Node53 = new TermNode(Node53Sub); //loccvg

            graphNodes.Add(Node53);
            TermNode Node54 = new TermNode(Node54Sub); //loccvg

            graphNodes.Add(Node54);
            TermNode Node55 = new TermNode(Node55Sub); //loccvg

            graphNodes.Add(Node55);

            TermNode Node56 = new TermNode(Node56Sub); //loccvg

            graphNodes.Add(Node56);
            TermNode Node57 = new TermNode(Node57Sub); //loccvg

            graphNodes.Add(Node57);
            TermNode Node58 = new TermNode(Node58Sub); //loccvg

            graphNodes.Add(Node58);

            TermNode Node59 = new TermNode(Node59Sub); //loccvg

            graphNodes.Add(Node59);
            TermNode Node60 = new TermNode(Node60Sub); //loccvg

            graphNodes.Add(Node60);
            TermNode Node61 = new TermNode(Node61Sub); //loccvg

            graphNodes.Add(Node61);

            //loc term
            TermNode Node46 = new TermNode(Node46Sub);  //loc

            graphNodes.Add(Node46);
            TermNode Node47 = new TermNode(Node47Sub);  //loc

            graphNodes.Add(Node47);
            TermNode Node48 = new TermNode(Node48Sub);  //loc

            graphNodes.Add(Node48);

            //policy coverage
            TermNode NodeB = new TermNode(NodeBSub);

            graphNodes.Add(NodeB);
            TermNode NodeC = new TermNode(NodeCSub);

            graphNodes.Add(NodeC);
            TermNode NodeBI = new TermNode(NodeBISub);

            graphNodes.Add(NodeBI);

            TermNode Node21 = new TermNode(Node21Sub);

            graphNodes.Add(Node21);

            //policy cover
            CoverNode Node11 = new CoverNode(Node21Sub, " L937_16");

            graphNodes.Add(Node11);

            //Build Parent to Child Mapping
            List <GraphNode> Node11Children = new List <GraphNode>()
            {
                Node21
            };

            parentToChildrenMap.Add(Node11, Node11Children);

            List <GraphNode> Node21Children = new List <GraphNode>()
            {
                Node46, Node47, Node48, NodeB, NodeC, NodeBI
            };

            parentToChildrenMap.Add(Node21, Node21Children);

            //List<GraphNode> Node32Children = new List<GraphNode>() { Node46, Node31, Node47 };
            //_parentToChildrenMap.Add(Node32, Node32Children);

            //List<GraphNode> Node31Children = new List<GraphNode>() { Node46 };
            //_parentToChildrenMap.Add(Node31, Node31Children);

            List <GraphNode> Node46Children = new List <GraphNode>()
            {
                Node53, Node54, Node55
            };

            parentToChildrenMap.Add(Node46, Node46Children);

            List <GraphNode> Node47Children = new List <GraphNode>()
            {
                Node56, Node57, Node58
            };

            parentToChildrenMap.Add(Node47, Node47Children);

            List <GraphNode> Node48Children = new List <GraphNode>()
            {
                Node59, Node60, Node61
            };

            parentToChildrenMap.Add(Node48, Node48Children);

            List <GraphNode> NodeBChildren = new List <GraphNode>()
            {
                Node53, Node56, Node59
            };

            parentToChildrenMap.Add(NodeB, NodeBChildren);

            List <GraphNode> NodeCChildren = new List <GraphNode>()
            {
                Node54, Node57, Node60
            };

            parentToChildrenMap.Add(NodeC, NodeCChildren);

            List <GraphNode> NodeBIChildren = new List <GraphNode>()
            {
                Node55, Node58, Node61
            };

            parentToChildrenMap.Add(NodeBI, NodeBIChildren);

            TopNodes = new List <GraphNode>()
            {
                Node11
            };
            AssignLevelToNode();
            BuildAtomicRITEs();
            GraphReady = true;
        } //end of Initialize
Пример #21
0
        public override void Initialize()
        {
            ////Build Graph here....
            //_graphNodes = new List<GraphNode>();
            //_parentToChildrenMap = new Dictionary<GraphNode, List<GraphNode>>();
            //_rites = new List<RITE>();
            //_schedules = new List<Schedule>();
            //_characteristics = new List<RITCharacteristic>();
            //_atomicCoverageRITEs = new HashSet<AtomicRITE>();

            ////Add Contract Declarations
            //Declarations = new Declarations();

            ////Create RITECharacteristics
            ////Rite 11334
            //RITCharacteristic RITChar53 = new RITCharacteristic(3253, ExposureType.Building, 1000000);
            //RITCharacteristic RITChar54 = new RITCharacteristic(3254, ExposureType.Contents, 500000);
            //RITCharacteristic RITChar55 = new RITCharacteristic(3255, ExposureType.BI, 100000);

            ////Rite 11332
            //RITCharacteristic RITChar56 = new RITCharacteristic(3256, ExposureType.Building, 2000000);
            //RITCharacteristic RITChar57 = new RITCharacteristic(3257, ExposureType.Contents, 1000000);
            //RITCharacteristic RITChar58 = new RITCharacteristic(3258, ExposureType.BI, 500000);

            ////Rite 11333
            //RITCharacteristic RITChar59 = new RITCharacteristic(3259, ExposureType.Building, 500000);
            //RITCharacteristic RITChar60 = new RITCharacteristic(3260, ExposureType.Contents, 500000);
            //RITCharacteristic RITChar61 = new RITCharacteristic(3261, ExposureType.BI, 50000);

            //_characteristics.Add(RITChar53);
            //_characteristics.Add(RITChar54);
            //_characteristics.Add(RITChar55);
            //_characteristics.Add(RITChar56);
            //_characteristics.Add(RITChar57);
            //_characteristics.Add(RITChar58);
            //_characteristics.Add(RITChar59);
            //_characteristics.Add(RITChar60);
            //_characteristics.Add(RITChar61);

            ////Create RITEs
            //RITE rite34 = new RITE(11334, 1);
            //rite34.AddCharacteristic(RITChar53);
            //rite34.AddCharacteristic(RITChar54);
            //rite34.AddCharacteristic(RITChar55);

            //RITE rite32 = new RITE(11332, 1);
            //rite32.AddCharacteristic(RITChar56);
            //rite32.AddCharacteristic(RITChar57);
            //rite32.AddCharacteristic(RITChar58);

            //RITE rite33 = new RITE(11333, 1);
            //rite33.AddCharacteristic(RITChar59);
            //rite33.AddCharacteristic(RITChar60);
            //rite33.AddCharacteristic(RITChar61);

            //_rites.Add(rite32);
            //_rites.Add(rite33);
            //_rites.Add(rite34);

            ////Create AtomicRITE
            //// AtomicRITE(string _subperil, ExposureType _expType, RITE _rite, long ID)
            //AtomicRITE aRite3453EQ = new AtomicRITE("EQ", ExposureType.Building, rite34, 11334);
            //AtomicRITE aRite3454EQ = new AtomicRITE("EQ", ExposureType.Contents, rite34, 11334);
            //AtomicRITE aRite3455EQ = new AtomicRITE("EQ", ExposureType.BI, rite34, 11334);

            //AtomicRITE aRite3256EQ = new AtomicRITE("EQ", ExposureType.Building, rite32, 11332);
            //AtomicRITE aRite3257EQ = new AtomicRITE("EQ", ExposureType.Contents, rite32, 11332);
            //AtomicRITE aRite3258EQ = new AtomicRITE("EQ", ExposureType.BI, rite32, 11332);

            //AtomicRITE aRite3359EQ = new AtomicRITE("EQ", ExposureType.Building, rite33, 11333);
            //AtomicRITE aRite3360EQ = new AtomicRITE("EQ", ExposureType.Contents, rite33, 11333);
            //AtomicRITE aRite3361EQ = new AtomicRITE("EQ", ExposureType.BI, rite33, 11333);

            //_atomicCoverageRITEs.Add(aRite3453EQ);
            //_atomicCoverageRITEs.Add(aRite3454EQ);
            //_atomicCoverageRITEs.Add(aRite3455EQ);
            //_atomicCoverageRITEs.Add(aRite3256EQ);
            //_atomicCoverageRITEs.Add(aRite3257EQ);
            //_atomicCoverageRITEs.Add(aRite3258EQ);
            //_atomicCoverageRITEs.Add(aRite3359EQ);
            //_atomicCoverageRITEs.Add(aRite3360EQ);
            //_atomicCoverageRITEs.Add(aRite3361EQ);

            ////Create Schedules
            //Schedule S16_EQ = new Schedule("S16.EQ");
            //S16_EQ.AddRITE(rite32);
            //S16_EQ.AddRITE(rite33);
            //S16_EQ.AddRITE(rite34);
            //_schedules.Add(S16_EQ);

            //Schedule S16_EQ_5229 = new Schedule("S16.EQ.SubPolicy5229");
            //S16_EQ_5229.AddRITE(rite34);
            //S16_EQ_5229.AddRITE(rite32);
            //_schedules.Add(S16_EQ_5229);

            //Schedule S16_EQ_5229_5228 = new Schedule("S16.EQ.SubPolicy5229.SubPolicy5228");
            //S16_EQ_5229_5228.AddRITE(rite34);
            //_schedules.Add(S16_EQ_5229_5228);

            //Schedule S16_EQ_5229_5228_46 = new Schedule("S16.EQ.SubPolicy5229.SubPolicy5228.46");
            //S16_EQ_5229_5228.AddRITE(rite34);
            //_schedules.Add(S16_EQ_5229_5228_46);

            //Schedule S16_EQ_5229_47 = new Schedule("S16.EQ.SubPolicy5229.47");
            //S16_EQ_5229_5228.AddRITE(rite32);
            //_schedules.Add(S16_EQ_5229_47);

            //Schedule S16_EQ_48 = new Schedule("S16.EQ.48");
            //S16_EQ_48.AddRITE(rite33);
            //_schedules.Add(S16_EQ_48);

            //Create Schedules
            ScheduleOfRITEs S16_EQ              = expdata.Schedules.ToList()[0]; //new Schedule("S16.EQ");
            ScheduleOfRITEs S16_EQ_5229         = expdata.Schedules.ToList()[1]; //new Schedule("S16.EQ.SubPolicy5229");
            ScheduleOfRITEs S16_EQ_5229_5228    = expdata.Schedules.ToList()[2]; //new Schedule("S16.EQ.SubPolicy5229.SubPolicy5228");
            ScheduleOfRITEs S16_EQ_5229_5228_46 = expdata.Schedules.ToList()[3]; //new Schedule("S16.EQ.SubPolicy5229.SubPolicy5228.46");
            ScheduleOfRITEs S16_EQ_5229_47      = expdata.Schedules.ToList()[4]; //new Schedule("S16.EQ.SubPolicy5229.47");
            ScheduleOfRITEs S16_EQ_48           = expdata.Schedules.ToList()[5]; //new Schedule("S16.EQ.48");

            //Create Subjects
            PrimarySubject Node53Sub = new PrimarySubject(S16_EQ_5229_5228_46, Building, EQ);
            PrimarySubject Node54Sub = new PrimarySubject(S16_EQ_5229_5228_46, Contents, EQ);
            PrimarySubject Node55Sub = new PrimarySubject(S16_EQ_5229_5228_46, BI, EQ);

            PrimarySubject Node56Sub = new PrimarySubject(S16_EQ_5229_47, Building, EQ);
            PrimarySubject Node57Sub = new PrimarySubject(S16_EQ_5229_47, Contents, EQ);
            PrimarySubject Node58Sub = new PrimarySubject(S16_EQ_5229_47, BI, EQ);

            PrimarySubject Node59Sub = new PrimarySubject(S16_EQ_48, Building, EQ);
            PrimarySubject Node60Sub = new PrimarySubject(S16_EQ_48, Contents, EQ);
            PrimarySubject Node61Sub = new PrimarySubject(S16_EQ_48, BI, EQ);

            PrimarySubject Node46Sub = new PrimarySubject(S16_EQ_5229_5228_46, Loss, EQ);
            PrimarySubject Node47Sub = new PrimarySubject(S16_EQ_5229_47, Loss, EQ);
            PrimarySubject Node48Sub = new PrimarySubject(S16_EQ_48, Loss, EQ);

            PrimarySubject NodeBSub  = new PrimarySubject(S16_EQ, Building, EQ);
            PrimarySubject NodeCSub  = new PrimarySubject(S16_EQ, Contents, EQ);
            int            ii        = 4;
            PrimarySubject NodeBISub = new PrimarySubject(S16_EQ, BI, EQ);

            PrimarySubject Node21Sub = new PrimarySubject(S16_EQ, Loss, EQ);

            //Nodes
            TermNode Node53 = new TermNode(Node53Sub); //loccvg

            graphNodes.Add(Node53);
            TermNode Node54 = new TermNode(Node54Sub); //loccvg

            graphNodes.Add(Node54);
            TermNode Node55 = new TermNode(Node55Sub); //loccvg

            graphNodes.Add(Node55);

            TermNode Node56 = new TermNode(Node56Sub); //loccvg

            graphNodes.Add(Node56);
            TermNode Node57 = new TermNode(Node57Sub); //loccvg

            graphNodes.Add(Node57);
            TermNode Node58 = new TermNode(Node58Sub); //loccvg

            graphNodes.Add(Node58);

            TermNode Node59 = new TermNode(Node59Sub); //loccvg

            graphNodes.Add(Node59);
            TermNode Node60 = new TermNode(Node60Sub); //loccvg

            graphNodes.Add(Node60);
            TermNode Node61 = new TermNode(Node61Sub); //loccvg

            graphNodes.Add(Node61);

            //loc term
            TermNode Node46 = new TermNode(Node46Sub);  //loc

            graphNodes.Add(Node46);
            TermNode Node47 = new TermNode(Node47Sub);  //loc

            graphNodes.Add(Node47);
            TermNode Node48 = new TermNode(Node48Sub);  //loc

            graphNodes.Add(Node48);

            //policy coverage
            TermNode NodeB = new TermNode(NodeBSub);

            graphNodes.Add(NodeB);
            TermNode NodeC = new TermNode(NodeCSub);

            graphNodes.Add(NodeC);
            TermNode NodeBI = new TermNode(NodeBISub);

            graphNodes.Add(NodeBI);

            TermNode Node21 = new TermNode(Node21Sub);

            graphNodes.Add(Node21);

            //policy cover
            CoverNode Node11 = new CoverNode(Node21Sub, "L938_365");

            graphNodes.Add(Node11);

            //Build Parent to Child Mapping
            List <GraphNode> Node11Children = new List <GraphNode>()
            {
                Node21
            };

            parentToChildrenMap.Add(Node11, Node11Children);

            List <GraphNode> Node21Children = new List <GraphNode>()
            {
                Node46, Node47, Node48, NodeB, NodeC, NodeBI
            };

            parentToChildrenMap.Add(Node21, Node21Children);

            //List<GraphNode> Node32Children = new List<GraphNode>() { Node46, Node31, Node47 };
            //_parentToChildrenMap.Add(Node32, Node32Children);

            //List<GraphNode> Node31Children = new List<GraphNode>() { Node46 };
            //_parentToChildrenMap.Add(Node31, Node31Children);

            List <GraphNode> Node46Children = new List <GraphNode>()
            {
                Node53, Node54, Node55
            };

            parentToChildrenMap.Add(Node46, Node46Children);

            List <GraphNode> Node47Children = new List <GraphNode>()
            {
                Node56, Node57, Node58
            };

            parentToChildrenMap.Add(Node47, Node47Children);

            List <GraphNode> Node48Children = new List <GraphNode>()
            {
                Node59, Node60, Node61
            };

            parentToChildrenMap.Add(Node48, Node48Children);

            List <GraphNode> NodeBChildren = new List <GraphNode>()
            {
                Node53, Node56, Node59
            };

            parentToChildrenMap.Add(NodeB, NodeBChildren);

            List <GraphNode> NodeCChildren = new List <GraphNode>()
            {
                Node54, Node57, Node60
            };

            parentToChildrenMap.Add(NodeC, NodeCChildren);

            List <GraphNode> NodeBIChildren = new List <GraphNode>()
            {
                Node55, Node58, Node61
            };

            parentToChildrenMap.Add(NodeBI, NodeBIChildren);

            TopNodes = new List <GraphNode>()
            {
                Node11
            };
            AssignLevelToNode();
            BuildAtomicRITEs();
            GraphReady = true;
        } //end of Initialize
Пример #22
0
        public override void Initialize()
        {
            // //Create RITECharacteristics
            // RITCharacteristic RITChar18 = new RITCharacteristic(19419518, ExposureType.Building, 100000);
            // RITCharacteristic RITChar19 = new RITCharacteristic(19419519, ExposureType.Contents, 10000);
            // RITCharacteristic RITChar20 = new RITCharacteristic(19419520, ExposureType.Building, 100000);
            // RITCharacteristic RITChar21 = new RITCharacteristic(19419521, ExposureType.Contents, 10000);
            // _characteristics.Add(RITChar18);
            // _characteristics.Add(RITChar19);
            // _characteristics.Add(RITChar20);
            // _characteristics.Add(RITChar21);

            // //Create RITEs
            // RITE rite57 = new RITE(11324657, 1);
            // rite57.AddCharacteristic(RITChar18);
            // rite57.AddCharacteristic(RITChar19);
            // RITE rite58 = new RITE(11324658, 1);
            // rite58.AddCharacteristic(RITChar20);
            // rite58.AddCharacteristic(RITChar21);
            // _rites.Add(rite57);
            // _rites.Add(rite58);

            // //Create AtomicRITE
            //// AtomicRITE(string _subperil, ExposureType _expType, RITE _rite, long ID)
            // AtomicRITE aRite5718EQ = new AtomicRITE("EQ", ExposureType.Building, rite57, 19419518);
            // AtomicRITE aRite5718WS = new AtomicRITE("WS", ExposureType.Building, rite57, 19419518);
            // AtomicRITE aRite5719EQ = new AtomicRITE("EQ", ExposureType.Building, rite57, 19419519);
            // AtomicRITE aRite5719WS = new AtomicRITE("WS", ExposureType.Building, rite57, 19419519);
            // AtomicRITE aRite5820EQ = new AtomicRITE("EQ", ExposureType.Building, rite58, 19419520);
            // AtomicRITE aRite5820WS = new AtomicRITE("WS", ExposureType.Building, rite58, 19419520);
            // AtomicRITE aRite5821EQ = new AtomicRITE("EQ", ExposureType.Building, rite58, 19419521);
            // AtomicRITE aRite5821WS = new AtomicRITE("WS", ExposureType.Building, rite58, 19419521);

            // _atomicCoverageRITEs.Add(aRite5718EQ);
            // _atomicCoverageRITEs.Add(aRite5718WS);
            // _atomicCoverageRITEs.Add(aRite5719EQ);
            // _atomicCoverageRITEs.Add(aRite5719WS);
            // _atomicCoverageRITEs.Add(aRite5820EQ);
            // _atomicCoverageRITEs.Add(aRite5820WS);
            // _atomicCoverageRITEs.Add(aRite5821EQ);
            // _atomicCoverageRITEs.Add(aRite5821WS);

            //Create Schedules
            ScheduleOfRITEs S2729_EQ       = expdata.Schedules.ToList()[0];
            ScheduleOfRITEs S2729_EQ_59491 = expdata.Schedules.ToList()[1];
            ScheduleOfRITEs S2729_EQ_59492 = expdata.Schedules.ToList()[2];

            //Create Subjects
            PrimarySubject Node41Sub = new PrimarySubject(S2729_EQ_59491, Building, EQ);
            PrimarySubject Node42Sub = new PrimarySubject(S2729_EQ_59491, Contents, EQ);

            PrimarySubject Node31Sub = new PrimarySubject(S2729_EQ_59491, Loss, EQ);
            PrimarySubject Node32Sub = new PrimarySubject(S2729_EQ_59492, Loss, EQ);

            PrimarySubject Node21Sub = new PrimarySubject(S2729_EQ, Loss, EQ);

            ///////////// New Contructors for Node, for reading from JSON prototype///Sunny
            //Create Nodes and Add to Node List
            //loccvg terms
            //TermNode Node41 = new TermNode(Node41Sub, false, false, 8000000, 10000000); //loccvg
            TermNode Node41 = new TermNode(Node41Sub); //loccvg

            graphNodes.Add(Node41);
            TermNode Node42 = new TermNode(Node42Sub);  //loccvg

            graphNodes.Add(Node42);

            //loc terms
            TermNode Node31 = new TermNode(Node31Sub); //loc

            graphNodes.Add(Node31);
            TermNode Node32 = new TermNode(Node32Sub); //loc

            graphNodes.Add(Node32);

            //policy term
            TermNode Node21 = new TermNode(Node21Sub);  //policy term, no limit term, so limit = 0?

            graphNodes.Add(Node21);

            //policy cover
            CoverNode Node11 = new CoverNode(Node21Sub, "L102_3222");  //policy layer

            graphNodes.Add(Node11);

            //Build Parent to Child Mapping
            List <GraphNode> Node11Children = new List <GraphNode>()
            {
                Node21
            };

            parentToChildrenMap.Add(Node11, Node11Children);

            List <GraphNode> Node21Children = new List <GraphNode>()
            {
                Node31, Node32
            };

            parentToChildrenMap.Add(Node21, Node21Children);

            List <GraphNode> Node31Children = new List <GraphNode>()
            {
                Node41, Node42
            };

            parentToChildrenMap.Add(Node31, Node31Children);

            AssignLevelToNode();

            TopNodes = new List <GraphNode>()
            {
                Node11
            };

            BuildAtomicRITEs();

            GraphReady = true;
        } //end of Initialize
Пример #23
0
        public void UpdateGraphForPerRiskArrayForm()
        {
            HashSet <PrimarySubject> DistinctPerRiskSubjects = GetDistinctPerRiskSubjects();
            Dictionary <PrimarySubject, Dictionary <string, int> > PerRiskSubjectDict = new Dictionary <PrimarySubject, Dictionary <string, int> >();

            HashSet <PrimarySubject> ExplodedSubject = new HashSet <PrimarySubject>();

            //Now we have unique list of Per Risk Subject, just explode them
            foreach (PrimarySubject s in DistinctPerRiskSubjects)
            {
                Dictionary <string, int> temp = new Dictionary <string, int>();
                //explode them
                foreach (RITE rite in s.Schedule.ScheduleList)
                {
                    HashSet <RITE> aRite = new HashSet <RITE>();
                    aRite.Add(rite);
                    ScheduleOfRITEs newSchedule = new ScheduleOfRITEs("Exploded." + rite.ToString(), aRite, new HashSet <RITCharacteristic> {
                    });
                    PrimarySubject newSub       = FormNewSubject(s, newSchedule);
                    ExplodedSubjectList.Add(newSub);
                    temp.Add(newSchedule.Name, newSub.ID);
                }
                PerRiskSubjectDict.Add(s, temp);
            }

            foreach (PrimarySubject s in DistinctPerRiskSubjects)
            {
                foreach (PrimarySubject notPerRiskSub in OriginalSubjectsMinusPerRisk)
                {
                    //copy the result
                    if (SubjectTreeMatrix[s.ID, notPerRiskSub.ID] == SubjectCompareOutcome.Parent)
                    {
                        foreach (string rite in PerRiskSubjectDict[s].Keys)
                        {
                            SubjectTreeArray[PerRiskSubjectDict[s][rite]].Add(notPerRiskSub.ID, SubjectCompareOutcome.Parent);
                        }
                    }
                    else if (SubjectTreeMatrix[s.ID, notPerRiskSub.ID] == SubjectCompareOutcome.Child || SubjectTreeMatrix[s.ID, notPerRiskSub.ID] == SubjectCompareOutcome.Overlap)
                    {
                        foreach (string rite in PerRiskSubjectDict[s].Keys)
                        {
                            if (CompareTwoSchedules(s.Schedule, notPerRiskSub.Schedule) == SubjectCompareOutcome.Parent)
                            {
                                SubjectTreeArray[PerRiskSubjectDict[s][rite]].Add(notPerRiskSub.ID, SubjectCompareOutcome.Parent);
                            }
                        }
                    }
                }

                foreach (PrimarySubject other in DistinctPerRiskSubjects)
                {
                    if (s.ID != other.ID && SubjectTreeMatrix[s.ID, other.ID] == SubjectCompareOutcome.Parent)
                    {
                        foreach (string rite in PerRiskSubjectDict[s].Keys)
                        {
                            SubjectTreeArray[PerRiskSubjectDict[s][rite]].Add(PerRiskSubjectDict[other][rite], SubjectCompareOutcome.Parent);
                        }
                    }
                }
            }
        }
Пример #24
0
 protected override void SetContractSubject()
 {
     ContractSubject = new PrimarySubject(Declarations.Schedule, Declarations.ExposureTypes, Declarations.CausesofLoss);
 }
Пример #25
0
 public PrimarySubject FormNewSubject(PrimarySubject s, ScheduleOfRITEs _schedule)
 {
     return(new PrimarySubject(_schedule, s.ExposureTypes, s.CauseOfLossSet));
 }
Пример #26
0
        public override void Initialize()
        {
            ////Build Graph here....
            //_graphNodes = new List<GraphNode>();
            //_parentToChildrenMap = new Dictionary<GraphNode, List<GraphNode>>();
            //_rites = new List<RITE>();
            //_schedules = new List<Schedule>();
            //_characteristics = new List<RITCharacteristic>();

            ////Add Contract Declarations
            //Declarations = new Declarations();

            ////Create RITECharacteristics
            //RITCharacteristic RITChar18 = new RITCharacteristic(19419518, ExposureType.Building, 100000);
            //RITCharacteristic RITChar19 = new RITCharacteristic(19419519, ExposureType.Contents, 10000);
            //RITCharacteristic RITChar20 = new RITCharacteristic(19419520, ExposureType.Building, 100000);
            //RITCharacteristic RITChar21 = new RITCharacteristic(19419521, ExposureType.Contents, 10000);
            //_characteristics.Add(RITChar18);
            //_characteristics.Add(RITChar19);
            //_characteristics.Add(RITChar20);
            //_characteristics.Add(RITChar21);

            ////Create RITEs
            //RITE rite57 = new RITE(11324657, 1);
            //rite57.AddCharacteristic(RITChar18);
            //rite57.AddCharacteristic(RITChar19);
            //RITE rite58 = new RITE(11324658, 1);
            //rite58.AddCharacteristic(RITChar20);
            //rite58.AddCharacteristic(RITChar21);
            //_rites.Add(rite57);
            //_rites.Add(rite58);

            ////Create Schedules
            //Schedule S2729_EQ = new Schedule("S2729.EQ");
            //S2729_EQ.AddRITE(rite57);
            //S2729_EQ.AddRITE(rite58);
            //_schedules.Add(S2729_EQ);

            //Schedule S2729_EQ_59491 = new Schedule("S2729.EQ.59491");
            //S2729_EQ_59491.AddRITE(rite57);
            //_schedules.Add(S2729_EQ_59491);

            //Schedule S2729_EQ_59492 = new Schedule("S2729.EQ.59492");
            //S2729_EQ_59492.AddRITE(rite58);
            //_schedules.Add(S2729_EQ_59492);

            //Create Schedules
            ScheduleOfRITEs S2729_EQ       = expdata.Schedules.ToList()[0];
            ScheduleOfRITEs S2729_EQ_59491 = expdata.Schedules.ToList()[1];
            ScheduleOfRITEs S2729_EQ_59492 = expdata.Schedules.ToList()[2];

            //Create Subjects
            PrimarySubject Node41Sub = new PrimarySubject(S2729_EQ_59491, Building, EQ);
            PrimarySubject Node42Sub = new PrimarySubject(S2729_EQ_59491, Contents, EQ);

            PrimarySubject Node31Sub = new PrimarySubject(S2729_EQ_59491, Loss, EQ);
            PrimarySubject Node32Sub = new PrimarySubject(S2729_EQ_59492, Loss, WS);

            PrimarySubject Node21Sub = new PrimarySubject(S2729_EQ, Loss, EQWS);

            //Create Nodes and Add to Node List
            //loccvg terms
            //TermNode Node41 = new TermNode(Node41Sub, false, false, 8000000, 10000000); //loccvg
            TermNode Node41 = new TermNode(Node41Sub); //loccvg

            graphNodes.Add(Node41);
            TermNode Node42 = new TermNode(Node42Sub);  //loccvg

            graphNodes.Add(Node42);

            //loc terms
            TermNode Node31 = new TermNode(Node31Sub); //loc

            graphNodes.Add(Node31);
            TermNode Node32 = new TermNode(Node32Sub); //loc

            graphNodes.Add(Node32);

            //policy term
            TermNode Node21 = new TermNode(Node21Sub);  //policy term, no limit term, so limit = 0?

            graphNodes.Add(Node21);

            //policy cover
            CoverNode Node11 = new CoverNode(Node21Sub, "L102_3222");  //policy layer

            graphNodes.Add(Node11);

            //Build Parent to Child Mapping
            List <GraphNode> Node11Children = new List <GraphNode>()
            {
                Node21
            };

            parentToChildrenMap.Add(Node11, Node11Children);

            List <GraphNode> Node21Children = new List <GraphNode>()
            {
                Node31, Node32
            };

            parentToChildrenMap.Add(Node21, Node21Children);

            List <GraphNode> Node31Children = new List <GraphNode>()
            {
                Node41, Node42
            };

            parentToChildrenMap.Add(Node31, Node31Children);

            TopNodes = new List <GraphNode>()
            {
                Node11
            };
            GraphReady = true;
        } //end of Initialize