コード例 #1
0
ファイル: CrossOver.cs プロジェクト: wlwtvr/Po
        public CrossOver(List <Individu> individu, double crossrate, int popSize)
        {
            double offspring = crossrate * (double)popSize;

            offspring = Math.Floor(offspring);

            SqliteDatabase db = new SqliteDatabase();

            DataTable dt = db.query("SELECT * FROM gejala");

            rule = new List <Gejala>();

            foreach (DataRow row in dt.Rows)
            {
                Gejala   g = new Gejala();
                double[] p = new double[3];
                g.SetKodeGejala(Convert.ToString(row["kode_gejala"]));
                g.SetNamaGejala(Convert.ToString(row["nama_gejala"]));
                p[0] = Convert.ToDouble(row["pneumonia"]);
                p[1] = Convert.ToDouble(row["bronkitis"]);
                p[2] = Convert.ToDouble(row["urti"]);
                g.SetPenyakit(p);
                rule.Add(g);
            }

            Density de = new Density(rule);

            de.setMinMax(-0.25, 0.25);
            Individu alpha = new Individu(de.GetDensity());

            crossover = new List <Individu>();

            int[] randomIndividu = generateNumber(individu.Count);
            int   offset         = 0;

            while (crossover.Count < offspring)
            {
                List <Gejala> c = new List <Gejala>();
                c = Cross(individu[offset], individu[offset + 1], alpha);
                Individu v = new Individu(c);
                crossover.Add(v);

                if (crossover.Count < offspring)
                {
                    c = Cross(individu[offset + 1], individu[offset], alpha);
                    Individu v2 = new Individu(c);
                    crossover.Add(v2);
                    offset = offset + 2;
                }
            }
        }
コード例 #2
0
ファイル: CrossOver.cs プロジェクト: wellwhatever/Po
        public CrossOver(List<Individu> individu, double crossrate, int popSize)
        {
            double offspring = crossrate * (double) popSize;
            offspring = Math.Floor(offspring);

            SqliteDatabase db = new SqliteDatabase();

            DataTable dt = db.query("SELECT * FROM gejala");

            rule = new List<Gejala>();

            foreach (DataRow row in dt.Rows)
            {
                Gejala g = new Gejala();
                double[] p = new double[3];
                g.SetKodeGejala(Convert.ToString(row["kode_gejala"]));
                g.SetNamaGejala(Convert.ToString(row["nama_gejala"]));
                p[0] = Convert.ToDouble(row["pneumonia"]);
                p[1] = Convert.ToDouble(row["bronkitis"]);
                p[2] = Convert.ToDouble(row["urti"]);
                g.SetPenyakit(p);
                rule.Add(g);
            }

            Density de = new Density(rule);
            de.setMinMax(-0.25, 0.25);
            Individu alpha = new Individu(de.GetDensity());

            crossover = new List<Individu>();

            int[] randomIndividu = generateNumber(individu.Count);
            int offset = 0;
            while (crossover.Count < offspring)
            {
                List<Gejala> c = new List<Gejala>();
                c = Cross(individu[offset], individu[offset + 1], alpha);
                Individu v = new Individu(c);
                crossover.Add(v);

                if (crossover.Count < offspring)
                {
                    c = Cross(individu[offset + 1], individu[offset], alpha);
                    Individu v2 = new Individu(c);
                    crossover.Add(v2);
                    offset = offset + 2;
                }    
            }
            
        }
コード例 #3
0
ファイル: Mutasi.cs プロジェクト: wlwtvr/Po
        public Mutasi(List <Individu> individu, double mutasiRate, int popSize, double maxmin, List <Gejala> rule)
        {
            this.rule = rule;
            double offspring = mutasiRate * (double)popSize;

            offspring = Math.Floor(offspring);

            List <Gejala> g = new List <Gejala>();

            int randomIndividu = GetRandomIndex(individu.Count);
            int randomGejala   = GetRandomIndex(rule.Count);
            int randomPenyakit = GetRandomIndex(3);

            double r = GetRandomNumber(-0.1, 0.1);

            double[] gen = individu[randomIndividu].find(rule[randomGejala].GetKodeGejala());
            gen[randomPenyakit] = gen[randomPenyakit] + (r * maxmin);

            for (int i = 0; i < rule.Count; i++)
            {
                Gejala gg = new Gejala();
                gg.SetKodeGejala(rule[i].GetKodeGejala());
                if (i == randomGejala)
                {
                    gg.SetPenyakit(gen);
                }
                else
                {
                    gg.SetPenyakit(individu[randomIndividu].find(rule[i].GetKodeGejala()));
                }

                g.Add(gg);
            }

            hasilMutasi = new Individu(g);
        }
コード例 #4
0
ファイル: Mutasi.cs プロジェクト: wellwhatever/Po
        public Mutasi(List<Individu> individu, double mutasiRate, int popSize, double maxmin, List<Gejala> rule)
        {
            this.rule = rule;
            double offspring = mutasiRate * (double)popSize;
            offspring = Math.Floor(offspring);

            List<Gejala> g = new List<Gejala>();

            int randomIndividu = GetRandomIndex(individu.Count);
            int randomGejala = GetRandomIndex(rule.Count);
            int randomPenyakit = GetRandomIndex(3);

            double r = GetRandomNumber(-0.1, 0.1);
            
            double[] gen = individu[randomIndividu].find(rule[randomGejala].GetKodeGejala());
            gen[randomPenyakit] = gen[randomPenyakit] + (r * maxmin);

            for (int i = 0; i < rule.Count; i++)
            {
                Gejala gg = new Gejala();
                gg.SetKodeGejala(rule[i].GetKodeGejala());
                if (i == randomGejala)
                {
                    gg.SetPenyakit(gen);
                }
                else
                {
                    gg.SetPenyakit(individu[randomIndividu].find(rule[i].GetKodeGejala()));
                }

                g.Add(gg);
            }
            
            hasilMutasi = new Individu(g);

        }
コード例 #5
0
ファイル: DiagnosaPage.cs プロジェクト: wlwtvr/Po
        private void Diagnose(List <Kasus> listKasus)
        {
            DataTable     dota = db.query("SELECT * FROM individu");
            List <Gejala> iv   = new List <Gejala>();

            foreach (DataRow dr in dota.Rows)
            {
                Gejala g = new Gejala();
                g.SetKodeGejala(Convert.ToString(dr["kode_gejala"]));
                double[] p = new double[3];
                p[0] = Convert.ToDouble(dr["pneumonia"]);
                p[1] = Convert.ToDouble(dr["bronkitis"]);
                p[2] = Convert.ToDouble(dr["urti"]);
                g.SetPenyakit(p);
                iv.Add(g);
            }

            Individu       iu         = new Individu(iv);
            DempsterShafer ds         = new DempsterShafer(iu, listKasus);
            List <Mass>    hasilAkhir = ds.GetMFinal();
            int            indeksMaks = 0;
            double         terbesar   = 0;

            for (int x = 0; x < hasilAkhir.Count; x++)
            {
                if (terbesar < hasilAkhir[x].GetDensity())
                {
                    terbesar   = hasilAkhir[x].GetDensity();
                    indeksMaks = x;
                }
            }

            List <string> d            = hasilAkhir[indeksMaks].GetPenyakit();
            string        namaPenyakit = "";

            foreach (string s in d)
            {
                namaPenyakit += GetNamaPenyakit(s) + "\n";
            }
            labelNamaPenyakit.Text = namaPenyakit;

            string nilaiBelief = Convert.ToString(terbesar);

            labelNilaiBelief.Text = nilaiBelief;
        }
コード例 #6
0
ファイル: CrossOver.cs プロジェクト: wlwtvr/Po
        private List <Gejala> Cross(Individu a, Individu b, Individu alpha)
        {
            List <Gejala> hasilKross = new List <Gejala>();

            for (int i = 0; i < rule.Count; i++)
            {
                Gejala   g        = new Gejala();
                double[] aDen     = a.find(rule[i].GetKodeGejala());
                double[] bDen     = b.find(rule[i].GetKodeGejala());
                double[] alphaden = alpha.find(rule[i].GetKodeGejala());
                double[] hasil    = new double[3];
                for (int j = 0; j < 3; j++)
                {
                    hasil[j] = aDen[j] + alphaden[j] * (bDen[j] - aDen[j]);
                }

                g.SetKodeGejala(rule[i].GetKodeGejala());
                g.SetPenyakit(hasil);

                hasilKross.Add(g);
            }

            return(hasilKross);
        }
コード例 #7
0
ファイル: Density.cs プロジェクト: wlwtvr/Po
 private void GenerateRandom()
 {
     density.Clear();
     for (int i = 0; i < rule.Count; i++)
     {
         Gejala ge = new Gejala();
         ge.SetKodeGejala(rule[i].GetKodeGejala());
         ge.SetNamaGejala(rule[i].GetNamaGejala());
         double[] p = new double[3];
         for (int j = 0; j < 3; j++)
         {
             if (rule[i].GetPenyakitById(j) == 1)
             {
                 p[j] = Math.Round(GetRandomNumber(this.minimum, this.maximum), 5);
             }
             else
             {
                 p[j] = 0;
             }
         }
         ge.SetPenyakit(p);
         density.Add(ge);
     }
 }
コード例 #8
0
ファイル: Density.cs プロジェクト: wellwhatever/Po
 private void GenerateRandom()
 {
     density.Clear();
     for (int i = 0; i < rule.Count; i++)
     {
         Gejala ge = new Gejala();
         ge.SetKodeGejala(rule[i].GetKodeGejala());
         ge.SetNamaGejala(rule[i].GetNamaGejala());
         double[] p = new double[3];
         for (int j = 0; j < 3; j++)
         {
             if (rule[i].GetPenyakitById(j) == 1)
             {
                 p[j] = Math.Round(GetRandomNumber(this.minimum, this.maximum), 5);
             }
             else
             {
                 p[j] = 0;
             }
         }
         ge.SetPenyakit(p);
         density.Add(ge);
     }
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: wellwhatever/Po
        public Form1()
        {
            InitializeComponent();
            db = new SqliteDatabase();
            DataTable dt = new DataTable();
            dt = db.query("SELECT * FROM gejala");

            List<Gejala> rule = new List<Gejala>();

            double[,] cek = {
                {0.534, 0.875, 0.530},
                {0.238, 0.374, 0.573},
                {0.468,	0,	0},
                {0.375,	0.583, 0.384},
                {0,	0.347, 0.474},
                {0.472,	0.582, 0},
                {0,	0.285, 0.372},
                {0,	0.514, 0.572},
                {0.372,	0.512, 0},
                {0.582,	0, 0},
                {0,	0.352, 0},
                {0,	0,	0.235},
                {0.682,	0.235, 0},
                {0,	0.523, 0},
                {0.5325, 0,	0},
                {0.5244, 0.483,	0},
                {0,	0.602, 0.662}
            };

            List<double[]> c*k = new List<double[]>();
            for (int z = 0; z < cek.GetLength(0); z++)
            {
                double[] fak = new double[3];
                fak[0] = cek[z, 0];
                fak[1] = cek[z, 1];
                fak[2] = cek[z, 2];
                c*k.Add(fak);
            }


                foreach (DataRow row in dt.Rows)
                {
                    Gejala g = new Gejala();
                    double[] p = new double[3];
                    g.SetKodeGejala(Convert.ToString(row["kode_gejala"]));
                    g.SetNamaGejala(Convert.ToString(row["nama_gejala"]));
                    p[0] = Convert.ToDouble(row["pneumonia"]);
                    p[1] = Convert.ToDouble(row["bronkitis"]);
                    p[2] = Convert.ToDouble(row["urti"]);
                    g.SetPenyakit(p);
                    rule.Add(g);
                }

            List<Gejala> pesatu = new List<Gejala>();

            for (int i = 0; i < rule.Count; i++)
            {
                Gejala h = new Gejala();
                h.SetKodeGejala(rule[i].GetKodeGejala());
                h.SetPenyakit(c*k[i]);
                pesatu.Add(h);
            }

            de = new Density(rule);
            p1 = new Individu(pesatu);
            p2 = new Individu(de.GetDensity());
        }
コード例 #10
0
        public Form1()
        {
            InitializeComponent();
            db = new SqliteDatabase();
            DataTable dt = new DataTable();

            dt = db.query("SELECT * FROM gejala");

            List <Gejala> rule = new List <Gejala>();

            double[,] cek =
            {
                {  0.534, 0.875, 0.530 },
                {  0.238, 0.374, 0.573 },
                {  0.468,     0,     0 },
                {  0.375, 0.583, 0.384 },
                {      0, 0.347, 0.474 },
                {  0.472, 0.582,     0 },
                {      0, 0.285, 0.372 },
                {      0, 0.514, 0.572 },
                {  0.372, 0.512,     0 },
                {  0.582,     0,     0 },
                {      0, 0.352,     0 },
                {      0,     0, 0.235 },
                {  0.682, 0.235,     0 },
                {      0, 0.523,     0 },
                { 0.5325,     0,     0 },
                { 0.5244, 0.483,     0 },
                {      0, 0.602, 0.662 }
            };

            List <double[]> c*k = new List <double[]>();

            for (int z = 0; z < cek.GetLength(0); z++)
            {
                double[] fak = new double[3];
                fak[0] = cek[z, 0];
                fak[1] = cek[z, 1];
                fak[2] = cek[z, 2];
                c*k.Add(fak);
            }


            foreach (DataRow row in dt.Rows)
            {
                Gejala   g = new Gejala();
                double[] p = new double[3];
                g.SetKodeGejala(Convert.ToString(row["kode_gejala"]));
                g.SetNamaGejala(Convert.ToString(row["nama_gejala"]));
                p[0] = Convert.ToDouble(row["pneumonia"]);
                p[1] = Convert.ToDouble(row["bronkitis"]);
                p[2] = Convert.ToDouble(row["urti"]);
                g.SetPenyakit(p);
                rule.Add(g);
            }

            List <Gejala> pesatu = new List <Gejala>();

            for (int i = 0; i < rule.Count; i++)
            {
                Gejala h = new Gejala();
                h.SetKodeGejala(rule[i].GetKodeGejala());
                h.SetPenyakit(c*k[i]);
                pesatu.Add(h);
            }

            de = new Density(rule);
            p1 = new Individu(pesatu);
            p2 = new Individu(de.GetDensity());
        }
コード例 #11
0
ファイル: DiagnosaPage.cs プロジェクト: wellwhatever/Po
        private void Diagnose(List<Kasus> listKasus)
        {
            DataTable dota = db.query("SELECT * FROM individu");
            List<Gejala> iv = new List<Gejala>();
            foreach (DataRow dr in dota.Rows)
            {
                Gejala g = new Gejala();
                g.SetKodeGejala(Convert.ToString(dr["kode_gejala"]));
                double[] p = new double[3];
                p[0] = Convert.ToDouble(dr["pneumonia"]);
                p[1] = Convert.ToDouble(dr["bronkitis"]);
                p[2] = Convert.ToDouble(dr["urti"]);
                g.SetPenyakit(p);
                iv.Add(g);
            }

            Individu iu = new Individu(iv);
            DempsterShafer ds = new DempsterShafer(iu, listKasus);
            List<Mass> hasilAkhir = ds.GetMFinal();
            int indeksMaks = 0;
            double terbesar = 0;

            for (int x = 0; x < hasilAkhir.Count; x++)
            {
                if (terbesar < hasilAkhir[x].GetDensity())
                {
                    terbesar = hasilAkhir[x].GetDensity();
                    indeksMaks = x;
                }
            }

            List<string> d = hasilAkhir[indeksMaks].GetPenyakit();
            string namaPenyakit = "";
            foreach (string s in d)
            {
                namaPenyakit += GetNamaPenyakit(s) + "\n";
            }
            labelNamaPenyakit.Text = namaPenyakit;

            string nilaiBelief = Convert.ToString(terbesar);
            labelNilaiBelief.Text = nilaiBelief;
            
        }
コード例 #12
0
ファイル: AdminPage.cs プロジェクト: wellwhatever/Po
        private void prosesBtn_Click(object sender, EventArgs e)
        {
            beliefDgv.Rows.Clear();
            individuDgv.Rows.Clear();
            int popSize = Convert.ToInt32(popSizeBox.Text);
            int iterasi = Convert.ToInt32(iterationBox.Text);
            double cr = Convert.ToDouble(crBox.Text);
            double mr = Convert.ToDouble(mrBox.Text);

            DataTable dt = db.query("SELECT * FROM gejala");

            rule = new List<Gejala>();

            foreach (DataRow row in dt.Rows)
            {
                Gejala g = new Gejala();
                double[] p = new double[3];
                g.SetKodeGejala(Convert.ToString(row["kode_gejala"]));
                g.SetNamaGejala(Convert.ToString(row["nama_gejala"]));
                p[0] = Convert.ToDouble(row["pneumonia"]);
                p[1] = Convert.ToDouble(row["bronkitis"]);
                p[2] = Convert.ToDouble(row["urti"]);
                g.SetPenyakit(p);
                rule.Add(g);
            }

            DataTable ks = db.query("SELECT * FROM kasus");

            List<Kasus> listKasus = new List<Kasus>();
            foreach (DataRow r in ks.Rows)
            {
                string s = Convert.ToString(r["gejala"]);
                string[] gejala = Array.ConvertAll(s.Split(','), ge => ge.Trim());
                string d = Convert.ToString(r["diagnosa"]);
                string[] diagnosa = Array.ConvertAll(d.Split(','), di => di.Trim());
                Kasus k = new Kasus();
                k.SetGejala(gejala);
                k.SetDiagnosa(diagnosa);
                listKasus.Add(k);
            }
            
            de = new Density(rule);
            iBaru = new List<Individu>();
            List<int> index = new List<int>();
            for (int iter = 0; iter < iterasi; iter++)
            {
                // Init
                List<Individu> P;
                Console.WriteLine("Iterasi ke - " + (iter + 1) + " ---------------------------------");
                if (iter == 0)
                {
                    P = new List<Individu>();
                    Console.WriteLine("-- Dempster Shafer Individu --");
                    for (int i = 0; i < popSize; i++)
                    {
                        Console.WriteLine(">> Individu ke - " + (i + 1));
                        Individu inv = new Individu(de.GetDensity());
                        DempsterShafer ds = new DempsterShafer(inv, listKasus);
                        inv.SetFitness(ds.GetFitness());
                        P.Add(inv);
                    }
                }
                else
                {
                    P = iBaru;
                }
                
                List<Individu> C = new List<Individu>();
                CrossOver co = new CrossOver(P, cr, popSize);
                C = co.GetCrossover();

                Console.WriteLine("-- Dempster Shafer Crossover --");
                for (int j = 0; j < C.Count; j++)
                {
                    Console.WriteLine(">> Crossover ke - " + (j + 1));
                    DempsterShafer ds = new DempsterShafer(C[j], listKasus);
                    C[j].SetFitness(ds.GetFitness());
                }

                double minimum = C[0].GetFitness();
                double maximum = 0;
                for (int k = 0; k < C.Count; k++)
                {
                    if (minimum > C[k].GetFitness()) minimum = C[k].GetFitness();
                    if (maximum < C[k].GetFitness()) maximum = C[k].GetFitness();
                }

                double maxmin = maximum - minimum;

                Console.WriteLine("-- Mutasi, Dempster Shafer Mutasi --");
                Mutasi mts = new Mutasi(P, mr, popSize, maxmin, rule);
                C.Add(mts.GetMutasi());
                DempsterShafer dss = new DempsterShafer(C[C.Count - 1], listKasus);
                C[C.Count - 1].SetFitness(dss.GetFitness());

                Console.WriteLine("-- Nilai Fitness Akhir --");
                Selection slct = new Selection(P, C, popSize);
                iBaru = slct.GetITerbaik();
                index = slct.GetIndex();
            }
            PopulateDgv(rule, iBaru[0]);
            double akurasi = iBaru[0].GetFitness() * 100; 
            labelAkurasi.Text = akurasi.ToString() + " %";

            for (int i = 0; i < iBaru.Count; i++)
            {
                int idIndividu = index[i]+1;
                string kode;
                if ( idIndividu > popSize)
                {
                    idIndividu -= popSize;
                    kode = "C" + idIndividu;
                }
                else
                {
                    kode = "P" + idIndividu;
                }
                this.individuDgv.Rows.Add(kode, iBaru[i].GetFitness());
            }

            MessageBox.Show("Proses Perhitungan Selesai");
        }
コード例 #13
0
ファイル: CrossOver.cs プロジェクト: wellwhatever/Po
        private List<Gejala> Cross(Individu a, Individu b, Individu alpha)
        {
            List<Gejala> hasilKross = new List<Gejala>();
            for (int i = 0; i < rule.Count; i++)
            {
                Gejala g = new Gejala();
                double[] aDen = a.find(rule[i].GetKodeGejala());
                double[] bDen = b.find(rule[i].GetKodeGejala());
                double[] alphaden = alpha.find(rule[i].GetKodeGejala());
                double[] hasil = new double[3];
                for (int j = 0; j < 3; j++)
                {
                    hasil[j] = aDen[j] + alphaden[j] * (bDen[j] - aDen[j]);
                }

                g.SetKodeGejala(rule[i].GetKodeGejala());
                g.SetPenyakit(hasil);

                hasilKross.Add(g);
            }

            return hasilKross;
        }
コード例 #14
0
        private void prosesBtn_Click(object sender, EventArgs e)
        {
            beliefDgv.Rows.Clear();
            individuDgv.Rows.Clear();
            int    popSize = Convert.ToInt32(popSizeBox.Text);
            int    iterasi = Convert.ToInt32(iterationBox.Text);
            double cr      = Convert.ToDouble(crBox.Text);
            double mr      = Convert.ToDouble(mrBox.Text);

            DataTable dt = db.query("SELECT * FROM gejala");

            rule = new List <Gejala>();

            foreach (DataRow row in dt.Rows)
            {
                Gejala   g = new Gejala();
                double[] p = new double[3];
                g.SetKodeGejala(Convert.ToString(row["kode_gejala"]));
                g.SetNamaGejala(Convert.ToString(row["nama_gejala"]));
                p[0] = Convert.ToDouble(row["pneumonia"]);
                p[1] = Convert.ToDouble(row["bronkitis"]);
                p[2] = Convert.ToDouble(row["urti"]);
                g.SetPenyakit(p);
                rule.Add(g);
            }

            DataTable ks = db.query("SELECT * FROM kasus");

            List <Kasus> listKasus = new List <Kasus>();

            foreach (DataRow r in ks.Rows)
            {
                string   s        = Convert.ToString(r["gejala"]);
                string[] gejala   = Array.ConvertAll(s.Split(','), ge => ge.Trim());
                string   d        = Convert.ToString(r["diagnosa"]);
                string[] diagnosa = Array.ConvertAll(d.Split(','), di => di.Trim());
                Kasus    k        = new Kasus();
                k.SetGejala(gejala);
                k.SetDiagnosa(diagnosa);
                listKasus.Add(k);
            }

            de    = new Density(rule);
            iBaru = new List <Individu>();
            List <int> index = new List <int>();

            for (int iter = 0; iter < iterasi; iter++)
            {
                // Init
                List <Individu> P;
                Console.WriteLine("Iterasi ke - " + (iter + 1) + " ---------------------------------");
                if (iter == 0)
                {
                    P = new List <Individu>();
                    Console.WriteLine("-- Dempster Shafer Individu --");
                    for (int i = 0; i < popSize; i++)
                    {
                        Console.WriteLine(">> Individu ke - " + (i + 1));
                        Individu       inv = new Individu(de.GetDensity());
                        DempsterShafer ds  = new DempsterShafer(inv, listKasus);
                        inv.SetFitness(ds.GetFitness());
                        P.Add(inv);
                    }
                }
                else
                {
                    P = iBaru;
                }

                List <Individu> C  = new List <Individu>();
                CrossOver       co = new CrossOver(P, cr, popSize);
                C = co.GetCrossover();

                Console.WriteLine("-- Dempster Shafer Crossover --");
                for (int j = 0; j < C.Count; j++)
                {
                    Console.WriteLine(">> Crossover ke - " + (j + 1));
                    DempsterShafer ds = new DempsterShafer(C[j], listKasus);
                    C[j].SetFitness(ds.GetFitness());
                }

                double minimum = C[0].GetFitness();
                double maximum = 0;
                for (int k = 0; k < C.Count; k++)
                {
                    if (minimum > C[k].GetFitness())
                    {
                        minimum = C[k].GetFitness();
                    }
                    if (maximum < C[k].GetFitness())
                    {
                        maximum = C[k].GetFitness();
                    }
                }

                double maxmin = maximum - minimum;

                Console.WriteLine("-- Mutasi, Dempster Shafer Mutasi --");
                Mutasi mts = new Mutasi(P, mr, popSize, maxmin, rule);
                C.Add(mts.GetMutasi());
                DempsterShafer dss = new DempsterShafer(C[C.Count - 1], listKasus);
                C[C.Count - 1].SetFitness(dss.GetFitness());

                Console.WriteLine("-- Nilai Fitness Akhir --");
                Selection slct = new Selection(P, C, popSize);
                iBaru = slct.GetITerbaik();
                index = slct.GetIndex();
            }
            PopulateDgv(rule, iBaru[0]);
            double akurasi = iBaru[0].GetFitness() * 100;

            labelAkurasi.Text = akurasi.ToString() + " %";

            for (int i = 0; i < iBaru.Count; i++)
            {
                int    idIndividu = index[i] + 1;
                string kode;
                if (idIndividu > popSize)
                {
                    idIndividu -= popSize;
                    kode        = "C" + idIndividu;
                }
                else
                {
                    kode = "P" + idIndividu;
                }
                this.individuDgv.Rows.Add(kode, iBaru[i].GetFitness());
            }

            MessageBox.Show("Proses Perhitungan Selesai");
        }