Диссертация (Методы и программные средства ускорения поиска решения в базах знаний нечетких экспертных систем), страница 18
Описание файла
Файл "Диссертация" внутри архива находится в папке "Методы и программные средства ускорения поиска решения в базах знаний нечетких экспертных систем". PDF-файл из архива "Методы и программные средства ускорения поиска решения в базах знаний нечетких экспертных систем", который расположен в категории "". Всё это находится в предмете "технические науки" из Аспирантура и докторантура, которые можно найти в файловом архиве НИУ «МЭИ» . Не смотря на прямую связь этого архива с НИУ «МЭИ» , его также можно найти и в других разделах. , а ещё этот архив представляет собой кандидатскую диссертацию, поэтому ещё представлен в разделе всех диссертаций на соискание учёной степени кандидата технических наук.
Просмотр PDF-файла онлайн
Текст 18 страницы из PDF
You can move, orremove it, as needed.this.elementTableAdapter.Fill(this.fuzzyReteDataSet1.Element);this.investigationRulesTableAdapter.Fill(this.fuzzyReteDataSet1.InvestigationRules);this.termsRulesTableAdapter.Fill(this.fuzzyReteDataSet1.TermsRules);}131private void button1_Click(object sender, EventArgs e){//this.fuzzyReteDataSetTableAdapter.Fill(this.fuzzyReteDataSet.fuzzyRete);da.SelectCommand = new SqlCommand("SELECT * fROM investigationRules", sc);ds.Clear();da.Fill(ds);investigationRulesDataGridView.DataSource = ds.Tables[0];bindsource.DataSource = ds.Tables[0];}public void InsertRule(int IDПравила, string IDВыражения, string IDЛП, string Условие,stringЗначение ){try{da.InsertCommand = new SqlCommand("Insert Into TermsRulesvalues(@IDПравила,@IDВыражения,@IDЛП,@Условие,@Значение)", sc);da.InsertCommand.Parameters.Add("@IDПравила", SqlDbType.Int).Value = IDПравила;da.InsertCommand.Parameters.Add("@IDВыражения", SqlDbType.NVarChar).Value =IDВыражения;da.InsertCommand.Parameters.Add("@IDЛП", SqlDbType.NVarChar).Value = IDЛП;da.InsertCommand.Parameters.Add("@Условие", SqlDbType.NVarChar).Value =Условие;da.InsertCommand.Parameters.Add("@Значение", SqlDbType.NVarChar).Value =Значение;sc.Open();da.InsertCommand.ExecuteNonQuery();sc.Close();}catch132{MessageBox.Show("error");}}private void button3_Click(object sender, EventArgs e){for (int i = 0; i < InvestigationRulesDataGridView.Rows.Count; i++){da.InsertCommand = new SqlCommand("Insert Into InvestigationRulesvalues(@IDПравила,@IDВыражения,@IDЛП,@Условие,@Значение)", sc);da.InsertCommand.Parameters.Add("@IDПравила", SqlDbType.Int).Value =investigationRulesDataGridView.Rows[i].Cells[0].Value.ToString();da.InsertCommand.Parameters.Add("@IDВыражения", SqlDbType.NVarChar).Value =investigationRulesDataGridView.Rows[i].Cells[1].Value.ToString();da.InsertCommand.Parameters.Add("@IDЛП", SqlDbType.NVarChar).Value =investigationRulesDataGridView.Rows[i].Cells[2].Value.ToString();da.InsertCommand.Parameters.Add("@Условие", SqlDbType.NVarChar).Value =investigationRulesDataGridView.Rows[i].Cells[3].Value.ToString();da.InsertCommand.Parameters.Add("@Значение", SqlDbType.NVarChar).Value =investigationRulesDataGridView.Rows[i].Cells[4].Value.ToString();sc.Open();da.InsertCommand.ExecuteNonQuery();sc.Close();}sc.Open();for (int i = 0; i < investigationRulesDataGridView.Rows.Count; i++)133{SqlDataAdapter da = new SqlDataAdapter("Insert Into investigationRules values('" +investigationRulesDataGridView.Rows[i].Cells[0].Value + "','" +investigationRulesDataGridView.Rows[i].Cells[1].Value + "','" +investigationRulesDataGridView.Rows[i].Cells[2].Value + "','" +investigationRulesDataGridView.Rows[i].Cells[3].Value + "','" +investigationRulesDataGridView.Rows[i].Cells[4].Value + "')", sc);da.Fill(ds, "investigationRules");da.InsertCommand.ExecuteNonQuery();}sc.Close();string Selection;if (investigationRulesDataGridView.SelectedRows.Count != 0){DataGridViewRow row = this.investigationRulesDataGridView.SelectedRows[0];Selection = row.Cells[0].Value.ToString();}string query = "INSERT INTO investigationRules VALUES(@IDПравила,@IDВыражения,@IDЛП,@Условие,@Значение)";command = new SqlCommand(query, sc);command.Parameters.AddWithValue("@IDПравила", Selection);command.Parameters.AddWithValue("@IDВыражения", Selection);command.Parameters.AddWithValue("@IDЛП", Selection);command.Parameters.AddWithValue("@Условие", Selection);command.Parameters.AddWithValue("@Значение", Selection);command.ExecuteNonQuery();command.Connection = sc;sc.Close();134for (int i = 0; i < investigationRulesDataGridView.Rows.Count; i++){String insertData = "INSERT INTO investigationRules(IDПравила, IDВыражения,IDЛП,Условие,Значение) VALUES(@IDПравила,@IDВыражения,@IDЛП,@Условие,@Значение)";SqlCommand cmd = new SqlCommand(insertData, sc);//da.InsertCommand = new SqlCommand("Insert Into TermsRulesvalues(@IDПравила,@IDВыражения,@IDЛП,@Условие,@Значение)", sc);cmd.Parameters.AddWithValue("@IDПравила",investigationRulesDataGridView.Rows[i].Cells[0].Value);cmd.Parameters.AddWithValue("@IDВыражения",investigationRulesDataGridView.Rows[i].Cells[1].Value);cmd.Parameters.AddWithValue("@IDЛП",investigationRulesDataGridView.Rows[i].Cells[2].Value);cmd.Parameters.AddWithValue("@Условие",investigationRulesDataGridView.Rows[i].Cells[3].Value);cmd.Parameters.AddWithValue("@Значение",investigationRulesDataGridView.Rows[i].Cells[4].Value);sc.Open();da.InsertCommand.ExecuteNonQuery();sc.Close();MessageBox.Show("Added successfully!");}foreach (DataGridViewRow row in investigationRulesDataGridView.Rows){string constring = @"Data Source=|DataDirectory|\FuzzyRete.sdf";using (SqlConnection con = new SqlConnection(constring)){using (SqlCommand cmd = new SqlCommand("INSERT INTO investigationRulesVALUES (@IDПравила,@IDВыражения,@IDЛП,@Условие,@Значение)", con)){cmd.Parameters.AddWithValue("@IDПравила", row.Cells["IDПравила"].Value);135cmd.Parameters.AddWithValue("@IDВыражения",row.Cells["IDВыражения"].Value);cmd.Parameters.AddWithValue("@IDЛП", row.Cells["IDЛП"].Value);cmd.Parameters.AddWithValue("@Условие", row.Cells["Условие"].Value);cmd.Parameters.AddWithValue("@Значение", row.Cells["Значение"].Value);con.Open();cmd.ExecuteNonQuery();con.Close();}}}MessageBox.Show("Records inserted.");this.Validate();this.investigationRulesBindingSource.EndEdit();this.tableAdapterManager.UpdateAll(this.fuzzyReteDataSet1);}private void button4_Click(object sender, EventArgs e){DialogResult result = MessageBox.Show("Are You Sure?\nThere is no undo once data isdeleted.", "Confirmed Message", MessageBoxButtons.YesNo);if (result == DialogResult.Yes){da.DeleteCommand = new SqlCommand("DELETE FROM Следствиеправил WHEREIDПравила=@IDПравила", sc);//da.DeleteCommand.Parameters.Add("@IDПравила", SqlDbType.Int).Value =fuzzyReteDataSet.Tables[0].Rows[fuzzyReteDataSetBindingSource.Position][0];136da.DeleteCommand.Parameters.Add("@IDПравила", SqlDbType.Int).Value =ds.Tables[0].Rows[bindsource.Position][0];sc.Open();da.DeleteCommand.ExecuteNonQuery();sc.Close();}else{MessageBox.Show("Deletion Cancel", "No Delete Data");}int ind = investigationRulesDataGridView.SelectedCells[0].RowIndex;investigationRulesDataGridView.Rows.RemoveAt(ind);}private void button5_Click(object sender, EventArgs e){sc.Open();for (int i = 0; i < termsRulesDataGridView.Rows.Count; i++){SqlDataAdapter da = new SqlDataAdapter("Insert Into TermsRules values('" +termsRulesDataGridView.Rows[i].Cells[0].Value + "','" +termsRulesDataGridView.Rows[i].Cells[1].Value + "','" +termsRulesDataGridView.Rows[i].Cells[2].Value + "','" +termsRulesDataGridView.Rows[i].Cells[3].Value + "','" +termsRulesDataGridView.Rows[i].Cells[4].Value + "')", sc);da.Fill(ds, "TermsRules");sc.Close();}sc.Open();for (int i = 0; i < termsRulesDataGridView.Rows.Count; i++)137{da.InsertCommand = new SqlCommand("Insert Into TermsRulesvalues(@IDПравила,@IDВыражения,@IDЛП,@Условие,@Значение)", sc);da.InsertCommand.Parameters.Add("@IDПравила", SqlDbType.Int).Value =termsRulesDataGridView.Rows[i].Cells["IDПравила"].Value.ToString();da.InsertCommand.Parameters.Add("@IDВыражения", SqlDbType.NVarChar).Value =termsRulesDataGridView.Rows[i].Cells["IDВыражения"].Value.ToString();da.InsertCommand.Parameters.Add("@IDЛП", SqlDbType.NVarChar).Value =termsRulesDataGridView.Rows[i].Cells["IDЛП"].Value.ToString();da.InsertCommand.Parameters.Add("@Условие", SqlDbType.NVarChar).Value =termsRulesDataGridView.Rows[i].Cells["Условие"].Value.ToString();da.InsertCommand.Parameters.Add("@Значение", SqlDbType.NVarChar).Value =termsRulesDataGridView.Rows[i].Cells["Значение"].Value.ToString();da.InsertCommand.ExecuteNonQuery();}sc.Close();this.Validate();this.termsRulesBindingSource.EndEdit();this.tableAdapterManager.UpdateAll(this.fuzzyReteDataSet1);this.Validate();this.elementBindingSource.EndEdit();this.tableAdapterManager.UpdateAll(this.fuzzyReteDataSet1);}private void button6_Click(object sender, EventArgs e){138sc.Open();SqlCommand cmd = new SqlCommand("DELETE FROM УсловиеПравила");cmd.Connection = sc;cmd.ExecuteNonQuery();sc.Close();MessageBox.Show("Database Cleared");DialogResult result = MessageBox.Show("Are You Sure?\nThere is no undo once data isdeleted.", "Confirmed Message", MessageBoxButtons.YesNo);if (result == DialogResult.Yes){da.DeleteCommand = new SqlCommand("DELETE FROM Условияправил WHEREIDПравила=@IDПравила", sc);//da.DeleteCommand.Parameters.Add("@IDПравила", SqlDbType.Int).Value =fuzzyReteDataSet.Tables[0].Rows[fuzzyReteDataSetBindingSource.Position][0];da.DeleteCommand.Parameters.Add("@IDПравила", SqlDbType.Int).Value =ds.Tables[0].Rows[bindsource.Position][0];sc.Open();da.DeleteCommand.ExecuteNonQuery();sc.Close();}else{MessageBox.Show("Deletion Cancel", "No Delete Data");}int ind = termsRulesDataGridView.SelectedCells[0].RowIndex;termsRulesDataGridView.Rows.RemoveAt(ind);}139private void Form2_FormClosed(object sender, FormClosedEventArgs e){UpdateRowDatabase();}private void termsRulesBindingNavigatorSaveItem_Click(object sender, EventArgs e){this.Validate();this.termsRulesBindingSource.EndEdit();this.tableAdapterManager.UpdateAll(this.fuzzyReteDataSet1);}private void investigationRulesBindingNavigatorSaveItem_Click(object sender, EventArgs e){this.Validate();this.investigationRulesBindingSource.EndEdit();this.tableAdapterManager.UpdateAll(this.fuzzyReteDataSet1);}private void elementBindingNavigatorSaveItem_Click(object sender, EventArgs e){this.Validate();this.elementBindingSource.EndEdit();this.tableAdapterManager.UpdateAll(this.fuzzyReteDataSet1);}}}"Form3.cs"140using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace DSSFuzzyRete{public partial class Form3 : Form{public Form3(){InitializeComponent();}private void Form3_Load(object sender, EventArgs e){this.da.Fill(this.fuzzyReteDataSet1.Element);da.SelectCommand = new SqlCommand("SELECT * fROM Description", sc);ds.Clear();da.Fill(ds);dataGridView1.DataSource = ds.Tables[0];bindsource.DataSource = ds.Tables[0];}private void button1_Click(object sender, EventArgs e){141foreach (DataGridViewRow row in dataGridView1.Rows){//string constring = @"Data Source=|DataDirectory|\FuzzyRete.sdf";string constring = @"Data Source=" +System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\FuzzyRete.sdf;Persist Security Info=False;";using (SqlConnection con = new SqlConnection(constring)){using (SqlCommand cmd = new SqlCommand("INSERT INTO Description VALUES(@IDЛП,@IDНе,@Названиене)", con)){cmd.Parameters.AddWithValue("@IDЛП", row.Cells["IDЛП"].Value);cmd.Parameters.AddWithValue("@IDНе", row.Cells["IDНе"].Value);cmd.Parameters.AddWithValue("@Названиене", row.Cells["Названиене"].Value);con.Open();cmd.ExecuteNonQuery();con.Close();}}}MessageBox.Show("Records inserted.");}private void button2_Click(object sender, EventArgs e){int ind = dataGridView1.SelectedCells[0].RowIndex;dataGridView1.Rows.RemoveAt(ind);}private void button3_Click(object sender, EventArgs e){for (int i = 0; i < dataGridView1.Rows.Count; i++){142da.InsertCommand = new SqlCommand("Insert Into Descriptionvalues(@IDЛП,@IDНе,@Названиене)", sc);da.InsertCommand.Parameters.Add("@IDЛП", SqlDbType.Int).Value =dataGridView1.Rows[i].Cells[0].Value.ToString();da.InsertCommand.Parameters.Add("@IDНе", SqlDbType.NVarChar).Value =dataGridView1.Rows[i].Cells[1].Value.ToString();da.InsertCommand.Parameters.Add("@Названиене", SqlDbType.NVarChar).Value =dataGridView1.Rows[i].Cells[2].Value.ToString();sc.Open();da.InsertCommand.ExecuteNonQuery();sc.Close();}}private void button4_Click(object sender, EventArgs e){int ind = dataGridView1.SelectedCells[0].RowIndex;dataGridView1.Rows.RemoveAt(ind);}private void button5_Click(object sender, EventArgs e){EditLP();}private void button6_Click(object sender, EventArgs e){EditData();}}}143"Form4.cs"using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace DSSFuzzyRete{public partial class Form4 : Form{SqlConnection sc = new SqlConnection(@"Data Source=" +System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\FuzzyRete.sdf;Persist Security Info=False;");SqlDataAdapter da = new SqlDataAdapter();SqlCommand cmd = new SqlCommand();DataSet ds = new DataSet();BindingSource bindsource = new BindingSource();public Form4(){InitializeComponent();}private void Form4_Load(object sender, EventArgs e){this.descriptionTableAdapter.Fill(this.fuzzyReteDataSet.Description);fillChart();//SplineChartExample();}144private void button1_Click(object sender, EventArgs e){for (int i = 0; i < dataGridView1.Rows.Count; i++){da.InsertCommand = new SqlCommand("Insert Into Coefficientvalues(@IDНе,@КоэффициентA,@КоэффициентB,@КоэффициентC)", sc);cmd.Parameters.AddWithValue("@IDНе", dataGridView1.Rows[i].Cells[0].Value);cmd.Parameters.AddWithValue("@КоэффициентA",dataGridView1.Rows[i].Cells[1].Value);cmd.Parameters.AddWithValue("@КоэффициентB",dataGridView1.Rows[i].Cells[2].Value);cmd.Parameters.AddWithValue("@КоэффициентC",dataGridView1.Rows[i].Cells[4].Value);sc.Open();da.InsertCommand.ExecuteNonQuery();sc.Close();MessageBox.Show("Added successfully!");}}private void button2_Click(object sender, EventArgs e){int ind = dataGridView1.SelectedCells[0].RowIndex;dataGridView1.Rows.RemoveAt(ind);}public double mu(double x){double muTnorm = 1.0 / (1.0 + ((x - 36.6) / 1.0) * ((x - 36.6) / 1.0));return muTnorm;}private void fillChart()145{double x = 30.0;double muTnorm = 0;chart1.Series[0].Points.Clear();while (x <= 42.0){muTnorm = mu(x);chart1.Series[0].Points.AddXY(x, muTnorm);x += 0.1;//chart1.Series["TP"].ChartType =//SeriesChartType.Line;}chart1.Titles.Add("Температура пациента");}private void button3_Click(object sender, EventArgs e){Visualize();}}}"Form5.cs"using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;146using System.Data.SqlClient;namespace DSSFuzzyRete{public partial class Form5 : Form{public Form5(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){foreach (DataGridViewRow row in dataGridView1.Rows){//string constring = @"Data Source=|DataDirectory|\FuzzyRete.sdf";string constring = @"Data Source=" +System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\FuzzyRete.sdf;Persist Security Info=False;";using (SqlConnection con = new SqlConnection(constring)){using (SqlCommand cmd = new SqlCommand("INSERT INTO InputData VALUES(@Лингвистическаяпеременная,@Значение)", con)){cmd.Parameters.AddWithValue("@Лингвистическаяпеременная",row.Cells["Лингвистическаяпеременная"].Value);cmd.Parameters.AddWithValue("@Значение", row.Cells["Значение"].Value);con.Open();cmd.ExecuteNonQuery();147con.Close();}}}MessageBox.Show("Records inserted.");}private void button2_Click(object sender, EventArgs e){int ind = dataGridView1.SelectedCells[0].RowIndex;dataGridView1.Rows.RemoveAt(ind);}private void button3_Click(object sender, EventArgs e){for (int i = 0; i < dataGridView1.Rows.Count; i++){da.InsertCommand = new SqlCommand("Insert Into InputData(Лингвистическаяпеременная,Значение) values(@Лингвистическаяпеременная,@Значение)", sc);da.InsertCommand.Parameters.Add("@Лингвистическаяпеременная",SqlDbType.NVarChar).Value = dataGridView1.Rows[i].Cells[0].Value.ToString();da.InsertCommand.Parameters.Add("@Значение", SqlDbType.NVarChar).Value =dataGridView1.Rows[i].Cells[1].Value.ToString();sc.Open();da.InsertCommand.ExecuteNonQuery();sc.Close();}}private void Form5_Load(object sender, EventArgs e){148da.SelectCommand = new SqlCommand("SELECT * fROM InputData", sc);ds.Clear();da.Fill(ds);dataGridView1.DataSource = ds.Tables[0];bindsource.DataSource = ds.Tables[0];}}}"Form6.cs"using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace DSSFuzzyRete{public partial class Form6 : Form{public Form6(){InitializeComponent();}private void button3_Click(object sender, EventArgs e){CollapseTree();}149private void button1_Click(object sender, EventArgs e){DeployTree();}}}"Form7.cs"using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace DSSFuzzyRete{public partial class Form7 : Form{public Form7(){InitializeComponent();}private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e){150SelectData();}private void Form7_Load(object sender, EventArgs e){this.searchTableAdapter.Fill(this.fuzzyReteDataSet.Search);textBox2.Text = @" ";textBox1.Text = @" ";}}}151Приложение 4.