📄 liedoc.cpp
字号:
// AfxMessageBox(str);
Sample1.SkowronArithmetic();
Sample1.SaveFile(TmpFileNameOut);
Sample1.DeleteContents();
}
else
{
AfxMessageBox("Can't open file!");
bErrorOccured=true;
break;
}
break;
}
//--------------------------- 其它(工具) --------------------------------
case 40001://miss value
{
pApp->WriteLogAlg("工具:随机遗失",TmpFileNameIn);
Miss_Value a;
if(! a.perform(TmpFileNameIn,TmpFileNameOut))
{
bErrorOccured=true;
break;
}
break;
}
case 40002: //随机筛选生成train集
{
pApp->WriteLogAlg("工具:随机筛选生成训练集",TmpFileNameIn);
CLieRandomFilter a;
if(!a.Perform(TmpFileNameIn,TmpFileNameOut) )
{
bErrorOccured=true;
break;
}
break;
}
default:
::AfxMessageBox("no algorithm specified!");
bErrorOccured=true;
break;
}
// }//end try
// catch(...){//捕获一切异常
// AfxMessageBox("no algorithm specified!");
// bErrorOccured=true;
// param->outFlag=0;
// ::MessageBeep(MB_ICONHAND);
// AfxMessageBox("Out of memory11!",MB_OK|MB_ICONSTOP);
// return 1;
// }
//处理完毕,发送消息给主框架,显示结果文件。
pApp->WriteLog("执行完毕.");
if(bErrorOccured)
param->outFlag=0; //error
else
param->outFlag=1; //no error
// AfxMessageBox("in process, over!");
return 1;
}
/*
CString GetGlobeFileName()
{
g_strFileToSave.Format("~RS~tmp~%d.tmp",((CRSetApp*)AfxGetApp())->iIndex++);
return g_strFileToSave;
}
*/
//---------------completion-------------------
void CLieDoc::OnRsCompleteDel()
{
RunAlgorithm(1001); //取消补齐
}
void CLieDoc::OnRsCompleteMet()
{
RunAlgorithm(1002); //可辨识矩阵补齐
}
void CLieDoc::OnRsCompleteCombination()
{
RunAlgorithm(1003); //组合补齐
}
//----------------离散化部分-------------------
void CLieDoc::OnRsDiscreteMini()
{
RunAlgorithm(2001); //贪心算法
}
void CLieDoc::OnRsDiscreteMydis()
{
RunAlgorithm(2002); //属性重要性
}
void CLieDoc::OnRsDiscreteNaive()
{
RunAlgorithm(2003); //Naive 算法
}
void CLieDoc::OnRsDiscreteOne()
{
RunAlgorithm(2004); //改进的贪心算法1
}
void CLieDoc::OnRsDiscreteTwo()
{
RunAlgorithm(2005); //改进的贪心算法2
}
void CLieDoc::OnRsDiscreteThree()
{
RunAlgorithm(2012); //贪心算法
}
void CLieDoc::OnRsDiscreteFour()
{
RunAlgorithm(2013); //改进的贪心算法3
}
void CLieDoc::OnRsDiscreteFive()
{
RunAlgorithm(2014); //改进的贪心算法3等价算法
}
void CLieDoc::OnRsDiscreteSeminaive()
{
RunAlgorithm(2006); //seminaive 算法
}
//---------------------属性约简部分---------------
void CLieDoc::OnRsAttrReduNormal()
{
RunAlgorithm(3001); //y一般属性约简
}
void CLieDoc::OnRsAttrReduMatrix()
{
RunAlgorithm(3002); //可辨识矩阵
}
void CLieDoc::OnRsAttrReduSelect()
{
RunAlgorithm(3003); //特征选择
}
void CLieDoc::OnRsAttrReduInc()
{
RunAlgorithm(3004); //归纳属性约简
}
void CLieDoc::OnRsAttrReduEntropy1()
{
RunAlgorithm(3005); //信息熵约简1
}
void CLieDoc::OnRsAttrReduEntropy2()
{
RunAlgorithm(3006); //信息熵约简2
}
void CLieDoc::OnRsAttrReduMibark()
{
RunAlgorithm(3007);//MIBARK算法
}
void CLieDoc::OnRsValueReduNormal()
{
RunAlgorithm(4001); //一般值约简
}
void CLieDoc::OnRsValueReduQif()
{
RunAlgorithm(4002); //启发式值约简
}
void CLieDoc::OnRsValueReduMatrix()
{
RunAlgorithm(4003); //决策矩阵值约简
}
void CLieDoc::OnRsValueReduInc()
{
RunAlgorithm(4004); //归纳值约简
}
void CLieDoc::OnRsValueReduSkowron()
{
RunAlgorithm(4005); //skownron算法
}
void CLieDoc::OnRsSpecIncmpl()
{
RunAlgorithm(5001); //基于容差关系不完备数据处理
}
void CLieDoc::OnRsSpecIncmpl2()
{
RunAlgorithm(5002); //基于限制容差关系不完备数据处理
}
void CLieDoc::OnRsSpecIncmpl3()
{
RunAlgorithm(5003); //相似关系不完备数据处理
}
void CLieDoc::OnRsTest() //测试 普通测试
{
TRACE("test\n");
CLieTestDlg dlg;
// dlg.SetPerformType(1); //单样本最长
dlg.SetBeTest(true);
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(10001); //普通算法
}
}
void CLieDoc::OnRsSpecIncmplTest() //容差关系样本测试
{
//容差关系样本测试
TRACE("test\n");
CLieTestDlg dlg;
dlg.SetBeTest(true);
dlg.SetPerformType(1);// 容差
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(10002);
}
}
void CLieDoc::OnRsSpecIncmpl2Test() //限制容差关系测试
{
TRACE("test\n");
CLieTestDlg dlg;
dlg.SetBeTest(true);
dlg.SetPerformType(2); //限制容差
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(10003);
}
// RunAlgorithm(10003);
}
void CLieDoc::OnRsSpecIncmpl3Test() //相似关系样本测试
{
//相似关系样本测试
TRACE("test\n");
CLieTestDlg dlg;
dlg.SetBeTest(true);
dlg.SetPerformType(3);// 相似
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(10004);
}
}
void CLieDoc::OnRsRecognise() //识别
{
CLieTestDlg dlg;
dlg.SetBeTest(false);
// dlg.SetPerformType(1); //单样本最长
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(20001); //普通算法
}
}
void CLieDoc::OnRsSpecIncmplRecognise()
{
//容差 样本RECOGNISE
CLieTestDlg dlg;
dlg.SetBeTest(false);
dlg.SetPerformType(1); //容差
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(20002);
}
}
void CLieDoc::OnRsSpecIncmpl2Recognise()
{
//限制容差 样本测试
CLieTestDlg dlg;
dlg.SetBeTest(false);
dlg.SetPerformType(2); //限制容差
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(20003);
}
// RunAlgorithm(20003);
}
void CLieDoc::OnRsSpecIncmpl3Recognise()
{
//相似关系 样本识别
CLieTestDlg dlg;
dlg.SetBeTest(false);
dlg.SetPerformType(3);// 相似
dlg.SetAttrNum(GetAttrNum()+m_iReductedNum);
dlg.SetAttrname(GetAttrName());
dlg.SetRuleFile(GetPathName());
dlg.SetReductedAttr(m_ipReductedAttr);
if(dlg.DoModal()==IDOK)
{
g_strTestInputFile=dlg.GetInputFilePath();
g_bTestFew=dlg.GetFew();
RunAlgorithm(20004);
}
}
void CLieDoc::OnToolMissvalue()
{
RunAlgorithm(40001); //miss value
}
void CLieDoc::OnUpdateRsAttrReduInc(CCmdUI* pCmdUI)
{
pCmdUI->Enable( m_iStage==1&&GetIntAttNum()==m_iAttrNum
||m_iStage==2||m_iStage==0&&GetIntAttNum()==m_iAttrNum&&
IsComplete()); }
void CLieDoc::OnUpdateRsAttrReduMatrix(CCmdUI* pCmdUI)
{
pCmdUI->Enable( m_iStage==1&&GetIntAttNum()==m_iAttrNum
||m_iStage==2||m_iStage==0&&GetIntAttNum()==m_iAttrNum&&
IsComplete()); }
void CLieDoc::OnUpdateRsAttrReduNormal(CCmdUI* pCmdUI)
{
bool enabled= m_iStage==1
&& GetIntAttNum()==m_iAttrNum
||m_iStage==2||m_iStage==0&&GetIntAttNum()==m_iAttrNum&&
IsComplete();
enabled=enabled && stricmp(GetStyle(),"train")==0;
if(pCmdUI->m_pSubMenu!=0 )
pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex,MF_BYPOSITION|(enabled?MF_ENABLED:MF_GRAYED) );
}
void CLieDoc::OnUpdateRsAttrReduSelect(CCmdUI* pCmdUI)
{
pCmdUI->Enable( m_iStage==1&&GetIntAttNum()==m_iAttrNum
||m_iStage==2||m_iStage==0&&GetIntAttNum()==m_iAttrNum&&
IsComplete()); }
void CLieDoc::OnUpdateRsValueReduInc(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
m_iStage==3);
}
void CLieDoc::OnUpdateRsValueReduMatrix(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
m_iStage==3);
}
void CLieDoc::OnUpdateRsValueReduNormal(CCmdUI* pCmdUI)
{//一般值约简
if(pCmdUI->m_pSubMenu!=0 )
pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex,MF_BYPOSITION|
((stricmp(m_strStyle,"train")==0 && m_iStage==3)?MF_ENABLED:MF_GRAYED));
}
void CLieDoc::OnUpdateRsValueReduQif(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
m_iStage==3);
}
void CLieDoc::OnUpdateRsValueReduSkowron(CCmdUI* pCmdUI) //skowron菜单
{//skowron值约简
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
m_iStage==3);
}
void CLieDoc::OnUpdateRsSpecIncmpl(CCmdUI* pCmdUI)
{//容差关系
// if(pCmdUI->m_pSubMenu!=0 )
// pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex,MF_BYPOSITION|
// ((stricmp(m_strStyle,"train")==0 && !HasFloat() && !HasString() && m_iStage==0)?MF_ENABLED:MF_GRAYED));
// pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
// !HasFloat() && !HasString() && m_iStage==0);
// || stricmp(m_strStyle,"train")==0 && m_iStage==2);
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && !IsComplete());
}
void CLieDoc::OnUpdateRsSpecIncmpl2(CCmdUI* pCmdUI)
{//限制容差
// pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
// !HasFloat() && !HasString() && m_iStage==0
// || stricmp(m_strStyle,"train")==0 && m_iStage==2);
// pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
// !HasString() && m_iStage==0 || stricmp(m_strStyle,"train")==0 && m_iStage==2);
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && !IsComplete());
}
void CLieDoc::OnUpdateRsSpecIncmpl3(CCmdUI* pCmdUI)
{//相似关系
// pCmdUI->Enable(stricmp(m_strStyle,"train")==0 &&
// !HasFloat() && !HasString() && m_iStage==0
// || stricmp(m_strStyle,"train")==0 && m_iStage==2);
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && !IsComplete());
}
void CLieDoc::OnUpdateRsDiscreteTwo(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && IsComplete());
}
void CLieDoc::OnUpdateRsDiscreteSeminaive(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && IsComplete());
}
void CLieDoc::OnUpdateRsDiscreteOne(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && IsComplete());
}
void CLieDoc::OnUpdateRsDiscreteThree(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && IsComplete());
}
void CLieDoc::OnUpdateRsDiscreteFour(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && IsComplete());
}
void CLieDoc::OnUpdateRsDiscreteFive(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && IsComplete());
}
void CLieDoc::OnUpdateRsDiscreteNaive(CCmdUI* pCmdUI)
{
pCmdUI->Enable(stricmp(m_strStyle,"train")==0 && m_iStage<=1 && IsComplete());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -