資源簡介
利用層次分析法需要計算權重,而權重的計算和使用是比較麻煩的,在這里封裝了一些方法。注意的吧,這個東西需要一點知識,代碼應該沒問題。

代碼片段和文件信息
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?WindowsFormsApplication2;
namespace?WindowsFormsApplication2
{
????public?partial?class?AHPWightCalculateForm?:?Form
????{
????????#region?變量
????????private?IList?m_matrixInfos?=?null;?//傳入的矩陣信息
????????private?List?m_childControls?=?new?List();
????????private?bool?m_IsOK?=?true;
????????private?Dictionary?m_Index_Width;
????????private?AHPWeightMatrixInfo?m_topItem?=?null;
????????#endregion
????????#region?屬性
????????public?IList?MatrixInfo
????????{
????????????get?{?return?m_matrixInfos;?}
????????}
????????#endregion
????????#region?構造函數
????????public?AHPWightCalculateForm(IList?matrixInfos)
????????{
????????????InitializeComponent();
????????????m_matrixInfos?=?matrixInfos;
????????????m_topItem?=?new?AHPWeightMatrixInfo(“總權重“);
????????????m_topItem.AddRange(m_matrixInfos);
????????????m_Index_Width?=?new?Dictionary();
????????????BuildTree();
????????}
????????private?void?FormCalcWeight_Load(object?sender?EventArgs?e)
????????{
????????????CreateTablePage(m_matrixInfos);
????????????button1_Click(nullnull);
????????}
????????#endregion
????????#region?構建樹界面
????????private?void?BuildTree()
????????{
????????????TreeNode?gtn?=?new?TreeNode();
????????????gtn.Text?=?“綜合權重-1“;
????????????gtn.ImageIndex?=?0;
????????????gtn.Tag?=?m_topItem;
????????????this.treeView1.Nodes.Add(gtn);
????????????for?(var?i?=?0;?i?????????????{
????????????????TreeNode?tn?=?new?TreeNode(m_matrixInfos[i].Name?+?“-0“);
????????????????tn.Tag?=?m_matrixInfos[i];
????????????????tn.ImageIndex?=?0;
????????????????gtn.Nodes.Add(tn);
????????????????BuildChildItem(m_matrixInfos[i]?tn);
????????????}
????????????this.treeView1.ExpandAll();
????????}
????????private?void?BuildChildItem(AHPWeightMatrixInfo?matrixTreeNode?parentNode)
????????{
????????????for?(var?j?=?0;?j?????????????{
????????????????TreeNode?tn?=?new?TreeNode(matrix.ChildItems[j].Name?+?“-0“);
????????????????tn.Tag?=?matrix.ChildItems[j];
????????????????tn.ImageIndex?=?1;
????????????????parentNode.Nodes.Add(tn);
????????????}
????????}
????????private?void?treeView1_AfterSelect(object?sender?TreeViewEventArgs?e)
????????{
????????????var?tn?=?this.treeView1.SelectedNode;
????????????if?(tn?==?null)?return;
????????????if?(tn?==?this.treeView1.Nodes[0])
????????????{
????????????????this.tablePage1.SelectedIndex?=?0;
????????????}
????????????else
????????????{
????????????????AHPWeightMatrixInfo?matrix?=?tn.Tag?as?AHPWeightMatrixInfo;
????????????????if?(matrix?!=?null)
????????????????{
???????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????371??2018-05-01?11:59??層次分析法權重1.2\folder.png
?????文件???????4624??2018-05-16?17:22??層次分析法權重1.2\WindowsFormsApplication2\AHPCompute.csproj
?????文件??????16842??2018-05-22?15:10??層次分析法權重1.2\WindowsFormsApplication2\AHPWightCalculateForm.cs
?????文件??????11251??2018-05-16?18:09??層次分析法權重1.2\WindowsFormsApplication2\AHPWightCalculateForm.designer.cs
?????文件??????11615??2018-05-16?18:09??層次分析法權重1.2\WindowsFormsApplication2\AHPWightCalculateForm.resx
?????文件??????15665??2018-05-22?15:29??層次分析法權重1.2\WindowsFormsApplication2\AHPWightCalculateWeightsControl.cs
?????文件??????12180??2018-05-22?15:16??層次分析法權重1.2\WindowsFormsApplication2\AHPWightCalculateWeightsControl.Designer.cs
?????文件???????6017??2018-05-22?15:16??層次分析法權重1.2\WindowsFormsApplication2\AHPWightCalculateWeightsControl.resx
?????文件??????40448??2018-05-22?15:30??層次分析法權重1.2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe
?????文件??????79360??2018-05-22?15:30??層次分析法權重1.2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb
?????文件??????11600??2018-05-22?15:29??層次分析法權重1.2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe
?????文件????????490??2012-06-06?02:06??層次分析法權重1.2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest
?????文件???????2455??2018-05-22?14:56??層次分析法權重1.2\WindowsFormsApplication2\Form1.cs
?????文件???????2043??2018-05-16?21:08??層次分析法權重1.2\WindowsFormsApplication2\Form1.Designer.cs
?????文件???????5817??2018-05-16?21:08??層次分析法權重1.2\WindowsFormsApplication2\Form1.resx
?????文件???????3317??2018-05-22?15:11??層次分析法權重1.2\WindowsFormsApplication2\MatrixCalculusHelper.cs
?????文件???????2018??2018-05-22?14:58??層次分析法權重1.2\WindowsFormsApplication2\MatrixInfo.cs
?????文件??????19238??2018-05-22?14:19??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6417??2018-05-22?15:30??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????4179??2018-05-16?18:09??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.AHPWightCalculateForm.resources
?????文件????????180??2018-05-22?15:18??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.AHPWightCalculateWeightsControl.resources
?????文件???????3932??2018-05-22?15:29??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt
?????文件???????1263??2018-05-22?15:18??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.csproj.GenerateResource.Cache
?????文件??????40448??2018-05-22?15:30??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.exe
?????文件????????180??2018-05-16?21:08??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Form1.resources
?????文件??????79360??2018-05-22?15:30??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.pdb
?????文件????????180??2018-05-16?17:22??層次分析法權重1.2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Properties.Resources.resources
?????文件????????505??2018-05-15?16:51??層次分析法權重1.2\WindowsFormsApplication2\Program.cs
?????文件???????1391??2018-05-22?15:30??層次分析法權重1.2\WindowsFormsApplication2\Properties\AssemblyInfo.cs
?????文件???????2900??2018-05-15?16:51??層次分析法權重1.2\WindowsFormsApplication2\Properties\Resources.Designer.cs
............此處省略17個文件信息
評論
共有 條評論