Ejemplo n.º 1
0
        public void GenerateCasesLarge()
        {
            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));

            foreach (var m in multipliersLarge)
            {
                for (int i = 1; i <= N; i++)
                {
                    var l = new Litige(Math.Round(1 * m));
                    l.decidePremiereInstance();
                    dtRaw.Rows.Add(
                        m,
                        l.dommage,
                        l.fraisJudiciaires,
                        l.depens,
                        l.honoraireAvocats,
                        l.calculeProbabiliteMinimum()
                        );
                }
            }
            Csv.Write(dtRaw, foDataLarge);
        }
Ejemplo n.º 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);
        }