《模糊综合评判c#代码》由会员分享,可在线阅读,更多相关《模糊综合评判c#代码(9页珍藏版)》请在金锄头文库上搜索。
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 int MatrixRows
2、 = 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 doubleMatrixCols, MatrixRo
3、ws; 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 da.Rows.Count; m+) for (in
4、t 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 = s1, 3; label11.Text = s1, 4; labe
5、l12.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; label24.Text = s3, 5; for (i = 0; i Matr
6、ixRows; 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.Text = t0; TextBox2.Text = t1; TextBox3.Text = t2; TextBox4.T
7、ext = 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+) / / myLiShuDui, j = Lishudu(i, j, a, b); / / for (i = 0; i MatrixCols; i+) / / for (j = 0; j Ma
8、trixRows; 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 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 = 0; for (i = 0; i MatrixCols; i+) ETotal += (bi / Averi); ERes