C REATING FIS S UGENO WITH J AVA Praktikum 13
R EVIEW FIS Metode Penalaran Mamdani Input dan Output berupa himpunen fuzzy Penentuan nilai defuzzifikasi dengan center of gravity Tsukamoto Input dan Output berupa himpunen fuzzy Penentuan nilai defuzzifikasi dengan rata-rata terbobot Sugeno Input berupa himpunan fuzzy Output berupa nilai linear Penentuan nilai defuzzifikasi bisa dengan center of gravity
R EVIEW FIS Representasi Kurva Segitiga dan Trapezoidal abc
F UZZIFIKASI FungsiVariabelMFRentangDomain input Jaminan Sangat kurang mendukung0-15[ ] Cukupmendukung[ ] Sangat mendukung[ ] Aset Sangat kurang mendukung [ ] Sangat mendukung [ ] outputKelayakan kelompok
M EMBUAT CLASS LATIHSUGENO public class latihansugeno extends javax.swing.JFrame { public double[] output_rule_kel_2 = new double[6]; public double[] u_output_kel_2 = new double[6]; public double z_kelompok_2; public double min_result_kelompok; public double u_aset_SM; public double u_aset_SKM; public double u_jaminan_SM; public double u_jaminan_CM; public double u_jaminan_SKM; public double kondisi_aset; public double kondisi_jaminan; public latihansugeno() { initComponents(); }
M EMBUAT CLASS J AMINAN class Jaminan { public double data_jaminan; // Himpunan Sangat Kurang Mendukung private double SangatKurangMendukung() { if (data_jaminan == 0) { return data_jaminan = 1; } else if ((data_jaminan >= 1) && (data_jaminan < 7.5)) { return (7.5 - data_jaminan) / ( ); } else { return 0; }
// Himpunan Cukup Mendukung private double CukupMendukung() { if ((data_jaminan >= 5) && (data_jaminan < 7.5)) { return (data_jaminan - 5) / ( ); } else if (data_jaminan == 7.5) { return data_jaminan = 1; } else if ((data_jaminan > 7.5) && (data_jaminan <= 10)) { return (10 - data_jaminan) / ( ); } else { return 0; } } // end of cukup mendukung
private double SangatMendukung() { if ((data_jaminan >= 7.5) && (data_jaminan <= 15)) { return (data_jaminan - 7.5) / ( ); } else { return 0; } } // end sangat mendukung } //end class Jaminan
M EMBUAT CLASS ASET class Aset { public double data_aset; // Himpunan Sangat Kurang Mendukung private double SangatKurangMendukung() { if (data_aset == 0) { return data_aset = 1; } else if ((data_aset > 0) && (data_aset <= )) { return ( data_aset) / ( ); } else { return 0; }
private double SangatMendukung() { if (data_aset == ) { return data_aset = 1; } else if ((data_aset >= ) && (data_aset < )) { return (data_aset ) / ( ); } else { return 0; } } // end sangat mendukung } //end class Aset
M EMBUAT CLASS KELAYAKAN KELOMPOK class KelayakanKelompok2 extends latihansugeno { public double[] nilai_kelayakan_kelompok2; KelayakanKelompok2() { nilai_kelayakan_kelompok2 = new double[6]; nilai_kelayakan_kelompok2[0] = ( ) / 2; nilai_kelayakan_kelompok2[1] = ( ) / 2; nilai_kelayakan_kelompok2[2] = ( ) / 2; nilai_kelayakan_kelompok2[3] = ( ) / 2; nilai_kelayakan_kelompok2[4] = (2 + 20) / 2; nilai_kelayakan_kelompok2[5] = (2 + 20) / 2; }
M EMBUAT FUNGSI C OMPUTE _MF private void Compute_Membership() { Jaminan jaminan = new Jaminan(); Aset aset = new Aset(); jaminan.data_jaminan = kondisi_jaminan; aset.data_aset = kondisi_aset; u_jaminan_SM = jaminan.SangatMendukung(); u_jaminan_CM = jaminan.CukupMendukung(); u_jaminan_SKM = jaminan.SangatKurangMendukung(); u_aset_SM = aset.SangatMendukung(); u_aset_SKM = aset.SangatKurangMendukung(); }
M EMBUAT FUNGSI CARI _ MINIMAL private double Cari_Min2(double a, double b) { if (a < b) { min_result_kelompok = a; return min_result_kelompok; } else { min_result_kelompok = b; return min_result_kelompok; }
M EMBUAT RULE private void applyRule_Kelompok_2() { KelayakanKelompok2 kelompok2 = new KelayakanKelompok2(); output_rule_kel_2[0] = Cari_Min2(u_jaminan_SM, u_aset_SM); u_output_kel_2[0] = kelompok2.nilai_kelayakan_kelompok2[0]; output_rule_kel_2[1] = Cari_Min2(u_jaminan_SM, u_aset_SKM); u_output_kel_2[1] = kelompok2.nilai_kelayakan_kelompok2[1]; output_rule_kel_2[2] = Cari_Min2(u_jaminan_CM, u_aset_SM); u_output_kel_2[2] = kelompok2.nilai_kelayakan_kelompok2[2]; output_rule_kel_2[3] = Cari_Min2(u_jaminan_CM, u_aset_SKM); u_output_kel_2[3] = kelompok2.nilai_kelayakan_kelompok2[3]; output_rule_kel_2[4] = Cari_Min2(u_jaminan_SKM, u_aset_SM); u_output_kel_2[4] = kelompok2.nilai_kelayakan_kelompok2[4]; output_rule_kel_2[5] = Cari_Min2(u_jaminan_SKM, u_aset_SKM); u_output_kel_2[5] = kelompok2.nilai_kelayakan_kelompok2[5]; }
M EMBUAT FUNGSI COMPUTE _ OUTPUT private void Compute_Output_Kelompok_2() { double temp_1 = 0; double temp_2 = 0; for (int i = 0; i < 6; i++) { temp_1 += output_rule_kel_2[i] * u_output_kel_2[i]; temp_2 += output_rule_kel_2[i]; } z_kelompok_2 = temp_1 / temp_2; System.out.print("\n kelompok"); System.out.print("OutPut Kel-2 " + z_kelompok_2); txt_evaluasi.setText(String.valueOf(z_kelompok_2)); }
private void btn_prosesActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: kondisi_jaminan = Double.parseDouble(txt_jaminan.getText()); kondisi_aset = Double.parseDouble(txt_aset.getText()); Compute_Membership(); applyRule_Kelompok_2(); Compute_Output_Kelompok_2(); }
public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new latihansugeno().setVisible(true); } }); } private javax.swing.JButton btn_proses; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JFormattedTextField txt_aset; private javax.swing.JTextField txt_evaluasi; private javax.swing.JFormattedTextField txt_jaminan; // End of variables declaration}
T ERIMA K ASIH