📄 view.htm
字号:
data. <BR>In the scaling member function in population.C, add one line of
code so that <BR><BR>275 sm->resize(n); <BR>276 return *sm;
<BR><BR>becomes <BR>275 sm->resize(n); <BR>if(evaluated)
sm->evaluate(*this); <BR>276 return *sm; <BR><BR>The copy member
function of the GAPopulation object has a typo in it. Whenever you try to
copy a population, the copy member clones the worst individual in the
population rather than copying each individual in the population. To fix
the problem, change [0] to [i] as shown here. <BR>In population.C, change
0 to an i in line 153 so that <BR><BR>151 ind = new GAGenome * [N];
<BR>152 for(i=0; i<N; <BR i++)>153 ind[i] = arg.ind[0]->clone();
<BR>154 <BR>155 if(arg.sm) sm = arg.sm->clone(); <BR><BR>becomes
<BR>151 ind = new GAGenome * [N]; <BR>152 for(i=0; i<N; <BR i++)>153
ind[i] = arg.ind[i]->clone(); <BR>154 <BR>155 if(arg.sm) sm =
arg.sm->clone(); <BR><BR>The initialize member function of any GA class
must be called after any calls to the populationSize member function,
otherwise the scaling object does not get updated and your GA will crash
on its first selection. This means that you cannot change the population
size during the course of an evolution. To fix the problem make the
following changes: <BR>In population.C, insert a line and modify a line to
change <BR><BR>209 sm->resize(pops); <BR>210 statted = sorted =
evaluated = gaFalse; <BR>211 n = pops; <BR><BR>to <BR>209
sm->resize(pops); <BR>210 statted = sorted = gaFalse; <BR>211 n = pops;
<BR>if(evaluated == gaTrue) evaluate(gaTrue); <BR><BR>and in the file
scaling.C, insert a single line to change <BR>102 fitSum = fitAve = fitMax
= fitMin = fitVar = fitDev = 0.0; <BR>103 return(n = popsize); <BR><BR>to
<BR>102 fitSum = fitAve = fitMax = fitMin = fitVar = fitDev = 0.0;
<BR>evaluated = gaFalse; <BR>103 return(n = popsize);
<BR><BR><BR><BR><BR><BR><BR>bugs in version 2.3.1
<BR><BR>--------------------------------------------------------------------------------
<BR><BR>There was a typo in population.C. In the function GAGenome *
GAPopulation::replace(GAGenome * repl, const int which),
<BR><BR>if(sorted) <BR>rawMax = ind[n-1]->score(); <BR>else
if(orig->score() == rawMax){ <BR>rawMax = ind[0]->score();
<BR>for(i=1; i<N; <BR i++)> rawMax = Min(rawMax, ind[i]->score());
<BR>} <BR>else <BR>rawMax = Max(rawMax, repl->score()); <BR><BR>The
'Min' should be 'Max': <BR>rawMax = Max(rawMax, ind[i]->score());
<BR><BR>Functions that return NULL would not compile with some compilers.
Functions that have this problem include member functions of the ListBASE
and List objects in listbase.h and listtmpl.h, and the TreeBASE and Tree
objects in treebase.h and treetmpl.h. ANSI C++ requires an explicit cast
of NULL. <BR>Many of the 'for' loops will not compile with some compilers.
In some cases, the loop variable is used outside the 'for' loop. Files
with this problem include allele.h, array1.op.C, binstr3.ch.C, ga.C,
list.op.C, population.C, scaling.C, selector.C, and many of the examples.
ANSI C++ specifies that a variable declared in a for loop loses scope
after the loop ends. <BR>The population object does not initialize genomes
when it is resized. <BR>SimpleGA has a bug in it that delays convergence.
A workaround is to use a SteadyStateGA with 100% replacement. This will be
only marginally slower than using a bug-free SimpleGA. <BR>Roundoff errors
in the population object could lead to negative numbers passed to the sqrt
function. The fix is to check for a sign change before the call to sqrt.
The only way a sign change can occur is if there is a roundoff error.
(There are only two calls to sqrt in population.C. The error can only
occur in the sqrt call in the function GAGenome *
GAPopulation::replace(GAGenome * repl, const int which)) <BR>The copy
constructor for the GAObjectiveVector object did not initialize the 'a'
member to NULL <BR></SPAN><BR><BR>
<DIV align=right></DIV>
<HR color=#000000 noShade SIZE=1>
临江仙<BR><BR>陈夕往事益归去,<BR>古道西风依旧.<BR>人生长河水长东,<BR>春去遇秋来,<BR>天际寻鹄鸿.<BR><BR>日月星移话沧桑,<BR>是非功过何在?<BR>一路风雨兼程行,<BR>唯清风明月,<BR>独在情怀中.
<BR></TD></TR></TBODY></TABLE><A name=73038></A>
<TABLE cellSpacing=1 cellPadding=4 width="95%" bgColor=#000000 border=0>
<TBODY>
<TR class=head>
<TD align=middle width=150><FONT color=#ffffff><B>作者</B></FONT></TD>
<TD><FONT color=#ffffff><B>Re:[推荐]GAlib: MIT的GA库! [Re:see_moonlight]
</B></FONT></TD></TR>
<TR class=even>
<TD vAlign=top width=150><B>pzm529</B> <BR><IMG
src="view.files/face_byhtsai_amuro.gif" border=0> <BR><BR><BR>论坛游民<IMG
src="view.files/advu.gif" border=0> <BR><BR><B>发贴:</B> 12 <BR><B>技术分:</B>
0 <BR><B>积分:</B>16 <BR><IMG height=1 src="view.files/pixel.gif" width=150
border=0> </TD>
<TD vAlign=top width="100%"><IMG src="view.files/post.gif" align=absMiddle
border=0>于 2004-07-19 17:03 <A
href="http://bbs.matwav.com/user/info?uid=13318"><IMG alt="user profile"
src="view.files/icon_profile.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/user/message?action=WriteMessage&to=pzm529&subject=Re%3ARe%3A%5B%CD%C6%BC%F6%5DGAlib%3A+MIT%B5%C4GA%BF%E2%A3%A1"
target=_blank><IMG alt="send a private message to user"
src="view.files/icon_pm.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/post/reply?bid=7&parent=73038&done=%2Fpost%2Fview%3Fid%3D47285%26sty%3D1%26bid%3D7%26tpg%3D2%26age%3D0%26ppg%3D1&quote=1"><IMG
alt="reply to post" src="view.files/icon_quote.gif" align=absMiddle
border=0></A><A
href="http://bbs.matwav.com/post/search?username=pzm529&action=Search"><IMG
alt="search all posts by" src="view.files/icon_find.gif" align=absMiddle
border=0></A><A href="javascript:copyText(document.all.text73038);"><IMG
alt="select and copy to clipboard. ie only, sorry for netscape users:-)"
src="view.files/icon_copy.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/user/favorite?action=Add&bid=7&id=73038"
target=_blank><IMG alt="add this post to my favorite list"
src="view.files/icon_favorite.gif" align=absMiddle border=0></A>
<HR color=#000000 noShade SIZE=1>
<SPAN class=javascript id=text73038>老大,这个在VC工程中怎么用啊? </SPAN><BR><BR>
<DIV align=right></DIV><BR></TD></TR></TBODY></TABLE><A name=76056></A>
<TABLE cellSpacing=1 cellPadding=4 width="95%" bgColor=#000000 border=0>
<TBODY>
<TR class=head>
<TD align=middle width=150><FONT color=#ffffff><B>作者</B></FONT></TD>
<TD><FONT color=#ffffff><B>Re:[推荐]GAlib: MIT的GA库! [Re:xman]
</B></FONT></TD></TR>
<TR class=even>
<TD vAlign=top width=150><B>xiechaomin</B> <BR><IMG
src="view.files/face_byhtsai_amuro.gif" border=0> <BR><BR><BR>论坛游民<IMG
src="view.files/advu.gif" border=0> <BR><BR><B>发贴:</B> 19 <BR><B>技术分:</B>
4 <BR><B>积分:</B>26 <BR><IMG height=1 src="view.files/pixel.gif" width=150
border=0> </TD>
<TD vAlign=top width="100%"><IMG src="view.files/post.gif" align=absMiddle
border=0>于 2004-08-01 15:27 <A
href="http://bbs.matwav.com/user/info?uid=18575"><IMG alt="user profile"
src="view.files/icon_profile.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/user/message?action=WriteMessage&to=xiechaomin&subject=Re%3ARe%3A%5B%CD%C6%BC%F6%5DGAlib%3A+MIT%B5%C4GA%BF%E2%A3%A1"
target=_blank><IMG alt="send a private message to user"
src="view.files/icon_pm.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/post/reply?bid=7&parent=76056&done=%2Fpost%2Fview%3Fid%3D47285%26sty%3D1%26bid%3D7%26tpg%3D2%26age%3D0%26ppg%3D1&quote=1"><IMG
alt="reply to post" src="view.files/icon_quote.gif" align=absMiddle
border=0></A><A
href="http://bbs.matwav.com/post/search?username=xiechaomin&action=Search"><IMG
alt="search all posts by" src="view.files/icon_find.gif" align=absMiddle
border=0></A><A href="javascript:copyText(document.all.text76056);"><IMG
alt="select and copy to clipboard. ie only, sorry for netscape users:-)"
src="view.files/icon_copy.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/user/favorite?action=Add&bid=7&id=76056"
target=_blank><IMG alt="add this post to my favorite list"
src="view.files/icon_favorite.gif" align=absMiddle border=0></A>
<HR color=#000000 noShade SIZE=1>
<SPAN class=javascript id=text76056>这个东东好用吗? </SPAN><BR><BR>
<DIV align=right></DIV><BR></TD></TR></TBODY></TABLE><A name=76705></A>
<TABLE cellSpacing=1 cellPadding=4 width="95%" bgColor=#000000 border=0>
<TBODY>
<TR class=head>
<TD align=middle width=150><FONT color=#ffffff><B>作者</B></FONT></TD>
<TD><FONT color=#ffffff><B>Re:[推荐]GAlib: MIT的GA库! [Re:xman]
</B></FONT></TD></TR>
<TR class=even>
<TD vAlign=top width=150><B>zhufang88</B> <BR><IMG
src="view.files/face_byhtsai_amuro.gif" border=0> <BR><BR><BR>论坛游民<IMG
src="view.files/advu.gif" border=0> <BR><BR><B>发贴:</B> 6 <BR><B>技术分:</B> 0
<BR><B>积分:</B>6 <BR><IMG height=1 src="view.files/pixel.gif" width=150
border=0> </TD>
<TD vAlign=top width="100%"><IMG src="view.files/post.gif" align=absMiddle
border=0>于 2004-08-04 10:21 <A
href="http://bbs.matwav.com/user/info?uid=20373"><IMG alt="user profile"
src="view.files/icon_profile.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/user/message?action=WriteMessage&to=zhufang88&subject=Re%3ARe%3A%5B%CD%C6%BC%F6%5DGAlib%3A+MIT%B5%C4GA%BF%E2%A3%A1"
target=_blank><IMG alt="send a private message to user"
src="view.files/icon_pm.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/post/reply?bid=7&parent=76705&done=%2Fpost%2Fview%3Fid%3D47285%26sty%3D1%26bid%3D7%26tpg%3D2%26age%3D0%26ppg%3D1&quote=1"><IMG
alt="reply to post" src="view.files/icon_quote.gif" align=absMiddle
border=0></A><A
href="http://bbs.matwav.com/post/search?username=zhufang88&action=Search"><IMG
alt="search all posts by" src="view.files/icon_find.gif" align=absMiddle
border=0></A><A href="javascript:copyText(document.all.text76705);"><IMG
alt="select and copy to clipboard. ie only, sorry for netscape users:-)"
src="view.files/icon_copy.gif" align=absMiddle border=0></A><A
href="http://bbs.matwav.com/user/favorite?action=Add&bid=7&id=76705"
target=_blank><IMG alt="add this post to my favorite list"
src="view.files/icon_favorite.gif" align=absMiddle border=0></A>
<HR color=#000000 noShade SIZE=1>
<SPAN class=javascript id=text76705>but i have a question:<BR>How to solve
restriction conditon using Galab? </SPAN><BR><BR>
<DIV align=right></DIV><BR></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=2 width="95%" border=0>
<TBODY>
<TR>
<TD align=left><A
href="http://bbs.matwav.com/post/reply?bid=7&parent=47285&done=%2Fpost%2Fview%3Fid%3D47285%26sty%3D1%26bid%3D7%26tpg%3D2%26age%3D0%26ppg%3D1"><IMG
alt="reply to topic" src="view.files/newreply.gif" align=absMiddle
border=0></A><IMG alt="flat mode" src="view.files/flat_d.gif"
align=absMiddle border=0><A
href="http://bbs.matwav.com/post/view?bid=7&id=47285&tpg=2&ppg=1&sty=3&age=0#47285"><IMG
alt="threaded mode" src="view.files/threaded.gif" align=absMiddle
border=0></A><A
href="http://bbs.matwav.com/post/view?bid=7&id=47285&tpg=2&ppg=1&sty=1&age=0&prev=1"><IMG
alt="go to previous topic" src="view.files/prev.gif" align=absMiddle
border=0></A><A
href="http://bbs.matwav.com/post/view?bid=7&id=47285&tpg=2&ppg=1&sty=1&age=0&next=1"><IMG
alt="go to next topic" src="view.files/next.gif" align=absMiddle
border=0></A> </TD></TR></TBODY></TABLE>
<TABLE width="95%" border=0>
<TBODY>
<TR vAlign=top>
<TD><IMG src="view.files/post.gif" align=absMiddle border=0><FONT
class=text> 已读帖子</FONT><BR><IMG src="view.files/post_n.gif"
align=absMiddle border=0><FONT class=text> 新的帖子</FONT><BR><IMG
src="view.files/post_d.gif" align=absMiddle border=0><FONT
class=text> 被删除的帖子</FONT></TD></TR></TBODY></TABLE>
<TABLE width="95%">
<TBODY>
<TR>
<TD align=right><A name=bottom></A><A href="javascript:jumpTo('top')"><IMG
alt="Jump to the top of page" src="view.files/up.gif" border=0></A>
</TD></TR></TBODY></TABLE><BR>
<CENTER><A
href="http://bbs.matwav.com/index.html">返回研学论坛首页</A> <A
href="http://www.matwav.com/">返回网站首页</A><BR><BR><A
href="http://bbs.matwav.com/ad.html" target=_blank>广告服务</A> | <A
href="http://bbs.matwav.com/private.html" target=_blank>隐私政策</A> | <A
href="mailto:%20xiaohnglv@163.com" target=_blank>联系我们</A> | <A
onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://210.192.122.151:8080/bbs/');"
href="http://bbs.matwav.com/#">设为首页</A><BR><BR><FONT class=text><FONT
color=#808080>Powered by <A href="http://www.cjsdn.com/" target=_blank>Powerful
JuteForum</A>® Version Jute 1.5.1 Ent <BR>Copyright© 2002-2003 研学论坛 All Rights
Reserved.</FONT></FONT> </CENTER></CENTER></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -