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 HashSet <Graph> BuildPosition(HashSet <long> conIDs) { HashSet <Graph> position = new HashSet <Graph>(); foreach (long ID in conIDs) { Graph contract; if (graphCache.GetContract(ID, out contract)) { position.Add(contract); } else { GraphBuilder builder = new GraphBuilder(graphCache); ExposureDataAdaptor expData = graphCache.GetExposure(ID); GraphType type = graphCache.GetSettings(ID).GraphType; contract = builder.MakeGraph(type, expData); graphCache.Add(ID, contract); position.Add(contract); } } return(position); }
public void InputLossForGraph(long ID, LossTimeSeries series) { Graph Contract; if (GraphCache.GetContract(ID, out Contract)) { //Contract.PayoutTimeSeries = series; Contract.IsExecuted = true; } else { throw new InvalidOperationException("Graph for contract: " + ID + " must be built before setting Losses"); } }
public Graph MakeGraph(GraphType type, ExposureDataAdaptor expData) { Graph graph; if (graphCache.GetContract(expData.ContractID, out graph)) { return(graph); } switch (type) { case GraphType.Auto: AutoGraphBuilder builder = new AutoGraphBuilder(expData, graphCache); graph = builder.Build(); break; case GraphType.FixedGraph1: graph = new FixedGraph1(expData); //graph.Initialize(); break; case GraphType.FixedGraph2: graph = new FixedGraph2(expData); //graph.Initialize(); break; case GraphType.FixedGraphOverlap: graph = new FixedGraphOverlap(expData); //graph.Initialize(); break; case GraphType.FixedGraphOverlapSubperil: graph = new FixedGraphOverlapSubperil(expData); //graph.Initialize(); break; case GraphType.FixedGraphOverlapSubperil2: graph = new FixedGraphOverlapSubperil2(expData); //graph.Initialize(); break; case GraphType.FixedTreaty1: graph = new FixedTreaty1(expData, graphCache); //graph.Initialize(); break; default: throw new NotSupportedException("Cannot currently support this treaty type"); } graph.Initialize(); if (graph is FixedPrimaryGraph || graph is FixedTreaty1) ///need to remove FixedTreaty1 condition { GetTermsForGraph(expData, graph); } graph.Reset(); graphCache.Add(graph.ContractID, graph); return(graph); }