home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / educatio / gaw110.zip / GAW.N < prev    next >
Text File  |  1992-06-27  |  46KB  |  1,269 lines

  1. .fo ''%''
  2. .tp
  3. .m4 0.7i
  4. .po +0.75i
  5. .nr pp 11
  6. .nr tp 12
  7. .nr sp 12
  8. .sz +2
  9. .ce
  10. .uh "Genetic Algorithm Workbench Documentation"
  11. .sz -2
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. .lp
  20. \fIThe Genetic Algorithm Workbench program and its documentation are
  21. copyright and may not be copied or distributed without written permission
  22. from the author with the following exceptions:
  23.  
  24. .ip \fI(1)
  25. \fICopies of the software and this documentation may be made and passed on to
  26. any third party provided that all the files on the distribution disk are
  27. distributed together in unmodified form, and providing that no profit is
  28. made from such distribution.
  29.  
  30. .ip \fI(2)
  31. \fIA reasonable number of copies may be made of the software for the purpose
  32. of archiving to guard against corruption of the working copy of the software.
  33.  
  34. .lp
  35. \fIThe software can be used without restriction or payment, but you are
  36. encouraged to send an appropriate contribution in sterling to the author if
  37. you feel that the program has been of use.
  38. See section 4 for the author's address.
  39.  
  40. .lp
  41. \fINo warranty is given that this software is fit for any purpose, nor that it
  42. will perform as described in this manual.
  43. You use it entirely at your own risk.\fR
  44.  
  45.  
  46.  
  47.  
  48. .(l
  49. \fICopyright (C) Mark Hughes 1989. All rights reserved.
  50.  
  51. Last Change:  30 November 1989.\fR
  52. .)l
  53. .bp
  54. .uh "CONTENTS"
  55.  
  56. .(l
  57. 1.    Introduction
  58.  
  59. 2.    Purpose
  60.  
  61. 3.    Using the Genetic Algorithm Workbench Program
  62.  
  63.     3.1    Hardware Requirements
  64.     3.2    Running the Program
  65.     3.3    Screen Display
  66.     3.4    Menu Commands
  67.     3.5    Program Control Variables
  68.  
  69. 4.    Bibliography
  70.  
  71. 5.    Appendix A -   Workbench Algorithms
  72.  
  73.     5.1    Solving Problems with a Genetic Algorithm
  74.     5.2    Genetic Coding
  75.     5.3    Genetic Algorithm Implementation
  76.     5.4    Summary of Algorithm Input Variables
  77.  
  78.         5.4.1    Population
  79.         5.4.2    Fitness Scaling
  80.         5.4.3    Breeder Selection
  81.         5.4.4    Generation Gap
  82.         5.4.5    Mates Selection
  83.         5.4.6    Mating
  84.         5.4.7    Crossover
  85.         5.4.8    Mutation Probability
  86.         5.4.9    Dispersal
  87.         5.4.10    Crowding Factor
  88.         5.4.11    Elitism
  89.         5.4.12    Sacrifice Selection
  90.  
  91.     5.5    Output Variables
  92.     5.6    References
  93.  
  94. 6.    Appendix B -   A Typical Session Using the Workbench
  95.  
  96. 7.    Appendix C -   Problems and How to Fix Them
  97.  
  98. 8.    Appendix D -   General Introduction to Genetic Algorithms
  99.  
  100. 9.    Appendix E -   Main Command Menu
  101. .bp
  102. .lp
  103. .sh 1 "Introduction"
  104.  
  105. .lp
  106. This is a user's manual for the Genetic Algorithm Workbench program
  107. which is an interactive tool for demonstrating and experimenting with genetic
  108. algorithms using an IBM compatible personal computer.
  109. This is not a set of subroutines for inclusion in your own programs.
  110. If that is what you require, see the bibliography for details of GENESIS.
  111.  
  112. .lp
  113. The manual commences with a description of the purpose of the Workbench in
  114. section 2.
  115.  
  116. .lp
  117. Section 3 then describes how to use the program and gives details of
  118. hardware requirements, instructions for running the program, an explanation
  119. of the screen display, and explains how to control the program using the
  120. command menu and program control variables.
  121.  
  122. .lp
  123. Section 4 contains a short bibliography.
  124.  
  125. .lp
  126. Appendix A describes the detailed operation of the genetic algorithm employed
  127. by the Workbench and the effect of each algorithm input variable.
  128. It gives details of where to find further information about the theory of
  129. the different aspects of the genetic algorithm which are described.
  130. An explanation of each output variable displayed on the screen is also given.
  131.  
  132. .lp
  133. Appendix B contains a short step by step example of using the Workbench.
  134.  
  135. .lp
  136. Appendix C may help if you encounter problems trying to use the Workbench.
  137.  
  138. .lp
  139. Appendix D includes an article as a general introduction to genetic
  140. algorithms and their applications.
  141.  
  142. .lp
  143. Appendix E is a brief summary of the Workbench command menu.
  144.  
  145. .sh 1 "Purpose"
  146.  
  147. .lp
  148. The purpose of the Workbench program is to allow experimentation with
  149. search and optimisation algorithms.
  150. It is primarily a tool for experimenting with different types of genetic
  151. algorithm, but is also intended for use in comparing genetic algorithms with
  152. other techniques although so far only the genetic algorithm has been
  153. implemented.
  154.  
  155. .lp
  156. A genetic algorithm is a method for finding the peaks of difficult functions,
  157. and the Workbench program is both for demonstrating genetic algorithms and
  158. for evaluating their performance.
  159.  
  160. .lp
  161. The idea is that you provide a function, the "Target Function" and see how
  162. quickly the selected algorithm is able to find the peak value, or indeed if
  163. it succeeds at all.
  164. You can vary the details of the algorithm used by tweaking several
  165. numeric control parameters and selecting different types of operator
  166. employed by the algorithm.
  167.  
  168. .sh 1 "Using the Genetic Algorithm Workbench Program"
  169.  
  170. .lp
  171. The following sections describe hardware required and provide instructions 
  172. for starting the Workbench program.
  173. The screen display is then explained followed by details of how to control
  174. the program, and finally a description of menu commands is given.
  175.  
  176. .lp
  177. Appendix B describes a typical session using the Workbench, and will also be
  178. useful while learning how to use the program.
  179.  
  180. .sh 2 "Hardware Requirements"
  181.  
  182. .lp
  183. To run the genetic algorithm Workbench, you require
  184.  
  185. .(l
  186. IBM PC/XT/AT or compatible
  187. EGA display
  188. Microsoft compatible mouse
  189. .)l
  190.  
  191. .lp
  192. The Workbench has been tested on MS-DOS version 3.3 but should work on
  193. most versions of MS-DOS and PC-DOS.
  194. Reports of problems with other versions will be appreciated.
  195.  
  196. .lp
  197. The program will work on a VGA mode screen, but unless you can put it in EGA
  198. emulation mode, the program will only use the lower two thirds of the
  199. screen, giving a squashed display.
  200.  
  201. .sh 2 "Running the Program"
  202.  
  203. .lp
  204. Check that your system hardware is suitable for running the genetic
  205. algorithm workbench (see above).
  206.  
  207. .lp
  208. Switch on the computer and wait for your MS-DOS prompt to appear on the screen.
  209. If you have a display adapter board that can emulate several display
  210. modes, ensure that it is in EGA mode.
  211. This might be done by setting configuration switches on the adapter
  212. card prior to switching your computer on, or by means of a special
  213. command provided with your display adapter.
  214. Refer to your display adapter manual for details of how to set it to EGA mode.
  215.  
  216. .lp
  217. Now, ensure that your mouse driver is loaded.
  218. On some systems a command such as "MOUSE" is provided to load the driver, on
  219. others a command must be inserted into your config.sys file.
  220. Refer to the documentation for your mouse on how to install the mouse driver.
  221.  
  222. .lp
  223. Now the final test.
  224. Insert the Genetic Algorithm Workbench disk into drive a: and type
  225.  
  226. .(l
  227. a:gaw
  228. .)l
  229.  
  230. .lp
  231. and press the <ENTER> key.
  232.  
  233. .lp
  234. The program takes a little while to load but you should see a display
  235. similar to that shown in figure 1 (see next section), and if you move your
  236. mouse, the mouse cursor should be visible and will change as you move it
  237. over different areas of the screen.
  238.  
  239. .lp
  240. If you don't think everything is as described here, refer to appendix C
  241. which describes possible problems and how to deal with them.
  242.  
  243. .sh 2 "Screen Display"
  244.  
  245. .lp
  246. Figure 1 shows a screen display similar to the one you should see when
  247. the Workbench is first started.
  248. The main features of the display are as follows.
  249.  
  250. .ip "\fICommand Menu\fR"
  251. This is a menu of commands shown at the top left of the screen which are
  252. activated using the mouse.
  253. Each command is highlighted when the mouse cursor overlays it, and is executed
  254. if the left mouse button is pressed while the command is highlighted.
  255. See section 3.5, Program Control for details of these commands.
  256.  
  257. .ip "\fIAlgorithm Control Chapter\fR"
  258. This is the large box which spans the top of the screen to the right of the
  259. command menu.
  260. It is called a \fIchapter\fR because it can contain several \fIpages,\fR
  261. only one of which is visible at one time.
  262. Initially, it displays a page called "Simple Genetic Algorithm" which shows
  263. a number of input variables and their values, which are used to control
  264. the operation of this algorithm.
  265. Pages can be flipped through, forwards or backwards, by clicking the left
  266. mouse button on the arrows in the top right hand corner of the chapter.
  267. Each page is described below.
  268.  
  269. .ip "\fISimple Genetic Algorithm Page\fR"
  270. This is the box within the algorithm control chapter entitled "Simple Genetic
  271. Algorithm".
  272. (Note that it may be necessary to select this page using the mouse before
  273. it is displayed within the chapter box - see "Algorithm Control Chapter" above.)
  274. This page is normally displayed when the Workbench is first started and
  275. lists a number of control inputs to the genetic algorithm together with
  276. their current values.
  277. The page shows two columns of input variables.
  278. Each variable displayed shows its name to the left, a pair of arrows in the
  279. middle, and the variable's current value to the right.
  280. Note that many of the variable values are text strings.
  281. You can alter the value of any of these variables by clicking the left mouse
  282. button on the up or down arrows to the left of each value.
  283. The meaning of each variable is described in appendix A.
  284.  
  285. .ip "\fIGeneral Program Control Variables Page\fR"
  286. This is the box within the algorithm control chapter entitled "General Program
  287. Control Variables".
  288. (Note that it may be necessary to select this page using the mouse before
  289. it is displayed within the chapter box - see "Algorithm Control Chapter" above.)
  290. This page contains variables related to general program operation rather
  291. than a specific algorithm.
  292. The meaning of each program control variable is described in section 3.5.
  293.  
  294. .ip "\fIOutput Variables Box\fR"
  295. This is the box at the bottom right of the screen which contains the current
  296. values of a number of variables relating to the current algorithm.
  297. These variables cannot be altered by the user; they indicate the current
  298. state of the algorithm.
  299. Each output variable is described in appendix A.
  300.  
  301. .ip "\fITarget Function Graph\fR"
  302. This is the graph labelled "Target Function" and is used for entry and display
  303. of the function to be solved.
  304. Using the Workbench involves drawing functions on this graph which are then
  305. solved using the selected algorithm.
  306. After a function has been provided, a small red triangle on the x axis marks
  307. the highest peak, which is the target for the algorithm to find.
  308.  
  309. .ip "\fIPopulation Distribution Histogram\fR"
  310. This is the plot entitled "Population Distribution" immediately below the
  311. target function graph and shows the distribution of organisms by value of
  312. x for the genetic algorithm.
  313.  
  314. .ip "\fIOutput Graph\fR"
  315. This is the graph labelled "Output Plot" and is used to display plots of
  316. various output variables against time.
  317.  
  318. .ip "\fIAxis Value Box\fR"
  319. This box labelled axis value is used in combination with the mouse cursor
  320. to read values from any of the graphs described above.
  321. When the mouse cursor is moved over the plot area of any graph, it changes to
  322. a cross hair and causes the Axis Value box to display the coordinate values
  323. of the corresponding graph at the point indicated by the cross hair.
  324.  
  325. .(b
  326. .sp 15
  327. .ce
  328. .uh "Figure 1 - Example Screen Display"
  329. .)b
  330.  
  331. .sh 2 "Menu Commands"
  332.  
  333. .lp
  334. The program is controlled entirely through use of a mouse.
  335. General commands such as starting and stopping the algorithm are invoked
  336. through a menu.
  337. The target function is input by drawing the function on a graph using the
  338. mouse cursor, and algorithm and program control variables can be altered
  339. by clicking the mouse over the up and down arrows to the left of each value.
  340.  
  341. .lp
  342. This section describes each menu command.
  343. Program control variables are explained in the following section.
  344.  
  345. .lp
  346. The functions of the command menu shown in the top left of the screen are
  347. as follows:
  348.  
  349.  
  350. .ip "\fIRedraw\fR"
  351. Redraws the whole screen.
  352.  
  353. .ip "\fIStart Alg/Stop Alg\fR"
  354. Start/pause algorithm operation.
  355. Note that an algorithm can only be run if it the algorithm chapter is
  356. showing the corresponding algorithm page.
  357. No algorithm can run while the chapter is displaying the page relating to
  358. general program control variables.
  359.  
  360. .ip "\fIStep Alg\fR"
  361. No function.
  362. Currently unimplemented.
  363.  
  364. .ip "\fIReset Alg\fR"
  365. Resets algorithm ready for a run.
  366. See the relevant appendix for details of reseting an algorithm.
  367.  
  368. .ip "\fIPlot Data\fR"
  369. Plots currently selected data (see description of "Plot data" variable
  370. later), on the output plot.
  371. This displays the selected variable against time for the duration of the
  372. current algorithm run.
  373.  
  374. .ip "\fIPlot Targ\fR"
  375. Re-plot the target function.
  376. After redrawing the entire screen the target function graph is cleared.
  377. This command allows the current target function to be redrawn, but note
  378. that it will have no effect until a function has been entered using
  379. the "Enter Targ" command described next.
  380.  
  381. .ip "\fIEnter Targ\fR"
  382. Enter or re-enter target function.
  383. After executing this command, the mouse cursor is moved to the target function
  384. graph allowing a target function to be drawn.
  385. Clicking with the left mouse button plots a point for the function, and
  386. clicking with the right deletes a point.
  387. You should draw a function which spans the full width of the x axis from
  388. left to right and uses as few points as possible.
  389. Functions with many points slow down the algorithms.
  390. When you are happy with the function, press both left and right mouse
  391. buttons together.
  392.  
  393. .ip "\fIQuit\fR"
  394. Exit the program.
  395.  
  396. .ip "\fITest\fR"
  397. Tests my jump-up menus (no function).
  398. Play by all means, but this has nothing to do with the Workbench program.
  399.  
  400. .sh 2 "Program Control Variables"
  401.  
  402. .lp
  403. The program control variables are shown on the page labelled "General
  404. Program Control Variables".
  405. The meaning of each program control variable explained below.
  406. (Algorithm control variables are explained in appendix A.)
  407.  
  408. .lp
  409. Program control variable meanings:
  410.  
  411. .ip "\fIPlot data\fR"
  412. This variable is used to determine the source of data for plotting on the
  413. graph entitled "Output Plot".
  414. The selections available include values (but not all values) of output
  415. variables from those displayed in the "Output Variables" box.
  416.  
  417. .ip "\fIO/P Plot X-max\fR"
  418. This variable sets scale of the output plot X axis by fixing the maximum
  419. x value that can be displayed.
  420.  
  421. .ip "\fIO/P Plot Y-max\fR"
  422. This variable sets scale of the output plot Y axis by fixing the maximum
  423. y value that can be displayed.
  424.  
  425. .ip "\fIPlot period\fR"
  426. This variable determines the frequency with which the population distribution
  427. histogram is updated.
  428. A value of 1 causes an update for every iteration (or generation) of the
  429. algorithm.
  430. A value of 2 causes update every other iteration, 3 every third and so on.
  431.  
  432. .ip "\fIRandom # seed\fR"
  433. This value is used to seed the program's random number generator each time
  434. the algorithm is reset from the command menu.
  435.  
  436. .sh 1 "Bibliography"
  437.  
  438. .lp
  439. This section lists some sources of information about genetic algorithms.
  440.  
  441. .lp
  442. A brief and very general introduction to genetic algorithms is given in
  443. appendix D which contains a copy of an article from The Guardian
  444. newspaper.
  445.  
  446. .lp
  447. The following text is a comprehensive textbook of genetic algorithm
  448. theory and applications up to the year 1989.
  449.  
  450. .ip
  451. Goldberg, D. E. (1989). \fIGenetic Algorithms in Search Optimization & Machine
  452. Learning.\fR Addison-Wesley.
  453.  
  454. .lp
  455. Users wishing to experiment with genetic algorithms in their own programs
  456. may be interested in a package called GENESIS.
  457. This is a set of very useful subroutines written in C and built into a tool
  458. for experimenting with different "flavours" of algorithm.
  459. GENESIS is far more flexible than the Workbench but is not interactive and
  460. has no graphical output built in.
  461. As an integrated tool, GENESIS will run on most Unix systems, but the genetic
  462. algorithm subroutines are easily ported to any system with a standard C
  463. compiler.
  464. GENESIS can be obtained from its author:
  465.  
  466. .(l
  467. John J. Grefenstette,
  468. Navy Center for Applied Research in Artificial Intelligence,
  469. Naval Research Laboratory, Washington, D.C. 20375-5000.
  470. USA.
  471. .)l
  472.  
  473. .lp
  474. The author of the Workbench program is happy to correspond with users
  475. interested in learning more about genetic algorithms, or who wish to discuss
  476. their relevance to a particular kind of problem.
  477. He can be reached by writing to the following address:
  478.  
  479. .(l
  480. Mark Hughes,
  481. 256 Milton Road,
  482. Cambridge,
  483. CB4 1LQ.
  484. UK.
  485.  
  486. Internet: mrh@camcon.co.uk
  487. .)l
  488. .bp
  489. .lp
  490. .sh 1 "Appendix A - Workbench Algorithms"
  491.  
  492. .lp
  493. This appendix describes the implementation of the genetic algorithm and
  494. operators used in the Workbench program.
  495.  
  496. .sh 2 "Solving Problems with a Genetic Algorithm"
  497.  
  498. .lp
  499. A genetic algorithm evolves solutions to a problem through natural selection,
  500. breeding and genetic variation.
  501. This involves generating a population of solutions, measuring their suitability
  502. or fitness, selecting the better solutions for breeding which produces a
  503. new population.
  504. The process is repeated and gradually the population evolves towards the
  505. solution.
  506.  
  507. .lp
  508. In the genetic algorithm Workbench, the problem is to find the value of x for
  509. which the target function has a maximum value of f(x).
  510. Each individual in the population represents a solution to this problem in
  511. the form of a candidate value for x.
  512. The suitability or fitness of the individual is simply taken by calculating
  513. the value of f(x) for the individual.
  514. This leads to an individual whose value of x corresponds to a high value of f(x)
  515. being fitter, and consequently being given a greater chance of breeding, than
  516. an individual whose value of x corresponds to a lower value of f(x).
  517.  
  518. .sh 2 "Genotype Coding"
  519.  
  520. .lp
  521. In the same way that the genetic information of animals is coded as a string
  522. (of DNA), the genetic information of each individual, i.e. its value of x, is
  523. also coded as a string.
  524. In this case as a string of zeros or ones which can be interpreted as a
  525. simple binary code.
  526. The choice of a string representation is deliberate because it allows
  527. processes which act on strings of DNA during natural evolution
  528. to be implemented by the computer version of the genetic algorithm.
  529.  
  530. .lp
  531. The string coding of each individual is known as its genotype in biological
  532. terminology, while its interpretation, i.e. its value of x, is referred to
  533. as its phenotype.
  534.  
  535. .sh 2 "Genetic Algorithm Implementation"
  536.  
  537. .lp
  538. The genetic algorithm implemented by this program boils down to the following
  539. steps.
  540. (Note that a number of new terms, shown in italics, are introduced during 
  541. the following steps without full explanation.
  542. These terms refer to operations that are explained subsequently.)
  543.  
  544. .np
  545. Generate an initial population of organisms.
  546. The random number generator is seeded with the value of "Random # seed" (see
  547. section 3.5), and a new population of organisms is generated each with a
  548. different random genotype.
  549. This happens whenever the "Reset Alg" command is invoked from the main menu.
  550. The command also resets the generation counter to 0 and clears the output
  551. variables which are updated during each algorithm run.
  552. The number of organisms generated depends on the value of the \fIpopulation\fR
  553. input variable.
  554.  
  555. .np
  556. Calculate and scale new fitnesses.
  557. Each new individual's fitness is calculated by reading a value of f(x)
  558. from the target function at the individual's value of x.
  559. If selected, \fIfitness scaling\fR is now done.
  560.  
  561. .np
  562. Select individuals for breeding.
  563. A subset of the population is selected for breeding.
  564.  
  565. .np
  566. Breed to produce new population.
  567. The set of breeders are taken in random pairs and mated to produce pairs of
  568. new organisms, the progeny.
  569.  
  570. .np
  571. Disperse progeny into the population.
  572. The new progeny are inserted into the population, displacing existing
  573. individuals.
  574.  
  575. .lp
  576. After the last step, the algorithm begins again at step 2, starting the next
  577. generation.
  578.  
  579. .sh 2 "Summary of Algorithm Input Variables"
  580.  
  581. .lp
  582. Each input variable to the simple genetic algorithm is summarised below.
  583.  
  584. .sh 3 "Population"
  585.  
  586. .lp
  587. This input variable determines the number of individuals in the population.
  588. That is, the number of candidate solutions being manipulated by the
  589. algorithm at any time.
  590. Too small a population and there will be little opportunity for genetic
  591. variation, too large and the algorithm will reduce to a random search.
  592.  
  593. .lp
  594. For the problem posed in the Workbench, populations as low as 5 to 10 can
  595. be quite effective but in more complex problems where there are many more
  596. possible solutions larger populations are required.
  597. However, even for very complex problems, populations rarely exceed a few
  598. hundred individuals.
  599.  
  600. .lp
  601. One of the reasons why surprisingly small populations can be effective is the
  602. intrinsic tolerance of noise exhibited by the genetic algorithm which arises
  603. out of the repeated sampling of small chunks of the genetic material (so
  604. called schemata) over a number of generations.
  605.  
  606. .lp
  607. There is a discussion of the issues in selecting suitable population sizes
  608. in Goldberg 1988.
  609.  
  610. .sh 3 "Fitness Scaling"
  611.  
  612. .lp
  613. Fitness scaling occurs between the production of new individuals in the
  614. population and the use of their fitness values for selection.
  615. It is a method of adjusting the probability distribution which
  616. determines the likelihood of an individual being selected for breeding.
  617. It is usually used to emphasise the relatively small differences in relative
  618. fitness when a population begins to converge.
  619. Without it, the rate of convergence will slow down as diversity decreases and
  620. most individuals in the population have similar fitnesses.
  621.  
  622. .lp
  623. The kind of fitness scaling employed depends on the value of the corresponding
  624. input variable which has one of the following values.
  625.  
  626. .ip \fINone\fR
  627. No scaling.
  628. An individual's scaled fitness value is the same as its unscaled value.
  629.  
  630. .ip \fILinear\fR
  631. Each individual's scaled fitness f' is calculated from its unscaled fitness f
  632. according to the formula
  633.  
  634. .(l
  635. f' = a.f + b
  636. .)l
  637.  
  638. .ip
  639. where a and b are chosen so that the mean scaled fitness is equal to the
  640. mean unscaled fitness of the population, and so that the maximum scaled
  641. fitness is a given multiple of the maximum unscaled fitness.
  642. The multiple is typically two.
  643.  
  644. .lp
  645. Several methods of fitness scaling are discussed in Goldberg 1989.
  646.  
  647. .sh 3 "Breeder Selection"
  648.  
  649. .lp
  650. Breeder selection involves choosing a number of individuals according to
  651. (scaled) fitness which will be used for breeding.
  652.  
  653. .lp
  654. The number chosen depends on the number of new individuals required, which
  655. is the product of the current population size and the \fIgeneration gap.\fR
  656. The latter is an input variable between 0 and 1 which represents the
  657. proportion of the current population replaced during each generation.
  658.  
  659. .lp
  660. The method of selecting the individuals depends on the value of the
  661. input variable \fIbreeder selection:\fR
  662.  
  663. .ip "\fIRoulette\fR"
  664. This method is so named because of its similarity to spinning a roulette wheel.
  665. In effect, an imaginary roulette wheel is marked out with one slot per
  666. individual in the population, but the slots are of differing sizes giving
  667. some individuals a better chance of being selected for breeding than others.
  668. By making the slot size proportional to the (scaled) fitness of each
  669. individual, the fitter individuals have a correspondingly better chance of
  670. being selected and passing on their characteristics.
  671.  
  672. .ip
  673. The imaginary wheel is spun once for each individual required, one individual
  674. being selected per spin.
  675. This allows some individuals to be selected more than once and others not
  676. to be selected at all.
  677.  
  678. .ip "\fIExpected Value\fR"
  679. There is a potential problem with roulette wheel selection because it is
  680. a stochastic process.
  681. In other words, its random element allows some individuals to be selected
  682. more often than their fitness deserves (and others to be selected less often).
  683. Expected value selection reduces this stochastic error by ensuring that
  684. no individual can be selected more than one more time than it deserves.
  685. (Obviously some stochastic error must remain because the number of times
  686. and individual is selected must be an integer whereas its "selection merit"
  687. is a real number).
  688.  
  689. .lp
  690. Both \fIgeneration gap\fR and several kinds of \fIbreeder selection\fR are
  691. discussed in Goldberg 1989.
  692.  
  693. .sh 3 "Generation Gap"
  694.  
  695. .lp
  696. The \fIgeneration gap\fR input variable determines the proportion of
  697. each the population replaced during each generation.
  698. See breeder selection above.
  699.  
  700. .sh 3 "Mates Selection"
  701.  
  702. .lp
  703. Following selection of a pool of individuals for breeding, pairs are
  704. taken from this pool and bred to produce a pool of progeny.
  705. The input variable \fImates selection\fR determines how these pairs are
  706. chosen.
  707. Currently only one method is supported:
  708.  
  709. .ip "\fIRandom\fR"
  710. Each individual chosen for mating from the breeding pool is selected
  711. at random and is immediately removed from the pool to prevent it
  712. being selected again.
  713.  
  714. .lp
  715. In this implementation all individuals are identical and so purely random
  716. selection of a mate is always valid.
  717. However, more complicated schemes are feasible where mating is restricted
  718. in some way, perhaps to simulate the formation of niche populations or
  719. species.
  720. This is discussed further in Goldberg 1989 (p188-197).
  721. See also section 5.4.9 which describes dispersal by crowding.
  722.  
  723. .sh 3 "Mating"
  724.  
  725. .lp
  726. Having selected a pair of individuals for mating, they are mated to produce
  727. new individuals which are collected in a pool of progeny.
  728. The method used is determined by the value of the \fImating\fR input
  729. variable, but this currently only supports one method:
  730.  
  731. .ip "\fISimple\fR"
  732. Simple mating produces two progeny from two parents as follows.
  733. First a copy of each parent is taken and \fIcrossover\fR is
  734. applied to produce two individuals each of which receives some genetic
  735. material from both parents.
  736. Finally, \fImutation\fR is applied to each individual which may introduce
  737. a random change to the genetic material.
  738.  
  739. .lp
  740. Crossover and mutation are described in the following sections.
  741.  
  742. .lp
  743. Currently only simple mating is supported, but many variations can be
  744. envisaged, for example incorporating other genetic operators than crossover
  745. and mutation.
  746. These operators are copied directly from natural processes and their are
  747. many other such operators, both natural and man made, that can be tried.
  748.  
  749. .sh 3 "Crossover"
  750.  
  751. .lp
  752. As mentioned earlier, each individual represents a candidate solution to
  753. the problem in the form of a string of zeros and ones.
  754. Crossover is a process which takes two such strings and exchanges portions of
  755. the strings to produce two new strings, each of which incorporates information
  756. from both the initial strings.
  757. Many variations of the crossover operator have been experimented with.
  758. The following are available according to the value of the \fIcrossover\fR
  759. input variable:
  760.  
  761. .ip "\fISingle Point\fR"
  762. A point is chosen at random from the first to the last but one binary digit
  763. of one of the strings.
  764. The digits following this point are exchanged between the two strings.
  765. For example, given the two initial strings and a crossover point indicated
  766. by the '^'.
  767.  
  768. .TS
  769. center tab(!) ;
  770. c c c c c c c .
  771. 0!1!0!0!0!0!0
  772. 1!0!1!1!0!1!0
  773.  ! !^
  774. .TE
  775.  
  776. .ip
  777. the following new strings would be produced.
  778.  
  779. .TS
  780. center tab(!) ;
  781. c c c c c c c .
  782. 0!1!0!1!0!1!0
  783. 1!0!1!0!0!0!0
  784.  ! !^
  785. .TE
  786.  
  787. .ip "\fITwo Point\fR"
  788. Two point crossover is similar except that two distinct points are chosen,
  789. again randomly, and the segment between the two points is exchanged.
  790. The operator works in such a way that single point crossover is a legal
  791. special case of two point crossover.
  792. This is the case if either of the two points is at the extremes of the
  793. string.
  794.  
  795. .ip "\fIUniform\fR"
  796. Uniform crossover passes along the length of the strings and chooses to take
  797. each bit from either one parent or the other according to some specified
  798. probability.
  799. The origin of each bit is independent of all the other bits and in this
  800. implementation has an equal chance of being taken from either parent.
  801. This produces more mixing of bits than the former operators.
  802.  
  803. .lp
  804. The effect of crossover, whatever its form, is to produce new individuals
  805. which contain genetic material from two parents.
  806. No new material is introduced, and so there is a limit to the genotypes that
  807. can be produced throughout crossover alone.
  808.  
  809. .lp
  810. Several such operators including single point and two point crossover
  811. are described in Goldberg 1989.
  812. Uniform crossover is described (and compared with several other crossover
  813. operators) in Syswerda 1989.
  814.  
  815. .sh 3 "Mutation Probability"
  816.  
  817. .lp
  818. Mutation involves the chance introduction of a change to any particular
  819. bit of an individual's string.
  820. Each bit is considered in turn, and is flipped from a zero to a one (or vice
  821. versa) with probability determined by the value of the \fImutation 
  822. probability\fR input variable.
  823.  
  824. .lp
  825. Mutation can result in new genetic material being introduced into the 
  826. population, since it can produce values that were not present in either
  827. parent, or indeed in the entire population.
  828.  
  829. .lp
  830. Typical mutation rates are of the order one in a hundred to one in a thousand
  831. bits.
  832. Much higher rates tend to disrupt the action of crossover, preventing
  833. convergence and leading to a more random type of search.
  834.  
  835. .sh 3 "Dispersal"
  836.  
  837. .lp
  838. Dispersal is the method by which progeny are placed into the existing
  839. population, which requires some existing individuals to be deleted.
  840. This is done by the method indicated by the value of the \fIdispersal\fR
  841. input variable:
  842.  
  843. .ip "\fIRandom\fR"
  844. Individuals are chosen at random from the existing population to be replaced by
  845. progeny until all progeny have been inserted.
  846. Measures are taken to ensure that progeny inserted by the current dispersal
  847. are not displaced by the insertion of other progeny.
  848.  
  849. .ip "Crowding"
  850. Crowding is a mechanism used to prevent premature convergence of the algorithm.
  851. The chance of an individual being displaced is made to depend on the degree 
  852. of similarity between it and the new individual that is replacing it.
  853. When a new individual is ready to be placed into the existing population,
  854. it is compared (bit for bit) with a given number of individuals chosen
  855. at random from the existing population.
  856. The one most like the new individual is chosen to be replaced.
  857. The number of individuals chosen for comparison is determined by the value
  858. of the \fIcrowding factor\fR input variable.
  859.  
  860. .ip
  861. Dispersal by crowding is so called because it simulates competition for
  862. scarce resources by individuals which are genetically similar and so
  863. encourages the formation of niche populations.
  864. Mate selection, described in section 5.4.5 is another method that can
  865. be used to encourage the formation of niche populations.
  866. These and other methods are discussed further in Goldberg 1989 (p188-197).
  867.  
  868. .sh 3 "Crowding Factor"
  869.  
  870. .lp
  871. The \fIcrowding factor\fR input variable determines the number of individuals
  872. that are compared with each new individual during during dispersal by
  873. crowding (see above).
  874. A crowding factor of 1 would prevent crowding from working and be equivalent
  875. to random dispersal.
  876.  
  877. .sh 3 "Elitism"
  878.  
  879. .lp
  880. Elitism is a feature that is active dependent on the value (on or off) of
  881. the \fIelitism\fR input variable.
  882.  
  883. .lp
  884. When active, elitism ensures that the best, or fittest, individual cannot
  885. be lost from the population through dispersal.
  886. A copy of the fittest individual in each generation is kept and is
  887. re-introduced into the population if, after dispersal, no individual in
  888. the new population is at least as fit.
  889.  
  890. .lp
  891. When elitism acts to re-introduce a lost individual it must choose an
  892. individual to be replaced.
  893. For details of how this is done, see the section entitled "Sacrifice Selection"
  894. below.
  895.  
  896. .lp
  897. Elitism is discussed in Goldberg 1989.
  898.  
  899. .sh 3 "Sacrifice Selection"
  900.  
  901. .lp
  902. The method by which an individual is selected for replacement due to the
  903. operation of elitism (see above) is determined by the value of the input
  904. variable \fIsacrifice selection\fR as follows:
  905.  
  906. .ip "\fIRandom\fR"
  907. The individual to be replaced is chosen randomly.
  908.  
  909. .ip "\fIWeakest\fR"
  910. The weakest (i.e. least fit) individual is chosen.
  911.  
  912. .sh 2 "Output variables"
  913.  
  914. .lp
  915. With each generation the display of output variables is updated.
  916. Each variable is explained below:
  917.  
  918. .ip "\fIGeneration\fR"
  919. The number of generations (iterations of the genetic algorithm) completed
  920. so far.
  921.  
  922. .ip "\fIOptimum Fitness\fR"
  923. The maximum value of the function f(x).
  924.  
  925. .ip "\fICurrent Best Fitness\fR"
  926. The highest value of f(x) for any individual in the current population.
  927.  
  928. .ip "\fIAverage Fitness\fR"
  929. The average value of f(x) for all individuals in the current population.
  930.  
  931. .lp
  932. Note that the above fitness values relate to unscaled fitnesses.
  933.  
  934. .ip "\fIOptimum x\fR"
  935. The value of x which corresponds the the maximum value of f(x) of the
  936. target function.
  937.  
  938. .ip "\fICurrent Best x\fR"
  939. The x of the individual in the population which has the highest value for f(x).
  940.  
  941. .ip "\fIAverage x\fR"
  942. The average of all x values in the current population.
  943.  
  944. .sh 2 "References"
  945.  
  946. .ip "Goldberg 1988"
  947. Goldberg, D. E. (1988). \fISizing Populations for Serial and Parallel
  948. Genetic Algorithms.\fR TCGA report no. 88005. University of Alabama.
  949.  
  950. .ip "Goldberg 1989"
  951. Goldberg, D. E. (1989). \fIGenetic Algorithms in Search Optimization & Machine
  952. Learning.\fR Addison-Wesley.
  953.  
  954. .ip "Syswerda 1989"
  955. Syswerda, G. (1989). \fIUniform Crossover in Genetic Algorithms.\fR
  956. Proceedings of the Third International Conference on Genetic Algorithms.
  957. Morgan Kaufman.
  958. .bp
  959. .lp
  960. .sh 1 "Appendix B - A Typical Session Using the Workbench"
  961.  
  962. .lp
  963. This appendix describes a typical session using the genetic algorithm
  964. Workbench.
  965.  
  966. .lp
  967. To run the Workbench program you require an IBM compatible personal computer
  968. with EGA display and Microsoft compatible mouse.
  969. To start the program, make sure your mouse driver is loaded, your display
  970. is in EGA mode and type
  971.  
  972. .(l
  973. gaw
  974. .)l
  975.  
  976. .lp
  977. followed by pressing the <ENTER> key.
  978. The program does not have any command line parameters.
  979. (See also section 3.2, "Running the Program".)
  980.  
  981. .lp
  982. Check that the program display is similar to that of figure 1 shown earlier
  983. in the manual.
  984. If you think something is wrong, refer to \fIproblems, appendix C\fI which describes
  985. possible problems and their solution.
  986.  
  987. .lp
  988. Typical use involves the following steps.
  989.  
  990. .ip 1
  991. Click on "Enter Targ" in the menu and enter a function extending from
  992. leftmost to rightmost points on the graph.
  993. (Note that clicking the left mouse button sets a point, clicking the right
  994. deletes a point, and pressing both together ends input of the function).
  995. You should enter a function starting from the graph origin (bottom left), and
  996. finishing at the bottom right of the graph.
  997. To end entry of the function, press left and right mouse buttons 
  998. simultaneously.
  999. If you go wrong, click on "Enter Targ" and try again.
  1000.  
  1001. .ip 2
  1002. Click on "Reset Alg" to initialise the genetic algorithm.
  1003. Notice the histogram of population distribution in the bottom left hand corner
  1004. is redrawn, along with the output variables in the box at the bottom right
  1005. corner of the screen.
  1006.  
  1007. .ip 3
  1008. Click on "Start Alg" which causes the algorithm to run.
  1009. Note that the menu option changes its name to "Stop Alg", and so clicking on
  1010. it again will pause the algorithm.
  1011.  
  1012. .lp
  1013. While running, a count of generations is maintained in the "Output Variables"
  1014. box, along with several other algorithm variables.
  1015. Every so often, the histogram is updated as the population
  1016. attempts to converge on the value of x which corresponds to the highest
  1017. peak in the target function input earlier.
  1018.  
  1019. .lp
  1020. At any time, a plot of average fitness against time can be produced by
  1021. clicking on "Plot Data".
  1022. The algorithm can be paused/re-started by clicking on "Stop Alg" 
  1023. and "Start Alg".
  1024. New target functions can be provided, as described earlier, and the algorithm
  1025. allowed to run with the current population distribution or with a
  1026. new distribution by clicking on "Reset Alg".
  1027.  
  1028. .lp
  1029. While the algorithm is paused, various program variables can be changed by
  1030. clicking the mouse button while the cursor is hovering over the \fIup\fR
  1031. and \fIdown\fR arrows next to values displayed in the large box spanning
  1032. the top of the screen.
  1033. Pressing and holding the mouse button enables variables to be changed
  1034. quickly.
  1035.  
  1036. .lp
  1037. Note that the large box spanning the top of the screen contains two pages, only
  1038. one of which is displayed at a time.
  1039. These can be thumbed through by clicking on the arrows at the very top right
  1040. of the display, immediately to the right of the copyright message.
  1041. The first page is called "Simple Genetic Algorithm" which allows algorithm
  1042. variables to be adjusted.
  1043. The second page, called "General Program Control Variables", allows selection
  1044. of different data for plotting on the output graph, changes to the scale
  1045. of output graph axes and so on.
  1046.  
  1047. .lp
  1048. Note that the algorithm will only run while the "Simple Genetic Algorithm"
  1049. page is selected.
  1050. Alternative algorithms, simulated annealing for example, will be implemented
  1051. by providing additional pages of algorithm variables.
  1052. .bp
  1053. .lp
  1054. .sh 1 "Appendix C - Problems and How to Fix Them"
  1055.  
  1056. .lp
  1057. This appendix is intended to help sort out problems encountered when
  1058. trying to run the genetic algorithm Workbench program.
  1059.  
  1060. .lp
  1061. If you are unable to fix any problems using the list of potential problems
  1062. and solutions which follow, it is wise to take the following steps before
  1063. giving up in despair:
  1064.  
  1065. .np
  1066. Prevent installation of any unnecessary resident programs such as pop-up
  1067. utilities, disk caches or command line editors.
  1068. These are often installed by commands in your autoexec.bat file and could
  1069. be the source of your problem.
  1070.  
  1071. .np
  1072. Prevent installation of any unnecessary device drivers.
  1073. These are usually installed by commands in your config.sys file such
  1074. as "device=filename".
  1075.  
  1076. .lp
  1077. The only resident program or device driver that you will need installed is
  1078. your mouse driver which may be installed by either of the above methods
  1079. depending on the software supplied with your mouse.
  1080.  
  1081. .uh "Problem: Display is squashed"
  1082.  
  1083. .lp
  1084. The top third of the screen is blank, but everything is displayed correctly
  1085. in the lower two thirds of the screen.
  1086. The mouse cursor may also be missing.
  1087.  
  1088. .lp
  1089. Your display adapter is in the wrong mode, possibly VGA mode.
  1090. Refer to your display adapter manual for details of how to set it into
  1091. EGA mode.
  1092.  
  1093. .uh "Problem: Display corrupt or blank"
  1094.  
  1095. .lp
  1096. Your display adapter is probably in the wrong mode.
  1097. Refer to your display adapter manual for details of how to set it into
  1098. EGA mode.
  1099.  
  1100. .uh "Problem: No mouse cursor"
  1101.  
  1102. .lp
  1103. The mouse cursor is not visible but it is possible to highlight options in
  1104. the command menu by moving the invisible cursor towards the menu and "circling"
  1105. with the mouse.
  1106.  
  1107. .lp
  1108. This probably indicates a problem with your mouse driver.
  1109. It may not be compatible with this mode of your display adapter.
  1110. Note that the Workbench program operates in \fIgraphics\fR mode, and so this problem
  1111. may occur even if you have used your mouse with the display in EGA \fIcharacter\fR
  1112. mode (which would display a block mouse cursor).
  1113. .bp
  1114. .lp
  1115. .sh 1 "Appendix D - General Introduction to Genetic Algorithms"
  1116.  
  1117. .lp
  1118. The following is an article which appeared in the Guardian newspaper on 14
  1119. September 1989.
  1120.  
  1121. .sz +2
  1122. .uh "Why Nature Knows Best About Design"
  1123. .sz -2
  1124.  
  1125. .ip
  1126. \fIEngineers now need a helping hand from Nature in order to solve their
  1127. problems.
  1128. Mark Hughes reports.\fR
  1129.  
  1130. .lp
  1131. All life on earth, including its most intricate
  1132. and ingenious features is the product of a genetic algorithm, known more
  1133. commonly as evolution.
  1134. However, genetic algorithms need not be confined to nature.
  1135. They can be used to help solve many design and optimisation problems.
  1136. Computer implementations of genetic algorithms are being used to tackle
  1137. difficult problems in fields as far ranging as turbine blade design,
  1138. automatic integrated circuit layout, and even in the training of neural
  1139. networks.
  1140.  
  1141. .lp 
  1142. All living things carry a kind of "blue-print" for their construction
  1143. in the DNA of each living cell.
  1144. Over a period of time, changes (e.g. mutations) occur to the DNA giving rise
  1145. to organisms which are more likely to survive, and so have a greater chance
  1146. of passing their improved characteristics on to future generations.
  1147. Of course, not all changes will be beneficial, but those which are not
  1148. tend to die out.
  1149. This is evolution.
  1150. It is analogous to engineers making design changes in order to
  1151. improve their company's product and so gain a competitive
  1152. advantage or increase profitability.
  1153. The genetic algorithm is the mechanism invented by nature for trying out 
  1154. alterations to DNA.
  1155.  
  1156. .lp
  1157. In the past, evolution has been perceived as a slow and hap-hazard process,
  1158. relying on random mutations, and thus unsuitable for use in
  1159. engineering.
  1160. This perception caused problems to scientists trying to explain the rapid rate
  1161. of evolution evident from the fossil record, and has been shown to be false.
  1162. Although scientists have been aware of genetic operators other than
  1163. random mutation for some time, it was not until the 1970s that a
  1164. mathematical analysis revealed their importance (Holland 1975). 
  1165. Holland showed that nature's genetic algorithm was highly efficient
  1166. at search and optimisation, and in no sense hap-hazard.
  1167.  
  1168. .lp
  1169. In engineering, computer simulations of genetic algorithms can be used to
  1170. evolve better designs for a variety of systems.
  1171. The computer is used to maintain a population of competing designs
  1172. each with its own computer representation of DNA (usually a binary string).
  1173. Here, instead of determining animal characteristics such as size, number
  1174. of limbs and eye colour, the "DNA" is decoded to produce design characteristics
  1175. such as lengths, angles, equations or rules.
  1176. At each generation, the better (cf. fitter) designs are chosen to
  1177. reproduce, and operators borrowed from nature are used to make changes
  1178. to their "DNA" in the search for improvements. 
  1179. The designs are then tested by decoding the "DNA", and over several
  1180. generations the population evolves and improves the criteria chosen by
  1181. the engineer. 
  1182.  
  1183. .lp
  1184. The freedom to select fitness criteria allows genetic algorithms to
  1185. be applied in many fields.
  1186. For example, you may wish to evolve rules for trading in financial markets,
  1187. improve the aerodynamics of a vehicle, or simply solve an abstract
  1188. mathematical function.
  1189. But why use a genetic algorithm, when in the last case for example, there
  1190. are plenty of established methods for solving mathematical functions?
  1191.  
  1192. .lp
  1193. The reason is that existing methods are fine so long as the problem is not 
  1194. too complex.
  1195. A genetic algorithm allows extremely difficult functions to
  1196. be solved efficiently - even the design of a living organism.
  1197.  
  1198. .lp
  1199. In engineering terms, the strengths of genetic algorithms can be
  1200. summarised by their abilities to cope with a variety of very difficult
  1201. problems, to work without prior knowledge about the function being
  1202. optimised, to optimise "noisy" functions, and to do without secondary
  1203. information such as gradients.
  1204. In plain language they can cope with the difficulties represented by real-life 
  1205. problems which are generally insoluble by other methods.
  1206.  
  1207. .lp
  1208. A recent and most impressive testament to the fact that genetic algorithms
  1209. are now coming of age has been provided by General Electric in the USA who
  1210. used the technique to design an improved gas turbine blade.
  1211. Their computer model indicates efficiency improvements of 2% for the design,
  1212. a significant saving in this field, and they are currently spending around
  1213. $1m verifying the prediction.
  1214. If this succeeds they will spend $70m re-tooling their production line to
  1215. produce the new type of blade.
  1216.  
  1217. .lp 
  1218. Applications in addition to those mentioned already include gas
  1219. pipeline management, medical image registration, adaptive filter design
  1220. and mechanical structure optimisation.
  1221. But engineering is not the only area to benefit.
  1222. Genetic algorithms have been used to generate rules for financial trading
  1223. systems, to classify forensic evidence, and to identify insurance risks.
  1224.  
  1225. .lp
  1226. A lack of computer power has been a factor limiting the usefulness of genetic
  1227. algorithms as they sometimes require large amounts of computation, particularly
  1228. if complex computer models are involved.
  1229. But this is no longer such a problem because computing power has become
  1230. relatively cheap.
  1231. Even very difficult problems can now be solved because of the efficiency
  1232. with which genetic algorithms can be implemented on today's parallel 
  1233. computer architectures.
  1234.  
  1235. .lp
  1236. Engineering problems are getting so complex that man's intuitive approach
  1237. to design is becoming too primitive.
  1238. Genetic algorithms are one of the tools that engineers are using to
  1239. make up for their short-comings.
  1240.  
  1241. .lp
  1242. \fIReference: Holland J. H. (1975). 
  1243. Adaptation in Natural and Artificial Systems.
  1244. Univ. of Michigan Press: Ann Arbor, MI.\fR
  1245. .bp
  1246. .lp
  1247. .sh 1 "Appendix E - Main Command Menu"
  1248.  
  1249. .lp
  1250. The functions of the command menu shown in the top left of the screen are
  1251. as follows.
  1252.  
  1253. .TS
  1254. center tab(!) ;
  1255. cb cb
  1256. l l .
  1257. Option!Function
  1258. Redraw!Redraws the whole screen
  1259. Start Alg/Stop Alg!Start/pause algorithm operation
  1260. Step Alg!No function
  1261. Reset Alg!Generate initial random population
  1262. Plot Data!Plot graph of average or best fitness
  1263. Plot Targ!Re-plot the target function
  1264. Enter Targ!Enter or re-enter target function
  1265. Quit!Exit the program
  1266. Test!Tests my jump-up menus (no function)
  1267. .TE
  1268.  
  1269.