• 大小: 119KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-08-11
  • 语言: 其他
  • 标签: AHP  权重  C#  

资源简介

利用层次分析法需要计算权重,而权重的计算和使用是比较麻烦的,在这里封装了一些方法。注意的吧,这个东西需要一点知识,代码应该没问题。

资源截图

代码片段和文件信息

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 < m_matrixInfos.Count; 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 < matrix.ChildItems.Count; 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个文件信息

评论

共有 条评论