Beispiel #1
0
        public void CalculTauxProcedure()
        {
            var dt = new DataTable("choice");

            dt.Columns.Add("Facteur", typeof(double));
            dt.Columns.Add("TauxProces", typeof(double));
            dt.Columns.Add("Type", typeof(string));

            foreach (var m in multipliersTaux)
            {
                int count = 0, countSans = 0, countAvec = 0, countDemi = 0;
                for (int i = 1; i <= N; i++)
                {
                    count++;
                    var l = new Litige(m);
                    if (l.decidePremiereInstance())
                    {
                        countAvec++;
                    }
                    if (l.decidePremiereInstanceSansAvocat())
                    {
                        countSans++;
                    }
                    if (l.decidePremiereInstanceDemiAvance())
                    {
                        countDemi++;
                    }
                }
                System.Console.WriteLine("Finished set {0} ; total {1} simulations", m, count);
                dt.Rows.Add(m, ((double)countSans) / N, "CPC sans avocat");
                dt.Rows.Add(m, ((double)countAvec) / N, "CPC avec avocat");
                dt.Rows.Add(m, ((double)countDemi) / N, "P-CPC avec avocat");
            }
            var foTaux = new FileInfo(Path.Combine(doBase.FullName, "results-taux.csv"));

            Csv.Write(dt, foTaux);
        }
Beispiel #2
0
        public void GenerateCasesPool()
        {
            Dictionary <double, List <Litige> > dictLitige = new Dictionary <double, List <Litige> >();

            var dtRaw = new DataTable("allData");

            dtRaw.Columns.Add("Facteur", typeof(double));
            dtRaw.Columns.Add("Dommage", typeof(double));
            dtRaw.Columns.Add("Frais", typeof(double));
            dtRaw.Columns.Add("Depens", typeof(double));
            dtRaw.Columns.Add("Honoraires", typeof(double));
            dtRaw.Columns.Add("ProbaGain", typeof(double));

            var dtTauxPool = new DataTable("choicePool");

            dtTauxPool.Columns.Add("Dommage", typeof(double));
            dtTauxPool.Columns.Add("TauxProces", typeof(double));
            dtTauxPool.Columns.Add("Type", typeof(string));

            var dtRawPool = new DataTable("allDataPool");

            dtRawPool.Columns.Add("Facteur", typeof(double));
            dtRawPool.Columns.Add("FacteurGroup", typeof(double));
            dtRawPool.Columns.Add("Frais", typeof(double));
            dtRawPool.Columns.Add("Depens", typeof(double));
            dtRawPool.Columns.Add("Honoraires", typeof(double));
            dtRawPool.Columns.Add("ProbaGain", typeof(double));
            dtRawPool.Columns.Add("TypeGroup", typeof(string));

            foreach (var m in multipliers)
            {
                dictLitige[m] = new List <Litige>();
                int count = 0;
                foreach (var ds in damageJitter)
                {
                    var l = new Litige(Math.Round(ds * m));
                    dictLitige[m].Add(l);
                    dtRaw.Rows.Add(
                        m,
                        ds * m,
                        l.fraisJudiciaires,
                        l.depens,
                        l.honoraireAvocats,
                        l.calculeProbabiliteMinimum()
                        );
                    if (l.decidePremiereInstanceDemiAvance())
                    {
                        count++;
                    }
                }
                dtTauxPool.Rows.Add(m, ((double)count) / N, "PCP/1");
            }
            Csv.Write(dtRaw, foData);

            // Part pooling
            var pooling = new List <int>()
            {
                2, 4, 10, 50, 100
            };

            foreach (var m in multipliers)
            {
                var shuffledLitiges = dictLitige[m].OrderBy(a => Guid.NewGuid()).ToList();
                foreach (var p in pooling)
                {
                    var groupType = String.Format("G-{0}", p);
                    int count     = 0;
                    int n         = N / p;
                    for (int i = 0; i < n; i++)
                    {
                        var test  = shuffledLitiges.GetRange(i * p, p);
                        var group = new LitigeGroup(test);
                        if (group.decidePremiereInstanceDemiAvance())
                        {
                            count += group.count;
                        }
                        dtRawPool.Rows.Add(m,
                                           m * p,
                                           group.fraisJudiciaires,
                                           group.depens,
                                           group.honoraireAvocats,
                                           group.calculeProbabiliteMinimum(),
                                           groupType
                                           );
                    }
                    dtTauxPool.Rows.Add(m, ((double)count) / N, groupType);
                }
            }
            Csv.Write(dtTauxPool, foTauxGroup);
            Csv.Write(dtRawPool, forRawPool);
        }