GAlib examples
mbw 5jan96
How to compile the examples
-------------------------------------------------------------------------------
Copy the contents of this directory into your own filespace. In the new
directory, edit the makefile as needed to specify the location of the GAlib
headers and library. If you system supports makedepend, do 'make depend' to
update the makefile dependencies.
To build all of the examples, type 'make all' or simply 'make'.
To build a specific example, type 'make exN' where N is the number of the
example you want to build. For example, to build example 5 you would type
'make ex5'.
To remove old core, executable, object, and data files, do 'make clean'.
You only need to do 'make depend' when the dependencies change. For example,
if you modify one of the examples so that it uses routines in another file,
you will have to modify the makefile then do 'make depend' so that make will
know about the new dependency.
What the examples do
-------------------------------------------------------------------------------
ex1 Fill a 2DBinaryStringChromosome with alternating 0s and 1s using a
SimpleGA.
ex2 Generate a sequence of random numbers, then use a Bin2DecChromosome
and SimpleGA to try and match the sequence. This example shows how
to use the user-data member of genomes in objective functions.
ex3 Read a 2D pattern from a data file then try to match the pattern using
a 2DBinaryStringChromosome and a SimpleGA. This example also shows
how to use the GAParametes object for setting genetic algorithm
parameters and reading command-line arguments.
ex4 Fill a 3DBinaryStringChromosome with alternating 0s and 1s using a
SteadyStateGA. This example uses many member functions of the genetic
algorithm to control which statistics are recorded and dumped to file.
ex5 This example shows how to build a composite genome (a cell?) using
a 2DBinaryStringGenome and a Bin2DecGenome. The composite genome uses
behaviors that are defined in each of the genomes that it contains.
The objective is to match a pattern and sequence of numbers.
ex6 Grow a GATreeGenome<int> using a SteadyStateGA. This example
illustrates the use of specialized methods to override the default
initialization method and to specialize the output from a tree. It
also shows how to use templatized genome classes. Finally, it shows
the use of the parameters object to set default values then allow these
to be modified from the command line. The objective function in this
example tries to grow the tree as large as possible.
ex7 Identical in function to example 3, this example shows how to use the
increment operator (++), completion measure, and other member functions
of the GA. It uses a GA with overlapping populations rather than the
non-overlapping GA in example 3 and illustrates the use of many of the
GA member functions. It also illustrates the use of the parameter list
for reading settings from a file, and shows how to stuff a genome with
data from an input stream.
ex8 Grow a GAListGenome<int> using a GA with overlapping populations.
This shows how to randomly initialize a list of integers, how to use
the sigma truncation scaling object to handle objective scores that
may be positive or negative, and the 'set' member of the genetic
algorithm for controlling statistics and other genetic algorithm
parameters.
ex9 Find the maximum value of a continuous function in two variables. This
example uses a GABin2DecGenome and simple GA. It also illustrates
how to use the GASigmaTruncationScaling object (rather than the default
linear scaling). Sigma truncation is particularly useful for
objective functions that return negative values.
ex10 Find the maximum value of a continuous, periodic function. This
example illustrates the use of sharing to do speciation. It defines
a sample distance function (one that does the distance measure based
on the genotype, the other based on phenotype). It uses a binary-
to-decimal genome to represent the function values.
ex11 Generate a sequence of descending numbers using an order-based list.
This example illustrates the use of a GAListGenome as an
order-based chromosome. It contains a custom initializer and shows
how to use this custom initializer in the List genome.
ex12 Alphabetize a sequence of characters. Similar to example 11, this
example illustrates the use of the GAStringGenome (rather than a
list) as an order-based chromosome.
ex13 This program runs a GA-within-GA. The outer level GA tries to
match the pattern read in from a file. The inner GA tries to match
a sequence of randomly generated numbers (the sequence is generated
at the beginning of the program's execution). The inner level GA is
run only when the outer GA reaches a threshhold objective score.
ex14 Another illustration of how to use composite chromosomes. In this
example, the composite chromosome contains a user-specifiable number
of lists. Each list behaves differently and is not affected by
mutations, crossovers, or initializations of the other lists.
ex15 The completion function of a GA determines when it is "done". This
example uses the convergence to tell when the GA has reached the
optimum (the default completion measure is number-of-generations).
It uses a binary-to-decimal genome and tries to match a sequence of
randomly generated numbers.
ex16 Tree chromosomes can contain any kind of object in the nodes. This
example shows how to put a point object into the nodes of a tree to
represent a 3D plant. The objective function tries to maximize the
size of the plant.
ex17 Array chromsomes can be used when you need tri-valued alleles. This
example uses a 2D array with trinary alleles.
ex18 This example compares the performance of three different genetic
algorithms. The genome and objective function are those used in
example 3, but this example lets you specify which type of GA you
want to use to solve the problem. You can use steady state, simple,
or incremental just by specifying one of them on the command line.
The example saves the generational data to file so that you can then
plot the convergence data to see how the performance of each genetic
algorithm compares to the others.
ex19 The 5 DeJong test problems.
ex20 Holland's royal road function. This example computes Holland's 1993
ICGA version of the Royal Road problem. Holland posed this problem as
a challenge to test the performance of genetic algorithms and
challenged other GA users to match or beat his performance.
ex21 This example illustrates various uses of the allele set in array
genomes. The allele set may be an enumerated list of items or a
bounded range of continuous values, or a bounded set of discrete
values. This example shows how each of these may be used in
combination with a real number genome.
ex22 This example shows how to derive a new genetic algorithm class in
order to customize the replacement method. Here we derive a new type
of steady-state genetic algorithm in which speciation is done more
effectively by not only scaling fitness values but also by controlling
the way new individuals are inserted into the population.
ex23 The genetic algorithm object can either maximize or minimize your
objective function. This example shows how to use the minimize
abilities of the genetic algorithm. It uses a real number genome with
one element to find the maximum or minimum of a sinusoid.
ex24 This example shows how to restricted mating using a custom genetic
algorithm and custom selection scheme. The restricted mating in the
genetic algorithm tries to pick individuals that are similar (based
upon their comparator). The selector chooses only the upper half of
the popul
没有合适的资源?快使用搜索试试~ 我知道了~
遗传算法组件的C++实现_C++_代码_下载
共234个文件
c:82个
h:53个
gif:24个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 128 浏览量
2022-06-18
17:44:42
上传
评论
收藏 508KB ZIP 举报
温馨提示
GAlib 是遗传算法对象的 C++ 库。使用 GAlib,您可以添加 使用任何数据对几乎任何程序进行进化算法优化 表示和标准或自定义选择、交叉、突变、 缩放和终止方法。 该库需要合理的 C++ 编译器。我在 MacOS 上测试过 GAlib 使用 Metrowerks 和 Symantec 开发环境,MacOSX 使用 gcc2/3, DOS/Windows 使用 Borland C++ 和 MS VC++,各种 UNIX 平台使用 g++、egcs、CC、DCC、xlC 和 aCC。 提供图形示例(XWindows/Motif 和 MS Windows) 使用 PVM 的并行分布式实现。大约有30个例子 这说明了在各种问题上使用 GAlib 的各种方法。
资源推荐
资源详情
资源评论
收起资源包目录
遗传算法组件的C++实现_C++_代码_下载 (234个子文件)
GAView.ad 891B
TSPView.ad 166B
Makefile.aimk 2KB
Makefile.aimk 2KB
makefile.bcc 2KB
makefile.bcc 1KB
makevars.bcc 966B
makefile.bcc 438B
GA1DArrayGenome.C 35KB
GA3DArrayGenome.C 32KB
GA3DBinStrGenome.C 31KB
gaview.C 29KB
GAPopulation.C 24KB
GA1DBinStrGenome.C 22KB
GA2DArrayGenome.C 22KB
GATreeBASE.C 21KB
GA2DBinStrGenome.C 21KB
tspview.C 21KB
randtest.C 21KB
GABaseGA.C 18KB
GAStatistics.C 18KB
GAListGenome.C 18KB
GAParameter.C 16KB
GASelector.C 15KB
GAAllele.C 13KB
ex27.C 13KB
ex26.C 12KB
ex5.C 12KB
GADemeGA.C 12KB
ex14.C 11KB
GATree.C 11KB
genome.C 11KB
gabincvt.C 10KB
GARealGenome.C 10KB
GASStateGA.C 10KB
GATreeGenome.C 10KB
GAScaling.C 9KB
ex22.C 9KB
PVMDemeGA.C 9KB
GABin2DecGenome.C 9KB
garandom.C 8KB
GAListBASE.C 8KB
ex10.C 8KB
ex16.C 8KB
ex7.C 8KB
ex19.C 8KB
ex24.C 8KB
ex13.C 7KB
ex6.C 7KB
ex21.C 7KB
ex8.C 7KB
genome.C 7KB
GASimpleGA.C 6KB
GAIncGA.C 6KB
ex18.C 6KB
ex11.C 6KB
GAList.C 6KB
master.C 6KB
ex20.C 5KB
bitstr.C 5KB
ex2.C 5KB
gaerror.C 5KB
ex3.C 5KB
ex15.C 5KB
seed.C 4KB
ex23.C 4KB
ex17.C 4KB
ex4.C 4KB
ex12.C 4KB
gnuex.C 4KB
ex1.C 3KB
GAStringGenome.C 3KB
bitblt.c 3KB
ex9.C 3KB
bitlcomp.c 3KB
slave.C 3KB
GAGenome.C 2KB
slave.C 2KB
GADCrowdingGA.C 2KB
bitcount.c 2KB
GABinStr.C 2KB
ex25.C 2KB
bitxor.c 2KB
bitand.c 2KB
bitcopy.c 2KB
bitany.c 1KB
bitclear.c 1KB
bitinvert.c 1KB
bitset1.c 1KB
master.C 1KB
BitString.cc 35KB
Obstack.cc 3KB
AllocRing.cc 2KB
error.cc 2KB
builtin.cc 67B
ChangeLog 4KB
ChangeLog 822B
ChangeLog 798B
COPYRIGHT 2KB
solve.cpp 3KB
共 234 条
- 1
- 2
- 3
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功