资源简介
C++语言编写的关于属性重要度的算法实现,对粗糙集初学者来说主要很好的指导价值
代码片段和文件信息
#include“DecisionTable.h“
//决策表DT=(U CUD V f)类实现------------------------------------------------
int DecisionTable::iNo = 0;
DecisionTable::DecisionTable()
{
this->SerialNumberOfElement = 0;
}
vector DecisionTable::SetToiVector(Set &s)
{
vector temp;
for(int i=0; i {
temp.push_back(s.KeyAt(i));
}
return temp;
}
DecisionTable::DecisionTable(std::vector &ConditionSet //条件属性集,如{abc}
std::vector &DecisionSet //决策属性集,如{def}
std::vector &ConditionValueSet //由各样本的条件属性值(看成本文的集合)构成的向量
std::vector &DecisionValueSet) //由各样本的决策属性值(看成本文的集合)构成的向量
{
this->SerialNumberOfElement = 0;
this->ConditionSet = ConditionSet;
this->DecisionSet = DecisionSet;
if(ConditionValueSet.size() != DecisionValueSet.size())
{
cout<<“条件值集样本数与决策值集样本数不同!“< }
else
{
vector::iterator it1 = ConditionValueSet.begin();
vector::iterator it2 = DecisionValueSet.begin();
Element temp;
for( ; it1 {
temp.SetCondition((*it1).ToIntVector());
temp.SetDecision((*it2).ToIntVector());
SerialNumberOfElement++;
temp.SetU(SerialNumberOfElement);
DT.push_back(temp);
}
}
iNo++;
}
DecisionTable::DecisionTable(std::vector &ConditionSet //条件属性集,如{abc}
std::vector &DecisionSet //决策属性集,如{def}
std::vector> &ConditionValueSet //由各样本的条件属性值(看成本文的集合)构成的向量
std::vector> &DecisionValueSet) //由各样本的决策属性值(看成本文的集合)构成的向量
{
this->SerialNumberOfElement = 0;
this->ConditionSet = ConditionSet;
this->DecisionSet = DecisionSet;
if(ConditionValueSet.size() != DecisionValueSet.size())
{
cout<<“条件值集样本数与决策值集样本数不同!“< }
else
{
vector>::iterator it1 = ConditionValueSet.begin();
vector>::iterator it2 = DecisionValueSet.begin();
Element temp;
for( ; it1 {
temp.SetCondition(*it1);
temp.SetDecision(*it2);
SerialNumberOfElement++;
temp.SetU(SerialNumberOfElement);
DT.push_back(temp);
}
}
iNo++;
}
const DecisionTable& DecisionTable::operator=(DecisionTable &DT)
{
if(this != &DT)
{
this->ConditionSet = DT.GetConditionSet();
this->DecisionSet = DT.GetDecisionSet();
this->DT = DT.GetDT();
}
return *this;
}
DecisionTable::DecisionTable(const char* FileName)
{
this->SerialNumberOfElement = 0;
string str;
ifstream in(FileName);
if(! in)
{
cerr<<“不能打开“< exit(-1);
}
while(getline(in str))
{
istringstream line(str);
line>>str;
if(str == “@ConditionAttribute“)
{
char ch;
line>>ch;
ConditionSet.push_back(ch);
}
if(str == “@DecisionAt
- 上一篇:C#遗传算法程序可视化版
- 下一篇:生产者与消费者 进程调度模拟c++
相关资源
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- CCS FFT c语言算法
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- 小波变换算法 c语言版
- 3des加密算法C语言实现
- C++纯文字DOS超小RPG游戏
- DES加密算法C语言实现
- VC++MFC小游戏实例教程(实例)+MFC类库
- 线性回归算法c语言实现
- 基于C语言的模拟退火算法
- C语言实现的DES对称加密算法
- 用VC6.0实现多边形扫描线填充算法
- c语言编写的货郎担算法
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
评论
共有 条评论