﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-振动理论-最新评论</title><link>http://www.cppblog.com/assist/CommentsRSS.aspx</link><description>我的C++实现之路</description><language>zh-cn</language><pubDate>Thu, 31 May 2007 03:26:58 GMT</pubDate><lastBuildDate>Thu, 31 May 2007 03:26:58 GMT</lastBuildDate><generator>cnblogs</generator><item><title>re: C++遗传算法源程序</title><link>http://www.cppblog.com/assist/archive/2008/04/20/24873.html#47646</link><dc:creator>阿毛</dc:creator><author>阿毛</author><pubDate>Sat, 19 Apr 2008 18:33:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2008/04/20/24873.html#47646</guid><description><![CDATA[你好，我在做遗传算法解决vrp问题的毕业论文，有问题想指教，有偿求助，急，望回复，我的q是267497220<img src ="http://www.cppblog.com/assist/aggbug/47646.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">阿毛</a> 2008-04-20 02:33 <a href="http://www.cppblog.com/assist/archive/2008/04/20/24873.html#47646#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: VC++窗口分割与通信实例[未登录]</title><link>http://www.cppblog.com/assist/archive/2007/11/27/24736.html#37374</link><dc:creator>th</dc:creator><author>th</author><pubDate>Tue, 27 Nov 2007 03:40:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/11/27/24736.html#37374</guid><description><![CDATA[找到原因了 我的CTestDlg对话框属性设置问题。<img src ="http://www.cppblog.com/assist/aggbug/37374.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">th</a> 2007-11-27 11:40 <a href="http://www.cppblog.com/assist/archive/2007/11/27/24736.html#37374#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: VC++窗口分割与通信实例[未登录]</title><link>http://www.cppblog.com/assist/archive/2007/11/27/24736.html#37350</link><dc:creator>th</dc:creator><author>th</author><pubDate>Mon, 26 Nov 2007 16:16:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/11/27/24736.html#37350</guid><description><![CDATA[你好，CTestDlg应该显示在 VCRightView里面，但我的为什么显示在CMainFrame的坐标（0。0）位置？请指点。<img src ="http://www.cppblog.com/assist/aggbug/37350.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">th</a> 2007-11-27 00:16 <a href="http://www.cppblog.com/assist/archive/2007/11/27/24736.html#37350#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: C++遗传算法源程序</title><link>http://www.cppblog.com/assist/archive/2007/10/21/24873.html#34733</link><dc:creator>starlet</dc:creator><author>starlet</author><pubDate>Sun, 21 Oct 2007 00:15:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/10/21/24873.html#34733</guid><description><![CDATA[作者不知道有没有联系方式，有问题请教<img src ="http://www.cppblog.com/assist/aggbug/34733.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">starlet</a> 2007-10-21 08:15 <a href="http://www.cppblog.com/assist/archive/2007/10/21/24873.html#34733#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: VC++窗口分割与通信实例</title><link>http://www.cppblog.com/assist/archive/2007/10/06/24736.html#33597</link><dc:creator>aa</dc:creator><author>aa</author><pubDate>Sat, 06 Oct 2007 02:26:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/10/06/24736.html#33597</guid><description><![CDATA[找到原因了是我加错了这个响应IsSelected<img src ="http://www.cppblog.com/assist/aggbug/33597.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">aa</a> 2007-10-06 10:26 <a href="http://www.cppblog.com/assist/archive/2007/10/06/24736.html#33597#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: VC++窗口分割与通信实例</title><link>http://www.cppblog.com/assist/archive/2007/10/06/24736.html#33596</link><dc:creator>aa</dc:creator><author>aa</author><pubDate>Sat, 06 Oct 2007 02:13:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/10/06/24736.html#33596</guid><description><![CDATA[LeftTreeView.obj : error LNK2001: unresolved external symbol &quot;public: virtual int __thiscall CLeftTreeView::IsSelected(class CObject const *)const &quot; (?IsSelected@CLeftTreeView@@UBEHPBVCObject@@@Z)<br>Release/SplitWndDemo.exe : fatal error LNK1120: 1 unresolved externals<br>Error executing link.exe.<br><br>怎么回事?<img src ="http://www.cppblog.com/assist/aggbug/33596.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">aa</a> 2007-10-06 10:13 <a href="http://www.cppblog.com/assist/archive/2007/10/06/24736.html#33596#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: C++遗传算法源程序</title><link>http://www.cppblog.com/assist/archive/2007/06/25/24873.html#26916</link><dc:creator>7777</dc:creator><author>7777</author><pubDate>Mon, 25 Jun 2007 09:33:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/06/25/24873.html#26916</guid><description><![CDATA[垃圾  什么你都往上传<img src ="http://www.cppblog.com/assist/aggbug/26916.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">7777</a> 2007-06-25 17:33 <a href="http://www.cppblog.com/assist/archive/2007/06/25/24873.html#26916#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: C++遗传算法源程序</title><link>http://www.cppblog.com/assist/archive/2007/05/27/24873.html#24942</link><dc:creator>江水兽</dc:creator><author>江水兽</author><pubDate>Sun, 27 May 2007 11:04:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/05/27/24873.html#24942</guid><description><![CDATA[啊哈 当初我也写过 只是没有像这样如此具有遗传算法的特点 当时只是为了选修课写的一个具有基本功能的GA Program<img src ="http://www.cppblog.com/assist/aggbug/24942.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">江水兽</a> 2007-05-27 19:04 <a href="http://www.cppblog.com/assist/archive/2007/05/27/24873.html#24942#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: C++遗传算法源程序</title><link>http://www.cppblog.com/assist/archive/2007/05/26/24873.html#24898</link><dc:creator>pass86</dc:creator><author>pass86</author><pubDate>Sat, 26 May 2007 09:38:00 GMT</pubDate><guid>http://www.cppblog.com/assist/archive/2007/05/26/24873.html#24898</guid><description><![CDATA[我也写过一点，从书上改编的。<br>/********************************************************************<br>	Filename: 	aiWorld.h<br>    Purpose:	遗传算法，花朵演化。<br>	Author:		pass86<br>    E-mail:     pass86@gmail.com<br>    Created:	2007/03/29<br>    Id:<br>    Copyright:<br>    Licence:<br>*********************************************************************/<br>#ifndef AIWORLD_H_<br>#define AIWORLD_H_<br><br>#include &lt;iostream&gt;<br>#include &lt;ctime&gt;<br>#include &lt;cstdlib&gt;<br>#include &lt;cmath&gt;<br><br>#define kMaxFlowers                         10<br><br>using std::cout;<br>using std::endl;<br><br>class ai_World<br>{<br>public:<br>	ai_World()<br>	{<br>	    srand(time(0));<br>    }<br>	~ai_World() {}<br><br>	int temperature[kMaxFlowers];           //温度<br>	int water[kMaxFlowers];                 //水质<br>	int sunlight[kMaxFlowers];              //阳光<br>	int nutrient[kMaxFlowers];              //养分<br>	int beneficialInsect[kMaxFlowers];      //益虫<br>	int harmfulInsect[kMaxFlowers];         //害虫<br><br>    int currentTemperature;<br>    int currentWater;<br>    int currentSunlight;<br>    int currentNutrient;<br>    int currentBeneficialInsect;<br>    int currentHarmfulInsect;<br><br>    /**<br>    第一代花朵<br>    */<br>	void Encode();<br><br>	/**<br>	花朵适合函数<br>	*/<br>	int Fitness(int flower);<br><br>	/**<br>	花朵演化<br>	*/<br>	void Evolve();<br><br>	/**<br>	返回区间[start, end]的随机数<br>	*/<br>	inline int tb_Rnd(int start, int end)<br>	{<br>	    if (start &gt; end)<br>            return 0;<br>        else<br>        {<br>            //srand(time(0));<br>            return (rand() % (end + 1) + start);<br>        }<br>	}<br><br>	/**<br>	显示数值<br>	*/<br>	void show();<br>};<br>// ----------------------------------------------------------------- //<br>void ai_World::Encode()<br>// ----------------------------------------------------------------- //<br><br>{<br>	int					i;<br><br>	for (i=0;i&lt;kMaxFlowers;i++)<br>		{<br>			temperature[i]=tb_Rnd(1,75);<br>			water[i]=tb_Rnd(1,75);<br>			sunlight[i]=tb_Rnd(1,75);<br>			nutrient[i]=tb_Rnd(1,75);<br>			beneficialInsect[i]=tb_Rnd(1,75);<br>			harmfulInsect[i]=tb_Rnd(1,75);<br>		}<br><br>	currentTemperature=tb_Rnd(1,75);<br>	currentWater=tb_Rnd(1,75);<br>	currentSunlight=tb_Rnd(1,75);<br>	currentNutrient=tb_Rnd(1,75);<br>	currentBeneficialInsect=tb_Rnd(1,75);<br>	currentHarmfulInsect=tb_Rnd(1,75);<br><br>	currentTemperature=tb_Rnd(1,75);<br>	currentWater=tb_Rnd(1,75);<br>	currentSunlight=tb_Rnd(1,75);<br>	currentNutrient=tb_Rnd(1,75);<br>	currentBeneficialInsect=tb_Rnd(1,75);<br>	currentHarmfulInsect=tb_Rnd(1,75);<br><br>}<br>// ----------------------------------------------------------------- //<br>int ai_World::Fitness(int flower)<br>// ----------------------------------------------------------------- //<br><br>{<br>	int				theFitness;<br><br><br>	theFitness=abs(temperature[flower]-currentTemperature);<br>	theFitness=theFitness+abs(water[flower]-currentWater);<br>	theFitness=theFitness+abs(sunlight[flower]-currentSunlight);<br>	theFitness=theFitness+abs(nutrient[flower]-currentNutrient);<br>	theFitness=theFitness+abs(beneficialInsect[flower]-currentBeneficialInsect);<br>	theFitness=theFitness+abs(harmfulInsect[flower]-currentHarmfulInsect);<br><br>	return (theFitness);<br><br>}<br>// ----------------------------------------------------------------- //<br>void ai_World::Evolve()<br>// ----------------------------------------------------------------- //<br><br>{<br>	int						fitTemperature[kMaxFlowers];<br>	int						fitWater[kMaxFlowers];<br>	int						fitSunlight[kMaxFlowers];<br>	int						fitNutrient[kMaxFlowers];<br>	int						fitBeneficialInsect[kMaxFlowers];<br>	int						fitHarmfulInsect[kMaxFlowers];<br>	int						fitness[kMaxFlowers];<br>	int						i;<br>	int						leastFit=0;<br>	int						leastFitIndex;<br><br>	for (i=0;i&lt;kMaxFlowers;i++)<br>		if (Fitness(i)&gt;leastFit)<br>			{<br>				leastFit=Fitness(i);<br>				leastFitIndex=i;<br>			}<br><br>	temperature[leastFitIndex]=temperature[tb_Rnd(0,kMaxFlowers - 1)];<br>	water[leastFitIndex]=water[tb_Rnd(0,kMaxFlowers - 1)];<br>	sunlight[leastFitIndex]=sunlight[tb_Rnd(0,kMaxFlowers - 1)];<br>	nutrient[leastFitIndex]=nutrient[tb_Rnd(0,kMaxFlowers - 1)];<br>	beneficialInsect[leastFitIndex]=beneficialInsect[tb_Rnd(0,kMaxFlowers - 1)];<br>	harmfulInsect[leastFitIndex]=harmfulInsect[tb_Rnd(0,kMaxFlowers - 1)];<br><br>	for (i=0;i&lt;kMaxFlowers;i++)<br>		{<br>			fitTemperature[i]=temperature[tb_Rnd(0,kMaxFlowers - 1)];<br>			fitWater[i]=water[tb_Rnd(0,kMaxFlowers - 1)];<br>			fitSunlight[i]=sunlight[tb_Rnd(0,kMaxFlowers - 1)];<br>			fitNutrient[i]=nutrient[tb_Rnd(0,kMaxFlowers - 1)];<br>			fitBeneficialInsect[i]=beneficialInsect[tb_Rnd(0,kMaxFlowers - 1)];<br>			fitHarmfulInsect[i]=harmfulInsect[tb_Rnd(0,kMaxFlowers - 1)];<br>		}<br><br>	for (i=0;i&lt;kMaxFlowers;i++)<br>		{<br>				temperature[i]=fitTemperature[i];<br>				water[i]=fitWater[i];<br>				sunlight[i]=fitSunlight[i];<br>				nutrient[i]=fitNutrient[i];<br>				beneficialInsect[i]=fitBeneficialInsect[i];<br>				harmfulInsect[i]=fitHarmfulInsect[i];<br>		}<br><br>	for (i=0;i&lt;kMaxFlowers;i++)<br>		{<br>			if (tb_Rnd(1,100)==1)<br>				temperature[i]=tb_Rnd(1,75);<br>			if (tb_Rnd(1,100)==1)<br>				water[i]=tb_Rnd(1,75);<br>			if (tb_Rnd(1,100)==1)<br>				sunlight[i]=tb_Rnd(1,75);<br>			if (tb_Rnd(1,100)==1)<br>				nutrient[i]=tb_Rnd(1,75);<br>			if (tb_Rnd(1,100)==1)<br>				beneficialInsect[i]=tb_Rnd(1,75);<br>			if (tb_Rnd(1,100)==1)<br>				harmfulInsect[i]=tb_Rnd(1,75);<br>		}<br><br>}<br>void ai_World::show()<br>{<br>//    cout &lt;&lt; &quot;\t temperature water sunlight nutrient beneficialInsect harmfulInsect\n&quot;;<br>    cout &lt;&lt; &quot;current\t  &quot; &lt;&lt; currentTemperature &lt;&lt; &quot;\t &quot; &lt;&lt; currentWater &lt;&lt; &quot;\t &quot;;<br>    cout &lt;&lt; currentSunlight &lt;&lt; &quot;\t &quot; &lt;&lt; currentNutrient &lt;&lt; &quot;\t &quot;;<br>    cout &lt;&lt; currentBeneficialInsect &lt;&lt; &quot;\t &quot; &lt;&lt; currentHarmfulInsect &lt;&lt; &quot;\n&quot;;<br>    for (int i=0;i&lt;kMaxFlowers;i++)<br>    {<br>        cout &lt;&lt; &quot;Flower &quot; &lt;&lt; i &lt;&lt; &quot;: &quot;;<br>        cout &lt;&lt; temperature[i] &lt;&lt; &quot;\t &quot;;<br>		cout &lt;&lt; water[i] &lt;&lt; &quot;\t &quot;;<br>        cout &lt;&lt; sunlight[i] &lt;&lt; &quot;\t &quot;;<br>		cout &lt;&lt; nutrient[i] &lt;&lt; &quot;\t &quot;;<br>		cout &lt;&lt; beneficialInsect[i] &lt;&lt; &quot;\t &quot;;<br>		cout &lt;&lt; harmfulInsect[i] &lt;&lt; &quot;\t &quot;;<br>		cout &lt;&lt; endl;<br>    }<br>}<br>#endif // AIWORLD_H_<br><br>//test.cpp<br>#include &lt;iostream&gt;<br>#include &quot;ai_World.h&quot;<br><br>using namespace std;<br><br>int main()<br>{<br>    ai_World a;<br>    a.Encode();<br>//    a.show();<br>    for (int i = 0; i &lt; 10; i++)<br>    {<br>        cout &lt;&lt; &quot;Generation &quot; &lt;&lt; i &lt;&lt; endl;<br>        a.Evolve();<br>        a.show();<br>    }<br><br>    system(&quot;PAUSE&quot;);<br>    return 0;<br>}<br><img src ="http://www.cppblog.com/assist/aggbug/24898.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/assist/" target="_blank">pass86</a> 2007-05-26 17:38 <a href="http://www.cppblog.com/assist/archive/2007/05/26/24873.html#24898#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>