home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 370_01 / gat_ref.asc < prev    next >
Text File  |  1992-10-28  |  118KB  |  3,265 lines

  1. GA Toolkit 
  2.  
  3. Version 1.0 
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. Sara A. Lienau 
  22.  
  23. University of Missouri-Kansas City 
  24.  
  25. May 20, 1992 
  26.  
  27.  
  28.  
  29. TABLE OF CONTENTS 
  30.  
  31. {toc \f|1.  INTRODUCTION                1 
  32.  
  33. Overview of Genetic Algorithms          1 
  34.  
  35. The GA Toolkit          3 
  36.  
  37. Overview of Documentation               4 
  38.  
  39. 2.  INSTALLATION                5 
  40.  
  41. 3.  USER INTERFACE PROGRAM              8 
  42.  
  43. Selecting GA Components         8 
  44.  
  45. Description of Available Components             9 
  46.  
  47. Selecting the Problem to Solve          12 
  48.  
  49. Description of Available Problems               12 
  50.  
  51. Creating an Executable GA Program               14 
  52.  
  53. Creating Input Files            15 
  54.  
  55. Creating the "in" File          16 
  56.  
  57. Description of Input Parameters         17 
  58.  
  59. Creating the "genes" File               20 
  60.  
  61. Defining a New Problem          24 
  62.  
  63. 4.  EXECUTING YOUR GA PROGRAM           29 
  64.  
  65. Description of Output Files             30 
  66.  
  67. 5.  PROGRAMMER'S REFERENCE              33 
  68.  
  69. Description of Classes          33 
  70.  
  71. Description of #define Directives               36 
  72.  
  73. Adding a New GA Component               38 
  74.  
  75. Adding a New Parameter          50 
  76.  
  77. REFERENCES              56 
  78.  
  79.  
  80. CHAPTER 1 
  81.  
  82. {tc "1.  INTRODUCTION"}Introduction 
  83.  
  84. This document describes a software tool for researching and applying Genetic 
  85. Algorithms (GAs), called the GA Toolkit.  GAs are powerful search and 
  86. optimization techniques based on the principles of natural selection and 
  87. population genetics.  This chapter provides a brief overview of Genetic 
  88. Algorithms, describes the GA Toolkit and present an overview of the remainder 
  89. of this document. 
  90.  
  91. {tc "Overview of Genetic Algorithms" \l 2}Overview of Genetic Algorithms 
  92.  
  93. GAs manipulate a population of sample points from the search space.  Each 
  94. sample point or individual in the population has several 
  95. components--chromosome, phenotype and fitness value.  The chromosome is a coded 
  96. representation for a particular point in the search space.  In biological 
  97. systems, the chromosomes contains the coded instructions for creating all the 
  98. features of an organism.  Similarly, in GAs, the chromosome contains a coded 
  99. representation for the various features or parameters for the problem the GA is 
  100. attempting to optimize.  A phenotype is the expression of the genetic material. 
  101.  For example, a gene on a human chromosome may contain the code for blue eyes 
  102. and the human with blue eyes is the expression of this genetic material or the 
  103. phenotype.  In GAs, the phenotype corresponds to decoding the chromosome 
  104. structure into components or parameters that are meaningful in terms of the 
  105. problem the GA is attempting to solve.  The GA treats the optimization problem 
  106. as a black box--it applies a set up inputs to the problem and measures the 
  107. overall performance (called the fitness of the solution) of the set of inputs.  
  108. The GA does not require knowledge of nor does it understand the relationships 
  109. that may exist between various parameters of the problem.  The GA uses the 
  110. fitness value of the sample points and the similarities in their coded 
  111. representation (the chromosome) to search for better points in the search 
  112. space. 
  113.  
  114. This concept comes from viewing the evolution of species as an optimization 
  115. process.  Darwin's "survival of the fittest" principle (also called natural 
  116. selection) suggested that species become better adapted to their environment 
  117. because only the "fittest" individuals are able to survive and reproduce 
  118. passing their genetic code on to subsequent generations.  The "fittest" 
  119. individuals are those with a some type of beneficial features or 
  120. characteristics that enables the creature to survive and reproduce in its 
  121. environment.  As individuals with various beneficial characteristics mate 
  122. subsequent generations are more likely to contain individuals with combinations 
  123. of advantageous features that were possessed by their parents.  And over time 
  124. the population as a whole becomes better suited for its environment by 
  125. preserving and propagating the beneficial characteristics. 
  126.  
  127. GAs use the principle of natural selection to mate the better individuals in 
  128. the population with a higher frequency.  The mating process, called crossover, 
  129. exchanges segments of the parents' coded chromosome to create new offspring.  
  130. This process allows the GA the combine features of good solutions in the hope 
  131. of developing better solutions to the problem. 
  132.  
  133. The following describes the basic execution cycle of a Genetic Algorithm. 
  134.  
  135.  
  136.  
  137.         Initialization 
  138.  
  139.         Evaluation 
  140.  
  141.         repeat 
  142.  
  143.             Selection 
  144.  
  145.             Recombination 
  146.  
  147.             Evaluation 
  148.  
  149.             Replacement 
  150.  
  151.         until ( termination condition satisfied ) 
  152.  
  153.  
  154.  
  155. The Initialization phase randomly creates an initial population.  At first the 
  156. GA has no information about the search space, so randomly sampling a number of 
  157. points from the search space is a good place to start the search process.  In 
  158. the Evaluation phase, each chromosome is decoded and a fitness value is 
  159. assigned using the fitness function defined for the problem.  In the Selection 
  160. phase, individuals in the population are selected for mating based on their 
  161. fitness with more fit individuals having a greater probability of being 
  162. selected.  During the Recombination phase, the individuals selected in the 
  163. previous phase mate via a crossover procedure and exchange segments of their 
  164. coded chromosome to create new offspring.  In addition, during this phase, the 
  165. new offspring or the parents may undergo mutation that slightly modifies their 
  166. genetic code.  Then the new offspring and any parents that were modified by 
  167. mutation are re-evaluated as described above.  And finally, the Replacement 
  168. phase determines which offspring and members of the current population will 
  169. survive into the next generation.  This cycle repeats until a termination 
  170. condition has been satisfied, either a sufficiently fit population member or a 
  171. maximum number of reproductive trials.  For a more detailed description of 
  172. Genetic Algorithms see Goldberg (1989) or Holland (1975). 
  173.  
  174. {tc "The GA Toolkit" \L 2}The GA Toolkit 
  175.  
  176. The description of GAs above presents a general framework for these algorithms. 
  177.  There are actually various implementation for each phase, that have been 
  178. proposed by the leading researchers in the field, each with varying degrees of 
  179. effectiveness on different types of problems.  With the variety of techniques 
  180. available, it is difficult to package together a single GA configuration that 
  181. is best suited for all problem domains.  The GA Toolkit is a software tool 
  182. designed to provide a better alternative for researching and applying Genetic 
  183. Algorithms. 
  184.  
  185. The GA Toolkit provides several techniques for each phase and allows the user 
  186. to select which component to use.  The GA Toolkit will actually create an 
  187. executable GA program with the components that the user selects.  This system 
  188. allows the user to create a variety of GA programs for solving different types 
  189. of problems.  In addition, the Toolkit was designed so that new GA components 
  190. could easily be added to the system as better techniques are developed. 
  191.  
  192. This tool offers many benefits to a variety of users.  For those users that 
  193. want to apply GAs, the Toolkit provides a collection of the most successful 
  194. techniques available.  These users can gain the benefits of using GAs without 
  195. detailed knowledge of the underlying theory and without developing their own 
  196. program code.  For GA researchers, this tool greatly increases the ability to 
  197. explore the effectiveness of different techniques in a variety of problem 
  198. domains.  In addition, the GA Toolkit allows the researcher to experiment with 
  199. a particular technique in a number of different contexts.  For example, the 
  200. researcher could observer the performance of a selection technique using 
  201. different crossover and replacement methods and develop a better evaluation of 
  202. the selection procedure.  This ability to isolate the effectiveness of a 
  203. particular method is essential for developing useful guidelines on which 
  204. components should be used in different problem domains. 
  205.  
  206. {tc "Overview of Documentation" \L 2}Overview of Documentation 
  207.  
  208. The remainder of this document describes how use the GA Toolkit.  Chapter 2 
  209. describes the installation process.  Chapter 3 discusses the user interface 
  210. program that allows the user to select the desired components and create an 
  211. executable GA program.  This chapter also describes the GA components and the 
  212. set of problems that are currently implemented in the GA Toolkit.  Chapter 4 
  213. discusses how to execute the GA programs you create with the Toolkit and 
  214. describes the output files produced by a GA program.  And finally, Chapter 5 
  215. provides a reference for programmers who which to modify the system.  This 
  216. chapter describes the classes used to implement the GA techniques and discusses 
  217. how to add new GA components to the Toolkit. 
  218.  
  219.  
  220.  
  221. Chapter 2 
  222.  
  223. {tc "2.  INSTALLATION"}Installation 
  224.  
  225. To install the GA Toolkit you need two files:  install and gat.tar.  Currently 
  226. these files are located in the /home/slienau/Toolkit directory on the Sun SPARC 
  227. workstations.  If this directory does not exist when want to install the GA 
  228. Toolkit, check with Dr. Graham about the new location of these files.  Once you 
  229. have found the necessary files you need to copy them to your home directory.  
  230. The install file is a Bourne shell script that will create a main directory for 
  231. the GA Toolkit, un-archive the files in the gat.tar file and create the 
  232. executable user interface program (gatuif).  Use the following command to 
  233. execute the installation program. 
  234.  
  235. %  install [directory name] 
  236.  
  237. The optional parameter allows you to specify the name of the directory where 
  238. you want the GA Toolkit installed.  If this parameter is omitted the Toolkit 
  239. will be installed a directory called GATool.  During the installation process 
  240. several messages will be displayed about the files that are being un-archived.  
  241. When the installation is complete a message will be displayed on your terminal. 
  242.  This message will inform you that you need to add the information in the 
  243. cshrc.gat file (located in the Toolkit's main directory) to your .cshrc file in 
  244. your home directory.  This file contains several environment variables that are 
  245. necessary for the Toolkit to operate correctly.  The following shows the 
  246. contents of this file.  Note:  In your file, the GATOOL environment variable 
  247. may have a different directory name. 
  248.  
  249.  
  250.  
  251.  
  252. #  GA Toolkit Env Variables 
  253.  
  254. #  
  255.  
  256. setenv GATOOL $home/GATool 
  257.  
  258. setenv GATSRC $GATOOL/Source 
  259.  
  260. setenv GATFNS $GATSRC/Funcs 
  261.  
  262. setenv GATIN  $GATOOL/Input 
  263.  
  264. setenv GATHLP $GATOOL/Help 
  265.  
  266. setenv GATUIF $GATOOL/Uif 
  267.  
  268. setenv GATBIN $GATOOL/SH_BIN 
  269.  
  270. set path = ($GATBIN $GATUIF $path) 
  271.  
  272.  
  273.  
  274.  
  275.  
  276. The installation program creates several sub-directories under the directory 
  277. where the GA Toolkit was installed.  The following briefly describes the 
  278. contents of each directory. 
  279.  
  280.  
  281.  
  282. Source  contains the source code for all the GA components. 
  283.  
  284. Source/Funcs    contains the source code for the test problems provided with the 
  285. Toolkit. 
  286.  
  287. Input   contains input files for the test problems in the Source/Funcs directory. 
  288.  
  289. Help    contains the help files for the user interface program. 
  290.  
  291. Uif     contains the source code for the user interface program. 
  292.  
  293. SH_BIN  contains several Bourne shell programs used by the user interface 
  294. program. 
  295.  
  296.  
  297.  
  298. The library of components in the GA Toolkit were written in the C++ language.  
  299. In order to create executable GA programs you must be able to execute the C++ 
  300. compiler.  If you do not have the proper environment variable set up in your 
  301. .cshrc file for the C++ compiler, then you will also need to add this 
  302. information.  The information you, currently, need to include in your .cshrc 
  303. file for the C++ compiler to work properly is shown below. 
  304.  
  305.  
  306.  
  307.  
  308. # C++ Env Variables (sun C++) 
  309.  
  310.  
  311. setenv MANPATH /usr/share/man:/usr/local/man:/usr/man 
  312.  
  313. setenv CCROOTDIR /usr/local/lang/SC1.0 
  314.  
  315. setenv CCLIBDIR  $CCROOTDIR 
  316.  
  317. setenv I         $CCROOTDIR/include/CC 
  318.  
  319. setenv LIBRARY   $CCROOTDIR/libC.a 
  320.  
  321. setenv cfrontC   $CCROOTDIR/cfront 
  322.  
  323.  
  324.  
  325. set path = (/usr/local/lang/SC1.0 $path) 
  326.  
  327.  
  328.  
  329. After you have made the necessary modifications to your .cshrc file you should 
  330. logout and login again so that the changes will take effect.  Now you have 
  331. completely installed the Toolkit and are ready to begin working with the user 
  332. interface program described in the next chapter. 
  333.  
  334.  
  335.  
  336. Chapter 3 
  337.  
  338. {tc "3.  USER INTERFACE PROGRAM"}User Interface Program 
  339.  
  340. The user interface program for the GA Toolkit allows the user to select a 
  341. component for each phase of the GA, select the problem to solve, create the 
  342. necessary input files, create an executable GA program and create a template 
  343. for defining a new problem.  This section describes how to uses the various 
  344. features of the user interface program. 
  345.  
  346. To start the user interface program use the following command: 
  347.  
  348.         %  gatuif 
  349.  
  350. The name "gatuif" is an acronym for GA Toolkit User InterFace.  After a few 
  351. seconds the main menu will appear on your terminal.  From the main menu, you 
  352. can access all the major features of the user interface program, such as 
  353. selecting GA components and creating an executable GA program.  Pressing the 
  354. return key will activate the highlighted choice.  The following describes each 
  355. of the options available on the main menu. 
  356.  
  357. {tc "Selecting GA Components" \L 2}Selecting GA Components 
  358.  
  359. The first step in creating an executable GA program is selecting which 
  360. components to use for each phase of the GA process.  Activating the Select GA 
  361. Components option will bring up a screen divided into two parts.  On the left 
  362. side of the screen there is a menu of components and the right portion of the 
  363. screen shows the current configuration--the component that is currently 
  364. selected for each phase.  To change the component for a particular phase, use 
  365. the up and down arrows to select the category on the menu (the left side of the 
  366. screen).  Pressing the return key will bring up a list of available components 
  367. or a sub-menu for the highlighted category.  Once the desired technique is 
  368. highlighted, pressing the return key will select that technique.  To see a 
  369. short description of a particular GA component highlight it by moving the up 
  370. and down arrow keys and press the F1 key (or the help key for your terminal).  
  371. When you are satisfied with the configuration of components, press CTRL-U to 
  372. return to the main menu. 
  373.  
  374. This portion of the user interface program also manages any constraints on 
  375. which components may used together.  When you select a category from the menu 
  376. (e.g., Selection or Replacement) only those techniques that are compatible with 
  377. the current configuration will be displayed.  This will prevent you from 
  378. accidentally creating an invalid GA configuration. 
  379.  
  380. {tc "Description of Available Components" \L 3}Description of Available 
  381. Components 
  382.  
  383. Chromosome--Representation - The chromosome representation is how the 
  384. chromosome structure is implemented.  Currently the Toolkit only provides one 
  385. implementation of the chromosome structure, but others, such as diploid or 
  386. two-dimensional chromosomes, could be added. 
  387.  
  388.  
  389.  
  390. 1-D Bit String - With this component, the chromosome is implemented as a one 
  391. dimensional string of ones and zeros. 
  392.  
  393.  
  394.  
  395. Chromosome--Decoding - The chromosome decoding specifies how the chromosome 
  396. string will be interpreted or decoded for the evaluation function. 
  397.  
  398.  
  399.  
  400. Binary - This component provides binary decoding of the chromosome string 
  401. (i.e., converting the string of 1s and 0s to a decimal integer). 
  402.  
  403.  
  404.  
  405. Gray - This component allows the chromosome string to be interpreted as Gray 
  406. code.  With Gray code, adjacent integers (e.g., 7 and 8 or 8 and 9) have a 
  407. Hamming distance of one. 
  408.  
  409.  
  410.  
  411. Reproduction - The reproduction style defines how many offspring are produced 
  412. before the replacement phase is initiated. 
  413.  
  414.  
  415.  
  416. Generational - In generational reproduction, an entire generation of offspring 
  417. are produced and then the replacement phase determines which offspring and 
  418. parents will survive in the next generation. 
  419.  
  420.  
  421.  
  422. Individual - With individual reproduction, as soon an offspring is created the 
  423. replacement phase selects a member of the population to be removed in order to 
  424. make room of the new offspring.  The concept behind individual reproduction is 
  425. that the GA could adapt faster if offspring are made available as soon as they 
  426. are produced rather than waiting for a complete generation. 
  427.  
  428.  
  429.  
  430. Selection - The selection technique determines which members will be given an 
  431. opportunity to reproduce and pass their genetic code onto subsequent 
  432. generations.  In general, the selection technique will provide more 
  433. reproductive trials to the more fit individuals of the population. 
  434.  
  435.  
  436.  
  437. SUS - In Stochastic Universal Sampling (SUS) (Baker 1987), each individual is 
  438. allocated a slice on a spinning wheel according to its expected value.  An 
  439. individual's expected value is the ratio of the its fitness to average fitness 
  440. of the population.  The wheel contains   N   evenly spaced pointers, where   N  
  441.  is the size of the population.  The wheel is spun one time and the individual 
  442. at each pointer is allocated a reproductive trial.  With this selection 
  443. technique, each individual is guaranteed to receive either   {EMBED Equation |} 
  444.   or   {EMBED Equation |}   trials. 
  445.  
  446.  
  447.  
  448. GENESIS Rank - GENESIS Rank selection (Grefenstette 1990) is similar to SUS 
  449. using a spinning wheel with   N   evenly spaced pointer.  But the size of the 
  450. slice on the wheel is determined by the individual's rank within the population 
  451. rather than the actual fitness value. 
  452.  
  453.  
  454.  
  455. Linear Rank - Linear Rank selection (Whitley 1989) uses a linear function to 
  456. bias the allocation of reproductive trials toward the better ranked 
  457. individuals.  Linear Rank selection provides a parameter, called Selection 
  458. Bias, so that the degree of preference for the best members can be adjusted.  
  459. For example, a Selection Bias of 1.5 means that the best individual is 1.5 
  460. times more likely to receive a reproductive trial than the median ranked 
  461. individual in the population. 
  462.  
  463.  
  464.  
  465. Replacement - The replacement phase determines which individuals will be 
  466. replaced when new offspring are produced.  Since the replacement phase is 
  467. initiated at different times with the different styles of reproduction, there 
  468. are several techniques that are appropriate for each type of reproduction. 
  469.  
  470.  
  471.  
  472. Replacement Techniques for Generational Reproduction  
  473.  
  474.  
  475.  
  476. DeJong's Gap w/Single Elitism - This technique implements DeJong's Gap model 
  477. (1975) that allows overlapping population.  The DeJong Gap specifies what 
  478. percentage of the next generation should be created by the genetic operators 
  479. (selection, crossover and mutation) and the remainder of the population is 
  480. filled by randomly selecting, without replacement, individuals from the parent 
  481. population.  For example, a DeJong Gap of 0.8 would mean that 80% of the next 
  482. generation would be new offspring and the remaining 20% would be randomly 
  483. selected members from the parent population.  This technique also provides a 
  484. single elitism feature which guarantees that the best solution developed so far 
  485. will always have a slot in the next generation. 
  486.  
  487.  
  488.  
  489. Variable Elitism - This replacement policy allows the user to specify the 
  490. percentage of the population slots (by the Elite Gap parameter) to reserve for 
  491. the best solutions developed so far and the remaining slots are filled by new 
  492. offspring.  With this technique,   N   offspring are created by the genetic 
  493. operators (selection, crossover and mutation) and then the best 
  494.  
  495. N * Elite Gap   individuals from among both the new offspring and parents 
  496. receive a slot in the next generation.  Any remaining population slots are 
  497. filled by randomly selecting, without replacement, members from the set of new 
  498. offspring.  For example, an Elite Gap of 0.35 reserves 35% of the next 
  499. generation for the best individuals and the remaining 65% is filled with new 
  500. offspring. 
  501.  
  502.  
  503.  
  504. Replacement Techniques for Individual Reproduction 
  505.  
  506.  
  507.  
  508. Remove Worst - With this replacement policy, when an offspring is created the 
  509. worst member of the population is replaced. 
  510.  
  511.  
  512.  
  513. Reverse Rank - This replacement policy uses a linear function to bias the 
  514. selection for replacement towards the worst ranked members of the population.  
  515. The Replacement Bias parameter can be adjusted to altered the pressure on the 
  516. worst individuals.  For example, a Replacement Bias of 1.2 means that the worst 
  517. individual in 1.2 times more likely to be replaced than the median ranked 
  518. individual in the population.  In addition, the Elite Gap parameter can also be 
  519. used to explicitly preserve a percentage of the best ranked individuals.  For 
  520. example, an Elite Gap of 0.1 with a population size of 50 means that the best 
  521. 10% of the population (the 5 highest ranked members) cannot be replaced. 
  522.  
  523.  
  524.  
  525. Reverse Tournament - With this replacement technique, two members from the 
  526. population are randomly selected and the least fit member is replaced by the 
  527. new offspring. 
  528.  
  529.  
  530.  
  531. Generational Emulation - This replacement policy is attempting to emulate the 
  532. replacement policy used in standard generational GAs while using individual 
  533. reproduction.  This policy monitors the trials allocated and used by each 
  534. individual.  When a member has exhausted its allocated trials or did not 
  535. receive any trials because of low fitness it becomes a candidate for 
  536. replacement.  When an offspring is created, a randomly selected individual from 
  537. the set of candidates is replaced.  This replacement policy can only be used 
  538. with selection techniques that explicitly calculate the number of trials each 
  539. individual should receive (i.e., SUS and GENESIS Rank selection). 
  540.  
  541.  
  542.  
  543. Crossover--Style - The crossover style specifies how the desired number of cut 
  544. points will be selected. 
  545.  
  546.  
  547.  
  548. Traditional - With traditional crossover the cut points are randomly selected. 
  549.  
  550.  
  551.  
  552. Reduced Surrogate - This crossover technique (Booker 1987) attempts to create 
  553. offspring that differ from their parents whenever possible.  This techniques 
  554. notes the position on the chromosome string where the parents have different 
  555. values (called the "reduced surrogate") and randomly selects cuts points 
  556. between the first and last position in the reduced surrogate.  For example, 
  557.  
  558.  
  559.  
  560.     Parent1         11001100 
  561.  
  562.     Parent2         10010110 
  563.  
  564.          
  565.  
  566.     Reduced         -1-01-0- 
  567.  
  568.     Surrogate       -0-10-1- 
  569.  
  570.  
  571.  
  572. A cut point any where after the second position and the before the seventh 
  573. position would produce an offspring that differed from its parents. 
  574.  
  575.  
  576.  
  577. Uniform - With Uniform crossover (Syswerda 1989), the parents' value for each 
  578. position on the chromosome string is swapped with a fixed probability to create 
  579. new offspring.  For example, if the swapping probability is 0.5, then for each 
  580. position on the chromosome string we would flip a fair coin to decide whether 
  581. the offspring should receive the bit value from the first or second parent. 
  582.  
  583.  
  584.  
  585. Crossover--# Cut Points - This category specifies the number of cut points that 
  586. will be selected or the how many segments to exchange between parents when 
  587. creating new offspring.  You can select either one point or two point 
  588. crossover. 
  589.  
  590.      
  591.  
  592. Mutation         
  593.  
  594. Canonical - Once a bit has be selected for mutation, this technique randomly 
  595. chooses a new value for the bit from the set of possible values. 
  596.  
  597.  
  598.  
  599. Statistics - This category defines the statistics to collect and report about 
  600. the GA experiment. 
  601.  
  602.  
  603.  
  604. Basic Stats - This technique provides information about population convergence, 
  605. the best and average performance of the current population as well as on-line 
  606. (average of all solutions tested) and off-line (average of the best solution 
  607. for each generation) performance measures.  See DeJong (1975) for a discussion 
  608. of on-line and off-line performance measures. 
  609.  
  610. {tc "Selecting the Problem to Solve" \L 2}Selecting the Problem to Solve 
  611.  
  612. The Select Problem option on the main menu allows you to select the problem the 
  613. GA will attempt to solve.  Pressing the return key when Select Problem is 
  614. highlighted on the main menu will bring up a screen divided into two parts.  
  615. The top of the screen displays the name of the problem that is currently 
  616. selected.  The bottom portion of the screen lists all the problems that are 
  617. currently defined in the system.  To change the problem, use the up and down 
  618. arrow keys to highlight the desired problem, in the bottom portion of the 
  619. screen, and press the return key to select the problem.  After you have 
  620. selected the desired problem, press CTRL-U to return to the main menu. 
  621.  
  622. {tc "Description of Available Problems" \L 3}Description of Available Problems 
  623.  
  624. Counting 1s - In this problem, the GA is attempting to maximized the number of 
  625. 1s in the chromosome string.  The fitness value is the number of 1s in the 
  626. chromosome string.  (File func.ct1, minimization problem) 
  627.  
  628.  
  629.  
  630. Partially Deceptive - This is an artificially created partially deceptive 
  631. problem.  This problem consists of ten 4-bit sub-problems distributed at 
  632. positions  i ,  i + 10,  i + 20,  i + 30, for  i = 1 to 10 on the chromosome 
  633. string.  For each 4-bit sub-problem, the order-1 and order-2 schemata are fully 
  634. deceptive, but the order-3 schemata are not deceptive.  (File func.d4, 
  635. maximization problem)  See Whitley (1991) for a discussion of deception in GAs. 
  636.  
  637.  
  638.  
  639. DeJong's F1 through F5 are the five problems from DeJong's test suite.  (See 
  640. DeJong 1975 for a description of these problems.) 
  641.  
  642.  
  643.  
  644. Ackley's Fig. 1-7 - This problem (Ackley 1987, 16-17) is basically a flat space 
  645. with several very steep hills.  The problem is defined by the following 
  646. function:   {EMBED Equation |}.  (File func.fig7, maximization problem) 
  647.  
  648.  
  649.  
  650. Noisy Ackley's Fig. 1-7 - This problem is similar to Ackley's Fig. 1-7 except 
  651. that a noise factor is used to alter the value of the function in about half 
  652. the chromosomes evaluated.  The noise factor is created by generating a random 
  653. number in the range [0, 1) and using it as a percentage of how much the actual 
  654. function value should be altered (i.e., noise factor = random number * function 
  655. value).  The GA randomly chooses to add or subtract the noise factor to the 
  656. actual function value.  (File func.nfig7, maximization problem) 
  657.  
  658.  
  659.  
  660. Noisy Shifted 3-D Parabola - This problem also incorporates a noise factor in a 
  661. space defined by the following function:   {EMBED Equation |}.  This space is a 
  662. 3-dimensional parabola shifted slightly off the origin.  The noise factor is 
  663. defined by the following:  noise factor = (random number / 2) * function value. 
  664.  The GA randomly chooses to add or subtract the noise factor to the actual 
  665. function value.  On average, half of the function evaluation will be altered by 
  666. the noise factor.  (func.npar, minimization problem) 
  667.  
  668.  
  669.  
  670. Shifted 3-D Parabola - The space of this problem is a 3-dimensional parabola 
  671. shifted slightly off the origin and defined by the following function:   {EMBED 
  672. Equation |}.  (File func.par, minimization problem) 
  673.  
  674.  
  675.  
  676. Select/Replace Test - This problem was used to observe the characteristics of 
  677. various combinations of selection and replacement techniques.  The function 
  678. used for this problem is the following:   {EMBED Equation |}.  (File func.repl, 
  679. maximization problem) 
  680.  
  681.  
  682.  
  683. TSP-Swap - This is a 16 city Traveling Salesman Problem where we are attempting 
  684. to find the shortest tour between 16 cities in the continental US traveling by 
  685. automobile.  In this problem, we use the information in the chromosome to tell 
  686. us how to create a permutation of the list of cities to visit.  Each pair of 
  687. genes on the chromosome, tell us which two cities to swap to create a different 
  688. tour and perhaps located the optimum tour.  (File func.swap, minimization 
  689. problem) 
  690.  
  691.  
  692.  
  693. TSP-New-Swap - This problem is similar to the TSP-Swap problem, but we 
  694. interpret the information in the chromosome slightly different.  Instead of 
  695. using pairs of genes for swapping instructions, we use the gene position and 
  696. the gene value.  For example, if the first gene has a value of 5 then we swap 
  697. the cities at the first and fifth position on our list, if the second gene has 
  698. a value of 4 then we swap the cities at the second and fourth position on the 
  699. list, and so on.  (File func.swp, minimization problem) 
  700.  
  701. {tc "Creating an Executable GA Program" \L 2}Creating an Executable GA Program 
  702.  
  703. After you have selected the component to use for each GA phase and the problem 
  704. the GA will be applied to, you can create the executable GA program.  Use the 
  705. up and down arrow keys to select the Make GA option from the main menu and 
  706. press the return key.  A dialog box will appear asking you to give a name for 
  707. the executable GA program.  After providing a name the system will begin 
  708. re-compiling the necessary program code.  This may take several minutes 
  709. depending on which components were changed, so please be patient.  When the 
  710. executable program has been created a message will appear in the dialog box 
  711. informing you that the program was successfully created.  Pressing the return 
  712. key after receiving the success message will return you to the main menu. 
  713.  
  714. Compilation error should not occur if you are using the components original 
  715. provided with the GA Toolkit.  However, if you have incorporated additional 
  716. components or modified the components in the Toolkit compilation errors could 
  717. occur if you have made an error in the program code.  If errors were 
  718. encountered during the re-compiling process a message will appear that will 
  719. inform you of this event.  This message will also tell you about a file that 
  720. contains all the message produced during the re-compilation process.  Pressing 
  721. the return key while this message is displayed will return you to the main menu 
  722. where you should exit from the user interface program.  By examining the file 
  723. containing the messages from the re-compilation process, you should be able to 
  724. locate where the error occurred and be able to correct it. 
  725.  
  726. Before you can execute the program you have just created you need to create 
  727. several input files.  This process is described in the next section.  In 
  728. addition, you should refer to Chapter 4 for a discussion of how to execute your 
  729. GA program and a description of the output files created by the GA program. 
  730.  
  731. {tc "Creating Input Files" \L 2}Creating Input Files 
  732.  
  733. Before you can execute the GA program you will need to create two input files.  
  734. The in file contains various user defined parameters for controlling the GA 
  735. experiment such as the maximum number of trials and the crossover and mutation 
  736. probabilities.  The genes file contains information on how to interpret the 
  737. chromosome string for the problem the GA is attempting to solve.  For example, 
  738. the genes file specifies the number of genes in the chromosome and the format 
  739. for displaying the gene values.  This section describes how to create these 
  740. input file through the user interface program.  In addition, this section also 
  741. briefly describes the contents of each file. 
  742.  
  743. You begin the input file creation process by selecting the Create Input Files 
  744. option on the main menu and pressing the return key.  This will bring up a 
  745. dialog box asking you to provide a file suffix for the input files.  When you 
  746. execute your GA program, the program will, by default, look for the "in" and 
  747. "genes" input files.  However, providing the GA program with the file suffix 
  748. will cause the program to read the information from the input files with the 
  749. specified suffix.  For example, if you use the suffix "p1" (for problem 1) then 
  750. the GA program will take the input information from the "in.p1" and "genes.p1" 
  751. input files.  Using a file suffix is helpful if you want to experiment with 
  752. several problems with different input parameters and different chromosome 
  753. formats.  If you want to use a file suffix, then type a suffix in the space 
  754. provided and press the return key.  Otherwise, just press the return key to 
  755. accept the default value (no file suffix). 
  756.  
  757. Then the Setup Input Files screen is displayed.  This screen allows you to 
  758. choose which file (in or genes) to create.  Use the up and down arrow keys to 
  759. highlight the desired option and press the return key to select the option.  
  760. The following describes how to create the in file and describes the various 
  761. parameters contained in this file.  The Creating the "genes" File section will 
  762. describe the genes file and its contents. 
  763.  
  764. {tc "Creating the \"in\" File" \L 3}Creating the "in" File 
  765.  
  766. Selecting the in file option will bring up a screen divided into two parts.  
  767. The left side of the screen contains a menu with Edit and Save options.  The 
  768. right side of the screen lists the various user-defined parameters and default 
  769. values for each.  The default values are not the product of any scientific 
  770. study to develop optimum parameter values--they are only reasonable settings 
  771. for each parameter.  Depending on the type of problem you want to solve the 
  772. default values may or may not be appropriate.  Feel free to change the value of 
  773. any or all parameters. 
  774.  
  775. To edit the values of the parameters, press the return key when the Edit option 
  776. is highlighted.  A parameter on the right side of the screen will be 
  777. highlighted (usually the first parameter on the screen).  Use the up and down 
  778. arrow keys to highlight a parameter.  The SHIFT-U and SHIFT-D key combinations 
  779. can also be used to scroll up or down an entire screen.  Pressing the return 
  780. key will bring up a dialog box asking you to enter a value for the highlighted 
  781. parameter.  If you enter an invalid value for the parameter a dialog box will 
  782. appear explaining the appropriate values.  After you have read this 
  783. information, pressing the return key will allow you to return to the previous 
  784. dialog box and enter an appropriate value.  You can change as many parameters 
  785. as you want by highlighting the parameter and pressing the return key.  If you 
  786. want more information about the parameters, pressing the F1 key will bring up a 
  787. help dialog box that contains short descriptions of all of the parameters.  
  788. When you have finished adjusting the parameter values, use the CTRL-U key 
  789. combination to return to the menu on the left side of the screen.  Then you can 
  790. select the Save option to save your parameter settings.  To exit from the in 
  791. file creating section press CTRL-U again and you will return to the Setup Input 
  792. Files screen that contains the menu where you selected which file to create (in 
  793. or genes). 
  794.  
  795. {tc "Description of Input Parameters" \L 3}Description of Input Parameters 
  796.  
  797. Total Experiments - This is the number of experiments you would like to conduct 
  798. with this set of input parameters.  That is, the number of complete GA runs 
  799. where the GA converges to solution or exceeds the maximum trials.  In each 
  800. experiment, the GA starts with the same initial population and then the random 
  801. number generator is seeded with a different value so that a different set of 
  802. choices will be made.  Total Experiments should be an integer number greater 
  803. than zero. 
  804.  
  805.  
  806.  
  807. Total Trials - This is the maximum number of trials you want to occur before 
  808. the GA is stopped.  Total Trials should be an integer number greater than zero. 
  809.  
  810.  
  811.  
  812. Population Size - This is the number of chromosomes or sample points of the 
  813. search space you want the system to work with.  Population Size should an even 
  814. integer number greater than zero.  (The number must be even because two parents 
  815. are selected and always produce two offspring.) 
  816.  
  817.  
  818.  
  819. DeJong Gap - This is used with the DeJong Gap with Single Elitism replacement 
  820. policy.  This parameter should be a real number in the following range [0.0, 
  821. 1.0].  The Gap measure specifies what percentage of the population should be 
  822. created via the genetic operators (selection, crossover and mutation) and the 
  823. remaining portion of the population are randomly selected members of the 
  824. previous generation.  For example, a Gap of 0.8 would mean 80% of new 
  825. generation is created by selection, crossover and mutation and the remaining 
  826. 20% are copies of randomly selected members of the previous generation. 
  827.  
  828.  
  829.  
  830. Elite Gap - This is used with the Variable Elitism and the Reverse Rank 
  831. replacement policies.  This parameter should be a real number in the following 
  832. range [0.0, 1.0].  Elite Gap specifies the percentage of the population 
  833. reserved for the best members so far.  For example, suppose we have a 
  834. population of 50 chromosomes and an Elite Gap of 0.1.  This means we want to 
  835. preserve the best 10% or 5 members. 
  836.  
  837.  
  838.  
  839. Prob. Cross - This is the crossover probability or how often crossover should 
  840. occur. This should be a real number in the following range [0.0, 1.0]. 
  841.  
  842.  
  843.  
  844. Prob. Mutation - This is the mutation probability or how often mutation should 
  845. occur.  This should be a real number in the following range [0.0, 1.0]. 
  846.  
  847.  
  848.  
  849. Selection Bias - This is used with the Linear Rank selection technique.  This 
  850. is how much preference should be given to the better members of the population. 
  851.  Selection Bias should be a real number in the following range (1.0, 2.0].  For 
  852. example, a selection bias of 1.5 means the best member of the population is 1.5 
  853. times more likely to be selected than the median ranked individual of the 
  854. population. 
  855.  
  856.  
  857.  
  858. Replacement Bias - This is used with the Reverse Rank replacement policy.  This 
  859. is how much pressure should be placed on replacing the worst individuals in the 
  860. population.  Replacement Bias should be a real number in the following range 
  861. (1.0, 2.0].  For example, a Replacement Bias of 1.5 means the worst individual 
  862. is 1.5 times more likely to be replaced than the median ranked individual. 
  863.  
  864.  
  865.  
  866. Maximum Spin - This is used to stop the experiment if no progress is being 
  867. made.  If a new chromosome has not be created in (Maximum Spin) generations 
  868. then the population has probably converged and no real progress is being made 
  869. so we should stop this experiment.  This parameter should be an integer number 
  870. greater than zero. 
  871.  
  872.  
  873.  
  874. Statistics Interval - This is how many trials should occur between printing 
  875. experiment statistics.  This parameter should be an integer greater than zero.  
  876. Statistics are only calculated after (Population Size) attempted trials or 
  877. roughly each generation.  The number of actual trials (when a chromosome needs 
  878. to be evaluated) may be less than the attempted trials.  So the Statistics 
  879. Interval is a lower bound on the number of trials that must occur before 
  880. another set of statistics is printed.  That is, the actual number of trials 
  881. before the reporting of statistics may be slightly more than the specified 
  882. Statistics Interval. 
  883.  
  884.  
  885.  
  886. Hamming Metrics - This is a boolean flag for whether the clustering and drift 
  887. Hamming metrics (Frederick, Sedlmeyer and White 1991) for population 
  888. convergence should be calculated and reported.  Clustering measure the average 
  889. Hamming distance between all pairs of chromosomes in the population.  And drift 
  890. measures the average Hamming distance between the best individual and all other 
  891. chromosomes in the population. 
  892.  
  893.  
  894.  
  895. Best Size - This is how many of the best chromosomes developed should be saved 
  896. and printed to a file (the best file described in Chapter 4) at the end of the 
  897. experiment.  This parameter should be an integer greater or equal to zero.  If 
  898. Best Size is greater zero, then the (Best Size) members with the best fitness 
  899. values developed in the entire experiment are preserved in a separate area for 
  900. reporting purposes only, regardless if any elitism policy is used in the other 
  901. phases of the GA. 
  902.  
  903.  
  904.  
  905. Worst Size - This is used as a scaling mechanism with SUS selection.  This is 
  906. similar to the scaling window used in the GENESIS GA program.  This parameter 
  907. should be an integer number greater or equal to zero.  If we are minimizing a 
  908. numerical function, then the fitness of a member (used for the selection 
  909. process) is the worst fitness value minus the function evaluation for this 
  910. particular member.  The worst fitness value is the worst member seen in the 
  911. last (Worst Size * Population Size) trials, if Worst Size is greater than 0.  
  912. This allows more differentiation between members whose fitness values are very 
  913. close together.  The smaller the Worst Size (greater than zero) the greater the 
  914. differentiation.  For a Worst Size of zero, the worst value is the worst member 
  915. seen in the entire experiment thus far.  This represents an infinite scaling 
  916. window or very little ability to differentiation between very similar values.  
  917. This scaling effect works analogously for maximization problems as well. 
  918.  
  919.  
  920.  
  921. Maximize - This is a boolean flag to indicate whether the evaluation function 
  922. should be maximized or minimized.  Turn the flag on (or yes) for maximization 
  923. and off (or no) for minimization.  Note:  If you are setting parameters for one 
  924. the problems provided with the GA Toolkit make sure you set this flag 
  925. correctly, otherwise you will get unexpected results.  The Description of 
  926. Available Problems section above states whether each problem should be 
  927. maximized or minimized. 
  928.  
  929.  
  930.  
  931. Evaluate All - This is a boolean flag to tell the system whether to evaluate 
  932. all chromosomes or only those that need evaluation.  Generally, if a new 
  933. chromosome (offspring) is equal to one of its parents we do not need to 
  934. re-evaluate the function again, but simply copy the function parameters and 
  935. fitness measure from the matching parent.  However, in noisy or non-stationary 
  936. functions the same chromosome may have a different function evaluation at 
  937. varying times, so all chromosomes inserted into the next generation need to be 
  938. re-evaluated.  Setting this flag on (or yes) forces all chromosomes to be 
  939. evaluated at the end of each generation.  If this parameter is turned off (or 
  940. no), new chromosomes are only evaluated if they differ from their parents. 
  941.  
  942.  
  943.  
  944. Seed Population - This is a boolean flag for whether the initial population 
  945. should be seeded with specific chromosomes from an input file.  Setting the 
  946. flag on (or yes) will cause the program to read the init file (or the 
  947. init.suffix file if you provide the GA program a file suffix).  This file 
  948. should contain the chromosome strings you want to place in the initial 
  949. population with one chromosome per line.  This file can contain any where from 
  950. one to an entire population of chromosomes. 
  951.  
  952.  
  953.  
  954. Debugging Level - This is used for tracing the procedure calls activated during 
  955. the GA run.  The debugging feature can produce and a lot of information that is 
  956. not very interesting, but may be helpful in debugging a new technique.  I would 
  957. recommend always setting this flag to 0 (no debugging trace).  However, if you 
  958. are interested in this information a value of 1 shows entry and exit of all 
  959. major procedures.  A value of 2 produces the same information as a value of 1 
  960. but also includes entry into class constructors and destructors.  And finally a 
  961. value of 3 shows the information for a value of 2 plus some addition 
  962. information about major events that are occurring. 
  963.  
  964.  
  965.  
  966. Display - This is a boolean flag to indicate whether to show, on the screen, 
  967. information about the GA's execution.  This display includes information about 
  968. the current trial, experiment statistics, the best chromosome so far and which 
  969. GA components are being utilized.  Setting the flag to on (or yes) turns the 
  970. display mode on. 
  971.  
  972.  
  973.  
  974. Print Generations - This is a boolean flag to determine whether the population 
  975. should be printed to a file (the pops file described in Chapter 4) at the end 
  976. of each generation.  Turning this flag on (or yes) will cause this information 
  977. to be printed. 
  978.  
  979.  
  980.  
  981. Random Seed - This is the seed for the random number generation procedures.  
  982. This parameter should be a long integer greater or equal to zero. 
  983.  
  984.  
  985.  
  986. Swapping Prob. - This is the swapping probability for Uniform crossover.  This 
  987. determines how frequently the positions on the chromosome string will be 
  988. swapped.  This should be a real number in the following range [0.0, 1.0].   
  989.  
  990. {tc "Creating the \"genes\" File" \L 3}Creating the "genes" File 
  991.  
  992. The genes file describes the structure of the chromosome string.  This file 
  993. specifies how many genes the chromosome contains, the length of each gene and 
  994. the format for displaying the value of each gene.  If you are applying a GA to 
  995. one of the pre-defined problems that was installed with the GA Toolkit, then 
  996. you do not need to create the genes file.  The genes files for these problems 
  997. have already been created and are located in the Input sub-directory.  The 
  998. suffix of the genes file corresponds the suffix of the file where the problem 
  999. is defined (e.g., genes.ct1 is the genes file for the Counting Ones problem 
  1000. defined in the func.ct1 file). 
  1001.  
  1002. If you need to define a new genes file the following describes the process for 
  1003. accomplishing this task.  Selecting the genes file from the Setup Input Files 
  1004. screen and pressing the return key brings up a dialog box asking whether you 
  1005. will be using the floating point representation.  If the problem the GA is 
  1006. being applied to is defined using the floating point decoding mechanism (i.e., 
  1007. the eval_chrom class that defines the problem is derived from the float_chrom 
  1008. class), then you should answer yes to this question.  The answer to the 
  1009. floating point representation question determines what type of information is 
  1010. required in the genes file. 
  1011.  
  1012. After providing an answer to the floating point representation question, a 
  1013. screen divided into two sections will appear.  The left side is again a menu 
  1014. that allows you to add, edit or delete gene specifications and save the 
  1015. information to the genes file.  The right portion of the screen is a table 
  1016. format for displaying the gene specifications that you will create.  For 
  1017. floating point representation, the table contains fields for the gene number, 
  1018. the minimum and maximum value of the floating point range, the number of values 
  1019. in the range, the format for printing the gene value and the length of the gene 
  1020. on the chromosome string.  When you are not using the floating point 
  1021. representation the table contains three fields:  the gene number, the format 
  1022. for printing the gene value and the length of the gene. 
  1023.  
  1024. Adding Genes 
  1025.  
  1026. The procedure for specifying the information in the genes file is similar 
  1027. whether or not the floating point representation is being used.  The only 
  1028. difference is the fields that need to be specified.  To add information about a 
  1029. gene highlight the Add Gene option in the menu on the left side of the screen 
  1030. and press the return key.  Then the system will ask you to provide a value for 
  1031. each to the appropriate fields.  The following describes each field you will be 
  1032. required to specify. 
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038. Fields for Floating Point Representation 
  1039.  
  1040.  
  1041.  
  1042. Minimum Value - this is the smallest value in the desired floating point range. 
  1043.  
  1044.  
  1045.  
  1046. Maximum Value - this is the largest value in the desired floating point range. 
  1047.  
  1048.  
  1049.  
  1050. Number of Values - this is the number of values in the floating point range and 
  1051. defines the precision of the values.  The value for this field must be a power 
  1052. of 2 (e.g., 2, 4, 8, 16, 32, 64, ...).  For example, suppose the minimum value 
  1053. is -5.11, maximum value is 5.12 and the number of values is 1024, then the gene 
  1054. can represent values in the following range [-5.11, -5.10,  
  1055.  
  1056. -5.09, ... , 5.10, 5.11, 5.12] and the precision is 0.01. 
  1057.  
  1058.  
  1059.  
  1060. Format - this is the printf conversion string for printing the value of the 
  1061. gene.  The gene values are store in an array of type double.  The following are 
  1062. valid conversion strings: 
  1063.  
  1064.  
  1065.  
  1066.     %f  - for floating point conversion (e.g., 5.043245 using %.3f is printed as 
  1067. 5.043). 
  1068.  
  1069.  
  1070.  
  1071.     %e and %E - for scientific notation (e.g., 504.3245 using %.4e is printed as 
  1072. 5.0432e+02 and  
  1073.  
  1074. using %.4E is printed as 5.0432E+02). 
  1075.  
  1076.  
  1077.  
  1078.     %g and %G - %e or %E is used if the exponent is less than -4 or greater than 
  1079. or equal to the precision; otherwise %f is used (e.g., 504.3245 using %.5g is 
  1080. printed as 504.32 and  
  1081.  
  1082. 50432.45 using %.3g is printed as 5.04e+04). 
  1083.  
  1084.  
  1085.  
  1086.         For more explanation of printf conversion strings refer to a C or C++ 
  1087. programming manual.  Note that since the values of the genes are stored as type 
  1088. double, the only valid conversion characters are f, e, E, g and G. 
  1089.  
  1090.  
  1091.  
  1092. Length - this field will automatically be calculated for you by using Number of 
  1093. Values field.  For example, it the number of values field is 64 then the length 
  1094. is 6 positions on the chromosome string (log(64) base 2 = 6). 
  1095.  
  1096.  
  1097.  
  1098. Repetitions - After you have provided values for all the required fields the 
  1099. system will ask you how many repetitions of the specification you wish to 
  1100. create.  If you have multiple genes with the same specification you will not 
  1101. need to repeatedly enter the same information over and over again, just specify 
  1102. the number of copies to create. 
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108. Fields for Non-Floating Point Representation 
  1109.  
  1110.  
  1111.  
  1112. Format - this is again the printf conversion string for printing the gene 
  1113. value, similar to the format field with floating point representation (see 
  1114. above). 
  1115.  
  1116.  
  1117.  
  1118. Length - this is the number of positions on the chromosome string that the gene 
  1119. will occupy. 
  1120.  
  1121.  
  1122.  
  1123. Repetitions - similar to the floating point representation you can instruct the 
  1124. system to create multiple copies the gene specification you have just created. 
  1125.  
  1126.  
  1127.  
  1128. After you have finished the gene specification, the values for each field will 
  1129. be displayed in the table on the right side of the screen.  If you create more 
  1130. than a screen full of genes then you can use SHIFT-U and SHIFT-D to scroll up 
  1131. or down to view the genes you have created.  At this point you can edit or 
  1132. delete a gene you have created or add additional genes.   
  1133.  
  1134. Editing a Gene 
  1135.  
  1136. To edit a gene specification, highlight the Edit Gene option and press the 
  1137. return key.  A dialog box will appear asking you for the number of the gene you 
  1138. wish to modify.  The gene number is the first column in the table on the right 
  1139. portion of the screen.  After you have provided the gene number a pop-up menu 
  1140. appears that contains the fields which you may edit.  Using the up and down 
  1141. arrow keys to highlight the field to modify and press the return key.  Another 
  1142. dialog box will appear asking you to enter a new value for the field.  From the 
  1143. pop-up menu of fields you can modify any or all fields of that particular gene. 
  1144.  When you are finished modifying the gene press CTRL-U to return to menu on the 
  1145. left side of the screen. 
  1146.  
  1147. Deleting a Gene 
  1148.  
  1149. If you made a mistake and want to completely remove a gene, highlight the 
  1150. Delete Gene option and press the return key.  A dialog box will appear asking 
  1151. you for the number of the gene you wish to delete.  Once you remove a gene the 
  1152. only way to undo this action is re-specific the gene through the Add Gene 
  1153. option on the menu. 
  1154.  
  1155. Saving the genes File and Exiting 
  1156.  
  1157. And finally, when you are finished creating the information about the genes, 
  1158. use the Save option to write this information to the genes file.  To exit the 
  1159. genes specification section press the CTRL-U key combination.  This will return 
  1160. you to the Setup Input Files screen, where you selected which file to create 
  1161. either the in or genes file.  If you have already created both input files you 
  1162. can use the CTRL-U key combination to return to the main menu of the user 
  1163. interface program. 
  1164.  
  1165. {tc "Defining a New Problem" \L 2}Defining a New Problem 
  1166.  
  1167. The Create New Problem option on the main menu allows you to create a template 
  1168. file for defining the evaluation function for a new problem.  Pressing the 
  1169. return key when the Create New Problem option is highlighted initiates this 
  1170. option.  A series of dialog boxes will appear asking you questions about the 
  1171. new problem. 
  1172.  
  1173. You will first be asked to enter a suffix for the file that will contain the 
  1174. new problem.  All evaluation functions are keep in files with "func" as the 
  1175. root name of the file.  The file suffix allows the system to identify the 
  1176. proper file when you select a particular problem to solve.  (Note:  You should 
  1177. use a unique suffix otherwise the file for a previously defined problem will be 
  1178. replaced with the new file you are creating.  See the Description of Available 
  1179. Problems above for the suffixes that are currently being used.)   
  1180.  
  1181. The second dialog box that will appear asks you to provide a short descriptive 
  1182. name for the problem.  The name you provide is the description that will appear 
  1183. in the list of problems when you select the problem to solve through the Select 
  1184. Problem option on the main menu.   
  1185.  
  1186. The final question that you will be required to answer is the type of values 
  1187. that will be required by the new evaluation function.  The system needs to know 
  1188. the type of values that are needed so that it can set up the appropriate 
  1189. representation and decoding mechanism.  In this dialog box you have a menu of 
  1190. four choices.  You can use the up and down arrows to highlight the desired type 
  1191. of values and press the return key to select that option.  The following 
  1192. describes the four types of values. 
  1193.  
  1194.  
  1195.  
  1196. Properties of Chromosome String - this option is for evaluation functions that 
  1197. do not require the genes on the chromosome to be decoded as integers or 
  1198. floating point values.  The fitness of the chromosome will be determined by 
  1199. some type of property of the binary chromosome representation.  For example, 
  1200. the Counting Ones Problem would use this type of value since the fitness is 
  1201. related to the number of 1s in the chromosome string. 
  1202.  
  1203.  
  1204.  
  1205. Integers - Binary Decoding - this option is for evaluation functions that 
  1206. require integer parameters where you want the genes to be interpreted as binary 
  1207. code.  That is, the genes on the chromosome string with be converted from the 
  1208. binary representation to decimal integers. 
  1209.  
  1210.  
  1211.  
  1212. Integers - Gray Decoding - this is similar to the previous option but the genes 
  1213. on the chromosome string will be interpreted as Gray code rather than binary 
  1214. code. 
  1215.  
  1216.  
  1217.  
  1218. Floating Point Values - this option is for evaluation functions that require 
  1219. floating point values.  In the case of floating point values you do not need to 
  1220. specify the decoding mechanism (i.e., binary or Gray) that will be used when 
  1221. you define the problem.  The decoding mechanism can be selected through the 
  1222. Select GA Components option on the main menu when you create the GA program 
  1223. that will be applied to this problem. 
  1224.  
  1225.  
  1226.  
  1227. After you have chosen the type of values that are required for the new problem, 
  1228. a message will appear telling you that the file for this problem has been 
  1229. successfully created and that you need to edit the file to add the program code 
  1230. for the evaluation function.  Pressing the return key while this message is 
  1231. displayed will return to the main menu.  If you want the edit the new file you 
  1232. will need to exit the user interface program. 
  1233.  
  1234. The files for all the evaluation functions are keep in the Source/Funcs 
  1235. sub-directory of the main directory where the GA Toolkit was installed.  To 
  1236. edit the new file you will need to go to this directory.  Your new file will 
  1237. have the "func" root name and the suffix you provided (e.g., func.test would be 
  1238. the file created if you specified "test" as the suffix).  You can use any text 
  1239. editor to add the program code for your new evaluation function.  The file you 
  1240. created will look similar to the following.  The contents of the actual file 
  1241. are printed in a Courier font and additional comments about the file are 
  1242. printed in a Times Roman font. 
  1243.  
  1244.  
  1245.  
  1246. /*                         GA Toolkit - Sara A. Lienau  
  1247.  
  1248.  * 
  1249.  
  1250.  *                        Center for Advanced Technology 
  1251.  
  1252.  *               Computer Science and Telecommunications Program 
  1253.  
  1254.  *                     University of Missouri - Kansas City 
  1255.  
  1256.  * ------------------------------------------------------------------------ 
  1257.  
  1258.  *  file:      eval_chr.temp  
  1259.  
  1260.  * 
  1261.  
  1262.  *  purpose:   eval_chrom class template  
  1263.  
  1264.  * 
  1265.  
  1266.  *  modified:  21 aug 91 - created 
  1267.  
  1268.  */ 
  1269.  
  1270.  
  1271.  
  1272. #include "extern.h" 
  1273.  
  1274. #include "chrom.h" 
  1275.  
  1276. #include "eval_chr.h" 
  1277.  
  1278.  
  1279.  
  1280. // It may be helpful to document some information about the function 
  1281.  
  1282. // here.  This is entirely optional. 
  1283.  
  1284.  
  1285.  
  1286. /*  Function Description 
  1287.  
  1288. The Name/Source item contains the short descriptive name that you specified for 
  1289. this problem.  This is the name that will be displayed on the list of available 
  1290. problems from the Select Problem section of the user interface program. 
  1291.  
  1292.  *   Name/Source: Test Problem 1 
  1293.  
  1294.  *   Description:  
  1295.  
  1296.  *   Properties:  
  1297.  
  1298.  *   Min or Max:   
  1299.  
  1300.  *   Min:  
  1301.  
  1302.  *   Max: 
  1303.  
  1304.  *   Limits:  
  1305.  
  1306.  *   Space: 
  1307.  
  1308. The END_CHROM item is used to specify which class the eval_chrom class will be 
  1309. derived from.  This determines what type of values will be provided to the 
  1310. evaluation function.  If you need to change the type of values that you 
  1311. originally specified you should use one of the following class names:  
  1312. bit_chrom, gray_chrom or float_chrom.  The bit_chrom class should be used for 
  1313. values from the properties of the chromosome string or integer values using 
  1314. binary decoding.  The gray_chrom class should be used for integer values using 
  1315. Gray decoding.  And the float_chrom class should be used for interpreting the 
  1316. genes as floating point values. 
  1317.  
  1318.  *   END_CHROM: gray_chrom 
  1319.  
  1320.  *   GENES info in: 
  1321.  
  1322.  */ 
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328. /*------------------------------------------------------------------------ 
  1329.  
  1330. --  class eval_chrom (objective function) 
  1331.  
  1332. ------------------------------------------------------------------------*/ 
  1333.  
  1334. The get_name function is used as a kind of sanity check.  This function returns 
  1335. the name of the problem being used and is printed in an output file (the log 
  1336. file described in Chapter 4).  This is useful to confirm that you are solving 
  1337. the problem you intended. 
  1338.  
  1339. char* eval_chrom::get_name(void){ 
  1340.  
  1341.    // get name - returns a string describing the evaluation function 
  1342.  
  1343.    //   and chromosome representation 
  1344.  
  1345.    char name[60]; 
  1346.  
  1347.  
  1348.  
  1349.    strcpy(name, "Test Problem 1, "); 
  1350.  
  1351.  
  1352.  
  1353.    strcat(name, END_CHROM::get_name()); 
  1354.  
  1355.    return( name ); 
  1356.  
  1357.  
  1358. The eval function is where you will insert the program code for calculating the 
  1359. fitness of each chromosome. 
  1360.  
  1361. void eval_chrom::eval(void){ 
  1362.  
  1363. // apply evaluation function to chrom 
  1364.  
  1365. The decode function is used to decode the genes of the chromosome string into 
  1366. the appropriate type of values for your evaluation or fitness function.  As 
  1367. noted in the comments in the file, you only need to call the decode function if 
  1368. the evaluation function requires floating point or integer parameters.  If you 
  1369. are calculating the fitness value on some property of the chromosome string, 
  1370. you can comment out or remove the call to the decode function. 
  1371.  
  1372.    // decode bit string first (only necessary if func. requires floating 
  1373.  
  1374.    // point or integers) 
  1375.  
  1376.    END_CHROM::decode(); 
  1377.  
  1378.  
  1379.  
  1380.    /*---- BEGIN MODIFY ----*/ 
  1381.  
  1382.    /* Insert code for evaluation function here.  Final value MUST be 
  1383.  
  1384.     * assigned to the variable "fitness".   
  1385.  
  1386.     * 
  1387.  
  1388.     * Summary of Variables 
  1389.  
  1390.     *   str - Chromosome Bit String  
  1391.  
  1392.     *     array of unsigned short int  
  1393.  
  1394.     *   LCHROM - size of "str" array 
  1395.  
  1396.     *   vect - Decoded Genes of Chromosome if decode function called 
  1397.  
  1398.     *     array of double 
  1399.  
  1400.     *   GENES - size of "vect" array 
  1401.  
  1402.     *    
  1403.  
  1404.     *   CAUTION:  str, LCHROM & GENES should be treated as read-only 
  1405.  
  1406.     *   variables.  Assigning values to these variables may cause  
  1407.  
  1408.     *   unpredictable behavior.  However, you may assign values to the 
  1409.  
  1410.     *   elements of the "vect" array if you want something other than 
  1411.  
  1412.     *   the decoded genes to be printed by the chromosome print function. 
  1413.  
  1414.     */ 
  1415.  
  1416.  
  1417.  
  1418. The above comments give a summary of the variable you have access to for 
  1419. calculating the fitness of the chromosome.  As an example suppose we want to 
  1420. optimize the function   {EMBED Equation |}  and we have properly defined three 
  1421. genes (one for each parameter) in the genes file.  The following is an example 
  1422. of how to code the fitness function.  The decode function above will be called 
  1423. to place the decoded values of the genes in the "vect" array. 
  1424.  
  1425.     double x, y, z; 
  1426.  
  1427.  
  1428.  
  1429.     // vect[0] is the x parameter, vect[1] is the y parameter and vect[2] is the z 
  1430. parameter 
  1431.  
  1432.  
  1433.  
  1434.     x =     vect[0] * vect[0];      // x^2 
  1435.  
  1436.     y =     vect[1] * 3;            // 3*y 
  1437.  
  1438.     z =     vect[2] - 2; 
  1439.  
  1440.     z = z * z;              // (z-2)^2 
  1441.  
  1442.  
  1443.  
  1444.     fitness = x + y + z; 
  1445.  
  1446.  
  1447.  
  1448.    /*---- END MODIFY ----*/ 
  1449.  
  1450.  
  1451.  
  1452.    // clear eval flag 
  1453.  
  1454.    do_eval = 0; 
  1455.  
  1456.  
  1457.  
  1458.  
  1459. After you have written the program code for the new problem you can apply a GA 
  1460. program to this problem by selecting it through the Select Problem option on 
  1461. the main menu. 
  1462.  
  1463.  
  1464.  
  1465. Chapter 4 
  1466.  
  1467. {tc "4.  EXECUTING YOUR GA PROGRAM"}Executing YOUR GA Program 
  1468.  
  1469. This chapter describes how to execute the GA programs you create through the 
  1470. user interface program and the output files produced by the GA program. 
  1471.  
  1472. The GA program works with several input files and creates several output files. 
  1473.  You can direct the GA program to used the default names for these files (i.e., 
  1474. file with no suffix) or used the files with a specified suffix.  To execute the 
  1475. GA program use the name you assigned to the program as the command and you may 
  1476. supply an optional parameter for the file suffix (i.e.,  % ga_program_name 
  1477. [suffix]).  For example, if you selected the default name for your GA program 
  1478. (i.e., GA.EXE) and you want the program to read input files with the "test" 
  1479. suffix (i.e., in.test and genes.test) and create output files with this suffix 
  1480. use the following command. 
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.         %  GA.EXE  test  
  1487.  
  1488.  
  1489.  
  1490. If you do not supply the optional command line parameter the GA program will 
  1491. look for the default input files (i.e., in and genes) and the program will use 
  1492. the default names for the output files created during the run (i.e., best, log, 
  1493. out, and pops).  The file suffix options allows you to save the input and 
  1494. output information about different experiments without continually renaming the 
  1495. files used by the system. 
  1496.  
  1497.  
  1498.  
  1499. {tc "Description of Output Files" \L 2}Description of Output Files 
  1500.  
  1501.  
  1502.  
  1503. best    The best file contains the specified number of the best chromosomes 
  1504. developed during each experiment.  The number of chromosome printed in this 
  1505. file is controlled by the Best Size parameter in the in file.  This file is 
  1506. only created if the Best Size parameter is greater than zero.  This file 
  1507. contains the chromosome string, the value of each gene, the fitness value and 
  1508. the generation and trial when the chromosome was first created.  The following 
  1509. is an example of this file. 
  1510.  
  1511.  
  1512.  
  1513. Experiment: 1 
  1514.  
  1515.  
  1516.  
  1517. 101101010101001110100101110011 
  1518.  
  1519.   2.13 -1.98 -1.41 
  1520.  
  1521. 0.5954 10 193 
  1522.  
  1523.  
  1524.  
  1525.     The first line is the chromosome string.  The second line show the values of 
  1526. the genes defined for this chromosome.  The last line contains the fitness 
  1527. value (0.5954) and the generation (10) and trial (193) when this chromosome was 
  1528. created, respectively. 
  1529.  
  1530.  
  1531.  
  1532. log     The log file contains general information about the GA experiment.  It 
  1533. contains the date and time the experiment was conducted, most of the values of 
  1534. the input parameters and the GA components used for each phase of the GA 
  1535. process.  The following is an example of a log file. 
  1536.  
  1537.  
  1538.  
  1539. Experiment Conducted: Sun May  3 13:29:10 1992 
  1540.  
  1541.  
  1542.  
  1543. Input Parameters: 
  1544.  
  1545.   Total Experiments = 1  
  1546.  
  1547.        Total Trials = 200  
  1548.  
  1549.     Population Size = 20  
  1550.  
  1551.   Chromosome Length = 30  
  1552.  
  1553.      DeJong Gap = 1.0000  
  1554.  
  1555.       Elite Gap = 1.0000  
  1556.  
  1557.     Prob. Cross = 1.0000  
  1558.  
  1559.      Prob. Mutation = 0.0010  
  1560.  
  1561.      Selection Bias = 1.5000  
  1562.  
  1563.    Replacement Bias = 1.5000  
  1564.  
  1565.        Maximum Spin = 3  
  1566.  
  1567.       Best Size = 1  
  1568.  
  1569.      Worst Size = 3  
  1570.  
  1571.        Maximize = 0  
  1572.  
  1573.     Random Seed = 123456789  
  1574.  
  1575.  
  1576.  
  1577. Genetic Algorithm Components 
  1578.  
  1579.    Chromosome: Shifted 3-D Parabola, Floating Pt, 1-D Bit Str. 
  1580.  
  1581.  Reproduction: Generational 
  1582.  
  1583.     Selection: GENESIS Rank 
  1584.  
  1585.   Replacement: DeJong Gap w/Single Elitism 
  1586.  
  1587.     Crossover: 1 PT Reduced Surrogate 
  1588.  
  1589.      Mutation: Canonical Mutation 
  1590.  
  1591.    Statistics: Basic Stats 
  1592.  
  1593.  
  1594.  
  1595. out     The out file contains the experiment statistics that are printed after each 
  1596. Statistics Interval (input parameter in the in file).  At each Statistics 
  1597. Interval the following information in printed. 
  1598.  
  1599.  
  1600.  
  1601. Current Generation - this is the number of generational cycles completed. 
  1602.  
  1603. Current Trial - this is the number of trials or chromosomes created so far. 
  1604.  
  1605. Lost Allele - this is the number of allele (positions on chromosome) where the 
  1606. entire population has the same value. 
  1607.  
  1608. Converged Allele - this is the number of allele where at least 80% of the 
  1609. population has the same value. 
  1610.  
  1611. Allele Bias - this is the average percentage of the most prominent value for 
  1612. each allele.  For example, a bias of 0.70 means that, on average, each position 
  1613. has converged to 70% 0s or 70% 1s.  The minimum bias is 0.5 when there is an 
  1614. equal distribution of 1s and 0s for each allele. 
  1615.  
  1616. On-line performance - this is the mean of all solutions tested to this point in 
  1617. the run. (DeJong 1975) 
  1618.  
  1619. Off-line performance - this is the mean of the best solutions developed at the 
  1620. end of each generation. (DeJong 1975) 
  1621.  
  1622. Best - this is the fitness value of the best solution in the current 
  1623. population. 
  1624.  
  1625. Average - this is the average fitness of the population at this point in the 
  1626. experiment. 
  1627.  
  1628.  
  1629.  
  1630.     If the Hamming Metrics flag is turned on then the On-line and Off-line 
  1631. performance fields are replaced by the Clustering and Drift metrics, 
  1632. respectively. 
  1633.  
  1634.  
  1635.  
  1636. Clustering - this is the average Hamming distance between each pair of 
  1637. chromosomes in the population.  A value near 1.0 indicates a lot of diversity 
  1638. in the population.  As the clustering metric moves toward 0.0 the population is 
  1639. converging and losing diversity. (Frederick, Sedlmeyer and White 1991) 
  1640.  
  1641. Drift - this is the average Hamming distance between the best chromosome and 
  1642. all other chromosomes in the population.  Similar to the clustering metric, a 
  1643. value near 1.0 indicates a lot of diversity and a value of 0.0 means the 
  1644. population has completely converged to a single chromosome. (Frederick, 
  1645. Sedlmeyer and White 1991) 
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651. The following is an example of the out file. 
  1652.  
  1653.  
  1654.  
  1655. Experiment: 1 
  1656.  
  1657. Gen Trials Lost Conv  Bias      OnLine     Offline          Best       Average 
  1658.  
  1659.  
  1660.  
  1661.   0     20    0    0 0.582  3.2093e+01  1.1283e+01  2.874900e+00  3.209285e+01 
  1662.  
  1663.   2     56    0    2 0.635  2.8387e+01  5.8203e+00  2.750900e+00  2.168309e+01 
  1664.  
  1665.   4     94    0    6 0.670  2.3457e+01  4.4480e+00  9.473000e-01  1.582167e+01 
  1666.  
  1667.   6    134    0    8 0.687  1.9270e+01  3.3912e+00  9.033000e-01  7.569095e+00 
  1668.  
  1669.   8    170    3   13 0.732  1.6394e+01  2.8505e+00  8.090000e-01  4.364355e+00 
  1670.  
  1671.  10    208    3   18 0.772  1.4202e+01  2.4559e+00  5.954000e-01  4.710895e+00 
  1672.  
  1673.  
  1674.  
  1675. pops    The pops file contains a printed copy of all chromosomes in each 
  1676. generation.  This file is only created if the Print Generation flag is turn on 
  1677. in the in file.  Depending on the population size and the maximum number of 
  1678. trials this file can be very large.  The following shows the format of this 
  1679. file. 
  1680.  
  1681.  
  1682.  
  1683. Experiment: 1 
  1684.  
  1685.  
  1686.  
  1687. GENERATION: 0 
  1688.  
  1689. 111110010010000101011000101011 
  1690.  
  1691.   4.84  0.21  0.43 
  1692.  
  1693. 16.8946 0 1 
  1694.  
  1695. 001101111100110001010011010010 
  1696.  
  1697.  -2.89 -3.15 -3.02 
  1698.  
  1699. 27.6750 0 2 
  1700.  
  1701. 010101001000111011111110010101 
  1702.  
  1703.  -1.74 -2.73  4.05 
  1704.  
  1705. 52.1030 0 3 
  1706.  
  1707.  
  1708.  
  1709.     Each chromosome printed in the pops file has the same format as those printed 
  1710. in the best file.  The first line contains the chromosome string.  The second 
  1711. line displays the value of each gene defined for the chromosome.  And the last 
  1712. line contains the fitness value and the generation and trials when the 
  1713. chromosome was created, respectively. 
  1714.  
  1715.  
  1716.  
  1717. CHAPTER 5 
  1718.  
  1719. {tc "5.  PROGRAMMER'S REFERENCE"}Programmer's Reference 
  1720.  
  1721. {tc "Description of Classes" \L 2}Description of Classes 
  1722.  
  1723.  
  1724.  
  1725. Chromosome Classes 
  1726.  
  1727.  
  1728.  
  1729. base_chrom - This class is the root of the chromosome hierarchy of classes.  
  1730. The base_chrom class provides several data items that are common to all 
  1731. chromosomes regardless of their actual implementation, such as a variable for 
  1732. the fitness value.  (Files chrom.h & chrom.C) 
  1733.  
  1734.  
  1735.  
  1736. bit_chrom - The bit_chrom class implements a one-dimensional binary string 
  1737. chromosome representation.  This class is derived from base_chrom and provides 
  1738. services for the other GA phases to access and modify the chromosome structure. 
  1739.  (Files chrom.h & chrom.C) 
  1740.  
  1741.  
  1742.  
  1743. gray_chrom - The gray_chrom class is derived from bit_chrom and overloads the 
  1744. decoding method so that the chromosome can be interpreted as Gray code (rather 
  1745. than binary).  (Files chrom.h & chrom.C) 
  1746.  
  1747.  
  1748.  
  1749. float_chrom - The float_chrom class provides a decoding mechanism that allows 
  1750. the chromosome to be decoded as floating point values rather than integers.  
  1751. The decoding procedure first decodes the chromosome to integers and then maps 
  1752. the integer value to a floating point range.  This class can be derived from 
  1753. either bit_chrom or gray_chrom so that the chromosome can be interpreted as 
  1754. binary or Gray code.  (Files chrom.h & chrom.C) 
  1755.  
  1756.  
  1757.  
  1758. eval_chrom - The eval_chrom class implements the problem specific evaluation or 
  1759. fitness function.  This class can be derived from bit_chrom, gray_chrom or 
  1760. float_chrom depending on what type of values the evaluation function requires 
  1761. (i.e., integers or real numbers).  (File eval_chr.h & eval_chr.C) 
  1762.  
  1763.  
  1764.  
  1765. Reproduction Classes 
  1766.  
  1767.  
  1768.  
  1769. base_pop - The base_pop class is the root of the population hierarchy of 
  1770. classes.  It implements data structures and procedures that are common to both 
  1771. generational and individual reproduction.  For example, both style of 
  1772. reproduction need at least on population data structure and they share common 
  1773. initialization and termination procedures for the basic execution cycle of the 
  1774. GA process.  (Files populat.h & populat.C) 
  1775.  
  1776.  
  1777.  
  1778. pop_gen - The pop_gen class is derived from base_pop and implements the basic 
  1779. execution cycle for generational reproduction.  (Files pop_gen.h & pop_gen.C) 
  1780.  
  1781.  
  1782.  
  1783. pop_ind - The pop_ind class is derived from base_pop and implements the basic 
  1784. execution cycle for individual reproduction, where one or two offspring are 
  1785. created and immediately inserted into the population.  (Files pop_ind.h & 
  1786. pop_ind.C) 
  1787.  
  1788.  
  1789.  
  1790. Selection Classes 
  1791.  
  1792.  
  1793.  
  1794. rank_sel - The  rank_sel class implements Linear Rank selection and can be used 
  1795. with either generational or individual reproduction.  (Files rank_sel.h & 
  1796. rank_sel.C) 
  1797.  
  1798.  
  1799.  
  1800. rank_sus_gen - The rank_sus_gen class implements GENESIS Rank selection for 
  1801. generational reproduction.  (Files rk_sus_gen.h & rk_sus_gen.C) 
  1802.  
  1803.  
  1804.  
  1805. rank_sus_ind - This class implements GENESIS Rank selection for individual 
  1806. reproduction.  (Files rk_sus_ind.h & rk_sus_ind.C) 
  1807.  
  1808.  
  1809.  
  1810. sus_gen - The sus_gen class implements SUS selection for generational 
  1811. reproduction.  (Files sus_gen.h & sus_gen.C) 
  1812.  
  1813.  
  1814.  
  1815. sus_ind - This class implements SUS selection for individual reproduction.  
  1816. (Files sus_ind.h & sus_gen.C) 
  1817.  
  1818.  
  1819.  
  1820. Replacement Classes 
  1821.  
  1822.  
  1823.  
  1824. base_replace_g - The base_replace_g class is the root of the hierarchy for 
  1825. generational replacement policies.  This class implements a shared procedure 
  1826. for storing new offspring until an entire generation has been created.  (Files 
  1827. repl_gen.h & repl_gen.C) 
  1828.  
  1829.  
  1830.  
  1831. gen_gap_e1 - The gen_gap_e1 class is derived from the base_replace_g class and 
  1832. implements DeJong's Gap with Single Elitism replacement policy for generational 
  1833. reproduction.  (Files repl_gen.h & repl_gen.C) 
  1834.  
  1835.  
  1836.  
  1837. gen_e_n - The gen_e_n class is derived from the base_replace_g class and 
  1838. implements the Variable Elitism replacement policy for generational 
  1839. reproduction.  (Files repl_gen.h & repl_gen.C) 
  1840.  
  1841.  
  1842.  
  1843. killer - The killer class implements the Remove Worst (kill_worst procedure), 
  1844. Reverse Rank (rev_rank procedure) and Reverse Tournament (rev_tourn procedure) 
  1845. replacement policies for individual reproduction.  (Files killer.h & killer.C) 
  1846.  
  1847.  
  1848.  
  1849. repl_rank - The repl_rank class implements tasks that Linear Rank selection, 
  1850. when used with individual reproduction, requires the replacement phase to 
  1851. accomplish (i.e., inserting new offspring in the proper order according to 
  1852. their rank).  This class is derived from the killer class so that the 
  1853. replacement policy can be varied independent of the additional tasks that the 
  1854. selection technique requires.  (Files repl_rank.h & repl_rank.C) 
  1855.  
  1856.  
  1857.  
  1858. repl_rk_sus - The repl_rk_sus class implements tasks that GENESIS Rank 
  1859. selection, for individual reproduction (rank_sus_ind), requires the replacement 
  1860. policy to accomplish.  This class is derived from the killer class.  The 
  1861. repl_rk_sus class also implements the Generational Emulation replacement policy 
  1862. (the kill_term procedure).  (Files repl_rk_sus.h & repl_rk_sus.C) 
  1863.  
  1864.  
  1865.  
  1866. repl_sus - The repl_sus class implements tasks that SUS selection, for 
  1867. individual reproduction (sus_ind), requires the replacement phase to 
  1868. accomplish.  This class is derived from the killer class.  The repl_sus class 
  1869. also implements the Generational Emulation replacement policy (the kill_term 
  1870. procedure).  (Files repl_sus.h & repl_sus.C) 
  1871.  
  1872.  
  1873.  
  1874. Crossover Classes 
  1875.  
  1876.  
  1877.  
  1878. n_pt - The n_pt class implements Traditional crossover where the cut points are 
  1879. randomly selected.  (Files n_pt.h & n_pt.C) 
  1880.  
  1881.  
  1882.  
  1883. reduced_sur - The reduced_sur class implements the Reduced Surrogate crossover 
  1884. technique.  (Files reduced.h & reduced.C) 
  1885.  
  1886.  
  1887.  
  1888. one_pt - The one_pt class can be derived from either n_pt or reduced_sur to 
  1889. provide a one point crossover procedure for either Traditional or Reduced 
  1890. Surrogate crossover, respectively.  (Files cross.h & cross.C) 
  1891.  
  1892.  
  1893.  
  1894. two_pt - The two_pt class similar to the one_pt class can be derive from either 
  1895. n_pt or reduced_sur for a crossover technique where two cut points are 
  1896. selected.  (Files cross.h & cross.C) 
  1897.  
  1898.  
  1899.  
  1900. uniform_xo - The uniform_xo class implements Uniform crossover.  This class is 
  1901. derived from n_pt which provides the procedure for determining when crossover 
  1902. should be performed according to the crossover probability.  But the uniform_xo 
  1903. class overloads the procedure for selecting the actual cut points.  (Files 
  1904. unixo.h & unixo.C) 
  1905.  
  1906.  
  1907.  
  1908. Mutation Class 
  1909.  
  1910.  
  1911.  
  1912. can_mute - The can_mute class implements the Canonical mutation technique.  
  1913. (Files can_mute.h & can_mute.C) 
  1914.  
  1915.  
  1916.  
  1917. Statistics Classes 
  1918.  
  1919.  
  1920.  
  1921. basic_stat - The basic_stat class is used to collect and report various 
  1922. statistics about the GA experiment.  (Files stat.h & stat.C) 
  1923.  
  1924.  
  1925.  
  1926. extreme_perfs - The extreme_perfs class is used by the basic_stat class for 
  1927. monitoring the best and worst performances or solutions developed by the GA.  
  1928. The best individuals may be printed to a file at the end of each experiment.  
  1929. The worst solutions developed are used as a scaling mechanism with 
  1930. fitness-based selection techniques (e.g., SUS).  (Files stat.h & stat.C) 
  1931.  
  1932. {tc "Description of #define Directives" \L 2}Description of #define Directives 
  1933.  
  1934. With the GA Toolkit the user is easily able to exchange the components used for 
  1935. each phase of the GA process.  To exchange components without manually 
  1936. modifying the program code, #define preprocessor directives of the C++ language 
  1937. were used where a particular class name needed to specified in the source code. 
  1938.  Different techniques are easily exchange by changing the class name that is 
  1939. associated with the appropriate #define identifier.  For example, the SELECT 
  1940. identifier specifies which selection technique the user desires.  So when we 
  1941. needed to create an instance of the a selection class in the source code, we 
  1942. used the SELECT identifier name rather than the actual class name.  Then we can 
  1943. easily change which selection technique is used by associating a different 
  1944. class name with the SELECT identifier.  For example, 
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950. #define SELECT sus_ind   // SUS selection for individual reproduction 
  1951.  
  1952.  
  1953.  
  1954. // create instance of a selection class 
  1955.  
  1956. SELECT  select_obj; 
  1957.  
  1958.  
  1959.  
  1960. // rather than 
  1961.  
  1962. sus_ind  select_obj; 
  1963.  
  1964.  
  1965.  
  1966. The following describes the purpose of each #define identifier and the class 
  1967. names that may be associated with each identifier. 
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973. #define 
  1974.  
  1975.  Identifier 
  1976.  
  1977.  
  1978.  
  1979. Valid Class  
  1980.  
  1981. Names 
  1982.  
  1983.  
  1984.  
  1985. Description 
  1986.  
  1987.  
  1988.  
  1989. REP_CHROM 
  1990.  
  1991. bit_chrom 
  1992.  
  1993. The REP_CHROM identifier specifies the representation chromosome class.  
  1994. (Located in file def_rep.h) 
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000. CODE_CHROM 
  2001.  
  2002. bit_chrom 
  2003.  
  2004. gray_chrom 
  2005.  
  2006. The CODE_CHROM identifier specifies the class that implements the desired 
  2007. method of chromosome decoding .  (Located in file def_rep.h) 
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013. END_CHROM 
  2014.  
  2015. bit_chrom 
  2016.  
  2017. gray_chrom 
  2018.  
  2019. float_chrom 
  2020.  
  2021.  
  2022.  
  2023. The END_CHROM identifier specifies the class that the eval_chrom class will be 
  2024. derived from.  (Located in file def_rep2.h) 
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030. CHROM 
  2031.  
  2032. eval_chrom 
  2033.  
  2034. The CHROM identifier specifies the complete chromosome class that all the other 
  2035. phases manipulate (e.g., selection and crossover).  (Located in file def_chr.h) 
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041. POP_TYPE 
  2042.  
  2043. pop_gen 
  2044.  
  2045. pop_ind 
  2046.  
  2047. The POP_TYPE identifier specifies the style of reproduction (generational or 
  2048. individual) that will be used.  (Located in file def_pop.h) 
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054. SELECT 
  2055.  
  2056. rank_sel 
  2057.  
  2058. rank_sus_gen 
  2059.  
  2060. rank_sus_ind 
  2061.  
  2062. sus_gen 
  2063.  
  2064. sus_ind 
  2065.  
  2066.  
  2067.  
  2068. The SELECT identifier specifies the selection technique to use.  (Located in 
  2069. file def_phase.h) 
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081. REPLACE 
  2082.  
  2083. gen_gap_e1 
  2084.  
  2085. gen_e_n 
  2086.  
  2087. repl_rank 
  2088.  
  2089. repl_rk_sus 
  2090.  
  2091. repl_sus 
  2092.  
  2093. The REPLACE identifier specifies the replacement class to use.  (Located in 
  2094. file def_phase.h) 
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108. KILLER 
  2109.  
  2110. kill_worst 
  2111.  
  2112. rev_rank 
  2113.  
  2114. rev_tourn 
  2115.  
  2116. kill_term 
  2117.  
  2118. The KILLER identifier specifies the replacement policy when using individual 
  2119. reproduction.  (Located in file def_kill.h) 
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129. CROSS_TYPE 
  2130.  
  2131. n_pt 
  2132.  
  2133. reduced_sur 
  2134.  
  2135. The CROSS_TYPE identifier specifies which class to use for selecting the 
  2136. desired number of cut points.  This is the class where one_pt or two_pt will be 
  2137. derived from.  (Located in file def_xo.h) 
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143. CROSS 
  2144.  
  2145. one_pt 
  2146.  
  2147. two_pt 
  2148.  
  2149. uniform_xo 
  2150.  
  2151. The CROSS identifier specifies the crossover technique to use.  (Located in 
  2152. file def_phase.h) 
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162. MUTE 
  2163.  
  2164. can_mute 
  2165.  
  2166. The MUTE identifier specifies the mutation technique to use.  (Located in file 
  2167. def_phase.h) 
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173. STATS 
  2174.  
  2175. basic_stat 
  2176.  
  2177. The STATS identifier specifies the class to use for collecting and reporting 
  2178. experiment statistics.  (Located in file def_phase.h) 
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184. {tc "Adding a New GA Component" \L 2}Adding a New GA Component 
  2185.  
  2186. This section describes how to add a new GA component to the Toolkit's library.  
  2187. This process requires that you create the program code for your new component 
  2188. and modify several of the existing source code files.  The following describes 
  2189. the necessary steps and illustrates this process by showing how the uniform 
  2190. crossover technique was added to the Toolkit. 
  2191.  
  2192. 1.  Create Program Code for New Component 
  2193.  
  2194. The first step is to write the program code for your new component.  The major 
  2195. rule you must follow is that the class definition of your new component must 
  2196. have the same public interface as the classes already defined in the Toolkit 
  2197. for that phase.  This is so that you can easily exchange the GA components.  
  2198. The header files and comments in the source code describe the interfaces for 
  2199. each phase.  The source code files for your component should be placed in the 
  2200. Source sub-directory where the Toolkit was installed.  The more familiar you 
  2201. are with the source code and the #define identifiers the easier it will be to 
  2202. develop the code for your new technique. 
  2203.  
  2204. As an example, the following describes the modifications that were necessary to 
  2205. incorporate the uniform crossover technique.  The first step was to look at the 
  2206. public interface for the crossover phase.  In the crossover hierarchy there 
  2207. were originally four classes:   one_pt, two_pt, n_pt, and reduced_sur.  The 
  2208. one_pt and two_pt classes implement crossover with the corresponding number of 
  2209. cut points.  These classes can be derived from either n_pt or reduced_sur so 
  2210. that the desired number of cut point(s) can be randomly selected (n_pt) or 
  2211. selected by the Reduced Surrogate method (class reduced_sur, which attempts to 
  2212. create offspring that differ from the parents whenever possible).  The other 
  2213. phases of the GA will interact with an instance of the one_pt or two_pt class.  
  2214. So we should first look at the public interface for these classes.  The class 
  2215. definition for one_pt is shown below (this is in the cross.h file). 
  2216.  
  2217.  
  2218.  
  2219. class one_pt : public CROSS_TYPE { 
  2220.  
  2221.   public: 
  2222.  
  2223.     one_pt(void) : CROSS_TYPE(1){} 
  2224.  
  2225.     char* get_name(void); 
  2226.  
  2227. }; 
  2228.  
  2229. The use of the CROSS_TYPE identifier allows us change which class (n_pt or 
  2230. reduced_sur) one_pt will be derived from.  The public interface contains a 
  2231. constructor and the get_name method.  The constructor calls the parent class' 
  2232. constructor with a parameter for the number of cut points (i.e., 1).  The 
  2233. get_name method returns the name of the component for printing in the log file. 
  2234.  Now we need to look at the parent class for methods that it inherits.  The 
  2235. following shows the class definition for the n_pt class (located in the n_pt.h 
  2236. file). 
  2237.  
  2238.  
  2239.  
  2240. class n_pt { 
  2241.  
  2242.   public: 
  2243.  
  2244.     n_pt(int); 
  2245.  
  2246.     ~n_pt(void) { delete cuts; } 
  2247.  
  2248.     char* get_name(void); 
  2249.  
  2250.     void cross(CHROM*, CHROM*, CHROM*, CHROM*); 
  2251.  
  2252.   protected: 
  2253.  
  2254.     int *cuts;              //array of cut positions 
  2255.  
  2256.     int no_cuts;            //number of cuts (n) 
  2257.  
  2258.     int total_cross;        //total crosses to perform 
  2259.  
  2260.     int cur_cross;          //crosses counter 
  2261.  
  2262.  
  2263.  
  2264.     virtual void pick_cuts(void);   //pick cut point(s) 
  2265.  
  2266. }; 
  2267.  
  2268.  
  2269.  
  2270. The cross method is the main procedure for implementing the crossover 
  2271. technique.  The cross method determines whether to perform crossover based on 
  2272. the crossover probability.  If crossover should be performed the pick_cuts 
  2273. method is called to randomly select the desired number of cut points.  Then the 
  2274. cross method will pass this list of cut point(s) to the chromosome object to 
  2275. actually exchange the desired segments from the parents to the offspring. 
  2276.  
  2277. The class we created for uniform crossover needed a similar cross method but we 
  2278. needed to pick the cut points differently.  So we created a new class derived 
  2279. from the n_pt class and overloaded the pick_cuts method.  We also needed to 
  2280. overload the get_name method so that it would return a name for the uniform 
  2281. crossover method.  The following shows the class definition and implementation 
  2282. of the uniform_xo class (located in the unixo.h and unixo.C files). 
  2283.  
  2284.  
  2285.  
  2286. class uniform_xo : public n_pt { 
  2287.  
  2288.   public: 
  2289.  
  2290.     uniform_xo(void) : n_pt(LCHROM-1){} 
  2291.  
  2292.     char* get_name(void); 
  2293.  
  2294.   protected: 
  2295.  
  2296.     void pick_cuts(void); 
  2297.  
  2298. }; 
  2299.  
  2300.  
  2301.  
  2302. char* uniform_xo::get_name(void){ 
  2303.  
  2304.   return( "Uniform Crossover" ); 
  2305.  
  2306.  
  2307.  
  2308.  
  2309. void uniform_xo::pick_cuts(void){ 
  2310.  
  2311.   int i; 
  2312.  
  2313.   int cur_toss, prev_toss; 
  2314.  
  2315.  
  2316.  
  2317.   prev_toss = flip(SWAP_PROB); 
  2318.  
  2319.   no_cuts = 0; 
  2320.  
  2321.   for( i=1; i < LCHROM; i++ ){ 
  2322.  
  2323.      cur_toss = flip(SWAP_PROB); 
  2324.  
  2325.      if(cur_toss != prev_toss){ 
  2326.  
  2327.        cuts[no_cuts] = i; 
  2328.  
  2329.        no_cuts++; 
  2330.  
  2331.        prev_toss = cur_toss; 
  2332.  
  2333.      } 
  2334.  
  2335.   } 
  2336.  
  2337.  
  2338. The constructor calls the n_pt constructor with the maximum number of cut 
  2339. points allowed so that the data structures will be initialized correctly.  The 
  2340. get_name method just returns the name of the technique.  And the pick_cuts 
  2341. method determines whether each position on the chromosome string should be 
  2342. swapped, according to the swapping probability.  If the previous position 
  2343. should be swapped and the current position should not (and vice versa) then 
  2344. this is noted as a cut point.  After the pick_cuts methods develops of the list 
  2345. cut points the cross procedure (inherited from n_pt) will call a chromosome 
  2346. method to actually exchange the segments between the parents and the offspring. 
  2347.  
  2348. 2.  Update the Appropriate #define Identifier 
  2349.  
  2350. After you create the program code for your new method, you will need to update 
  2351. the file that contains the appropriate #define identifier.  The Description of 
  2352. #define Directives section above describes the purpose of each identifier and 
  2353. the file where it is located.  You will need to add a line to the file that 
  2354. contains the appropriate identifier for the type of component you are adding.  
  2355. A little later we will get more specific about the necessary modification, but 
  2356. first you need to decide which #define identifier is appropriate for your new 
  2357. component. 
  2358.  
  2359. Returning to the uniform crossover example we have two possible #define 
  2360. identifiers the might apply:  CROSS_TYPE and CROSS.  CROSS_TYPE is used to 
  2361. specify which class the one_pt and two_pt classes will be derived from.  The 
  2362. CROSS identifier specifies which class is used for the crossover phase.  Since 
  2363. we have already specified that the uniform_xo class will be derived from the 
  2364. n_pt class the CROSS_TYPE identifier is not applicable in this case.  Moreover, 
  2365. the uniform_xo class implements all the public interface features of a 
  2366. technique for the crossover phase and thus it should be under the CROSS 
  2367. identifier category. 
  2368.  
  2369. The following shows part of the def_phase.h file, that contains the CROSS 
  2370. #define identifier, and discusses the modifications that are require to update 
  2371. this file. 
  2372.  
  2373.  
  2374.  
  2375. // -- crossover 
  2376.  
  2377. //#define CROSS uniform_xo 
  2378.  
  2379. #define CROSS one_pt 
  2380.  
  2381. //#define CROSS two_pt 
  2382.  
  2383.  
  2384.  
  2385. // -- select 
  2386.  
  2387. // ****** gen style 
  2388.  
  2389. //#define SELECT sus_gen 
  2390.  
  2391. //#define SELECT rank_sel 
  2392.  
  2393. #define SELECT rank_sus_gen 
  2394.  
  2395. // ****** individual style 
  2396.  
  2397. //#define SELECT sus_ind 
  2398.  
  2399. //#define SELECT rank_sus_ind 
  2400.  
  2401.  
  2402.  
  2403. In the file that contains the appropriate #define identifier you will need to 
  2404. add a line containing the #define preprocessor directive with the identifier 
  2405. name and the class name for your new component.  For example, "//#define CROSS 
  2406. uniform_xo".  The new line must be preceded by the comment symbol "//" (the new 
  2407. style of C++ comments).  This is necessary because the user interface program 
  2408. changes which components are used by commenting out the #define directive of 
  2409. the active component and then removing the comment symbol ("//") from the 
  2410. #define directive for the component you selected.  As you can see from the 
  2411. section of the def_phase.h file shown above, only one definition for each 
  2412. identifier will be active (i.e., not commented out) at any one time. 
  2413.  
  2414. There are several reasons for listing all the appropriate values for each 
  2415. identifier and keeping only one active by removing the comment symbol.  First, 
  2416. this is a convenient method to document the legal values for each identifier.  
  2417. Second, this is an addition level of security to prevent inappropriate values 
  2418. from being assigned to a #define identifier since the system must find an exact 
  2419. match before it will remove the comment symbol. 
  2420.  
  2421. 3.  Update Header Files 
  2422.  
  2423. The next step is to place an #include preprocessor directive for the header 
  2424. file of your new class in one of several composite header files.  The composite 
  2425. header files are files the contain nothing but #include directives for other 
  2426. header files.  The use of these composite header files simplifies the process 
  2427. of making the appropriate section of the program code aware of and be able to 
  2428. use your new component.  So instead of having locate all the places in the 
  2429. source code that need access to your new header file, you only need to add an 
  2430. #include directive in one of the composite header files.  And the composite 
  2431. header files are already included in the appropriate places in the existing 
  2432. source code. 
  2433.  
  2434. Which composite header file you need to modify will depend on type of component 
  2435. you are adding to the system.  The following describes the type of components 
  2436. that should be included in the different composite header files. 
  2437.  
  2438.  
  2439.  
  2440.     hdr_chr.h - this file includes header files for classes in the chromosome 
  2441. hierarchy. 
  2442.  
  2443.  
  2444.  
  2445.     hdr_xo.h - this file includes header files for classes in the crossover 
  2446. hierarchy. 
  2447.  
  2448.  
  2449.  
  2450.     hdr_gen.h - this file includes header files for components that can only be 
  2451. used with generational reproduction GAs and that were not included in the 
  2452. previous composite header files (i.e., hdr_chr.h or hdr_xo.h). 
  2453.  
  2454.  
  2455.  
  2456.     hdr_ind.h - this file includes header files for components that can only be 
  2457. used in individual reproduction GAs and that were not included in the previous 
  2458. composite header files. 
  2459.  
  2460.  
  2461.  
  2462.     hdr_both.h - this file includes header files for components that can be used 
  2463. with either generational or individual reproduction GAs and that were not 
  2464. included in the previous composite header files. 
  2465.  
  2466. For example, we added the following line to the hdr_xo.h file for the uniform 
  2467. crossover technique. 
  2468.  
  2469.  
  2470.  
  2471. #include  "unixo.h" 
  2472.  
  2473.  
  2474.  
  2475. NOTE:  You only need to add the #include directive for the header file of your 
  2476. new component to one of the listed composite header files. 
  2477.  
  2478. 4.  Update makefile 
  2479.  
  2480. At this point you have made all the necessary modification to the source code.  
  2481. Now its time to update the makefile so the make utility will be able to compile 
  2482. your new component and link it with other modules to create an executable GA 
  2483. program.  There are several modifications you will need to make to the makefile 
  2484. located in the Source sub-directory. 
  2485.  
  2486. First, near the top of the makefile there are several variables defined with a 
  2487. list of object files, you will need to add the object file for your new 
  2488. component to one of these variables.  The BOTH variable contains object files 
  2489. that can be used with either generational or individuals reproduction GAs.  The 
  2490. GEN variable contains object files for components that can only be used with 
  2491. generational reproduction GAs.  And the IND variable contains object files for 
  2492. components that can only be used with individual reproduction GAs.  The 
  2493. following shows the this portion of the makefile. 
  2494.  
  2495.  
  2496.  
  2497. #  object files for components that can be used with either 
  2498.  
  2499. #  generational or individual reproduction 
  2500.  
  2501.  
  2502.  
  2503. BOTH = main.o chrom.o eval_chr.o cross.o n_pt.o rank_sel.o reduced.o \ 
  2504.  
  2505.        can_mute.o stat.o populat.o unixo.o 
  2506.  
  2507.  
  2508.  
  2509. #  object files needed for Generational Reproduction GAs 
  2510.  
  2511.  
  2512.  
  2513. GEN = repl_gen.o sus_gen.o rk_sus_gen.o pop_gen.o 
  2514.  
  2515.  
  2516.  
  2517. #  object files needed for Individual Reproduction GAs 
  2518.  
  2519.  
  2520.  
  2521. IND  = killer.o repl_rank.o repl_sus.o sus_ind.o repl_rk_sus.o \ 
  2522.  
  2523.        rk_sus_ind.o pop_ind.o 
  2524.  
  2525.  
  2526.  
  2527. The object file for uniform crossover (unixo.o) was added to the BOTH variable 
  2528. since it can be used with either type of GA. 
  2529.  
  2530. The second modification to the makefile is to add the dependency information 
  2531. for the object file of your component and add the commands for updating the 
  2532. object file if the dependents have been modified since the object file was 
  2533. created.  The following shows the section of the makefile relating to the 
  2534. crossover object files. 
  2535.  
  2536.  
  2537.  
  2538. #-----  Crossover Classes - implement crossover techniques 
  2539.  
  2540.  
  2541. #       cross.*     implements 1 and 2 point crossover 
  2542.  
  2543. #       n_pt.*      implements Traditional crossover (where cut points 
  2544.  
  2545. #                   randomly selected). 
  2546.  
  2547. #       reduced.*   implements Reduced Surrogate crossover 
  2548.  
  2549. #       unixo.*     implements Uniform crossover 
  2550.  
  2551.  
  2552.  
  2553. cross.o : cross.C hdr_xo.h extern.h 
  2554.  
  2555.     CC +i -c -g cross.C 
  2556.  
  2557.     rm *..c 
  2558.  
  2559.  
  2560.  
  2561. n_pt.o : n_pt.C n_pt.h $(HDRS) 
  2562.  
  2563.     CC +i -c -g n_pt.C 
  2564.  
  2565.     rm *..c 
  2566.  
  2567.  
  2568.  
  2569. reduced.o : reduced.C reduced.h $(HDRS) 
  2570.  
  2571.     CC +i -c -g reduced.C 
  2572.  
  2573.     rm *..c 
  2574.  
  2575.  
  2576.  
  2577. unixo.o : unixo.C hdr_xo.h extern.h 
  2578.  
  2579.     CC +i -c -g unixo.C 
  2580.  
  2581.     rm *..c 
  2582.  
  2583. For example, the uniform crossover object file is depended on several header 
  2584. files and the source code file that implements the methods defined for this 
  2585. class.  The lines below the dependency information are the commands necessary 
  2586. to update date the object file. 
  2587.  
  2588. And the final modification to the makefile is to add a new dependent for the 
  2589. composite header file where you added the #include directive for your 
  2590. component's header file in Step 3 above.  The following shows the section of 
  2591. the makefile for the hdr_xo.h file where we added the #include directive for 
  2592. the header file of the uniform crossover technique. 
  2593.  
  2594.  
  2595.  
  2596. hdr_xo.h : n_pt.h reduced.h cross.h unixo.h 
  2597.  
  2598.     touch hdr_xo.h 
  2599.  
  2600.  
  2601.  
  2602. Here we only need to modify the time and date of the file (by the touch 
  2603. command) to update the composite header file.  This causes the object files 
  2604. that have this file as a dependent to be updated since the hdr_xo.h file is now 
  2605. more currently than the object files. 
  2606.  
  2607. 5.  Create a Help File 
  2608.  
  2609. Now you need to create a help file for your new component.  The information in 
  2610. this file will be displayed when the user selects your component and presses 
  2611. the F1 key while in the Select GA Components section of the user interface 
  2612. program. 
  2613.  
  2614. All of the help files are located in the Help sub-directory under the main 
  2615. directory where the GA Toolkit was installed.  You will need to go to this 
  2616. directory to create the help file.  In the Help directory there is a file 
  2617. called HELP.TEMP.  This provides a template for creating your help file.  To 
  2618. create your help file you will need to make a copy the HELP.TEMP file.  Then 
  2619. you will need to edit your new file with a text editor and add the information 
  2620. about your new component. 
  2621.  
  2622. 6.  Update Initialization File for the User Interface Program 
  2623.  
  2624. Now comes the fun part!  For you to be able to choose your new component 
  2625. through the user interface program you need to update an initialization file 
  2626. the system reads about the available components.  By placing this information 
  2627. in an input file, rather than hard-coding it, it is easier to update the user 
  2628. interface program when new components are added.  This initialization file 
  2629. (called gat.ini in the Uif sub-directory) contains information about how to 
  2630. display the components and the constraints on which component can be used 
  2631. together.   
  2632.  
  2633. The first line of the file contains a number for the number of entries in the 
  2634. file.  The user interface program uses an array data structure to store and 
  2635. manipulate the information about each component.  Knowing the number of entries 
  2636. in the file makes it easier to create this data structure.  You will need to 
  2637. increment this number for each entry you add to this file. 
  2638.  
  2639. The entries about each components contain several fields.  Each field, with the 
  2640. exception of Constraints, must be delimited by commas.  The following describes 
  2641. each field.  An actual portion of the gat.ini file will be presented and 
  2642. explained later. 
  2643.  
  2644.  
  2645.  
  2646. Menu Category - this is the name to display on the menu of components (e.g., 
  2647. Chromosome or Selection). 
  2648.  
  2649.  
  2650.  
  2651. Sub-Menu - this indicates whether there is a sub-menu for the category and the 
  2652. name of the sub-category (e.g., Representation and Decoding are sub-categories 
  2653. for Chromosome).  Use "None" in this field if there is no sub-category. 
  2654.  
  2655.  
  2656.  
  2657. Name of Component - this is name that will be displayed for the component 
  2658. (e.g., GENESIS Rank and Linear Rank components in the Selection category). 
  2659.  
  2660.  
  2661.  
  2662. #define Identifier - this is the #define identifier associated with the 
  2663. component (e.g., CROSS is the #define identifier for Uniform Crossover). 
  2664.  
  2665.  
  2666.  
  2667. Value for #define - this the value to associate with the #define identifier 
  2668. when the component is selected (e.g., we would give CROSS the value uniform_xo 
  2669. when Uniform Crossover is selected). 
  2670.  
  2671.  
  2672.  
  2673. Help file - this is the name of the file (in the Help sub-directory) that 
  2674. contains information about the component to displayed when the user presses the 
  2675. F1 key. 
  2676.  
  2677.  
  2678.  
  2679. Number of Constraints - this is the number of lines that follow describing the 
  2680. constraints about which components can be used with this technique. 
  2681.  
  2682.  
  2683.  
  2684. Constraints - each constraint is on a separate line following the entry for the 
  2685. component.  Each constraint line must begin with a tab character.  Constraints 
  2686. have the following format: 
  2687.  
  2688.  
  2689.  
  2690.         identifier operator value 
  2691.  
  2692.  
  2693.  
  2694. The system currently understands the four operators described below.  Examples 
  2695. of these operators will be discussed later. 
  2696.  
  2697.  
  2698.  
  2699. =       This is the equal operator.  It means that the current value associated with 
  2700. the #define identifier must be equal to the value specified in the constrain 
  2701. for this component to be compatible with the current configuration. 
  2702.  
  2703.  
  2704.  
  2705. !=      This is the not equal operator.  It means that as long as the current value 
  2706. associated with the #define identifier is not equal to the value specified in 
  2707. the constraint then this component is compatible with the current 
  2708. configuration. 
  2709.  
  2710.  
  2711.  
  2712. >       This is the implies operator.  It means that if this component is selected 
  2713. and all the other constraints are satisfied then the component designated by 
  2714. the #define identifier and value of the constraint must also be selected.  For 
  2715. example, if you are using SUS selection with individual reproduction, the 
  2716. repl_sus class must be used in the replacement phase. 
  2717.  
  2718.  
  2719.  
  2720. ?=      This is the if operator.  It means that if the identifier is currently 
  2721. associated with the value in the constraint then evaluate the constraints in 
  2722. the following lines preceded by two tab characters. 
  2723.  
  2724. The follow shows portions of the gat.ini file.  The actual contents of the file 
  2725. are print in a Courier font and additional comments explaining the entries are 
  2726. printed in a Times Roman font. 
  2727.  
  2728.  
  2729.  
  2730. The first three entries in the file are for the chromosome category.  The first 
  2731. entry is for the Representation sub-category.  The name of the component is 1-D 
  2732. Bit String (the third field).  When this component is selected the system will 
  2733. assign the REP_CHROM identifier the value of bit_chrom (the fourth and fifth 
  2734. fields).  The bit_str.hlp file in the Help sub-directory contains additional 
  2735. information the user may access via the F1 key.  And the last field contains a 
  2736. zero indicating that there are no constraints for this component. 
  2737.  
  2738. 24 
  2739.  
  2740. Chromosome,Representation,1-D Bit String,REP_CHROM,bit_chrom,bit_str.hlp,0 
  2741.  
  2742. Chromosome,Decoding,Binary,CODE_CHROM,bit_chrom,binary.hlp,0 
  2743.  
  2744. Chromosome,Decoding,Gray,CODE_CHROM,gray_chrom,gray.hlp,0 
  2745.  
  2746. The entry below is for the Individual Reproduction.  This is probably the most 
  2747. complicated entry because of the various constraints.  But this is a good 
  2748. example to explain how the constraints work.  All of the constraints in this 
  2749. case use the if operator.  The system will evaluate each constraint with the if 
  2750. operator and if the condition is true it will evaluate the constraints below it 
  2751. that are precede by two tab characters.  So the first two constraints mean that 
  2752. when the user selects individual reproduction if we are currently using the 
  2753. generational version of SUS (sus_gen) or GENESIS Rank (rank_sus_gen), 
  2754. respectively, that we should switch to the individual reproduction version of 
  2755. the selection technique.  The third constraint has two if conditions.  It means 
  2756. the if Linear Rank selection (rank_sel) and the Generational Emulation 
  2757. replacement policy (kill_term) are currently selected the we need to change the 
  2758. replacement policy to the Remove Worst technique (kill_worst) since 
  2759. Generational Emulation is not compatible with Linear Rank selection.  And the 
  2760. final constraint is a little confusing.  It says the if Linear Rank selection 
  2761. is being used then we need to change the selection component to Linear Rank.  
  2762. Now this seem silly.  But the implies constraint (>) actually causes the 
  2763. program to evaluate the constraints for the component we what to change.  So 
  2764. the program will evaluate the constraints for Linear Rank selection.  One of 
  2765. these constraints is that if individual reproduction is being used then we also 
  2766. need the repl_rank component for the replacement phase which inserts new 
  2767. offspring into the population it the proper order according to their rank. 
  2768.  
  2769. Reproduction,None,Individual,POP_TYPE,pop_ind,ind.hlp,9, 
  2770.  
  2771.     SELECT ?= sus_gen 
  2772.  
  2773.         SELECT > sus_ind 
  2774.  
  2775.     SELECT ?= rank_sus_gen 
  2776.  
  2777.         SELECT > rank_sus_ind 
  2778.  
  2779.     SELECT ?= rank_sel 
  2780.  
  2781.     KILLER ?= kill_term 
  2782.  
  2783.         KILLER > kill_worst 
  2784.  
  2785.     SELECT ?= rank_sel 
  2786.  
  2787.         SELECT > rank_sel 
  2788.  
  2789. The entries below are most of the entries for the Selection category.  The 
  2790. first entry is for the generational version of SUS selection.  The only 
  2791. constraint on this component is that the style for reproduction must be 
  2792. generational (pop_gen).  The last entry is for Linear Rank selection with 
  2793. individual reproduction.  The constraint says we must be using individual 
  2794. reproduction for this component to be compatible.  The second constraint says 
  2795. the we can use Linear Rank selection as long as we are not using the 
  2796. Generational Emulation replacement policy (kill_term).  And the final 
  2797. constraint says the to use this component we must also use the repl_rank class 
  2798. for the replacement phase so that the offspring will be inserted in the proper 
  2799. position within the population, according to their rank. 
  2800.  
  2801.  
  2802.  
  2803. Selection,None,SUS,SELECT,sus_gen,sus.hlp,1, 
  2804.  
  2805.     POP_TYPE = pop_gen 
  2806.  
  2807. Selection,None,SUS,SELECT,sus_ind,sus.hlp,2, 
  2808.  
  2809.     POP_TYPE = pop_ind 
  2810.  
  2811.     REPLACE > repl_sus 
  2812.  
  2813. Selection,None,Linear Rank,SELECT,rank_sel,lrank.hlp,1, 
  2814.  
  2815.     POP_TYPE = pop_gen 
  2816.  
  2817. Selection,None,Linear Rank,SELECT,rank_sel,lrank.hlp,3, 
  2818.  
  2819.     POP_TYPE = pop_ind 
  2820.  
  2821.     KILLER != kill_term 
  2822.  
  2823.     REPLACE > repl_rank 
  2824.  
  2825. The entries below are for the Crossover category.  The first entry is the item 
  2826. we added for the Uniform crossover technique.  In addition, we needed to add 
  2827. several constraints to the next two entries (Traditional and Reduced Surrogate 
  2828. crossover, respectively).  These constraints mean the if we select either 
  2829. Traditional or Reduced Surrogate crossover when Uniform crossover is the 
  2830. component that we are currently using, then we need to change the CROSS 
  2831. identifier to one_pt.  That is, it is invalid for the CROSS_TYPE identifier to 
  2832. be associated with either n_pt (Traditional) or reduced_sur (Reduced Surrogate) 
  2833. when the CROSS identifier is set to uniform_xo (Uniform crossover).  Since the 
  2834. user has selected either Traditional or Reduced Surrogate crossover we need to 
  2835. change the CROSS identifier to either one_pt or two_pt and by default the 
  2836. system will use one_pt. 
  2837.  
  2838. Crossover,Style,Uniform XO,CROSS,uniform_xo,unif_xo.hlp,0 
  2839.  
  2840. Crossover,Style,Traditional,CROSS_TYPE,n_pt,trad_xo.hlp,2, 
  2841.  
  2842.     CROSS ?= uniform_xo 
  2843.  
  2844.         CROSS > one_pt 
  2845.  
  2846. Crossover,Style,Reduced Surrogate,CROSS_TYPE,reduced_sur,surr_xo.hlp,2, 
  2847.  
  2848.     CROSS ?= uniform_xo 
  2849.  
  2850.         CROSS > one_pt 
  2851.  
  2852. Crossover,# Cut Points,One,CROSS,one_pt,none,0 
  2853.  
  2854. Crossover,# Cut Points,Two,CROSS,two_pt,none,0 
  2855.  
  2856. So to be able to select your new component through the user interface program 
  2857. you will need to add an entry to the gat.ini file.  When you add your entry you 
  2858. should place it in the file with the other entries for that type of technique.  
  2859. For example if your created a new selection technique you should add the new 
  2860. entry in the area of the gat.ini file the has other entries for the selection 
  2861. category.  In addition, you may need to modify the constraints for some the 
  2862. existing entries to ensure compatibility with your new component.  And finally, 
  2863. do not forget to update the number on the first line of gat.ini file to 
  2864. accurately represent the number of component entries in the file. 
  2865.  
  2866. After you have modified the gat.ini file you can execute the user interface 
  2867. program and you should be allow to select your new component.  There is no need 
  2868. to re-compile the user interface program since gat.ini is only an input file. 
  2869.  
  2870. {tc "Adding a New Parameter" \L 2}Adding a New Parameter 
  2871.  
  2872. This section describes how you can add a new input parameter for the GA 
  2873. programs that you create with the GA Toolkit.  This is especially useful if you 
  2874. create a new component that needs a new parameter.  For example, for the 
  2875. Uniform crossover technique that was recently added to the system needed a 
  2876. parameter to specify the probability for swapping each position on the 
  2877. chromosome.  The following describes the process for adding a new parameter. 
  2878.  
  2879. 1.  Declaring a Variable for the New Parameter 
  2880.  
  2881. The first step is to declare a new variable for your parameter.  You will need 
  2882. to modify two files to declare your new variable and to provide the component 
  2883. access to your parameter.  All user-defined input parameters for the GA Toolkit 
  2884. are declared as global variables so that all component will have access to the 
  2885. parameters they require. 
  2886.  
  2887. The global.h file in the Source sub-directory contains all the declaration of 
  2888. global variables.  You will need to add a declaration for your new variable in 
  2889. this file.  For example, we added the following for the swapping probability 
  2890. parameter. 
  2891.  
  2892.  
  2893.  
  2894. double  SWAP_PROB; 
  2895.  
  2896.  
  2897.  
  2898. The second file you need to modify is extern.h (in the Source sub-directory).  
  2899. This file contains all the external declaration for the global variables.  This 
  2900. is necessary so that all the components will have access to the proper 
  2901. variables.  For example, we added the following external declaration for the 
  2902. swapping probability parameter. 
  2903.  
  2904.  
  2905.  
  2906. extern double  SWAP_PROB; 
  2907.  
  2908.  
  2909.  
  2910. 2.  Update the Input Section 
  2911.  
  2912. In this step you need to modify the input.h file (in the Source sub-directory). 
  2913.  This file contains several #define directives used for reading the input 
  2914. parameters from the in file.  The INPUT_FORM identifier is used for the fscanf 
  2915. format string.  And the INPUT_VARS identifier is used as the list of input 
  2916. parameter variables in the fscanf call.  So by updating the #define identifies 
  2917. in the input.h file the program will be able to read in your new parameter.  
  2918. The following shows a section of the input.h file where we updated the 
  2919. INPUT_FORM and INPUT_VARS #define identifiers. 
  2920.  
  2921.  
  2922.  
  2923. #define INPUT_FORM " \ 
  2924.  
  2925.   Total Experiments = %d \ 
  2926.  
  2927.        Total Trials = %d \ 
  2928.  
  2929.     Population Size = %d \ 
  2930.  
  2931.      DeJong Gap = %lf \ 
  2932.  
  2933.       Elite Gap = %lf \ 
  2934.  
  2935.     Prob. Cross = %lf \ 
  2936.  
  2937.      Prob. Mutation = %lf \ 
  2938.  
  2939.      Selection Bias = %lf \ 
  2940.  
  2941.    Replacement Bias = %lf \ 
  2942.  
  2943.        Maximum Spin = %d \ 
  2944.  
  2945. Statistics Interval = %d \ 
  2946.  
  2947.     Hamming Metrics = %d \ 
  2948.  
  2949.       Best Size = %d \ 
  2950.  
  2951.      Worst Size = %d \ 
  2952.  
  2953.        Maximize = %d \ 
  2954.  
  2955.        Evaluate All = %d \ 
  2956.  
  2957.     Seed Population = %d \ 
  2958.  
  2959.     Debugging Level = %d \ 
  2960.  
  2961.         Display = %d \ 
  2962.  
  2963.   Print Generations = %d \ 
  2964.  
  2965.     Random Seed = %lu \ 
  2966.  
  2967.      Swapping Prob. = %lf" 
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973. #define INPUT_VARS &MAX_EXPER, &MAX_TRIALS, &POP_SIZE, &GAP, \ 
  2974.  
  2975.        &ELITE_GAP, &P_CROSS, &P_MUTE, &SELECT_BIAS, &REPLACE_BIAS, \ 
  2976.  
  2977.        &MAX_SPIN, &STATS_GAP, &HAM_FLAG, &BEST_SIZE, &WORST_SIZE, &MAX_FLAG, \ 
  2978.  
  2979.        &EVAL_ALL, &INIT_FLAG, &DEBUG_FLAG, &DISPLAY_FLAG, &PRINT_GEN, &SEED, \ 
  2980.  
  2981.        &SWAP_PROB 
  2982.  
  2983.  
  2984.  
  2985. As you can see we just added our new "Swapping Prob." parameter to the end of 
  2986. the INPUT_FORM identifier and the variable SWAP_PROB to the end of the 
  2987. INPUT_VARS identifier.  Note:  The INPUT_VARS identifier is used as the list of 
  2988. argument to the fscanf function so the "&" in front of the variable name is 
  2989. necessary so the value will be actually be store in the variable after the 
  2990. fscanf function returns. 
  2991.  
  2992. 3.  Update the Help File for Input Parameters 
  2993.  
  2994. The next step is to add a short description about your new parameter to the 
  2995. in.hlp file (in the Help sub-directory).  This file contains information about 
  2996. all the input parameters.  You should use a text editor to edit the in.hlp file 
  2997. and add some information about your new parameter. 
  2998.  
  2999. 4.  Update the Parameter Initialization File for the User Interface Program 
  3000.  
  3001. The final step for adding a new parameter is to update an initialization file, 
  3002. called gat_in.ini in the Uif sub-directory, so that you can create input files 
  3003. with this new parameter via the user interface program.  The gat_in.ini file 
  3004. contains information about the parameters so the user interface program can 
  3005. ensure that only appropriate values are entered for each parameter. 
  3006.  
  3007. The first line in the gat_in.ini file contains the number parameter entries in 
  3008. the file.  The user interface program uses an array data structure for storing 
  3009. and manipulation the parameter information.  The number on the first line of 
  3010. the file makes it easier to create this data structure.  When you add 
  3011. information to this file for new parameters you will need to update this number 
  3012. to accurately reflect the number of entries in the file. 
  3013.  
  3014. Each remaining lines in the file contains information about one parameter.  
  3015. Each line or entry contains several comma delimited fields described below.  
  3016. The actual gat_in.ini file will be presented and explained later. 
  3017.  
  3018.  
  3019.  
  3020. Parameter Name - this is a name for the parameter.  You must use exactly the 
  3021. same name you used in the INPUT_FORM identifier in the input.h file.  For 
  3022. example, for the swapping probability parameter we used the name "Swapping 
  3023. Prob." so that is the value we must use for this field. 
  3024.  
  3025.  
  3026.  
  3027. Default Value - this the default value for the parameter that will initially be 
  3028. displayed in the user interface program where the user begins creating the in 
  3029. file. 
  3030.  
  3031.  
  3032.  
  3033. Type of Parameter - this field is used so that the validity of the user's input 
  3034. can be checked.  The system currently understands the following entries for 
  3035. this field. 
  3036.  
  3037.  
  3038.  
  3039. 1       the value for this parameter must be greater than the value of the Minimum 
  3040. field. 
  3041.  
  3042.  
  3043.  
  3044. 2       the value for this parameter must be greater than or equal to the value of 
  3045. the Minimum field. 
  3046.  
  3047.  
  3048.  
  3049. 3       the value for this parameter must be an even integer. 
  3050.  
  3051.  
  3052.  
  3053. 4       the value for this parameter must be in the range [Minimum field, Maximum 
  3054. field]. 
  3055.  
  3056.  
  3057.  
  3058. 5       the value for this parameter must be in the range (Minimum field, Maximum 
  3059. field]. 
  3060.  
  3061.  
  3062.  
  3063. 6       the value for this parameter can be 0 or 1.  This is for boolean flags.  A 
  3064. value of 0 is displayed as "no" and a 1 is displayed as "yes" in the user 
  3065. interface program.  The default value for this field must be 1 or 0 (not yes or 
  3066. no). 
  3067.  
  3068.  
  3069.  
  3070. Minimum - this field is only used with parameters of type 1, 2, 4 or 5. 
  3071.  
  3072.  
  3073.  
  3074. Maximum - this field is only used with parameters of type 4 or 5. 
  3075.  
  3076.  
  3077.  
  3078. The following shows the actual gat_in.ini file and explains several of the 
  3079. entries.  The contents of the file is printed in a Courier font and additional 
  3080. comments are printed in a Times Roman font. 
  3081.  
  3082.  
  3083.  
  3084. 22 
  3085.  
  3086. Total Experiments,1,1,0 
  3087.  
  3088. The Total Trials parameter has a default value of 1000.  This is a type 1 
  3089. parameter and the Minimum field is 0 which means that the value for this 
  3090. parameter must be greater than 0. 
  3091.  
  3092. Total Trials,1000,1,0 
  3093.  
  3094. Population Size,50,3 
  3095.  
  3096. DeJong Gap,1.0,4,0.0,1.0 
  3097.  
  3098. Elite Gap,1.0,4,0.0,1.0 
  3099.  
  3100. The Prob. Cross entry is for the cross probability parameter.  It has a default 
  3101. value of 1.0.  This is a type 4 parameter with a minimum of 0.0 and maximum of 
  3102. 1.0.  So the values for this parameter must be in the following range [0.0, 
  3103. 1.0]. 
  3104.  
  3105. Prob. Cross,1.0,4,0.0,1.0 
  3106.  
  3107. Prob. Mutation,0.001,4,0.0,1.0 
  3108.  
  3109. Selection Bias,1.5,5,1.0,2.0 
  3110.  
  3111. Replacement Bias,1.5,5,1.0,2.0 
  3112.  
  3113. Maximum Spin,3,1,0 
  3114.  
  3115. Statistics Interval,200,1,0 
  3116.  
  3117. Hamming Metrics,0,6 
  3118.  
  3119. Best Size,1,2,0 
  3120.  
  3121. Worst Size,3,2,0 
  3122.  
  3123. The Maximize parameter is boolean flag (type 6) parameter for whether the GA 
  3124. will be applied to a maximization or minimization problem.  The default value 
  3125. is 1 (the flag is on)  indicating a maximization problem. 
  3126.  
  3127. Maximize,1,6 
  3128.  
  3129. Evaluate All,0,6 
  3130.  
  3131. Seed Population,0,6 
  3132.  
  3133. Debugging Level,0,2,0 
  3134.  
  3135. Display,0,6 
  3136.  
  3137. Print Generations,0,6 
  3138.  
  3139. Random Seed,123456789,2,0 
  3140.  
  3141. The Swapping Prob. entry is what we added for the swapping probability 
  3142. parameter for the Uniform crossover technique.  The default value is 0.5 or on 
  3143. average half the positions on the chromosome will be swapped.  This a type 4 
  3144. parameter with a minimum of 0.0 and a maximum of 1.0.  So this parameter can be 
  3145. assigned values in the following range [0.0, 1.0]. 
  3146.  
  3147. Swapping Prob.,0.5,4,0.0,1.0 
  3148.  
  3149.  
  3150.  
  3151. When you add an entry for your new parameter it must be in the same relative 
  3152. position as you added the information in the input.h file.  For example, we 
  3153. added the Swapping Prob. parameter to the end of the INPUT_FORM and INPUT_VARS 
  3154. #define identifiers in the input.h file so we must also add our entry for this 
  3155. parameter to the end of the list in the gat_in.ini file.  You can arrange the 
  3156. parameters in  
  3157.  
  3158. any order you like also long as you maintain the same order in the gat_in.ini 
  3159. file and in the INPUT_FORM #define identifier (with corresponding variables in 
  3160. the INPUT_VARS #define identifier).   
  3161.  
  3162. After you have completed the necessary modification to the gat_in.ini file you 
  3163. can execute the user interface program and create an in input file with your 
  3164. new parameter. 
  3165.  
  3166. {tc "REFERENCES" \l 1}References 
  3167.  
  3168. Ackley, D. H.  A Connectionist Machine for Genetic Hillclimbing.  Boston, MA: 
  3169. Kluwer Academic Publishers, 1987. 
  3170.  
  3171. Baker, J. E.  "Adaptive Selection Methods for Genetic Algorithms."  In 
  3172. Proceedings of the First International Conference on Genetic Algorithms and 
  3173. Their Applications, ed. J. J. Grefenstette, 101-111.  Hillsdale, NJ: Lawrence 
  3174. Erlbaum Associates, 1985. 
  3175.  
  3176. Baker, J. E.  "Reducing Bias and Inefficiency in the Selection Algorithm."  In 
  3177. Genetic Algorithms and Their Applications: Proceedings of the Second 
  3178. International Conference on Genetic Algorithms, ed. J. J. Grefenstette, 14-21.  
  3179. Hillsdale, NJ: Lawrence Erlbaum Associates, 1987. 
  3180.  
  3181. Booker, L.  "Improving Search in Genetic Algorithms."  In Genetic Algorithms 
  3182. and Simulated Annealing, ed. Lawrence Davis, 61-73.  Los Altos, CA: Morgan 
  3183. Kaufmann Publishers, Inc., 1987. 
  3184.  
  3185. DeJong, K. A.  "An Analysis of the Behavior of a Class of Genetic Adaptive 
  3186. Systems."  Ph.D. dissertation, University of Michigan, 1975. 
  3187.  
  3188. Frederick, W., R. Sedlmeyer and C. White.  "The Hamming Metric in Genetic 
  3189. Algorithms and Its Application to Two Network Problems."  Computer Science 
  3190. Department, Indiana University-Purdue University at Fort Wayne, (unpublished 
  3191. manuscript), 1991. 
  3192.  
  3193. Goldberg, D. E.  Genetic Algorithms in Search, Optimization, and Machine 
  3194. Learning.  Reading, MA: Addison-Wesley Publishing Company, Inc., 1989. 
  3195.  
  3196. Grefenstette, J. J.  GENESIS Software (Version 5.0).  Distributed by The 
  3197. Software Partnership, Melrose, MA, 1990. 
  3198.  
  3199. Holland, J. H.  Adaptation in Natural and Artificial Systems.  Ann Arbor, MI: 
  3200. The University of Michigan Press, 1975. 
  3201.  
  3202. Lienau, S. A.  Effective Investigation of Genetic Algorithms.  Master's Thesis, 
  3203. University of Missouri-Kansas City, 1992. 
  3204.  
  3205. Syswerda, G.  "Uniform Crossover in Genetic Algorithms."  In Proceedings of the 
  3206. Third International Conference on Genetic Algorithms, ed. J. D. Schaffer, 2-9.  
  3207. San Mateo, CA: Morgan Kaufmann Publishers, Inc., 1989. 
  3208.  
  3209. Whitley, D.  "The GENITOR Algorithm and Selection Pressure: Why Rank-Based 
  3210. Allocation of Reproductive Trials is Best."  In Proceedings of the Third 
  3211. International Conference on Genetic Algorithms, ed. J. D. Schaffer, 116-121.  
  3212. San Mateo, CA: Morgan Kaufmann Publishers, Inc., 1989. 
  3213.  
  3214. Whitley, D.  "Fundamental Principles of Deception in Genetic Search."  In 
  3215. Foundations of Genetic Algorithms, ed. G. J. E. Rawlins, 221-241.  San Mateo, 
  3216. CA: Morgan Kaufmann Publishers, Inc., 1991. 
  3217.  
  3218.    
  3219.  
  3220.  
  3221.  
  3222.     {PAGE|33} 
  3223.  
  3224.  
  3225.  
  3226.     {PAGE|i}   
  3227.  
  3228.  
  3229.  
  3230.         {PAGE|55} 
  3231.  
  3232.  
  3233.  
  3234.    
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.         {PAGE|57} 
  3247.  
  3248.  
  3249.  
  3250.     {PAGE|56} 
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.