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

📄 liedoc.cpp

📁 某个实验事编写粗糙集智能信息处理的程序
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		3001		一般属性约简
		3002		可辨识矩阵属性约简
		3003		特征选择属性约简
		3004		归纳属性约简
		3005		信息熵属性约简1
		3006		信息熵属性约简2
		3007		信息熵属性约简3 MIBARK
		3008		动态约简
		3009		手工约简
		3010		遗传算法1
		3011		遗传算法2(贪心算法)
		3012		遗传算法3(贪心算法)
   值约简(优化)		400-
		4001		一般值约简
		4002		启发式值约简
		4003		决策矩阵值约简
		4004		归纳值约简
		4005		skowron 算法
		
   不规则数据处理	500-
		5001		不完备数据处理——容差关系
		5002		不完备数据处理——限制容差关系
		5003		不完备数据处理——相似关系

   样本测试			1000-
		10001		一般测试
		10002		容差关系测试
		10003		限制容差测试
		10004		相似关系测试
   样本识别			2000-
		20001		一般识别
		20002		容差关系识别
		20003		限制容差识别
		20004		相似关系识别
  自主学习模型:
        30001       不确定性自主学习
  其它(工具):
		40001		随机遗失

*/
//---------------------------------------------------------
UINT CLieDoc::PerformFunc( LPVOID pParam )
{
	P_KYLIN_PARAM param=(P_KYLIN_PARAM)pParam;	//get param
	BOOL bErrorOccured=false;

	char TmpPath[_MAX_DIR],TmpFileNameIn[_MAX_DIR];
//	char TmpFileNameOut[_MAX_DIR];
	char TmpFileNameOut[200];
	CRSetApp* pApp=(CRSetApp*)AfxGetApp();

	if(param->inFlag!=500)
	{
// prepare for out file name
	GetTempPath(_MAX_DIR,TmpPath);
	param->outFile1.Format("%s~~Rs@%d.tmp",TmpPath,pApp->iIndex++);
	param->outFile1.LockBuffer();
	strcpy(TmpFileNameOut,param->outFile1.GetBuffer(_MAX_DIR));
	param->outFile1.ReleaseBuffer();
// prepare for in file name
	
	strcpy(TmpFileNameIn,param->inFile1.GetBuffer(_MAX_DIR));
 // try{
	}
	switch (param->inFlag)
	{
//----------------------------------  打开数据库文件 --------------------------------------------
      case 500:
		{
	    	CDatabase *database=new CDatabase;
        	LinkDB link;
			link.pDb=database;			
			if(link.DoModal()==IDOK)
			{ 
				if(strcmp(link.OutPath,"")!=0)
				{
					param->outFile1.Format("%s",link.OutPath);
					param->outFile1.LockBuffer();
					strcpy(TmpFileNameOut,param->outFile1.GetBuffer(200));
					param->outFile1.ReleaseBuffer();
				}
				else bErrorOccured=true;
			}
			else
				bErrorOccured=true;
			break;	
		}

//----------------------------------  补齐算法 --------------------------------------------

	case 1001:		//取消补齐
		{
			pApp->WriteLogAlg("补齐:取消补齐",TmpFileNameIn);
			CLieCompleteDel a;
			if(! a.ReadFile(TmpFileNameIn))
			{
				bErrorOccured=true;
				break;
			}
			if( !a.WriteFile(TmpFileNameOut))
			{
				AfxMessageBox("error! Please check source file!");
				bErrorOccured=true;
				break;
			}
			break;
		}
	case 1002:			//基于可辨识矩阵补齐
		{
			pApp->WriteLogAlg("补齐:基于可辨识矩阵",TmpFileNameIn);
			CBaoComplete a;
			if(! a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("error! Please check source file!");
				bErrorOccured=true;
				break;
			}
			if(! a.InitTable())
			{
				bErrorOccured=true;
				break;
			}
			if(!a.Remedy())
			{
				AfxMessageBox("分配内存时发生错误!");
				bErrorOccured=true;
				break;
			}
			if ( !a.SaveFile(TmpFileNameOut) )
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			break;
		}
	case 1003:			//组合补齐
		{
			pApp->WriteLogAlg("补齐:组合补齐",TmpFileNameIn);
			CZssCombinalComplete aa;
			if(!aa.CombinatorialCompleter(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
			}
			break;

		}

	//	1003		组合补齐	combination compleate
	//	1004		条件组合补齐
	//	1005		平均补齐	meancomplete
	//	1006		条件平均补齐	condition mean complete
	case 1004:
		{
			pApp->WriteLogAlg("补齐:条件组合补齐",TmpFileNameIn);
			CZssCombinalComplete aa;
			if(!aa.ConditionCombinatorialCompleter(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
			}
			break;
		}
	case 1005:
		{
			pApp->WriteLogAlg("补齐:平均补齐",TmpFileNameIn);
			CZssMeanComplete aa;
			if(!aa.MeanComplete(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
			}
			break;
		}
	case 1006:
		{
			pApp->WriteLogAlg("补齐:条件平均补齐",TmpFileNameIn);
			CZssConditionMeanComplete aa;
			if(!aa.ConditionMeanCompleter(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
			}
			break;
		}
		
	
//--------------------------------离散化算法--------------------------------------

	case 2001:		//Ngugen贪心算法
		{
			pApp->WriteLogAlg("离散化:贪心算法",TmpFileNameIn);

			CSemiMini a;
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			if(! a.OnSemiMinidis())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnSemiMinidisSave(TmpFileNameOut);
			break;
		}
	case 2002:		//属性重要性算法
		{
			pApp->WriteLogAlg("离散化:属性重要性算法",TmpFileNameIn);
			CMydis a;
			
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			
			if(!a.OnMydis())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnMydisSave(TmpFileNameOut);
			break;
		}
	case 2003:		//Naive算法
		{
			pApp->WriteLogAlg("离散化:Naive算法",TmpFileNameIn);
			CNaivedis a;
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			
			if(!a.OnNaivedis())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			if(!a.OnNaivedisSave(TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			break;
		}

	case 2012:	//原本的贪心算法(按照算法的思路重写)
		{
			pApp->WriteLogAlg("离散化:Nguyen贪心算法",TmpFileNameIn);
			CDisThree a;
			
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			
			if(!a.OnDisThree())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnDisThreeSave(TmpFileNameOut);
			break;
		}

	case 2004:	//改进的贪心算法1
		{
			pApp->WriteLogAlg("离散化:改进的贪心算法1",TmpFileNameIn);
			CDisOne a;
			
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			
			if(!a.OnDisOne())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnDisOneSave(TmpFileNameOut);
			break;
		}
	case 2005:	//改进的贪心算法2
		{
			pApp->WriteLogAlg("离散化:改进的贪心算法2",TmpFileNameIn);
			CDisTwo a;
			
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			
			if(!a.OnDisTwo())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnDisTwoSave(TmpFileNameOut);
			break;
		}
	case 2013:	//改进的贪心算法3
		{
			pApp->WriteLogAlg("离散化:改进的贪心算法3",TmpFileNameIn);
			CDisFour a;
			
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			
			if(!a.OnDisFour())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnDisFourSave(TmpFileNameOut);
			break;
		}
	case 2014:	//改进的贪心算法3等价算法
		{
			pApp->WriteLogAlg("离散化:贪心算法",TmpFileNameIn);

			CSemiMiniOne a;
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			if(! a.OnSemiMinidis())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnSemiMinidisSave(TmpFileNameOut);
			break;
		}

	case 2006:	//seminaive算法
		{
			pApp->WriteLogAlg("离散化:SemiNaive算法",TmpFileNameIn);
			CSemiNaive a;
			
			if(!a.ReadDataFromFile(TmpFileNameIn))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			
			if(!a.OnSemiNaivedis())
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				break;
			}
			a.OnSemiNaivedisSave(TmpFileNameOut);
			break;
		}

//		2007		等距离离散化 widthscaler
//		2008		等频率		 frequency scaler
//		2009		 信息熵		 entropy sclaer
//		2010		断点重要性	 breakpointscalar
//		2011		Manual scalar
	case 2007:		//2007等距离离散化 widthscaler
		{
			pApp->WriteLogAlg("离散化:等距离离散化",TmpFileNameIn);
			CZssWidthScaler aa;
			if(!aa.EqualWidthScaler(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误或者取消操作!");
				bErrorOccured=true;
			}
			break;
		}
	
	case 2008://		2008		等频率		 frequency scaler
		{
			pApp->WriteLogAlg("离散化:等频率离散化",TmpFileNameIn);
			CZssFrequencyScaler aa;
			if(!aa.EqualFrequencyScaler(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误或者取消操作!");
				bErrorOccured=true;
			}
			break;
		}
	case 2009://		2009		 信息熵		 entropy sclaer

		{
			pApp->WriteLogAlg("离散化:信息熵算法",TmpFileNameIn);
			CZssEntropyScaler aa;
			if(!aa.EntropyScaler (TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
			}	
			break;
		}
	case 2010://		2010		断点重要性	 breakpointscalar

		{
			pApp->WriteLogAlg("离散化:断点重要性算法",TmpFileNameIn);
			try
			{
				CZssBreakPointScaler aa;
				aa.BreakPointScaler(TmpFileNameIn,TmpFileNameOut);
			}
			catch(...)
			{
				AfxMessageBox("发生错误!");
			}
			break;
		}
	case 2011://		2011		Manual scalar
		{
			pApp->WriteLogAlg("离散化:手工离散化",TmpFileNameIn);
			CZssManualScaler aa;
			if(! aa.MannualScaler(TmpFileNameIn,TmpFileNameOut) )
			{
				AfxMessageBox("发生错误或者用户取消操作!");
				bErrorOccured=true;
			}
			break;
		}
//----------------------------------------属性约简------------------------------------
	case 3001:		//一般属性约简
		{
			pApp->WriteLogAlg("属性约简:一般约简",TmpFileNameIn);
			CTable *redu= new CReduct1;
			if(! redu->Perform(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("error occured!");
				bErrorOccured=true;
				delete redu;
				break;
			}

			delete redu;
			break;
		}
	case 3002:		//可辨识矩阵属性约简
		{
			pApp->WriteLogAlg("属性约简:可辨识矩阵约简",TmpFileNameIn);
			CTable *redu= new CReduct2;
			if(! redu->Perform(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				delete redu;
				break;
			}
			
			delete redu;
			break;
		}
	case 3003:		//特征选择属性约简
		{
			pApp->WriteLogAlg("属性约简:特征选择约简",TmpFileNameIn);
	     	CTable *redu= new CReduct3;
			if(! redu->Perform(TmpFileNameIn,TmpFileNameOut))
			{
				AfxMessageBox("发生错误!");
				bErrorOccured=true;
				delete redu;
				break;
			}
			

⌨️ 快捷键说明

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