




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、精选优质文档-倾情为你奉上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.OleDb;using System.Web;namespace FuzzyJudge public partial class Form1 : Form public static i
2、nt MatrixRows = 4; public static int MatrixCols = 6; double, a = new doubleMatrixRows, MatrixCols; double b = new doubleMatrixCols; double myResult = new doubleMatrixRows; double myweight = new doubleMatrixCols; double, mysort = new doubleMatrixRows, MatrixCols; double, myLiShuDu = new doubleMatrixC
3、ols, MatrixRows; string, s = new stringMatrixRows, MatrixCols; string t = new stringMatrixCols; int i, j; public Form1() InitializeComponent(); private void Button3_Click(object sender, EventArgs e) string sql = "select * from 评判集$" DataTable da = DB.GetDataTable(sql); for (int m = 0; m &l
4、t; da.Rows.Count; m+) for (int n = 0; n < da.Columns.Count; n+) sm, n = da.Rowsmn.ToString(); Label1.Text = s0, 0; label2.Text = s0, 1; label3.Text = s0, 2; label4.Text = s0, 3; label5.Text = s0, 4; label6.Text = s0, 5; label7.Text = s1, 0; label8.Text = s1, 1; label9.Text = s1, 2; label10.Text =
5、 s1, 3; label11.Text = s1, 4; label12.Text = s1, 5; label13.Text = s2, 0; label14.Text = s2, 1; label15.Text = s2, 2; label16.Text = s2, 3; label17.Text = s2, 4; label18.Text = s2, 5; label19.Text = s3, 0; label20.Text = s3, 1; label21.Text = s3, 2; label22.Text = s3, 3; label23.Text = s3, 4; label2
6、4.Text = s3, 5; for (i = 0; i < MatrixRows; i+) for (j = 0; j < MatrixCols; j+) ai, j = Convert.ToDouble(si, j); string sql1 = "select * from 评价指标值$" OleDbDataReader read = DB.ExecuteReader(sql1); while (read.Read() for (i = 0; i < MatrixCols; i+) ti = readi.ToString(); TextBox1.T
7、ext = t0; TextBox2.Text = t1; TextBox3.Text = t2; TextBox4.Text = t3; TextBox5.Text = t4; textBox6.Text = t5; for (i = 0; i < MatrixCols; i+) bi = Convert.ToDouble(ti); / Console.Write("评判集和评判因子的关系矩阵:n"); / for (i = 0; i < MatrixCols; i+) / for (j = 0; j < MatrixRows; j+) / / myLi
8、ShuDui, j = Lishudu(i, j, a, b); / / for (i = 0; i < MatrixCols; i+) / / for (j = 0; j < MatrixRows; j+) / / Console.Write("0:F, ", myLiShuDui, j); / / Console.Write("n"); / static double CalculateAverage(int m, double, a) double myResult; int i; myResult = 0; for (i = 0; i
9、 < MatrixRows; i+) myResult = myResult + ai, m; myResult = myResult / MatrixRows; return myResult; static double EWeight(int m, double, a, double b) double Aver = new doubleMatrixCols; double EResult; int i; double ETotal; for (i = 0; i < MatrixCols; i+) Averi = CalculateAverage(i, a); ETotal
10、= 0; for (i = 0; i < MatrixCols; i+) ETotal += (bi / Averi); EResult = (bm / Averm) / ETotal; return EResult; static double Sort(int m, int n, double, a) double, b = new doubleMatrixRows, MatrixCols; int i, j, k; for (i = 0; i < MatrixRows; i+) for (j = 0; j < MatrixCols; j+) bi, j = ai, j;
11、 for (j = 0; j < MatrixCols; j+) for (i = 0; i < 3; i+) for (k = i; k < MatrixRows; k+) if (bi, j > bk, j) double tmp; tmp = bi, j; bi, j = bk, j; bk, j = tmp; return bm, n; static double Lishudu(int m, int n, double, a, double b) double, c = new doubleMatrixRows, MatrixCols; double, LSD
12、Result = new doubleMatrixCols, MatrixRows; int i, j, k; for (i = 0; i < MatrixRows; i+) for (j = 0; j < MatrixCols; j+) ci, j = Sort(i, j, a); for (j = 0; j < MatrixCols; j+) for (i = 0; i < MatrixRows; i+) for (k = 0; k < MatrixRows; k+) if (ai, j = ck, j) if (k = 0) if (bj < ck,
13、j) LSDResultj, i = 1; if (bj >= ck, j && bj < ck + 1, j) LSDResultj, i = (ck + 1, j - bj) / (ck + 1, j - ck, j); if (bj >= ck + 1, j) LSDResultj, i = 0; if (k = 1 | k = 2) if (bj < ck - 1, j) LSDResultj, i = 0; if (bj >= ck - 1, j && bj < ck, j) LSDResultj, i = (bj
14、- ck - 1, j) / (ck, j - ck - 1, j); if (bj >= ck, j && bj < ck + 1, j) LSDResultj, i = (ck + 1, j - bj) / (ck + 1, j - ck, j); if (bj >= ck + 1, j) LSDResultj, i = 0; if (k = 3) if (bj < ck - 1, j) LSDResultj, i = 0; if (bj >= ck - 1, j && bj < ck, j) LSDResultj, i
15、= (bj - ck - 1, j) / (ck, j - ck - 1, j); if (bj >= ck, j) LSDResultj, i = 1; return LSDResultm, n; static double FuzzyEvalution(int x, double, a, double b) double E = new doubleMatrixCols; double, R = new doubleMatrixCols, MatrixRows; double FEResult = new doubleMatrixRows; int i, j; for (i = 0;
16、 i < MatrixCols; i+) for (j = 0; j < MatrixRows; j+) Ri, j = Lishudu(i, j, a, b); for (i = 0; i < MatrixCols; i+) Ei = EWeight(i, a, b); for (i = 0; i < MatrixRows; i+) FEResulti = 0; for (j = 0; j < MatrixCols; j+) FEResulti += Ej * Rj, i; return FEResultx; private void Button1_Click
17、(object sender, EventArgs e) for (i = 0; i < MatrixCols; i+) myweighti = EWeight(i, a, b); TextBox7.Text = myweight0.ToString("0.00"); TextBox8.Text = myweight1.ToString("0.00"); TextBox9.Text = myweight2.ToString("0.00"); TextBox10.Text = myweight3.ToString("0.
18、00"); TextBox11.Text = myweight4.ToString("0.00"); TextBox12.Text = myweight5.ToString("0.00"); for (i = 0; i < MatrixRows; i+) myResulti = FuzzyEvalution(i, a, b); TextBox13.Text = myResult0.ToString("0.00"); TextBox14.Text = myResult1.ToString("0.00"
19、); TextBox15.Text = myResult2.ToString("0.00"); TextBox16.Text = myResult3.ToString("0.00"); private void Button2_Click(object sender, EventArgs e) this.Close(); private void Button4_Click(object sender, EventArgs e) string filename = Application.StartupPath + "computing res
20、ult.xls" string connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" + filename + "Extended Properties='Excel 8.0;HDR=Yes'"/这个链接字符串是excel2003的 OleDbConnection oleConn = new OleDbConnection(connstr); try oleConn.Open(); string sqlStr
21、,sqlStr1; DataTable dt = oleConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables_Info, null); bool existTable = false; foreach (DataRow dr in dt.Rows)/检查是否有信息表 if (dr"TABLE_NAME".ToString() = "指标权重表$" && dr"TABLE_NAME".ToString() = "评判结果表$")/要加个$号 existTabl
22、e = true; if (!existTable) sqlStr = "create table 指标权重表(完成质量确认_40 char(15),完成质量确认_80 nvarchar(10),施工方案变更确认 char(8),野外验收日期和结论 nvarchar(20),年度工作报告 varchar(30),监理评语 nvarchar(50)" sqlStr1 = "create table 评判结果表(好 char(15),较好 nvarchar(10),一般 char(8),较差 nvarchar(20)" OleDbCommand oleCmd
23、 = new OleDbCommand(sqlStr, oleConn); oleCmd.ExecuteNonQuery(); OleDbCommand oleCmd1 = new OleDbCommand(sqlStr1, oleConn); oleCmd1.ExecuteNonQuery(); string quality_40 = TextBox7.Text; string quality_80 = TextBox8.Text; string changeconfirm = TextBox9.Text; string datediscuss = TextBox10.Text; string workreport = TextBox11.Text; string comment = TextBox12.Text; string good = TextBox13.Text; string littlegood = TextBox14.Text; string common = TextBox15.Text; string bad = TextBox16
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二零二五年度时尚行业设计师薪酬与品牌保护合同
- 二零二五年度深海探测船光船租赁及数据采集合同
- 二零二五年度住房保障补贴协议
- 二零二五年度农村土地承包经营权流转与农业机械化服务合同
- 二零二五年度房地产劳务工派遣与物业管理服务合同
- 二零二五年度抵押车辆欠款转让合同
- 二零二五年度婚内财产约定协议书(婚后共同财产增值收益协议)
- 基层医疗卫生机构工会组织建设情况
- 公文知识培训-红头文件制作
- 门诊与急诊护理伦理
- 教育数字化转型背景下高职院校工程造价专业人才培养模式的创新路径
- 2025年春新冀教版英语三年级下册课件 U3L4
- 人生下半场-(美)鲍伯·班福德著杨曼如译
- 高中家长会 高二文科班下学期家长会课件
- (八省联考)河南省2025年高考综合改革适应性演练 思想政治试卷合集(含答案)
- 2024年沈阳二手房交易协议模板
- DB33T 1134-2017 静钻根植桩基础技术规程
- 《餐巾折花图示》课件
- 南京市、盐城市2025届高三年级第一次模拟考试(一模)英语试卷(含答案)+听力音频
- DB12T 676.3-2016 高速公路联网收费技术要求 第3部分:非现金收费
- 国家标准装修合同(2025年)
评论
0/150
提交评论