📄 galib faq.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0033)http://lancet.mit.edu/ga/FAQ.html -->
<HTML><HEAD><TITLE>GAlib: FAQ</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><!-- Copyright (c) 2005 Matthew Wall --><!-- all rights reserved -->
<META content="MSHTML 6.00.2900.2769" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff><STRONG>Answers to Frequently Asked Questions
about <A href="http://lancet.mit.edu/ga/">GAlib</A></STRONG><BR><SMALL><I><!--#exec cgi="/bin/lastmod"--></I></SMALL><BR><BR><BR><STRONG>1
General</STRONG><BR><A href="http://lancet.mit.edu/ga/FAQ.html#1.1">1.1 Where
did GAlib come from?</A><BR><A href="http://lancet.mit.edu/ga/FAQ.html#1.2">1.2
Can I use GAlib for commercial purposes?</A><BR><A
href="http://lancet.mit.edu/ga/FAQ.html#1.3">1.3 What newsgroups/mailing lists
are available for GAlib users?</A><BR><A
href="http://lancet.mit.edu/ga/FAQ.html#1.4">1.4 What features and options does
GAlib include?</A><BR><BR><STRONG>2 Compilation Issues</STRONG><BR><A
href="http://lancet.mit.edu/ga/FAQ.html#2.1">2.1 I'm having problems with Visual
C++. What's wrong?</A><BR><A href="http://lancet.mit.edu/ga/FAQ.html#2.2">2.2
How to make GAlib work with MFC?</A><BR><A
href="http://lancet.mit.edu/ga/FAQ.html#2.3">2.3 How to make GAlib work with gcc
3?</A><BR><A href="http://lancet.mit.edu/ga/FAQ.html#2.4">2.4 I'm having
problems with GARealGenome and/or GA1DArrayAlleleGenome during compilation. What
is wrong?</A><BR><BR><STRONG>3 Algorithms and Optimization</STRONG><BR><A
href="http://lancet.mit.edu/ga/FAQ.html#3.1">3.1 How do I use GAlib to solve my
problem?</A><BR><A href="http://lancet.mit.edu/ga/FAQ.html#3.2">3.2 Should I use
a binary string or a real number genome?</A><BR><A
href="http://lancet.mit.edu/ga/FAQ.html#3.3">3.3 How do I determine which kind
of genome to use?</A><BR><BR><BR><BR><BR><BR><BR><A name=1.1><STRONG>1.1 Where
did GAlib come from? </STRONG></A>
<BLOCKQUOTE>
<P>The original GAlib implementation evolved over the course of 3 years. I
started GAlib after using a GA library written by Kazu Saito at the MIT
CADlab. As my first major C++ programming effort, GAlib started out as a
programming exercise. Eventually I found that I needed a full-featured,
extensible, and reasonably fast genetic algorithm package for my doctoral
work. Since there was nothing available at the time (circa 1993) I decided to
make GAlib do the job. Others in the CADlab and various optimization courses
at MIT found it useful, so I ended up making it even more extensible and
cross-platform-happy. GAlib made its first public appearance in the spring of
1995. </P>
<P>My doctoral work was largely funded by the <A
href="http://me.mit.edu/groups/lfm/">Leaders for Manufacturing Program</A>.
</P></BLOCKQUOTE><BR><BR><BR><A name=1.2><STRONG>1.2 Can I use GAlib for
commercial purposes? </STRONG></A>
<BLOCKQUOTE>
<P>Yes. As of Fall 1999, GAlib is free for any use, commercial or otherwise.
The only stipulation is that the copyright notice be included in any
derivative works. The licensing of GAlib is now similar to that of the
XWindows software, but not as restrictive (from a commercial point of view) as
the GNU public license. </P></BLOCKQUOTE><BR><BR><BR><A name=1.3><STRONG>1.3
What newsgroups/mailing lists are available for GAlib users? </STRONG></A>
<BLOCKQUOTE>There are two GAlib mailing lists, one for announcements and the
other for general questions.
<P>The general GAlib mailing list is <A
href="http://mailman.mit.edu/mailman/listinfo/galib">galib</A> at mit.edu.
This is an unmoderated list for questions about GAlib and how to use it.
Please read the GAlib documentation before you send your questions to this
list. To subscribe or unsubscribe, go to <A
href="http://mailman.mit.edu/mailman/listinfo/galib">http://mailman.mit.edu/mailman/listinfo/galib</A>
</P>
<P>The GAlib announcement mailing list is <A
href="http://mailman.mit.edu/mailman/listinfo/galib-announce">galib-announce</A>
at mit.edu. This list is used by the author of GAlib to announce new releases
of GAlib. Traffic on this list is typically two or three messages per year. To
subscribe or unsubscribe, go to <A
href="http://mailman.mit.edu/mailman/listinfo/galib-announce">http://mailman.mit.edu/mailman/listinfo/galib-announce</A>
</P>
<P>The GAlib mailing list is archived at <A
href="http://mailman.mit.edu/pipermail/galib">http://mailman.mit.edu/pipermail/galib</A>
</P>
<P>There is currently no newsgroup for galib. However, the <A
href="news:comp.ai.genetic">comp.ai.genetic</A> newsgroup is a good place to
go for help with genetic algorithms in general and often with specific
problems as well. </P></BLOCKQUOTE><BR><BR><BR><A name=1.4><STRONG>1.4 What
features and options come with GAlib? </STRONG></A>
<BLOCKQUOTE>GAlib was designed to make it easy to try different objective
functions, representations, genetic operators, and genetic algorithms. It
includes many different representations, genetic operators, genetic
algorithms, stopping criteria, scaling methods, selection methods, and
evaluation schemes. For a complete list of features, see the <A
href="http://lancet.mit.edu/galib-2.4/FeatureList.html">feature list</A>.
</BLOCKQUOTE><BR><BR><BR><A name=2.1><STRONG>2.1 I'm having problems with Visual
C++. Does GAlib work with Visual C++? </STRONG></A>
<BLOCKQUOTE>
<P>GAlib will compile under Visual C++, but Microsoft's compiler is overly
strict about types without being smart. It adheres so strictly to the ANSI
standard that it becomes a real pain in the #@$! to use. </P>
<P>In GAlib 2.4.x you will have to add explicit casts to many member functions
to get the library to compile. For example, instead of simply saying <PRE> GARealGenome mygenome(10);
float x = mygenome[5];
</PRE>you must do it this way: <PRE> GARealGenome mygenome(10);
float x = mygenome[(unsigned int)5];
</PRE>
<P></P>
<P>The compiler also warns about statements such as <CODE>float x =
0.0;</CODE> You can disable these warnings by inserting these lines into
gaconfig.h: <PRE> #if defined(_MSC_VER)
#pragma warning (disable : 4244)
#pragma warning (disable : 4305)
#endif
</PRE>
<P></P></BLOCKQUOTE><BR><BR><BR><A name=2.2><STRONG>2.2 How to make GAlib work
with MFC? </STRONG></A>
<BLOCKQUOTE>
<P>You may want to compile GAlib without streams in order to get it to work
with MFC. To turn off streams, edit the configuration file gaconfig.h so that
GALIB_USE_STREAMS is not defined (in GAlib 2.4.5 and earlier, define the
NO_STREAMS macro). </P>
<P>You may have to force VCPP to ignore the LIBCD library using the ignore
libraries option in your project settings on the link properties panel.
</P></BLOCKQUOTE><BR><BR><BR><A name=2.3><STRONG>2.3 How to make GAlib work with
gcc 3? </STRONG></A>
<BLOCKQUOTE>
<P>For best results, use GAlib 2.4.6 or later - it will compile with gcc 3.x
with no modifications required. </P>
<P>GAlib 2.4.5 requires some modifications. See the suggestions at <A
href="http://mailman.mit.edu/pipermail/galib/2004-December/001076.html">in the
archives</A>. </P>
<P>Thanks to Anthony Liekens for the gcc 3 patches.
</P></BLOCKQUOTE><BR><BR><BR><A name=2.4><STRONG>2.4 I'm having problems with
GARealGenome and/or GA1DArrayAlleleGenome during compilation. What is wrong?
</STRONG></A>
<BLOCKQUOTE>
<P>This usually applies when using gcc 3 or another modern compiler. </P>
<P>GARealGenome.h defines some inline functions that are also defined in
GARealGenome.C. To keep the compiler happy, all definitions must be done
before instantiation, so moving the definitions of </P>
<BLOCKQUOTE>float GAAlleleSet<FLOAT>::allele() const<BR>float
GAAlleleSet<FLOAT>::allele(unsigned int i) const<BR></BLOCKQUOTE>
<P>to be before any of the inline functions in GARealGenome.h will solve the
compile problem. </P>
<P>Thanks to Bertrand Mesot for <A
href="http://mailman.mit.edu/pipermail/galib/2003-December/000896.html">pointing
this out</A>. </P></BLOCKQUOTE><BR><BR><BR><A name=3.1><STRONG>3.1 How do I use
GAlib to solve my problem? </STRONG></A>
<BLOCKQUOTE>
<P>There is an extensive <A
href="http://lancet.mit.edu/galib-2.4/Overview.html">overview</A> included in
the GAlib documentation. It explains the basics of genetic algorithms as well
as the design philosophy behind the GAlib implementation. The distribution
includes <A href="http://lancet.mit.edu/galib-2.4/examples">many examples</A>
that illustrate the use of GAlib, and the documentation includes examples of
<A href="http://lancet.mit.edu/galib-2.4/Extensions.html">how to derive your
own classes</A>. </P>
<P>In general, start with an example that is similar to your problem, then go
from there. We have found that people struggle with the following issues: (1)
learning C++ and object-oriented design in general; (2) how to represent the
problem; (3) how to define then refine an objective function that will
actually do what you want it to do; and (4) how to handle multiple, and often
conflicting, objectives. Please read the <A
href="http://lancet.mit.edu/galib-2.4/Overview.html">overview</A>!
</P></BLOCKQUOTE><BR><BR><BR><A name=3.2><STRONG>3.2 Should I use a binary
string or a real number genome? </STRONG></A>
<BLOCKQUOTE>Nine times out of ten, a real number genome will perform better
than a binary string genome. However, actual performance depends on the
problem you are trying to solve. If you use a binary genome to encode real
values, then chances are the real number genome will do better.
<P>Remember also that the genetic operators are closely coupled to the
representation. It is possible to choose the 'right' representation but the
'wrong' genetic operator, or vice versa. </P></BLOCKQUOTE><BR><BR><BR><A
name=3.3><STRONG>3.3 How do I determine which kind of genome to use?
</STRONG></A>
<BLOCKQUOTE>This depends on the problem you are trying to solve. For any given
problem, there are many different representations you could use. Of those
representations, some may work much better than others. As you experiment with
different representations, remember that the genetic operators and your
evaluation function affect performance at least as much as the representation.
And they are usually all closely coupled.
<P>As you work on a new problem, start with something simple. Make simplifying
assumptions if needed, but get something that works. Then you will have
something to use as a benchmark for evaluating the performance of other
representations and operators. If you manage your code properly, you can mix
and match operators, representations, and objective functions so that you can
evaluate the performance of each component.
</P></BLOCKQUOTE><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -