📄 readme
字号:
Genetic Algorithm ProgramWelcome to the wonderful world of the Genetic Algorithm C++ directory.This program demonstrates having a population of individuals, each ofwhom is given a fitness value. The entire population evolves throughmutation and crossover to maximize the fitness function. The programis meant to be a companion to chapter 4 of the "ArtificialIntelligence" textbook. This code was written by Jon Monsarrat,jgm@cs.brown.edu.Five sections describe the program:1. The problem2. Building the program3. Running the program4. The solution, and how to read the source code----------------------------------------------------------------------1. The problemThe book goes into quite some detail about the problem, but here it isin a nutshell.We want to maximize some fitness function that applies to a bunch ofboolean values. This bunch we call a chromosome, and each booleanvalue is an allele. Given a population of randomly generatedchromosomes, we want to evolve a new generation out of the fittest ofthe current population.----------------------------------------------------------------------2. Building the programThe source code in this directory is complete and does not depend uponany other source code from the textbook. It only uses standardand libraries which should come any C++ compiler.You can build this program in UNIX by simply typing makeYou may need to edit the Makefile to change the name of the compiler,if you do not have a compiler named "CC".You will need to recompile the program if you want to add your ownfitness measuring functions. The program comes with two examplefunctions so you can so try it out.----------------------------------------------------------------------3. Running the programRunning the program is very simple. Just type genetic -singleto try to maximize the single_func() function for 10 generations of evolution.More generally, you can type genetic <-multiple> <-single> <-a num> <-i num> <-g num> -multiple Evolve to maximize the multiple function -single Evolve to maximize the single function -a num Use num many alleles in each individual -i num Use num many individuals in the population -g num Use num many generations of evolutionThere is no example filename. Because the fitness functions are C++functions, you will have to recompile the prorgam to use your ownfitness function.----------------------------------------------------------------------4. The solution, and how to read the source codeThis solution is quite close to the Lisp version given in the textbook.The classes are: Population -- Holds the entire population of chromosomes. Chromosome -- Holds a single chromosome, with its alleles.There are 2 source files in this directory: Population.C The Population class and the main() function Chromosome.C The Chromosome class----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -