private void loadGejala() { DataTable dt = db.query("SELECT kode_gejala, nama_gejala FROM gejala WHERE kode_gejala NOT IN ('G15', 'G16', 'G17')"); foreach (DataRow row in dt.Rows) { var items = listBoxGejala.Items; string item = "(" + Convert.ToString(row["kode_gejala"]) + ") " + Convert.ToString(row["nama_gejala"]); items.Add(item); } }
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; } } }
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; } } }
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()); }
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()); }
private void LoadGejala() { string qr = "SELECT kode_gejala as 'Kode Gejala', nama_gejala as 'Nama Gejala', pneumonia, bronkitis, urti FROM gejala"; gejalaDgv.DataSource = db.query(qr); }