//文件routcompute.h
#pragma once
#include "geneset.h"
class RoutCompute
{
public:
RoutCompute(void);
~RoutCompute(void);
//路由计算
void ComputeMethods(int ** netArray, int ** valArray,
int **& result, int routNum, int index);
private:
//成熟态gene集合
GeneSet *pGeneSet;
//路由接点集
NodeSet routNodes;
//路由接点数
int nodeNum;
//网络拓扑信息与耗散信息
int **netArray;
int **valArray;
private:
void Init(int ** _netArray, int ** _valArray, int _routNum);
void Evolution(RoutGene & gene);
bool COMPLETE(RoutGene & gene);
bool DECOMPLETE(RoutGene & gene);
void Builder1(RoutGene & gene);
void Builder2(RoutGene & gene);
void Builder(RoutGene & gene);
};
//文件routcompute.cpp
#include "routcompute.h"
#include "resource.h"
#using <mscorlib.dll>
using namespace GeneResource;
RoutCompute::RoutCompute(void)
{
pGeneSet = NULL;
netArray = NULL;
valArray = NULL;
nodeNum = 0;
SRand();
}
RoutCompute::~RoutCompute(void)
{
if(netArray!=NULL)
delete []netArray;
if(valArray!=NULL)
delete []valArray;
if(pGeneSet!=NULL)
delete pGeneSet;
}
void RoutCompute::Init(int ** _netArray, int ** _valArray, int _routNum)
{//初始化
nodeNum = _routNum;
routNodes.SetNodeNum(nodeNum);
for(int i=0;i<nodeNum;i++)
*(routNodes.GetpNodeSet()+i)=i;
netArray = new int*[nodeNum];
valArray = new int*[nodeNum];
for(int i=0;i<nodeNum;i++)
{
netArray[i]=new int[nodeNum];
valArray[i]=new int[nodeNum];
for(int j=0;j<nodeNum;j++)
{
netArray[i][j] = _netArray[i][j];
valArray[i][j] = _valArray[i][j];
}
}//
pGeneSet = new GeneSet(nodeNum,netArray,valArray);
}
本文地址:http://com.8s8s.com/it/it944.htm