Пример #1
0
        public void AddExposureToTreaty(ExposureDataAdaptor otherExposure)
        {
            if (!TreatyIncludesPrimaryData)
            {
                this.UseAggregatedRITEs = otherExposure.UseAggregatedRITEs;
            }
            else
            {
                if (this.UseAggregatedRITEs != otherExposure.UseAggregatedRITEs)
                {
                    throw new InvalidOperationException("Cannot combine extracts from different versions of disaggregation tool, all input primary contracts to a Treaty must be of same disaggreation version!");
                }
            }

            this._characteristics.UnionWith(otherExposure.Characteristics);
            this._rites.UnionWith(otherExposure.ContractRITES);
            this._schedules.UnionWith(otherExposure.Schedules);

            //Combine Dictionarys
            this._characteristicsDict = MergeDictionarys(this._characteristicsDict, otherExposure._characteristicsDict);
            this._ritesDict           = MergeDictionarys(this._ritesDict, otherExposure._ritesDict);
            this._schedulesDict       = MergeDictionarys(this._schedulesDict, otherExposure._schedulesDict);

            //Combine Contract COls
            this.ContractCOLs.UnionWith(otherExposure.ContractCOLs);

            //Combine Aggregate Mappings
            this.RiskCharIDtoAggregateID  = MergeDictionarys(this.RiskCharIDtoAggregateID, otherExposure.RiskCharIDtoAggregateID);
            this.DisaggRitCharToDisAggRIT = MergeDictionarys(this.DisaggRitCharToDisAggRIT, otherExposure.DisaggRitCharToDisAggRIT);
            this.AggregateIDtoDisaggIDs   = MergeDictionarys(this.AggregateIDtoDisaggIDs, otherExposure.AggregateIDtoDisaggIDs);
        }
Пример #2
0
        public ReferenceResultOutput ExecutePeriod(long conID, GraphType type, List <Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > > ListOfguLossDict)
        {
            ExposureDataAdaptor expData = PDataAdaptor.GetExposureAdaptor(conID);
            string error;

            // Gu Loss can be for many contracts for need Dictionary of Mapper as input..
            Dictionary <long, IRITEindexMapper> indexMappers = GetMappers(expData);

            //Need to get mapper for current executing contract to build graph..
            IRITEindexMapper mapperForContract = indexMappers[conID];

            GraphInfo graphInfo = GetGraph(type, expData, mapperForContract);
            Graph     graph     = graphInfo.Graph;

            //Output object
            ReferenceResultOutput ResultOutput = new ReferenceResultOutput(0, 0);

            foreach (Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > >
                     guLossDict in ListOfguLossDict)
            {
                //Execute each event
                graph.EventReset();

                GULossAdaptor guLossAdaptor = new GULossAdaptor(indexMappers, guLossDict, graph.DeclarationsForAssociatedContracts, true);

                GraphExecuterAdaptor MainExecuter = new GraphExecuterAdaptor(graphInfo);

                ResultOutput += MainExecuter.RunExecution(guLossAdaptor);
            }

            return(ResultOutput);
        }
Пример #3
0
 public TreatyContractExtractor(ExposureDataAdaptor _expData, GraphBuildCache _graphCache)
     : base(_expData)
 {
     graphCache             = _graphCache;
     PrimaryDeclarationsSet = new Dictionary <long, Declarations>();
     SetContractSubject();
 }
Пример #4
0
 public PrimaryContractExtractor(ExposureDataAdaptor _expData)
     : base(_expData)
 {
     DedComponent = new Dictionary <PrimarySubject, DeductibleCollection>();
     LimComponent = new Dictionary <PrimarySubject, LimitCollection>();
     SetContractSubject();
 }
Пример #5
0
        private HashSet <GraphInfo> BuildPosition(HashSet <long> conIDs)
        {
            HashSet <GraphInfo> position = new HashSet <GraphInfo>();

            foreach (long ID in conIDs)
            {
                GraphInfo contract;
                if (graphCache.GetGraphInfo(ID, out contract))
                {
                    position.Add(contract);
                }
                else
                {
                    GraphBuilder        builder = new GraphBuilder(graphCache);
                    ExposureDataAdaptor expData = graphCache.GetExposure(ID);
                    GraphType           type    = graphCache.GetSettings(ID).GraphType;
                    IRITEindexMapper    mapper  = GetMapper(expData);

                    contract = builder.MakeGraph(type, expData, mapper);
                    graphCache.Add(ID, contract);
                    position.Add(contract);
                }
            }

            return(position);
        }
Пример #6
0
        //RITE.ID -> numBldgs -> <timestamp -> list of loss>

        //public GUInputGenerator(long conID, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle)
        //{
        //    PartitionDataAdpator PData = new PartitionDataAdpator(PD);
        //    expData = PData.GetExposureAdaptor(conID);
        //    subperils = _COLSet.GetSubperils();
        //    timestyle = _timestyle;
        //    lossstyle = _lossstyle;

        //}

        public GUInputGenerator(ExposureDataAdaptor _expData, HashSet <string> _subperils, TimeStyle _timestyle, LossStyle _lossstyle)
        {
            expData   = _expData;
            subperils = _subperils;
            timestyle = _timestyle;
            lossstyle = _lossstyle;
        }
Пример #7
0
 public ContractExtractor(ExposureDataAdaptor _expData)
 {
     ExpData         = _expData;
     jsonParseResult = _expData.ContractJSON;
     CoverComponent  = new Dictionary <Subject, Dictionary <string, Cover> >();
     Declarations    = new Declarations();
     SetContractDeclarations();
 }
Пример #8
0
        public VectorGUInputGenerator GetGeneratorForContract(long conID)
        {
            ExposureDataAdaptor expData     = pData.GetExposureAdaptor(conID);
            RITEmapper1         mapper      = new RITEmapper1(expData, new RAPSettings(subperils), subperilConfig);
            GUInputGenerator    guGenerator = GeneratorFactory.GetGeneratorForContract(conID);

            return(new VectorGUInputGenerator(guGenerator, mapper));
        }
Пример #9
0
        //RITE.ID -> numBldgs -> <timestamp -> list of loss>

        public GUInputGenerator(PartitionData PD, long conID, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle)
        {
            PartitionDataAdpator PData = new PartitionDataAdpator(PD);

            expData   = PData.GetExposureAdaptor(conID);
            COLSet    = _COLSet;
            timestyle = _timestyle;
            lossstyle = _lossstyle;
            //    Dictionary<long, Dictionary<int, Tuple<int, List<float>>>> GULosses = new Dictionary<long, Dictionary<int, Tuple<int, List<float>>>>();
        }
Пример #10
0
        public PLTGenerator(PartitionData _PD, long _conID, int pid, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossStyle, DateTime _start, DateTime _end)
        {
            PartitionDataAdpator PData = new PartitionDataAdpator(_PD);

            expData   = PData.GetExposureAdaptor(conID);
            PD        = _PD;
            conID     = _conID;
            COLSet    = _COLSet;
            timestyle = _timestyle;
            lossStyle = _lossStyle;
            PLT       = new PeriodLossTable(pid, _COLSet, _timestyle, _lossStyle, _start, _end);
        }
Пример #11
0
        public FixedPrimaryGraph(ExposureDataAdaptor _expdata)
            : base(_expdata.ContractID)
        {
            expdata = _expdata;

            //Build Graph here....
            graphNodes          = new List <GraphNode>();
            parentToChildrenMap = new Dictionary <GraphNode, List <GraphNode> >();
            atomicCoverageRITEs = new HashSet <CoverageAtomicRITE>();

            //Add Contract Declarations
            Declarations = new Declarations();
        }
