⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ahp_computerdlg.cpp

📁 AHP(层次分析法)的计算软件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CAHP_COMPUTERDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CAHP_COMPUTERDlg::OnOK() 
{
	// TODO: Add extra validation here
	//////////////////////////////////////////////////////
	// 计算前数据初始化
	// 变量初始化
	for(int i=0; i<6; i++)
	{
		m_TZXL[i] = 0.0f;   // 特征向量数组
		m_W[i] = 1.0f;      // 特征向量计算数组
		m_WT[i] = 0.0f;     // 特征根计算中间值(矩阵与特征向量乘积)
		
	}
	m_Wsum = 0.0f;   // 特征向量计算中间值
	m_TZGT = 0.0f;   // 特征根计算中间值(矩阵积与特征向量比的和)
	m_CI = 0.0;
	m_CR = 0.0;
	//////////////////////////////////////////////////////
	// 绘图设置
	CDC *pDC = GetDC();
	pDC->SetBkMode (TRANSPARENT);  // 背景透明
	//////////////////////////////////////////////////////
	// 计算
	for(i=0; i<m_JZJIESHU; i++)
	{
		for(j=0; j<m_JZJIESHU; j++)
		{
			m_W[i] = m_W[i] * m_JZ[i][j];    // 计算特征向量计算数组
		}
		m_Wsum = m_Wsum + pow(m_W[i],1.0/m_JZJIESHU);  // 计算特征向量计算中间值
	}
	// 计算特征向量
	for(k=0; k<m_JZJIESHU; k++)
	{
		m_TZXL[k] = pow(m_W[k],1.0/m_JZJIESHU)/m_Wsum;
	}
	// 计算BW(矩阵与特征向量相乘)
	for(m=0; m<m_JZJIESHU; m++)
	{
		for(n=0; n<m_JZJIESHU; n++)
		{
			m_WT[m] = m_WT[m] + m_JZ[m][n]*m_TZXL[n];
		}
	}
	// 特征根计算中间值(矩阵积与特征向量比的和)
	for(i=0; i<m_JZJIESHU; i++)
	{
		m_TZGT = m_TZGT + m_WT[i]/m_TZXL[i];
	}
	// 计算特征根
	m_TZG = m_TZGT/m_JZJIESHU;
	// 计算一致性指标
	m_CI = (m_TZG-m_JZJIESHU)/(m_JZJIESHU-1);
	// 计算随机一致性比例
	m_CR = m_CI/m_RI[m_JZJIESHU-1];

	//////////////////////////////////////////////////////
	// 结果输出
	m_TZXL0 = m_TZXL[0];  // 特征向量
	m_TZXL1 = m_TZXL[1];
	m_TZXL2 = m_TZXL[2];
	m_TZXL3 = m_TZXL[3];
	m_TZXL4 = m_TZXL[4];
	m_TZXL5 = m_TZXL[5];

	if(m_JZJIESHU>2)
	{
		m_YZZB = m_CI;  // 一致性指标
		m_YZBL = m_CR;  // 一致性比例
	}

	UpdateData(FALSE);  // 显示输出
	// 输出说明内容
	if(m_JZJIESHU==1)
	{
  		pDC->TextOut(50,315,"由于判断矩阵为一阶,所以具有完全一致性!");
	}
	else if(m_JZJIESHU==2)
	{
		pDC->TextOut(50,315,"由于判断矩阵为二阶,所以具有完全一致性!");
	}
	else if(m_JZJIESHU>2)
	{
		if(m_CR<0.1)
		{
			pDC->TextOut(50,315,"由于随机一致性比例CR < 0.1,所以判断矩阵具有满意的一致性!");
		}
		else if(m_CR>0.1)
		{
			pDC->TextOut(50,315,"由于随机一致性比例CR > 0.1,所以判断矩阵不具有满意的一致性!");
		}
	}
	else
	{
		pDC->TextOut(50,315,"输入参数不正确,请重新输入然后点开始按钮进行计算!");
	}

	//CDialog::OnOK();
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl00()   // 矩阵变量1
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[0][0]=m_JZBL00;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzjieshu() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl01() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[0][1]=m_JZBL01;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl02() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[0][2]=m_JZBL02;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl03() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[0][3]=m_JZBL03;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl04() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[0][4]=m_JZBL04;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl05() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[0][5]=m_JZBL05;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl10() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[1][0]=m_JZBL10;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl11() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[1][1]=m_JZBL11;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl12() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[1][2]=m_JZBL12;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl13() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[1][3]=m_JZBL13;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl14() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[1][4]=m_JZBL14;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl15() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[1][5]=m_JZBL15;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl20() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[2][0]=m_JZBL20;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl21() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[2][1]=m_JZBL21;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl22() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[2][2]=m_JZBL22;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl23() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[2][3]=m_JZBL23;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl24() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_JZ[2][4]=m_JZBL24;  // 矩阵数组赋值
}

void CAHP_COMPUTERDlg::OnChangeEditJzbl25() 
{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -