public override void Initialize() { _contractRITEs = new HashSet <ContractAtomicRITE>(); //Build Graph here.... graphNodes = new List <GraphNode>(); parentToChildrenMap = new Dictionary <GraphNode, List <GraphNode> >(); atomicCoverageRITEs = new HashSet <CoverageAtomicRITE>(); //Add Contract Declarations Declarations = new Declarations(); Graph overlapGraph; cache.GetContract(11331, out overlapGraph); Graph normalGraph; cache.GetContract(11324656, out normalGraph); ScheduleOfContracts schedule = new ScheduleOfContracts("PositionA_Gross", new HashSet <Graph>() { overlapGraph, normalGraph }); ReinsuranceSubject TreatyNodeSub = new ReinsuranceSubject(schedule, Loss, EQ); CoverNode TreatyNode = new CoverNode(TreatyNodeSub, "OccLim"); //TreatyNode.SetCoverTerms(false, 100, 100000, 1); graphNodes.Add(TreatyNode); this.TopNodes = new List <GraphNode>() { TreatyNode }; this.BuildAtomicRITEs(); }
private void UpdateGraphWithCover(Dictionary <string, object> coverDictionary, GraphOfNodes graph) { bool nodefound = false; Type type = typeof(DedInteractionType); Subject sub = GetSubjectForCover(coverDictionary); foreach (GraphNode node in graph.GraphNodes) { if (node is CoverNode) { CoverNode coverNode = node as CoverNode; Cover cover = TermParser.GetCoverForTerm(coverDictionary); if (coverNode.Subject.Equals(sub) && coverNode.CoverName.Trim() == cover.CoverName.Trim()) { nodefound = true; coverNode.Cover = cover; break; } } } if (!nodefound) { throw new InvalidOperationException("Cannot find Node in fixed graph, for JSON cover with subject: (" + sub.ToString() + ")"); } }
public override void SetAggStates(Dictionary <string, AggState> CoverAggregateStates) { List <CoverNode> coverNodes = graphNodes.Where(node => node is CoverNode).Cast <CoverNode>().ToList(); foreach (KeyValuePair <string, AggState> pair in CoverAggregateStates) { CoverNode NodeToUpdate = coverNodes.Where(node => node.CoverName == pair.Key).First(); NodeToUpdate.CurrentAggState = new AggState(pair.Value); } }
public CoverNode(Subject _subject, string _coverName, CoverNode cNode) : base(_subject) { Payout = 0; CoverName = _coverName; CurrentAllocationState = new AllocationStateCollection2(1); //CurrentAggState = new AggState(Cover.AggDedAmount, Cover.AggLimitAmount, Cover.DedOfAggDedLayer.Amount, Cover.LimitOfAggDedLayer.Amount); CurrentAggState = new AggState(); keystring = keystring + "-Cov: " + _coverName; //Cover = cNode.Cover; Cover = new Cover(cNode.Cover.CoverName, cNode.Cover.AttIsFranchise, cNode.Cover.AttPoint, cNode.Cover.Limit, cNode.Cover.ProRata, cNode.Cover.Unlimited, cNode.Cover.AttachmentTimeBasis, cNode.Cover.LimitTimeBasis, cNode.Cover.LimitValType, cNode.Cover.NumofReinstatements, cNode.Cover.UnlimitedReinstatements); }
public void AllocateGraph() { CoverNode topCover = graph.TopNodes[0] as CoverNode; if (topCover == null) { throw new InvalidOperationException("Top node must be a cover node! Cannot execute graph..."); } IAllocatable topIA = topCover as IAllocatable; //init the allocation state to be the lossState topCover.GetAllocState().collection[0].P = topCover.GetPayout(); RecursiveAllocateIAllocatable(topIA); } //AllocateGraph
public ExecutionOutput ExecuteCover(GUInputEngine guinputengine, CoverNode topCover) { if (graph.IsOverlapped == false) { RecursiveExecution(topCover, guinputengine); //Allocate Graph GraphAllocation Allocater = new GraphAllocation(graph); Allocater.AllocateGraph(); } else { ExecuteOverlappedGraph(guinputengine); } graph.IsExecuted = true; graph.exResults = new ExecutionOutput(topCover.Payout, graph.AtomicRites); return(graph.exResults); }
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); } } } }
private List <GraphNode> GetCoverNodes(ContractExtractor contract, List <Subject> graphSubs) { List <GraphNode> coverNodes = new List <GraphNode>(); foreach (Subject sub in graphSubs) { HashSet <Cover> covers; if (contract.GetCoversForSubject(sub, out covers)) { foreach (Cover cover in covers) { CoverNode node = new CoverNode(sub, cover.CoverName); node.Cover = cover; coverNodes.Add(node); } } } return(coverNodes); }
public List <CoverNode> GetCoverNodes() { List <CoverNode> coverNodes = new List <CoverNode>(); List <Subject> graphSubs = Contract.GetAllCoverSubjects(); foreach (Subject sub in graphSubs) { HashSet <Cover> covers; if (Contract.GetCoversForSubject(sub, out covers)) { foreach (Cover cover in covers) { CoverNode node = new CoverNode(sub, cover.CoverName); node.Cover = cover; coverNodes.Add(node); } } } return(coverNodes); }
private void RecursiveExecution(GraphNode currNode, GUInputEngine guLossesEngine) { Aggregation aggType = Aggregation.Summed; if (currNode is TermNode) { TermNode currTermNode = currNode as TermNode; //Execution for Term Node here... if (currTermNode.Executed == true) { return; } //execute child node first List <GraphNode> childrenNodes = graph.GetChildrenForNode(currTermNode); List <TermNode> childrenTermNodes = new List <TermNode>(); foreach (GraphNode childNode in childrenNodes) //Parallel.ForEach(childrenNodes, childNode => { TermNode childTermNode = childNode as TermNode; if (childTermNode == null) { throw new InvalidOperationException("Term node's children must be Term node."); } childrenTermNodes.Add(childTermNode); if (childNode.Executed == false) { RecursiveExecution(childTermNode, guLossesEngine); } } //); //has not executed, get the GU loss first double[] inputlosses; //inputlosses = graph.GetNodeSubjectLoss(currTermNode).AllLoss().Zip(currTermNode.PrimarySubject.Schedule.MultiplierArr, (d1, d2) => d1 * d2).ToArray(); inputlosses = graph.GetNodeSubjectLoss(currTermNode).AllLoss(); currTermNode.CurrentLossStateCollection.SetSubjectLosses(inputlosses); if (currTermNode.IsPerRisk == true && currTermNode.PrimarySubject.Schedule.ActNumOfBldgs > 1) { aggType = Aggregation.PerBuilding; } else { //need reset the lossState to act as only one building LossStateCollection tempLossStateCollection = new LossStateCollection(1); tempLossStateCollection.collection[0] = currTermNode.CurrentLossStateCollection.GetTotalSum; currTermNode.CurrentLossStateCollection = tempLossStateCollection; } //if no childrenNodes, nothing to do with the Interaction: the interaction terms are all zeros. if (childrenNodes.Count > 0) { //initialize InterObj InteractionObject[] InterObj = GetInterObj(currTermNode, aggType, childrenTermNodes); TermFunctionalEngine tFunEng = new TermFunctionalEngine(currTermNode, aggType); tFunEng.TermFunction(InterObj); //Interaction //InteractionEngine InterEng = new InteractionEngine(currTermNode, aggType, InterObj); //InterEng.Interaction(); } else { TermFunctionalEngine tFunEng = new TermFunctionalEngine(currTermNode, aggType); tFunEng.TermFunction(new InteractionObject[0]); //no interaction } //Final Adjustment for (int i = 0; i < currTermNode.CurrentLossStateCollection.NumBldgs; i++) { currTermNode.CurrentLossStateCollection.collection[i].AdjustR(); } currTermNode.CurrentLossStateCollection.CalcTotalSum(); currTermNode.Executed = true; } else //currNode is Cover Node { CoverNode currCoverNode = currNode as CoverNode; //Execution for Cover Node here... if (currCoverNode.Executed == true) { return; } foreach (AtomicRITE aRite in currCoverNode.ResidualAtomicRITEs) { currCoverNode.Payout += aRite.GetLossState().GetTotalSum.R; } // Parallel.ForEach(graph.GetChildrenForNode(currCoverNode), childNode => foreach (GraphNode childNode in graph.GetChildrenForNode(currCoverNode)) { RecursiveExecution(childNode, guLossesEngine); if (childNode is TermNode) { TermNode childTermNode = childNode as TermNode; //LossState currentLossState = new LossState(childTermNode.CurrentLossStateCollection.GetTotalSum); //currCoverNode.Payout += currentLossState.R; currCoverNode.Payout += childTermNode.CurrentLossStateCollection.GetTotalSum.R; } else { CoverNode childCoverNode = childNode as CoverNode; currCoverNode.Payout += childCoverNode.Payout; } } // ); CoverNodeFunctionalEngine coverNodeFuncEng = new CoverNodeFunctionalEngine(currCoverNode); coverNodeFuncEng.CoverNodeFunction(); currCoverNode.Executed = true; } //currNode is Cover Node }
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
private void AllocateOverlappedCoverNode(CoverNode currCoverNode, HashSet <CoverageAtomicRITE> SubjectARITEs) { int numOfChildren = SubjectARITEs.Count; //for cover node, always allocate as summed Double childrenRSum = SubjectARITEs.Sum(item => item.GetLossState().GetTotalSum.R); Double childrenSSum = SubjectARITEs.Sum(item => item.GetLossState().GetTotalSum.S); AllocationStateCollection[] MidAllocationStateCollection = new AllocationStateCollection[numOfChildren]; int j = 0; foreach (CoverageAtomicRITE childNode in SubjectARITEs) { MidAllocationStateCollection[j] = new AllocationStateCollection(childNode.GetAllocState().NumBldgs); j++; } if (childrenRSum != 0) { j = 0; //child foreach (CoverageAtomicRITE childNode in SubjectARITEs) { //devided among children double temp = currCoverNode.GetPayout() * childNode.GetLossState().GetTotalSum.R / childrenRSum; for (int jj = 0; jj < childNode.GetAllocState().NumBldgs; jj++) { //divided among building if (childNode.GetLossState().GetTotalSum.S > 0) { MidAllocationStateCollection[j].collection[jj].P = temp * childNode.GetLossState().collection[jj].S / childNode.GetLossState().GetTotalSum.S; } else { MidAllocationStateCollection[j].collection[jj].P = temp / childNode.GetAllocState().NumBldgs; } } j++; } } else { j = 0; //child foreach (CoverageAtomicRITE childNode in SubjectARITEs) { //devided among children double temp = currCoverNode.GetPayout() * childNode.GetLossState().GetTotalSum.S / childrenSSum; for (int jj = 0; jj < childNode.GetAllocState().NumBldgs; jj++) { //divided among building if (childNode.GetLossState().GetTotalSum.S > 0) { MidAllocationStateCollection[j].collection[jj].P = temp * childNode.GetLossState().collection[jj].S / childNode.GetLossState().GetTotalSum.S; } else { MidAllocationStateCollection[j].collection[jj].P = temp / childNode.GetAllocState().NumBldgs; } } j++; } } j = 0; foreach (CoverageAtomicRITE childNode in SubjectARITEs) { for (int jj = 0; jj < childNode.GetAllocState().NumBldgs; jj++) { MidAllocationStateCollection[j].collection[jj].P += childNode.GetAllocState().collection[jj].P; MidAllocationStateCollection[j].collection[jj].S = childNode.GetAllocState().collection[jj].S; } childNode.SetAllocState(MidAllocationStateCollection[j]); j++; } }
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
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
private CoverNode CurrNode; //Attachment only for Cover Node public CoverNodeFunctionalEngine(CoverNode _currNode) { CurrNode = _currNode; }
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
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
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