资源简介
有代码,有详细文档,有毕业论文 非常好的一个毕业设计

代码片段和文件信息
#include “chromosome.h“
Chromo::Chromo()
{
//默认全部置0
m_iKpCount = 0;
m_pKpItems = NULL;
m_pKpList = NULL;
m_pObSet = NULL;
m_iProfit = 0;
m_pAssignedOb = NULL;
m_iAObCount = 0;
m_pUnssignedOb = NULL;
m_iUObCount = 0;
m_bChanged = true;
}
Chromo::Chromo(int kCount objectSet *pSetint capint* capList)
{
m_pKpList = NULL;
m_pAssignedOb = NULL;
m_pUnssignedOb = NULL;
m_pKpItems = NULL;
m_pObSet = pSet;
m_iKpCount = kCount;
reset();
m_pKpList = new Knapsack[kCount];
for(int i = 0;i < kCount; ++i){
if(cap) m_pKpList[i].setProp(cappSet->m_pTablepSet->m_iObCount);
else m_pKpList[i].setProp(capList[i]pSet->m_pTablepSet->m_iObCount);
}
m_bChanged = true;
// set(kCountpSetcapcapList);
}
Chromo::Chromo(const Chromo &another)
{
m_iKpCount = another.m_iKpCount;
m_pKpItems = NULL;
m_pKpList = new Knapsack[m_iKpCount];
for(int i = 0;i < m_iKpCount; ++i)
m_pKpList[i] = another.m_pKpList[i];
m_pObSet = another.m_pObSet;
m_iAObCount = another.m_iAObCount;
m_pAssignedOb = new int[m_pObSet->m_iObCount];
for(int i = 0;i < m_pObSet->m_iObCount;++i)
m_pAssignedOb[i] = another.m_pAssignedOb[i];
m_iUObCount = another.m_iUObCount;
m_pUnssignedOb = new int[m_pObSet->m_iObCount];
for(int i = 0; i < m_pObSet->m_iObCount; ++i)
m_pUnssignedOb[i] = another.m_pUnssignedOb[i];
m_iProfit = 0;
m_bChanged = true;
}
Chromo::~Chromo()
{
if(m_pUnssignedOb) delete []m_pUnssignedOb;
if(m_pAssignedOb)delete []m_pAssignedOb;
resetKpItems();
if(m_pKpList) delete []m_pKpList;
}
Chromo& Chromo::operator =(const Chromo &another)
{
m_iKpCount = another.m_iKpCount;
resetKpItems();
if(!m_pKpList) m_pKpList = new Knapsack[m_iKpCount];
for(int i = 0;i < m_iKpCount; ++i)
m_pKpList[i] = another.m_pKpList[i];
m_pObSet = another.m_pObSet;
m_iAObCount = another.m_iAObCount;
m_iUObCount = another.m_iUObCount;
if(!m_pAssignedOb) m_pAssignedOb = new int[m_pObSet->m_iObCount];
if(!m_pUnssignedOb) m_pUnssignedOb = new int[m_pObSet->m_iObCount];
for(int i = 0; i < m_pObSet->m_iObCount; ++i){
m_pAssignedOb[i] = another.m_pAssignedOb[i];
m_pUnssignedOb[i] = another.m_pUnssignedOb[i];
}
m_iProfit = another.m_iProfit;
m_bChanged = true;
return *this;
}
void Chromo::set(int kCount objectSet *pSet int cap int *capList)
{
m_iKpCount = kCount;
m_iProfit = 0;
m_pObSet = pSet;
reset();
if(m_pKpList) delete[] m_pKpList;
m_pKpList = new Knapsack[kCount];
for(int i = 0; i < kCount; ++i){
if(cap) m_pKpList[i].setProp(cappSet->m_pTablepSet->m_iObCount);
else m_pKpList[i].setProp(capList[i]pSet->m_pTablepSet->m_iObCount);
}
m_bChanged = true;
}
void Chromo::reset()
{
m_iAObCount = 0;
m_iUObCount = m_pObSet->m_iObCount;
if(m_pAssignedOb) delete[] m_pAssignedOb;
m_pAssignedOb = new int[m_pObSet->m_iObCount];
if(m_pUnssignedOb) delete[] m_pUnssignedOb;
m_pUnssignedOb = new int[m_pObSet->m_iObCount];
for
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 779264 2009-05-06 23:10 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\二维多重背包问题及基于遗传算法的解决方案.doc
文件 7313 2009-04-07 15:53 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\chromosome.cpp
文件 2374 2009-04-07 15:53 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\chromosome.h
文件 5091 2009-04-19 21:51 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\knapsack.cpp
文件 1336 2009-04-07 15:53 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\knapsack.h
文件 1205 2009-04-07 15:53 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\ob
文件 4450 2009-04-07 15:53 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\population.cpp
文件 1010 2009-04-07 15:53 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\population.h
文件 130 2009-04-22 21:33 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\readme.txt
文件 1544 2009-04-10 01:49 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source\test.cpp
目录 0 2009-04-26 17:38 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)\source
目录 0 2009-05-07 00:14 05372137谢文祺(二维多重背包问题及基于遗传算法的解决方案)
----------- --------- ---------- ----- ----
803717 12
- 上一篇:双音多频信号的合成与识别.zip
- 下一篇:小波图像处理
相关资源
- QGA 量子遗传算法
- 基于遗传算法的排课系统
- 遗传算法的M文件
- 遗传算法PPT(Genetic_Algorithms.ppt)
- 遗传算法的堆石料非线性本构模型参
- 遗传算法越野小车unity5.5
- 车间布局遗传算法
- 遗传算法论文11篇
- 基于遗传算法的立体车库车位调度研
- 遗传算法解决TSP旅行商问题程序开源
- 基于GA-ELM的瓦斯涌出量预测
- 5种多旅行商问题(MTSP)的遗传算法
- 人工智能和遗传算法的结合推荐必读
- 遗传算法0-1背包问题论文
- 改进的k_均值聚类排挤小生境遗传算法
- 基于遗传优化的无刷直流电机模糊控
- GA+ICP代码
- 计算智能大作业合集
- 遗传算法与工程优化_玄光男_程润伟
- NSGA和NSGAII算法
- 群体智能.ppt
- Qt写的遗传算法加画图程序
- 遗传算法优化支持向量机算法
- 遗传算法原理及应用--选择交叉变异算
- 使用神经网络与遗传算法的小游戏
- 遗传算法的适应度函数构造
- 车间调度遗传算法程序
- 遗传算法及其代码实现
- 遗传算法的基本理论与应用
- 遗传算法原理及应用
评论
共有 条评论