Пример #12
0
        private ExposureDataAdaptor GetTreatyExposureData(ContractExposure contractExposure)
        {
            ExposureDataAdaptor treatyAdaptor = new ExposureDataAdaptor(contractExposure, NGFM_API);

            treatyAdaptor.ExtractPositionData();

            foreach (long conID in treatyAdaptor.Positions.GetDependentContracts())
            {
                ExposureDataAdaptor childContractData = GetExposureAdaptor(conID);
                treatyAdaptor.CombineExposure(childContractData);
            }

            return(treatyAdaptor);
        }
Пример #13
0
        public RITEmapper1(ExposureDataAdaptor _expData, RAPSettings _rapsettings, ISubPerilConfig _subperilConfig)
        {
            expData = _expData;
            HashSet <string> subPerilInputList = new HashSet <string>(_rapsettings.SubPerils.Union(_expData.ContractCOLs.GetSubperils()));

            SPmapping                  = new SubPerilMapping(_subperilConfig, subPerilInputList);
            preBldgIndex               = new Dictionary <long, Dictionary <string, int> >();
            CummulativeBuildingMap     = new Dictionary <long, int>();
            UniqueARTIEIndexToRITEID   = new Dictionary <int, long>();
            UniqueARTIEIndexToSubPeril = new Dictionary <int, string>();

            aggregatemapper = new AggregateRITEMapper(expData);
            BuildIndexDictionary();
        }
Пример #14
0
        private IRITEindexMapper GetMapper(ExposureDataAdaptor expData)
        {
            IRITEindexMapper indexMapper;

            if (graphCache.GetIndexMapper(expData.ContractID, out indexMapper))
            {
                return(indexMapper);
            }
            else
            {
                RAPSettings rapsettings = graphCache.GetSettings(expData.ContractID).RAPsettings;
                indexMapper = new RITEmapper1(expData, rapsettings, new RMSSubPerilConfig());
                graphCache.Add(expData.ContractID, indexMapper);
                return(indexMapper);
            }
        }
Пример #15
0
        private ContractExtractor GetContract(ExposureDataAdaptor expData, GraphBuildCache graphCache)
        {
            //Make all graph nodes for Graph
            List <GraphNode>  IntitialGraphNodes = new List <GraphNode>();
            ContractExtractor contract;

            if (expData.TreatyExposure)
            {
                contract = new TreatyContractExtractor(expData, graphCache);
            }
            else
            {
                contract = new PrimaryContractExtractor(expData);
            }

            return(contract);
        }
Пример #16
0
        private Dictionary <long, IRITEindexMapper> GetMappers(ExposureDataAdaptor expData)
        {
            Dictionary <long, IRITEindexMapper> indexMappers = new Dictionary <long, IRITEindexMapper>();

            if (expData.TreatyExposure)
            {
                foreach (long conID in expData.Positions.GetDependentContracts())
                {
                    ExposureDataAdaptor childContractData = PDataAdaptor.GetExposureAdaptor(conID);
                    IRITEindexMapper    childMapper       = GetMapperForContract(childContractData);
                    indexMappers.Add(childContractData.ContractID, childMapper);
                }
                indexMappers.Add(expData.ContractID, null);
            }
            else
            {
                IRITEindexMapper Mapper = GetMapperForContract(expData);
                indexMappers.Add(expData.ContractID, Mapper);
            }

            return(indexMappers);
        }
Пример #17
0
        public ExposureDataAdaptor GetExposureAdaptor(long conID)
        {
            ExposureDataAdaptor exposure;

            if (!expData.TryGetValue(conID, out exposure))
            {
                ContractExposure contractExposure = GetExposure(conID);
                if (contractExposure.ContractType.IsReinsuranceContract())
                {
                    exposure = GetTreatyExposureData(contractExposure);
                }
                else
                {
                    exposure = new ExposureDataAdaptor(contractExposure, NGFM_API);
                    exposure.GetPrimaryData();
                }

                expData.Add(conID, exposure);
            }

            return(exposure);
        }
Пример #18
0
        private void GetTermsForGraph(ExposureDataAdaptor expData, GraphOfNodes graph)
        {
            string message;
            DeclarationExtractor declarationExtractor = new DeclarationExtractor(expData);

            declarationExtractor.GetDeclarations(graph.Declarations, out message);
            FinancialTermExtractor fintermExtractor;

            if (graph.Declarations.ContractType == "Primary Policy")
            {
                fintermExtractor = new PrimaryTermExtractor(expData, graph.Declarations);
            }
            else if (graph.Declarations.ContractType == "Catastrophe Treaty")
            {
                fintermExtractor = new TreatyTermExtractor(expData, graph.Declarations, graphCache);
            }
            else
            {
                throw new NotSupportedException();
            }

            fintermExtractor.GetTermsForGraph(graph, out message);
        }
Пример #19
0
        public double Execute(long conID, GraphType type, Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > guLoss)
        {
            ExposureDataAdaptor expData = PDataAdaptor.GetExposureAdaptor(conID);
            string error;

            //Stopwatch watch = new Stopwatch();
            //watch.Start();
            Graph graph = GetGraph(type, expData);
            //watch.Stop();

            //long graphTime = watch.ElapsedMilliseconds;

            GraphExecuter Executer;

            if (graph is PrimaryGraph)
            {
                Executer = new PrimaryGraphExecuter(graph as PrimaryGraph);
            }
            else if (graph is TreatyGraph)
            {
                Executer = new TreatyGraphExecuter(graph as TreatyGraph);
            }
            else
            {
                throw new NotSupportedException("Can only handle graph of type Treaty and Primary");
            }

            //Execute Graph and Allocate graph
            double payout = Executer.Execute(guLoss);

            //Allocate Graph
            //GraphAllocation Allocater = new GraphAllocation(graph);
            //Allocater.AllocateGraph();

            return(payout);
        }
Пример #20
0
 public FixedGraphOverlapSubperil(ExposureDataAdaptor expData) : base(expData)
 {
 }
Пример #21
0
 public FixedGraph3(ExposureDataAdaptor expData) : base(expData)
 {
 }
Пример #22
0
 public FixedMatrixGraphJPTY(ExposureDataAdaptor expData)
     : base(expData)
 {
 }
Пример #23
0
        public PLTGenerator GetGeneratorForContract(ExposureDataAdaptor _expData)
        {
            GUInputGenerator guGenerator = GeneratorFactory.GetGeneratorForContract(_expData);

            return(new PLTGenerator(guGenerator, Start, End));
        }
Пример #24
0
 public FixedMatrixGraphAmlin1(ExposureDataAdaptor expData) : base(expData)
 {
 }
Пример #25
0
 public FixedTreaty1(ExposureDataAdaptor _expData, GraphBuildCache _cache)
     : base(_expData.ContractID)
 {
     expdata = _expData;
     cache   = _cache;
 }
Пример #26
0
 public AutoGraphBuilder(ExposureDataAdaptor _expData, GraphBuildCache _graphChache)
 {
     expData     = _expData;
     graphChache = _graphChache;
 }
Пример #27
0
 public void CombineExposure(ExposureDataAdaptor otherExposure)
 {
     this._characteristics.UnionWith(otherExposure.Characteristics);
     this._rites.UnionWith(otherExposure.ContractRITES);
     this._schedules.UnionWith(otherExposure.Schedules);
 }
Пример #28
0
 public FixedMatrixGraph(ExposureDataAdaptor _expData)
 {
     expData = _expData;
 }
Пример #29
0
 public StepPolicyGraph(ExposureDataAdaptor expData) : base(expData)
 {
 }
Пример #30
0
        private Graph GetGraph(GraphType type, ExposureDataAdaptor expData)
        {
            GraphBuilder builder = new GraphBuilder(GraphCache);

            return(builder.MakeGraph(type, expData));
        }