📄 galib bug list.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0034)http://lancet.mit.edu/ga/Bugs.html -->
<HTML><HEAD><TITLE>GAlib: Bug List</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><!-- by matthew wall all rights reserved --><!-- Copyright (c) 1995-1996 Massachusetts Institute of Technology --><!-- Copyright (c) 1996-2005 Matthew Wall -->
<META content="MSHTML 6.00.2900.2769" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff><STRONG>Bugs in <A
href="http://lancet.mit.edu/ga/">GAlib</A></STRONG><BR><SMALL><I><!--#exec cgi="/bin/lastmod"--></I></SMALL><BR>
<P>This page contains a list of bugs and suggested workarounds. </P><A
href="http://lancet.mit.edu/ga/Bugs.html#config">configuration issues</A><BR><A
href="http://lancet.mit.edu/ga/Bugs.html#version_2.4">version 2.4.x</A><BR><A
href="http://lancet.mit.edu/ga/Bugs.html#version_2.3.2">version 2.3.2</A><BR><A
href="http://lancet.mit.edu/ga/Bugs.html#version_2.3.1">version
2.3.1</A><BR><BR><BR><BR><A name=config><STRONG>Compiler/Configuration
Issues</STRONG></A><BR>
<HR>
<DL>
<DT><STRONG>Random number woes</STRONG><BR>
<DD>If you find that the examples don't evolve properly, check the performance
of the random number generator using the randtest example. You can specify
which random number generator to use by modifying the gaconfig.h file. Note
that that modifications to gaconfig.h will require a rebuild of the entire GA
library. </DD></DL><BR><BR><BR><BR><BR><A name=version_2.4><STRONG>bugs in
version 2.4.6</STRONG></A><BR>
<HR>
<UL>
<LI>The <CODE>std_stream.h</CODE> header file is not installed when you do a
<CODE>make install</CODE>. To fix this, either copy
<CODE>ga/std_stream.h</CODE> to the location of your installed GAlib headers,
or modify <CODE>ga/makefile</CODE> so that the <CODE>HDRS</CODE> includes
<CODE>std_stream.h</CODE> before you do <CODE>make install</CODE> <BR><BR>
<LI>For gcc4 compatibility, modify gaconfig.h as follows. Add detection of gcc
4 so that: <PRE>#if defined(__GNUG__) || defined(__GNUC__)
#if __GNUC__ == 3
</PRE>becomes: <PRE>#if defined(__GNUG__) || defined(__GNUC__)
#if __GNUC__ == 4
#define GALIB_COMPILER "gcc4"
#elif __GNUC__ == 3
</PRE>In the GNU compiler section of gaconfig.h, make galib upward compatible
with respect to the gcc compiler: <PRE>#if __GNUC__ == 3
#define GALIB_USE_ANSI_HEADERS
#define GALIB_USE_STD_NAMESPACE
#define GALIB_USE_COMP_OPERATOR_TEMPLATES
#endif
</PRE>becomes: <PRE>#if __GNUC__ >= 3
#define GALIB_USE_ANSI_HEADERS
#define GALIB_USE_STD_NAMESPACE
#define GALIB_USE_COMP_OPERATOR_TEMPLATES
#endif
</PRE></LI></UL><BR><BR><BR><BR><BR><A name=version_2.4.5><STRONG>bugs in
version 2.4.5</STRONG></A><BR>
<HR>
<UL>
<LI>In some cases the GASelector may walk past the end of its arrays,
resulting in corrupted memory. Thanks to Gio Sarto for finding this one. In
the file GASelector.C, modify the following: <PRE> while(ne > 0){
choices[k] = i;
k++; ne--;
}
</PRE>to become: <PRE> while(ne > 0 && k < (int)n){
choices[k] = i;
k++; ne--;
}
</PRE>This construct appears 4 times in the GASelector.C file.
</LI></UL><BR><BR><BR><BR><BR><STRONG>bugs in version 2.4.4</STRONG></A><BR>
<HR>
<UL>
<LI>On some platforms, the seed functions for the RAN1 and RAN2 random number
generator only works half of the time, on average. The other half of the time
it generates the same random seed. Thanks to Peter Ross and George LeCompte
for finding this one. In the file garandom.C, change the sran1 and sran2
functions so that: <PRE>206 void
207 sran1(unsigned int seed) {
208 int j;
209 long k;
210
211 idum = seed;
212 if (idum < 1) idum=1;
213 for (j=NTAB+7;j>=0;j--) {
214 k=(idum)/IQ;
215 idum=IA*(idum-k*IQ)-IR*k;
216 if (idum < 0) idum += IM;
217 if (j < NTAB) iv[j] = idum;
218 }
219 iy=iv[0];
220 }
...
280 void
281 sran2(unsigned int seed) {
282 int j;
283 long k;
284
285 idum = STA_CAST(long,seed);
286 if (idum < 1) idum=1;
287 idum2=(idum);
288 for (j=NTAB+7;j>=0;j--) {
289 k=(idum)/IQ1;
290 idum=IA1*(idum-k*IQ1)-k*IR1;
291 if (idum < 0) idum += IM1;
292 if (j < NTAB) iv[j] = idum;
293 }
294 iy=iv[0];
295 }
</PRE>becomes this: <PRE>206 void
207 sran1(unsigned int seed) {
208 int j;
209 long k;
210
211 idum = seed;
212 if (idum == 0) idum=1;
if (idum < 0) idum = -idum;
213 for (j=NTAB+7;j>=0;j--) {
214 k=(idum)/IQ;
215 idum=IA*(idum-k*IQ)-IR*k;
216 if (idum < 0) idum += IM;
217 if (j < NTAB) iv[j] = idum;
218 }
219 iy=iv[0];
220 }
...
280 void
281 sran2(unsigned int seed) {
282 int j;
283 long k;
284
285 idum = STA_CAST(long,seed);
286 if (idum == 0) idum=1;
if (idum < 0) idum = -idum;
287 idum2=(idum);
288 for (j=NTAB+7;j>=0;j--) {
289 k=(idum)/IQ1;
290 idum=IA1*(idum-k*IQ1)-k*IR1;
291 if (idum < 0) idum += IM1;
292 if (j < NTAB) iv[j] = idum;
293 }
294 iy=iv[0];
295 }
</PRE>
<LI>The RAN3 random number generator has a bug in it that was included in the
Numberical Recipes code but has since been fixed. Thanks to Peter Ross for
pointing this out. The fix is as follows in garandom.C: <PRE>353 mj=MSEED-idum;
</PRE>becomes this: <PRE>353 mj=labs(MSEED-labs(idum));
</PRE>
<LI>The population's pointer to the genetic algorithm that contains it is not
initialized to zero. Thanks to Harald H Soleng of the Norwegian Computing
Center for finding this one. The fix is to change GAPopulation.C so that two
of the three GAPopulation constructors initialize the ga member to nil (the
copy constructor does a deep copy and thus gets the genetic algorithm from the
population it is cloning): <PRE>76 evaldata = (GAEvalData*)0;
77 }
...
104 evaldata = (GAEvalData*)0;
105 }
</PRE>becomes this: <PRE>76 evaldata = (GAEvalData*)0;
ga = (GAGeneticAlgorithm*)0;
77 }
...
104 evaldata = (GAEvalData*)0;
ga = (GAGeneticAlgorithm*)0;
105 }
</PRE>
<LI>Boolean parameters are not read correctly from file. Thanks to Klaus
Kirchberg for finding this one.. The fix is to modify GAParameter.C as
follows: <PRE>313 if(ival) os << "true\n";
314 else os << "false\n";
</PRE>becomes this: <PRE>313 if(ival) os << "1\n";
314 else os << "0\n";
</PRE></LI></UL><BR><BR><BR><BR><BR><STRONG>bugs in version 2.4.3</STRONG><BR>
<HR>
<UL>
<LI>The early release of the Mac project file has a bogus struct alignment
configuration for each of the examples. Be sure that the linker is configured
to PowerPC struct alignment, not 68K struct alignment. If you use the wrong
alignment, everything will compile and link just fine, but it will crash when
you run it. </LI></UL><BR><BR><BR><BR><BR><STRONG>bugs in version
2.4.2</STRONG><BR>
<HR>
<UL>
<LI>Example 13 does not do what it purports to do. There are a number of
places where _numbers should be replaced with _picture, and there are some
flaws in the logic. Please use the example 13 from the 2.4.3 release. <BR><BR>
<LI>GAParameter::setvalue can corrupt memory when it frees memory that it just
allocated. The result is a bogus file name and/or application crashing. The
fix is to change GAParameter.C so that this: <PRE>95 case STRING:
96 {
97 char* ptr=0;
</PRE>becomes this: <PRE>95 case STRING:
96 if(v != val.sval) {
97 char* ptr=0;
</PRE>
<LI>GAGeneticAlgorithm::TerminateUponConvergence will stop after the first
generation when doing a minimization with convergence as the stopping
criterion. <BR><BR>
<LI>When using a GARealGenome and an allele set with INCLUDE/EXCLUDE limits,
you may find that the limits you set are ignored. This is probably due to a
bug in the GAAlleleSet<>::allele() function. It may also be due to
genetic operators (mutate, crossover) that ignore the allele boundary/type
details. <BR><BR>
<LI>GAAlleleSet<>::allele does not respect allele bounds. Neither does
the specialization, GAAlleleSet<float>::allele() Please get a new copy
of GARealGenome.C and GAAllele.C from the 2.4.3 release to fix the problems.
Note that you will have to define your own GAAlleleSet<>::allele()
member function if you use a type other than float (use the GARealGenome.C
code to as an example of how to do this) <BR><BR>
<LI>There are quite a few problems with the GADemeGA object. The problems only
show themselves when you attempt to change the number of populations and/or
the replacement numbers or migration numbers. Please get a new copy of
GADemeGA.C from the 2.4.3 release to fix all the problems. <BR><BR>
<LI>The <STRONG>resizeBehaviour</STRONG> method for both
<STRONG>GA3DBinaryStringGenome</STRONG> and <STRONG>GA3DArrayGenome</STRONG>
has two errors in it. If you use this member function to query the resize
behavior of a genome, you will always get 0 for HEIGHT and DEPTH rather than
the actual HEIGHT and DEPTH values. The fix is to modify the if statements. In
the 'if' test statements, the variable should be <CODE>which</CODE> not
<CODE>val</CODE>. <BR><BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -