Ejemplo n.º 1
0
        public DiagnosaPage()
        {
            InitializeComponent();
            formClosed = false;

            db = new SqliteDatabase();
            loadGejala();
        }
Ejemplo n.º 2
0
 public AdminPage()
 {
     InitializeComponent();
     db = new SqliteDatabase();
     LoadGejala();
     LoadKasus();
     formClosed = false;
 }
Ejemplo n.º 3
0
        public DiagnosaPage()
        {
            InitializeComponent();
            formClosed = false;

            db = new SqliteDatabase();
            loadGejala();
        }
Ejemplo n.º 4
0
 public AdminPage()
 {
     InitializeComponent();
     db = new SqliteDatabase();
     LoadGejala();
     LoadKasus();
     formClosed = false;
 }
Ejemplo n.º 5
0
        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;
                }
            }
        }
Ejemplo n.º 6
0
        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;
                }    
            }
            
        }
Ejemplo n.º 7
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());
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
0
 public Algoritma()
 {
     db = new SqliteDatabase();
 }
Ejemplo n.º 10
0
 public Algoritma()
 {
     db = new SqliteDatabase(); 
 }