University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji GENETIC (EVOLUTIONARY) ALGORITHM: INTRODUCTION AND ITS USE AS AN ENGINEERING DESIGN TOOL A A Adedeji Department of Civil Engineering University of Ilorin Ilorin, Nigeria 2007 i University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji © A A Adedeji No part of this book may be reproduced or stored in a retrieval system transmitted in any form or by any means, and only by photocopying or recording for the purpose of research for which no permission is sought from the author. Published by: OLAD PUBLISHERS & PRINTING ENTERPRISES Head Office: No. 45/70, Niger Road, Ilorin, Kwara State, Nigeria ISBN NO: 978 – 8115 – 86 - 1 Printed by: Mark Computer Centre ii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Preface The theory of evolution was once in scientific circles. Charles Darwin theorised the evolution as a sort of survival of the fittest or simply put: if you are fit you survive. A single cell would struggle hard, among a pool of cells, to survive, while another cell would also struggle harder and another very hard, but who ever is fit among the population of cells would survive. Survival in this sense does not mean that the harder the fitness, rather the survival is fit by random selection or chaos and not by order. The random chance of variation together with the law of selection is a problem-solving method of immerse power. This book introduces the use of this principle to optimise design of engineering problems and give manual computations to some examples and generic idea of computer programming. Adedeji, A. A. iii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Table of Contents 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Preface Table of contents Introduction Objective of the Book Brief History of Genetic (Evolutionary) Algorithms Generic System in Genetic Algorithms 4.1 Chromosomal representation 4.2 Initial population 4.3 Fitness evaluation 4.4 Selection Elitist Linear rank selection Roulette wheel selection Stochastic universal sampling Truncation selection Tournament selection 4.5 Reproduction Crossover Mutation Strength of Genetic Algorithms Limitations of Genetic Algorithms Some Specific Application of Genetic Algorithm 7.1 DNA 7.2 Design of hardware 7.3 Acoustic 7.4 Aerospace 7.5 Astronomy and astrophysics 7.6 Chemistry Genetic Algorithms Simple Examples Genetic Algorithms in Optimal Design Problem Formulation Examples 10.1 Example 1 10.1.1 Problem formulation 10.1.2 Genetic operators 10.1.3 Comparison of results 10.2 Example 2 10.2.1 Floor planning 10.3 Example 3 10.3.1 Optimisation model 10.3.2 Structured genetic algorithms iv iii iv 1 3 4 6 6 7 7 8 8 8 9 10 11 11 11 11 11 14 16 17 17 17 18 18 19 19 20 23 27 27 27 29 30 31 31 34 34 37 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 11. 12. A A Adedeji 10.3.3 Proiblem formulation 10.3.4 Results and analysis Conclusion and Recommendations References Appendix I Binary/decimal conversion Appendix II: PseudoCode Appendix II: Executional Steps for Genetic Algorithms Appendix III: Definitions of Symbols v 37 40 44 45 48 51 52 57 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 1. A A Adedeji Introduction After scientists became disillusioned with classical and neo-classical attempt at modelling intelligence, they looked in other directions. Two prominent fields arose, conventional (neural network, parallel processing) and evolutionary computing. It is the latter that this paper deals with. i.e. “Genetic Algorithms.” Genetic Algorithms (GAs) are not too hard to programme or understand since they are biological based. Thinking in terms of real life evolution may help one understand. An initial population is created from a random selection of solutions, which are analogous to chromosome (or genome). This is unlike the situation where the initial state in a problem is already given instead, such as in symbolic artificial intelligence. When considering configuration design as a search problem, the number of possible solution is usually too large for exhaustive search. Knowledge-based systems rely on expert or experimental knowledge to narrow down the search space to a manageable size. This approach may work well in a situation where such knowledge is encodable (Radford and Gero, 1988), but there are two disadvantages: i) it is often difficult to extract and encode relevant design knowledge and ii) a knowledge applicable in one domain may not possibly be applicable to another domain, while the problem may be so large that the time taken to find a solution is not practical. GAs are stochastic, parallel search and designed to efficiently search large, non-linear, poorly-understood search spaces, where knowledge-base system is scarce or difficult to encode. The genetic algorithm works in the following manners: The first step is to represent a legal solution to the problem to be solved by using a string of genes ( a gene is a unit in chromosome controlling heredity), that can take on some value from a specified finite range. This string of genes that represents a solution is the chromosome. Then an initial population of legal chromosomes is constructed at random. And at each generation, the fitness of each chromosome in the population is measured. The fitter chromosomes are then selected to produce offspring for the next generation, which inherit the best characteristics of both the parents – the survivor of the fittest by Darwin’s theory of evolution. After many generations of selection, for the fitter chromosomes, the result is expected to be a population that is vi 1 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji substantially fitter than the original. Genetic algorithms consist of: Chromosomal Representation, initial population, fitness evolution, selection, crossover and mutation. 2 vii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji 2. Objective of This Book The focus of this book o the introduction of the Genetic Algorithms (GAs) development and implementation of a methodology for the design of discrete engineering system by the use of Genetic Algorithms as an automated design tools. Due to the methodology employed GAs may be defined as been: efficient, since it finds an acceptable solution with minimal computational effort; reliable, because it finds acceptable solution regardless of the problem nuances or the starting point used; accurate since it provides the best possible solution to a problem and robust doe to the fact that methodology is efficient, reliable and accurate. 3 viii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 3. A A Adedeji Brief History of Genetic (Evolutionary) Algorithms and Variation The earlier instances of what might be called Genetic Algorithms appeared in the late 1950s and early 1960s, programmed on computers by evolutionary biologists who were explicitly seeking to model aspects of natural evolution. It did not occur to them that this strategy could be more generally applied to artificial problems. In 1962, at the University of Michigan, John Holland’s work on adaptive systems laid the foundation for later development. Holland (1975) was the first to explicitly propose crossover and other recombination operations. However, the seminar works in the field of genetic algorithm came in his book “Adaptation in Natural and Artificial System” where GA was used to mimic some of the processes of natural evolution and selection. In nature, each species needs to adapt to a complicated and changing environment in order to maximize the likelihood of its survival. The knowledge that each species gains is encoded in its chromosome that undergoes transformation when reproduction occurs. Over a period of time this changes to the chromosomes give rise to species that are more likely to survive, and so have a greater chance of passing their improved characteristic on to future generation. The genetic algorithm (GA) is a stochastic global search method that mimics the metaphor of natural biological evolution. Now the power of evolution has touched virtually any field one cares to name while new uses continue to be discovered, as research is ongoing. At the heart of it all lies nothing more than Charles Darwin’s simple theory of evolution: survival of the fittest, and that the random chance of variation, coupled with the law of selection is a problem-solving technique of immense power with nearly unlimited applications. It is important to note that biological evolution refers to populations and not to individuals and the changes brought about by evolution must be passed on to the next generation. Hence evolution is a process that results in heritable changes in a population spread over many generations. In fact evolution can be precisely defined as any change in the frequency of alleles within a gene pool from one generation to the next. Most so-called standard dictionaries outside the scientific community is different from the above definitions where the evolution is referred to as a progressive action They are simply inexcusable for a dictionary of science. ix 4 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Evolution is a change in the gene pool of a population over time. The theory of evolution and common descent were once controversial in scientific circles. This is no longer the case. The scientific community now considers the evolution theory and as common descent fact. Science is based on an open and honest look at the data and not on black boxes with dishonest debates where no common facts could not be openly supported. It is now a fact that “Theory of Nothingness” refers to evolution which is indestructible. Space and matter can become uniform by diffusion, driven by the second law of thermodynamics that create entropy. This law simply puts that: energy is required to create complexity and structure in material systems but entropy, which limits the life energy. In other words, entropy ensures that the energy that assembles particles into atoms into molecules into complex structure is no longer available (Energy = 0) to do any more constructive work making sure that the complex structure is eventually comes apart, but infinite by returning its components into its surrounding. When an electron and proton fuse they produce density, lose energy and cancel charge. The extra energy may be given up as nuclear radiation and heat. Some neutrons flies off into the space and others are trapped in the electron-proton system to become helium fitter than the initial matter. For instance, the only difference between helium and hydrogen is that helium has a neutron in its nucleus, which requires an an extra electron orbiting it to balance things out. Some energy is stored as the extra density of the electron, capturing an extra electron forming potential energy (fit) from increased differentiation and organization. GA is based on this simple fact. x 5 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji 4. Generic System in Genetic Algorithms Genetic algorithms consist of: Chromosomal Representation, initial population, fitness evaluation, selection and reproduction (i.e., crossover and mutation). Simple outline of a genetic algorithm is shown in Fig. 1. INITIAL POPULATION FITNESS OBJECTIVE FUNCTION SELECTION CROSSOVER MUTATION GEN > MAX GEN YES STOP NO GEN ~ GEN + 1 Fig. 1. Outline of genetic algorithm 4.1 Chromosomal Representation Before a genetic algorithm can be put to work on any problem, a method is needed to encode potential solutions to that problem in a form that a computer can process. The following approaches are in use. By encoding solutions as binary strings sequences of 1s and Os where the digit at each position represents the value of some aspect of the solution. xi 6 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji By encoding solutions as arrays of integers or decimal numbers, allowing for greater precision and complexity than the comparatively restricted method of binary numbers. See Appendix I on binary operation By representing individuals in a GA as strings of letters where each letter again stands for a specific aspect of the solution. The virtue of all these methods is to make it easy to define operators that cause the random changes in the selection of candidates. The canonical GA (PseudoCode) is represented simply as: choose initial population evaluate each individual’s fitness repeat select individuals to reproduce mate pairs at random apply crossover operator apply mutation operator evaluate individual’s fitness until terminating condition See Appendix II for a translation of the PseudoCode. The learning loop can terminate either a satisfactory solution is found or the number of generations pass a preset limit, suggesting that a complete solution will not be found with this set of individuals. See Appendix III for explanation of executional steps for genetic algorithm in Fig. III. 4.2 Initial Population This is created from a random selection of solutions (which are analogous to chromosomes). This is unlike in a symbolic artificial intelligence where the initial state in a problem is given instead. 4.3 Fitness Evaluation A value of fitness is assigned to each solution (chromosome) depending on how close it actually is to solving the problem, thus arriving to the answer of the designed problem. The solutions are thought of as possible characteristics that the system would employ in order to reach the answer. 7xii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 4.4 A A Adedeji Selection According to Dawkins (1986), natural selection means differential survival of entities where some entities live and others die. There are many different techniques, which a genetic algorithm can use to select the individuals to be copied over into the next generation. Some of the methods listed below are mutually exclusive, but others can be and often used in combination. Elitist selection: The most fit members of each generation are guaranteed to be selected. Though most GAs don’t use pure elitism unless modified from each generation and copied into the next generation in a case nothing better come up. Linear Rank Selection (LRS): Here the neighbourhood (is a set of individuals placed close to it on the grid, with its shape having a great impact on the behaviour of the evolution algorithm – could be linear or compact, see Fig. 2 a and b respectively. Increasing the neighbourhood size creates a larger overlap and decreases the propagation time. Selection intensity increases only when the size is fixed and the local size ® of the neighbourhood is increased, so that ® = ( ( xi x) ( yi y) 2 2 ). / N at the mean centre (x,y) of a neighbourhood pattern of N points. Take example of the 1st pattern of neighbourhood of L5, ® = 22 0.8944 ) is sorted 5 according to the objective values. The LRS algorithm defines the target sampling rate (TSR) of an individual x (i.e. the number of times an individual should be chosen as a parent for every N sampling operations) as: TSR(x) = min + (max – min) rank(x)/(N-1) (1) Where rank (x) = index of x when the neighbourhood is sorted in increasing order based on fitness and N = neighbourhood size so that we impose the constraints that 0 TSR (x), TSR (x) = N, 1 max 2 and min – max = 2. xiii8 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering L5 (n=5) A A Adedeji L9 (n=9) (a) 1inear neighborhood pattern C9 (n=9) C13(n=13) b) Compact neighborhood pattern Fig. 2 Set of individuals placed to neighbourhood on a grid Roulette Wheel Selection (RWS): A form of fitness-proportionate selection in which the chances of an individual’s being selected is proportional to the amount by which its fitness is greater or less than its competitors fitness. This is a stochastic algorithm and involves the following technique: The individuals are mapped to contiguous segments of a line, such that each individual’s segment is equal in size to its fitness. A random number is generated and the individual whose segment spans the random number is selected. The process is repeated until the desired number of individuals is obtained. See Fig.3 with the individuals of Table 1 that shows the selection probability for 11 individuals. Individual 1 is the most fit and occupies the largest interval, while individual 10 is the second least fit, the least fit interval (of value 0) is individual 11 and it has no chance for reproduction. xiv 9 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Table1 Selection probability and fitness value Number of individual Fitness value Selection probability 1 2 3 4 5 6 7 8 9 10 11 2.0 0.18 1.8 0.16 1.6 0.15 1.4 0.13 1.2 0.11 1.0 0.09 0.8 0.07 0.6 0.06 0.4 0.03 0.2 0.02 00 0.0 Trial 4 Trial 2 Trial 6 2 3 1 Trial 5 4 5 Trial 1 6 7 Trial 3 8 9 10 Individual 0.0 I 0.18 I 0.34 I 0.49 I 0,62 I 0.73 Fig. 3 Roulette-wheel selection I 0.82 I I 0.95 I 1.0 For selecting the mating population the appropriate number of uniformly distributed random numbers (between 0.0 and 1.0) is independently generated. For the 6 random numbers: 0.81, 0.32, 0.96, 0.01, 0.65 and 0.42, the selection process is shown. This may actually provides a zero bias but may not guarantee minimum spread Stochastic Universal Sampling: This method provides zero bias and minimum spread. The individuals are mapped to contiguous segments of a line, such that each individual’s segment is equal in size to its fitness exactly as in roulette-wheel selection. Consider Npointer the number of individuals to be selected, then the distance between the pointers are1/Npointer and the position of the first pointer is given by a randomly generated number in the range [0, 1/Npointer]. Again for 6 individuals to be selected as in roulette-wheel selection, the distance between the pointers is 1/6 = 0.167. See Fig. 4 for the selection for the sample of the random number 0.1 in the range [0, 0.167]. After selection the mating population consists of the individuals:1, 2, 3, 4, 6, 8. Pointer 1 Pointer 2 Pointer 3 Pointer 4 Pointer 5 Pointer 6 Individual 1 2 3 4 5 6 7 8 9 10 I I I I I I I I I 0.0 0.18 0.34 0.49 0.62 0 73 0.82 0.95 1.0 random number Fig. 4 Stochastic Universal Sampling xv10 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Truncation Selection: Compared to the previous methods of selections that model natural selection truncated is an artificial selection method. The selected parents range between 50% - 10% and any individual below the truncated threshold value do not produce. Tournament Selection: Here subgroup of individuals is chosen from the large population and the members of each subgroup compete against each other. Only one from each subgroup is chosen to reproduce. Others are: Generasational selection, in which the offspring of the individuals selected from each generation become the entire next generation and no individuals are retained between generations; steady-state selection, in which the offspring of the individuals selected from each generation go back into the pre-existing gene pool, replacing some of the less fit members of the previous generation. 4.5 Reproduction According to Dawkins (1986), natural selection means differential survival of entities where some entities live and others die For this to happen there must be a population of entities capable of reproduction. Crossover: Crossover is a GA operator that entails choosing two individuals to swap segments of their code, whereby producing new offspring that are combination of their parents. This process is intended to simulate the analogous process of recombination that occurs to chromosomes during sexual reproduction. In other words crossover causes genotypes (set of genes that builds a life form or phenotype) to be cut and spliced Mutation: This operator forms a new chromosome by making (usually small) alterations to the values of genes in a copy of a single parent chromosome, just as mutation in living things changes one gene to another, so also in a genetic algorithm. Crossover and mutation are two basic operators of GA. Performance of GA depends on them very much. The types and implementation of these xvi 11 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji operators depends on the encoding and also on the problem. Here few very important ways of crossover and mutation are listed below (Fig. 5): Binary Encoding: Single-point crossover (of 10-bits) BEFORE CROSSOVER Parent A Parent B + 0011 011010 1110 AFTER CROSSOVER (OFFSPRINGS) Parent A 0011 010001 010001 Parent B 1110 011010 Mutation 0 0 1 1 0 1 0 0 0 1 => 1 1 1 1 0 1 1 0 1 0 (Offspring) Multi-point crossover (of 10-bits) BEFORE CROSSOVER Parent A + 001 101 1010 Parent B 111 001 AFTER CROSSOVER (OFFSPRINGS) Parent A 001 001 1010 0001 Parent B 111 101 0001 Mutation 1 1 1 1 0 1 0 0 0 1 => 1 1 1 1 0 1 0 1 0 1 (Offspring) Fig. 5 Crossover and mutation techniques Permutation Encoding One crossover point selected, the permutation is copied from the first parent till the crossover point, then the other parent is scanned and if the number is not yet in the offspring, it is added. xvii 12 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Crossover: Parent A Parent B Offspring (1 2 3 4 5 6 7 8 9) + (4 5 3 6 8 9 7 2 1) = (1 2 3 4 5 6 8 9 7) Mutation (Two numbers are selected and exchanged) Offspring (1 2 3 4 5 6 8 9 7) => (1 8 3 4 5 6 2 9 7) In traditional GAs, the chromosome length is determined when the phenotype (a survival machine built by a set of genes (genotypes) is encoded in to a genotype. The length is always fixed and can not change with evolution. Young and Week (2004) developed an effective genetic algorithm that can change the chromosome length by implementing the design freedom by extending the length of chromosome allowing for the reduction in the computational cost for complex problems with large number of design variables. Examples of design in the phenotype and corresponding chromosome in the genotype are shown in Fig.6. Short chromosome 0 1 0 1 R 1 0 Long chromosome 0 H 1 0 R 1 1 0 1 1 H a L (10 bits) L (6-bits) 1 0 b (a) GENOTYPE a b H H R R Less design information More design information (b) PHENOTYPE Fig. 6 Design in the phenotype and corresponding chromosomes in genotype domain xviii 13 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 5. A A Adedeji Strength of Genetic Algorithms (GAs) Genetic algorithms are intrinsically parallel as most other algorithms are serial and can only explore the solution to a problem in one direction at a time which can lead to a sub-optimal solution that nothing could be done but abandon to start all over. GAs are much more likely to locate a global peak than the traditional search techniques because they are less likely to get stuck at local minimal. Due to its parallelism it allows the evaluation of many schemas at once. GAs are well-sited to solving problems (as in non-linear problems) where the space of all potential solution is truly large for a reasonable time. In a linear problem, for instance, the fitness of each component is independent of amount of time. Non-linear is the norm where changing one component may have triple effects on the entire system. Problem solving results in a combination explosion, the space of, say, 1000-digit binary strings can be exclusively searched by evaluating only 2000 possibilities if the problem is linear, but if it is a non-linear, an exhaustive search requires evaluating 21000 (i.e. individual represents one sample point in a space of size 2n, as n = a bit string of length) possibilities, which may take over 300 digits to write in full. But this can be done in a very short period of time if GA is used. The principal advantages of the evolutionary algorithms resides in the fact that no sensitivity analysis is required and global optimal solution can be obtained. GAs perform well in problems in which the fitness landscape is complex one. They are cases where fitness functions are discontinuous and change over time with many local optima. Evolutionary algorithms have proved to be effective at escaping local optima and discovering global optimum. GAs excel in their ability to manipulate many parameters simultaneously (Forrest, 1993). In a Pareto Optimal (non-dominated) (Cocilo, 2000) GA, a particular solution to a multiobjective problem optimises one parameter to a degree such that the parameter cannot be further improved without causing a corresponding decrease in the quality of some other parameters. xix 14 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji GAs Know nothing about the problems they are developed to solve by not using previously known domain-specific information to guide each step and making changes towards a specific improvement. Here GAs make random changes to their candidate’s solution and then use the fitness function to determine whether those changes produce an improvement. The entropy—based searching techniques with multi-population and the quasi—exactness penalty function (Wang, 2002) has been developed to ensure rapid and steady convergence of results. xx 15 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 6. A A Adedeji Limitations of Genetic Algorithms In creating a GA, the first consideration is defining a representation for the problem. The language required must be robust so as to tolerate random changes to avoid errors. This can be overcomed: (i) by defining individuals as lists of numbers (binary valued, integers or real-valued) that represent some aspects of a candidate solution, (ii) though, the issue of representing candidate solutions in a robust way does not exist in nature, so virtually any change to an individual’s gene will still produce an intelligent result and so mutation or swapping sub-trees has a higher chance of producing an improvement. In order to attain higher fitness for a given problem, problem of writing fitness function must be carefully considered. Size of the population, rate of mutation and crossover and type and strength of selection, all must be carefully chosen. If the population size falls too low, mutation rate will be too high resulting to a strong selection pressure (as in environmental changes) so that species may go extinct. GA seems to have problem in dealing with deceptive fitness functions (Mitchell, 1996) to find the location of the global optimum. A problem with 8-bits strings – 0 0 0 0 0 0 0 1 would be less fit than 0 0 0 0 0 0 1 1 naturally, and the string 1 1 1 1 1 1 1 1 turns out to be less fit than the string 0 0 0 0 0 0 0 0. In such a problem a GA would be no more likely to find global optimum than random search A premature convergence in GA, by driving down the population diversity too soon, if an individual that is more fit than most of its competitors emerges early during running, whereby leading the algorithm to converge on local optimum. This often occur in nature (genetic drift). Most researchers (Holland 1992, Forrest 1993 and Haupt et al 1998) have advised against the use of GA to solve analytically solvable problems as the traditional analytic methods take much less time and computational effort than GA. xxi 16 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 7. A A Adedeji Some Specific Applications of GAs in Science and Engineering Technology Engineering problems that are faced in everyday decision-making are often complex and multiobjective, requiring solutions to be judged on their ability to satisfy competing design goals (Rawlins, 1991). In structural mechanics for instance, many nonlinear problems, such as elastic and post-buckling of elastic-structures, involve a category of geometrical nonlinear elastic systems. Circuit optimisation becomes one of the applications most used by microwave engineers and due to the nature of the circuits the optimisation task is far from easy. Error function mostly surfers from local minimum problems so that in many cases the optimisation gets unbelievably inefficient. 7.1. Deoxyribonucleic Acid (DNA) Also in DNA (Deoxyribonucleic acid), models have represented molecules with geometrical nonlinearity and material elasticity (Stump et al, 1997, Fain and Rudnick, 1999). For such nonlinear elastic problems, the static equilibrium configuration of the system is the one that possesses stationary potential energy. And since the system is nonlinear, different configurations corresponding to different energy levels can exist under the same geometric constraints. To search and identify the different configurations is usually the first step towards the understanding of the system. GAs were developed to solve unconstrained optimisation problems. However, engineering design problems are usually constrained. They are solved by transforming the problem to unconstrained problems. 7.2 Design of Hardware In a vast of hardware devices, principles of evolution has been employed to produce a prototype voice-recognition circuit that can distinguish between and respond to spoken commands using only 37 logic gates- a task that would have been considered impossible for any human engineer. Random bit strings have been generated and used as configurations for the field programmable gate array (FPGA), selecting the fittest individuals from each generation, reproducing and randomly mutating them, swapping sections of their code and passing them on to another round of selection. xxii 17 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Other specific areas where GA has been used to tackle broad varieties of problems are: 7.3 Acoustic GA is used to design a concert hall with optimal acoustic properties maximizing the sound quality for the audience (Sato et al, 2002). GA was used to train neural networks to distinguish between sonar reflections from different types of the object: man-made metal spheres, plant-life etc (Porto and Fogel 1995). Tang et al (1996) surveyed the uses of GAs within the field of acoustics and signal processing, such as the design of active noise control system. 7.4 Aerospace Multiple objective GA was used to design the wing shape for a supersonic aircraft, by minimising aerodynamic drag at supersonic cruising speeds, and aerodynamic load (the bending forces on the wing) (Obayatshi et al, 2000). Chromosome in this case is a string of 66 members, each of which corresponds to a specific aspect of he wing for its shape, its thickness its twist etc. Minimising the twisting moment (additional fitness objective) of the aircraft wing – A known potential problem for arrow-wing designs. Here, additional control points (Sasaki et al, 2001) for thickness are added to the array of design variables. The results, when compared with the Japanese National Aerospace Laboratory’s wing design for NEXST-1 experimental supersonic airplane, were found to be physically reasonable and superior to the NAL’s design. Satellites in high Earth orbit, around 35,420 km up, can see large sections of the planet at once and be in constant with ground stations, but they are far more expensive to launch and more vulnerable to cosmic radiation. It is therefore more economical to put satellites in low orbits. But because of the curvature shape of the Earth, it is inevitable that satellites will at times lose line-of-sight access to surface receivers and thus be useless. Even constellation of several satellites experience unavoidable blackouts and losses of coverage for this reason. This is a multi-objective problem where there is the need to arrange the satellites xxiii 18 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji orbits to minimise this downtime. GA was then applied to this problem, the evolved results for the constellations were unusual, highly asymmetric orbit configurations, with the satellites spaced by alternating large and small gaps rather than equal-sized gaps as conventional technology would produce. This solution significantly reduced both average and maximum revisit time up to 90 minutes. 7.5 Astronomy and Astrophysics GA (PIKAIA) has been used generation, fitness-proportionate ranking selection and elitism to ensuring that the single best individual is copied over once into the next generation without modification, with a cross rate of 0.65 and a variable mutation rate of 0.003 initially and gradually increased later on. In the galactic rotation-curve problem, the GA produced two curves, both of which were very good fits to the data. In solving for the six critical parameters of the solar wind, the GA successfully determine the value of three of them to an accuracy of within 0.1% and the remaining three to accuracies of between 1 to 10%. 7.6 Chemistry High powered, ultrasonic pulses of laser energy can split apart complex molecules into simpler molecules in the applications to organic chemistry and microelectronics, where the specific end products of such reactions can be controlled by modulating the phase of the laser pulse. But for large molecules, solving for the desired pulse shape analytically is too difficult because of its complex calculations and its relevant characteristics are not known precisely enough. This problem has been solved using evolutionary algorithm. The algorithm fires a pulse, measures the proportions of the resulting product molecules, randomly mutates the beam characteristics with the hope of getting theses proportions closer to the desired output. GA was able, according to Gillet (2002), to simultaneously satisfy the criteria of molecular diversity and maximisation synthetic efficiency and was able to find molecules that were drug-like. 19 xxiv University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 8. A A Adedeji Genetic Algorithms Simple Example Let us consider an equation: a + 2b + 3c + 4d = 30, where a, b, c, and d are positive integes. Given the constraints that, 1 a, b, c, d < 30. For the so-called ‘building blocks’ to be reached quicker since “better” solutions have a better chance of surviving. Starting from the beginning. Let us choose 5 random initial solution sets (one may wish to choose more as wished). It is possible to choose fewer constraints for b, c, d but for the sake of simplicity we use 30. Table 2 (a). 1st generation Table 2(a) 1st generation chromosomes and contents Chromosome Solutions to reach A B C 1 1 28 15 2 14 9 2 3 13 5 7 4 23 8 16 5 9 13 5 their D 3 4 3 19 2 To calculate the fitness values, plug each solution set into he expression a+2b+3c+4d, then calculate the absolute of the difference of each expression with 30. This is the fitness value. Table 2 (b) Fitness value of 1st generation chromosome, solution tests Chromosome Fitness value 1 2 3 4 5 114 – 30 = 84 54 – 30 = 24 56 – 30 = 26 163 – 30 = 133 58 – 30 = 28 Since the values that are lower are closer to the desired answer (i.e. 30), these values are more desirable. In this case high fitness values are not desirable while lower ones are. In order to create a system xxv 20 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji where chromosomes with more desirable fitness values are more likely to be chosen as parents, we must first calculate the percentages that each chromosome has to be picked. A sum of the multiplicative inverses of the fitness values (0.135266) are calculated and the percentages from there (Note that all simulations were created using a random number generator) are obtained. See Table 2©. Table 2 © Parent selection by % Chromosome Likelihood 1 2 3 4 5 (1/84)/0.135266 = 8.8% (1/24)/0.135266 = 30.8% (1/26)/0.135266 = 28.4% (1/133)/0.135266 = 5.56% (1/28)/0.135266 = 26.4% In order to pick the 5 chosen pairs of parents. Each parent will have one offspring and has 5 new solutions sets total. Consider a die with 10,000 sides, and on the 880 of those sides chromosomes 1 was labelled and on 3080 of those sides, chromosome 2 was labelled and on 2640 sides 3 was labelled and on 556 and 2640 of those sides chromosome 4 and 5 were labelled respectively. In order to choose our first pair (of parents) we role the die twice (each for a parent) and then take those chromosomes to be our first two parents. Continuing in this fashion we have the following parents as shown in Table 2 (d). Table 2 (d) Simulated selection of parents Father Mother Chromosome Chromosome 3 4 3 2 5 1 2 5 5 3 The offspring of each of these parents contains the genetic information of both father and mother. Here crossover technique is applied. We may say that a mother has solution sets of a1, b1, c1, d1, and a father a2, b2, c2, d2, then there can be six possible crossover dividing lines (refer to section 4.5 on crossover). xxvi 21 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Father Chromosome Table 2(e) Generalisation of crossover Mother Offspring chromosome Chromosome a1 b1, c1, d1 a1 b1, c1, d1 a1 b1, c1, d1 a2 b2, c2, d2 a2 b2, c2, d2 a2 b2, c2, d2 a1 b2, c2, d2 or a2 b1, c1, d1 a1 b1, c2, d2 or a2 b2, c1, d1 a1 b1, c1, d2 or a2 b2, c2, d1 Let us apply this to our offspring: Table 2 (f). Table 2 (f) Simulated crossover from parent chromosomes Father Mother Offspring chromosome Chromosome Chromosome 13 5, 7, 3 9, 13 5, 2 13, 5, 7 3 14 8, 2, 4 13, 15 7, 3 1 28, 15, 3 14, 9 2, 4 9, 13, 5 2 9 13, 5, 2 9, 13 5, 2 13, 28, 15, 3 9, 13, 2, 4 13, 5, 7, 2 14, 13, 5, 2 13, 5, 5, 2 Now fitness values can be calculated for the new generation of offsprings. See Table 2 (g). Table 2 (g) Fitness values of offspring chromosomes Offspring Fitness Chromosome Chromosome 13, 28, 15, 3 9, 13, 2, 4 13, 5, 7, 2 14, 13, 5, 2 13, 5, 5, 2 126 – 30 = 96 57 – 30 = 27 57 – 30 = 27 63 – 30 = 33 46 – 30 = 16 The average fitness value for the offspring chromosome were 38.8, while the average fitness value for the parent chromosomes were 59.4. In the next generation, the offspring are supposed to mutate. If after the mutation has been done one chromosome should eventually reach a fitness level of 0 eventually. That is where a solution is found 22 xxvii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji 9. Genetic Algorithms in Optimal Design Genetic algorithms were developed to solve unconstrained optimisation problems. However, engineering design problems are usually constrained. They are solved by transforming the problem to an unconstrained problem. The transformation is not unique and one possibility is to use the following strategy: Find Minimise : x = [bx1,…, bxNEBV; ix1,…,ixNNIV; sx1,…, sxNSBV] f ( x) c i Max (0, g i ) c j h j i (1) (2) i where design variables b, i and s = Boolean, inequalities and continuos respectively, ci and cj = penalty parameters used with inequality and equality constraints. Determining the appropriate penalty weights is always problematic. An algorithm can be proposed here where the penalty weight is computed automatically and adjusted in an adaptive manner. First the objective function is expressed: f ( x) ca Max (0, gi ) h j i (3) i In order to select ca : (i) ca is set as the minimum f(x) among all feasible designs in the current generation, if there are feasible designs in the current generation. And if the maximum f(x) among all feasible designs is used, infeasible designs will have a smaller probability to survive even if the constraint violations are small; (ii) ca is set as the f(x) that has the least constraint violation if there is no feasible design. The general constrained nonlinear programming problem can be stated as follows: Minimise f(x) Subject to gj(x) 0, (4a) j = 1, 2, …q (4b) Where f(x) = cost(fitness) function, x = {x1, x2,….xn}T = a vector of n design variables, gj(x) (j = 1, 2, …q) = constraints functions. This can be transformed into the following model: 23 xxviii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Minimise f(x) Subject to g ( x) (5a) n ln exp[gi ( x)) 0 i 1 1 (5b) 1 n i 1 The parametric constraint evaluation function ln exp[g i ( x)) 0 and if the optimisation problems in equations (4) and (5) and have the same Kuhn-Tucker points. In other word equation (5) can be solved by using quasi-exactness penalty function. n ( x, a) f ( x) ln exp[gi ( x)) 0 i 1 a (6) Parameter can be chosen in the range103 to 105 and a > 0 is the penalty factor. The fitness function of GA therefore is: Max F(x, a) = c - (x, a) (7) C is a large positive number to ensure F > 0. Typically, cost is the most popular optimisation criterion in structural design. Cost is a function of the total weight of the structure. Other important factors that may be considered in estimation of the cost of a structure are associated with maintenance (relating to the total surface area for structural element) and connections. For example, framed structures, where total weight is the only term in the objective function subjected to stress, displacement, and fabrication constraints, the optimisation problem may be defined as: Minimise H zW e Le Ae (8) e Subject to the following constraints: {l} {all} {u}, dl dall du and Al Aall Au 24 xxix (9) University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji where e, Le and Ae = material density, length and cross-sectional area of the element e respectively, {}, d and A represent the constraints for stress, displacement and area respectively. Subscripts i and u refer to the prescribed lower and upper boundaries of each constraint. In GA, to evaluate the performance of a solution string, the string’s binary characters are decoded into values of the design variable representing the properties of the structure. Using these design variables, a structural analysis may be performed using Finite Element method of analysis. After which the value of the objective function as given in equation (4) is computed. Now if any constraints are violated, a penalty (i.e. the degree in which the constraints are violated) is applied to the objective function. Therefore the penalised objective function provides a relatively meaningful measurement of performance of the solution string. Typically the penalty functions are of the form: c i 1 k 1 c max n (10) where i = the penalty constraint i, k = penalty factor, c = value of the constraint from a solution string, cmax = value of the constraint i and n = penalty rate. The penalty objective function of a particular string can be obtained by multiplying the fitness value or cost objective (ie weight of the stricture) by the corresponding penalty factor k. so that: m P W i (11) where P = penalized objective function, W = weight of the structural member and m = total number of points where the constraints are checked and the product representing the total penalty for i constraints. Once the fitness of each string in the population is determined from the penalised objective function values, a new generation of string is produced using reproduction operator (see Reproduction for crossover and mutation (of 0.1%) methods in section 4.4). After a mutation operation is applied to the population a new generation is reproduced. 25 xxx University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji In this case the population is divided into several partitions. The strings inside each partition are assigned the same probability of being selected as parent strings. This reproduction scheme may be based in the elitist model (see selection 4.4) as proposed by De Jong (1975) where the partitioning may improve local search in the neighborhood of the upper partition of the population. As such global exploration of the search space may be prohibited. 26 xxxi University of Ilorin, Ilorin, Nigeria Department of Civil Engineering Problem Formulation Examples 10. 10.1 A A Adedeji Example 1 In this section, the discrete weight optimization of a 10-bar plane truss shown in Fig.7 will be solved using a floating point GA. Forty two shapes taken from BS5950 manual are available and are given in SI units in Table . The assumed data are modulus of elasticity, E=68.9 x 103 MPa, density of the material, =2770 kg/m3, allowable stress = ±172 MPa and allowable displacement = ± 50.8mm. 5 3 1 1 2 9 7 5 6 8 6 9m 10 3 4 445 kN 9m 4 2 445 kN 9m Fig.7 Plane truss system with 10 steel-bars 10.1.1 Problem formulation The mathematical model of minimum weight design using available member sizes can be expressed as in the following: m Min.W L j A j ( i ) j (i ) 1,2,...42 (12) i = 1, 2, . . .10 (13) i 1 Subject to: stress i - all 0, deflection k - all 0, k = 1, 2, …12 xxxii 27 (14) University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji where A is a cross sectional area pointed by the 10-element design vector j(i). For example, A8(3) is the shape 8 from Table 3, pointed for member 3 (A8(3)) =1858 mm2). And and Li are, density and length for that member respectively. Inequalities (equations 4 and 5) express the constraints on stresses and vertical and horizontal deflections of joints. The design vector j (i) is treated as a floating point number, and its integer part is used as a pointer. Since there are 10 design variables and 42 available shapes, the intrinsic size of the search space is 4210 (1016). Table 3 – Properties of Steel Shapes Shape 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Area (mm2) 1045 1161 1284 1374 1535 1690 1697 1858 1890 1993 2019 2181 2239 2290 Shape 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Area (mm2) 2342 2477 2497 2503 2697 2723 2897 2961 3097 3206 3303 3703 4658 5142 Shape 29 30 31 32 33 34 35 36 37 38 39 40 41 42 Area (mm2 7419 8710 8968 9161 10000 10323 10903 12129 12839 14193 14774 17097 19355 21613 As the present problem is a constrained optimization one, it is necessary to transform it into an unconstrained problem. Many alternatives are possible. In this study, a transitional exterior penalty approach is used. The transformed model is expressed as follows: m 12 10 Min.W Aj (i ) Li P i (ei 1) k (ek 1) i 1 1 i 1 j (i) 1,2,...42 (15) in which = 1 for = 0 or = 0 and P is a penalty coefficient. In order to compare the results properly with those from the literature, all the computations are done in the original units used by the other researchers, and then converted to SI units. For a typical run, very little computing time, in order of few minutes on a Pentium III, 1.2 GHz, is 28 xxxiii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji required. The use of PseudoCode program with the relevant parameters is given in the Appendix II, while Appendix III shows the flow chart for executional steps on GA. 10.1.2 Genetic operators In this work, the following GA operators are used: Tournament selection: The selection operator is intended to improve the average quality of the population by giving individuals of higher fitness a higher probability to be copied into the next generation. Tournament selection works as follows: Choose two individuals randomly from the population and copy the best individual into the intermediate population. Whole linear crossover: Crossover operator is intended to combine the genetic data of the existing population and generating offsprings. Pair of chromosomes are recombined on a random basis to form two new individuals. If according to a probability of crossover parameter, p c, there is crossover, then a whole linear crossover is used. From two parents P1 and P2, three offsprings are generated, namely 0.5P1+0.5P2, 1.5P1-0.5P2, and -0.5P1+1.5P2. The best two of the three offsprings are then selected. Non-uniform mutation: Mutation operator plays a secondary role. It allows new genetic patterns to be formed, thus improving the search method. Occasionally, it protects some useful genetic material loss. During the process, a rate of mutation, pm, determines the possibility of mutating one of the design variables. If a variable (V) is chosen to be mutated, its value is modified as follows: V = V + (t, bU – V) Or (16a) V = V - (t, bL – V) (16b) where t is the actual generation, bU and bL the upper and lower bounds for the variable, and (t, y) is given as (Turkkan,,2003), (t, y) = y (1 – r(1 – c/T)2) (17) where r is a uniform random number between 0 and 1, T is the maximum generation, and b is a parameter determining the degree of dependency on the generation number (usually between 1 and 5). 29 xxxiv University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Elitist strategy: In standard GA the best possible solution is not preserved, thereby increasing the chance of loosing the obtainable best possible solution. Elitist strategy overcomes this problem by copying the best member of each generation into the next one. 10.1.3 Comparison of results The result produced in this example is compared with the bit string coded GA solutions obtained by several researchers as shown in Table 4. It is believed that the minimum weight obtained by Cal and Thierauf (1993) and the present work is the global minimum, therefore the best possible solution. The solutions obtained by Galante (1996) and Ghasemi et al. (1999) are not acceptable solutions in a mathematical sense, as they violate slightly the displacement constraint. It is observed that the vertical displacement of node 2 is the binding constraint and a maximum stress of 99 MPa, well below 172MPa, is reached in member 5. State of stress and displacement of the structure is shown in Fig. 8. Because of its simplicity and ease of coding the floating point GA procedure described here can be applied to a wide variety of optimization problems. It has been shown here that it can be also used successfully in the discrete weight optimization of structures. Despite the large design space of permissible solutions, the procedure converged rapidly towards the best possible solution. Table 4. Comparison of the optimum solution for the truss system Method I II III IV V VI Weight (kg) 2545.4 2490.6 2534.1 2475.9 2471.0 2490.5 2y (mm) -50.5 -50.5 -50.5 -51.1 -51.2 -50.5 1 42 42 41 42 42 42 2 1 1 1 1 1 1 3 38 39 39 38 38 39 Note: Shape of members 4 5 6 7 33 1 1 32 32 1 1 26 30 1 1 31 32 1 1 28 31 1 1 28 32 1 1 28 I: Rajeev and Krishnamoorty (1992) II: Cai and Thierauf (1993) III: Coello (1994) IV: Galante (1996) V: Ghasemi & al. (1999) with population = 100 VI: Present work all = 50.8 mm, all = 172 Mpa, and max = 99 Mpa (number 5) 30 xxxv 8 37 38 38 38 39 38 9 37 38 38 38 39 38 10 6 1 1 1 1 1 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Fig.8 deformed shape of the truss system at minimum weight 10.2 Example 2 10.2.1 Floor planning This section uses a floor-planning problem [Radford and Gero, 1988], in Table 5, to follow the issues discussed so far. Consider an apartment floor-plan of 3-bedrooms, a living room, Kitchen, bath and a hall. The problem is to find the length and width of each room that will minimize the cost of the apartment, subject to some constraints. The cost for each room in this case is the area except for the cost of the kitchen and bathroom, whose costs are twice their respective areas. The constraints are: Table 5 Dimensions of the rooms Room Living Kitchen Bath Hall Bedroom 1 Bedroom 2 Bedroom 3 Length (m) Min Max 2.44 6.10 1.83 5.49 1.68 1.68 1.68 1.68 3.05 5.19 2.75 6.10 2.44 5.49 Width(m) Min Max 2.44 6.10 1.83 5.49 2.59 2.59 1.07 1.83 3.05 5.19 2.75 6.10 2.44 5.49 Min 36.60 15.25 Area (mm2) Max Proportion 91.50 1.5 36.60 Any 5.20 30.50 30.50 30.50 21.96 54.90 54.90 54.49 Any 1.5 1.5 1.5 Further, there must be a space -- 3.0 units -- for a doorway in the walls connecting bed2 and bed3 to the hall, and all rooms are rectangular (as is the entire plan). 31 xxxvi University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji This design problem is a nonlinear optimization problem and can be formulated mathematically as follows. Let length be the horizontal dimension and width the vertical dimension, then the variables are given in Table 6. Table 6 Design variables due to rooms dimensions Room Length/width Label Living Length X1 Living Width X2 Kitchen Length X3 Kitchen Width X4 Bedroom 1 Length X5 Bedroom 2 Length X6 Bedroom 2 Width X7 Bedroom 3 Width X8 Although at first glance there appear to be fourteen variables, one each for the length and width of each room, analysis of the problem reveals that some of the variables can be computed from others. For example the width of the hall is the width of the living room minus the width of the bathroom. The design task is to minimize the cost of the apartment, that is to: minimise zcost = X1X2 + 2X3X4 + 9350 (cost of bath in N year2005) + 1.69(X2 - 2.59) + X4X5 + X6X7 + X6X8 (18) subject to the following constraints: Living X1, X2 6.10, X1, X2 2.44, X1/X2 1.5, X1X2 91.5, X1X2 36.6, Kitchen X3, X4 5.49, X1, X2 1.83, X1X2 36.6, X1, X2 15.25 Hall 1.68 (X2 - 2.59) 21.95, 1.68 (X2 - 2.59) 5.20, Bedroom 1 X3, X4 5.19, X3, X4 3.05, X5 X4 54.9, X5 X4 36.6, X5/X4 1.5, Bedroom 2 X6, X7 6.10, X6,X4 2.75 X6 X7 54.9, X6 X7 36.6, xxxvii 32 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji X6/X7 1.5, Bedroom 3 X8, X6 5.49, X8,X6 2.44. X8 X6 54.9, X8 X6 36.6, X6/X8 1.5 Doorways (in hall) X7 – 2.59 0.92, X8 – X4 0.92 The whole plan is rectangular therefore: X1 + 1.68 = X3 + X5 Wall alignments: 2.59 + (X2 – 2.59) + X4 = X7 + X8 = X2 + X4 (19) (20) (21) Using GA in this problem, the constraints must be incorporated in the encoding or the objective function (zcost) and the design variables (X1...X8) have to be represented in a form suitable for GA. Each variable must be encoded in a bit string and the strings of all variables forming the genotype. Since the minimum and maximum value of each variable is given, only the range (the difference between the maximum and minimum values) needs to be represented. The maximum range is 12 and as an accuracy of about 0.5 units is sufficient, 11 bits are used to encode the variables with a range of 12 and 10 bits for the rest. 11 bits is used to represent values from 0 to 2046 and mapped to the values from 0 to 12, so that if Y1 represents the binary encoded value of the first variable (X1’s) range, the length of the living room is computed as: X 1 Min ( X 1 ) 100.0 x12.0 Y1 ( 22) where Min (X1) = 2.44 (minimum length of the living room. The GA therefore codes for the range from 0 through 12 in increments of 12.0/20.48. Increasing the number of buts for Y1 by 1 results in a precision of 12/40.96, so that the minimum and maximum lengths and widths of rooms are represented in the encoding. 33 xxxviii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Violation of constraints on area, proportion, door and wall alignments take the form of penalties which increase the total cost. Thus the function to be minimised – the objective or evaluation function – becomes: zcost = X1X2 + 2X3X4 + 9350 (cost of bath in N year2005) + + 1.68 (X2 - 2.59) + X4X5 + X6X7 + X6X8 + penalties (23) from this analysis, GA can now work on the encoded design problem in the following stages( model of analysis, synthesis and evaluation): Starting with an initial random population of solution encoded as described above Selection evaluate candidate solution Crossover and mutation synthesize new solution The minimum cost by sequential linear programming (an optimisation technique that first converts problem to a linear on and then solve it) is 715.98 units and this solution violates some of the constraints. When considering a population of 30, crossover probability of 0.9 and mutation of 1% (0.01), GA finds that the costs range from 689.30 to 752.92 with various degrees and types of constraints violations. One can choose among the solutions. 10.3 10.3.1 Example 3 Optimization model Variables in this example represent those parameters that define a building design and were passed to a building simulation program. For example, window-type is a variable in the system. Several window types can be set as alternatives to other window types to the designer’s requirement. Some variables such as window type can only be of discrete type while some variables (e.g., orientation) can be either continuous or discrete. In this example, the types of buildings considered are limited to a rectangular shape with known total floor area. Figure 9 illustrates the definition of some variables, as proposed by Weimin et al (2003). These are: Building Orientation (Orientation) xxxix34 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Aspect Ratio (aspect Ratio) defined as a/b, where a and b are shown in Figure 9. Window Type (WinType). Window area ratio for each building façade (WinRatio) Wall Type (WallType) in terms of materials a Side 3 Side 4 Side 2 North (building) Orientation 30 True North Fig. 9 Definition of orientation and aspect ratio. Each layer of wall (WallLayer). The total number and the arrangement of layers are dependent on wall type. Roof Type (RoofType). Because it is essential to explore the relationship between economical performance and environmental performance, Life cycle Cost and LifeCycle Environmental impact (LCEI) are coupled together using weighted secularization method. Assuming (x) as the variable vector, the integrated objective function F(x) can be expressed as: F(x) = w1 LCEI (x) + w2 LCC (x) (24) xl 35 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji where w1 and w2 are predefined weights for life-cycle environmental impact and life-cycle cost respectively. LCEI is the life-cycle environmental impact using energy as an indicator criterion, LCC.= lifecycle cost for service. If the weights were reversed and set to (w1 = 1 and w2 = 0) then all the emphasis is placed on minimizing the variance of the objective function without regard to the mean. There are an infinite number of possible weights that are each Pareto optimal, in which its solution is not possible to improve one of the objectives without worsening the others. The weighted sum approach does not generate all the Pareto solutions for some problem, but since this work is focusing on the extreme points of the Pareto front, adoption of this method is adequate (Parkinson et al, 1998). The general expression (for construction and operational or services) to calculate LCEI is: LCEI (x) = EE (x) + OE (x) (25) where EE = Embodied energy, that is the expanded cumulative exergy consumption due to building construction and is assumed 0 initially, because most of the sources data before the commencement of the construction are not certain and that the building is assumed not yet in service, and only OE which is the operating energy is considered as the expended cumulative exergy consumption due to building operation and service. EE (x) and OE (x) were employed in the analysis when the building is assumed in service. The general expression to calculate LCC is: LCC (x) = IC(x) + OC (x) (26) where, IC = Construction cost due to waste emission, was not as well considered initially in the analysis because the analytical building was assumed not to be in service, but are used during the service life, OC = Operating and service cost, including both demand and energy consumption costs. In this example however, the building load calculations is coupled with the optimization model to estimate the annual peak energy consumption and demand (CExC) due to ventilation in the room as the results of heat produced (QH) by human, lighting (QL), electric motor engine (QE), radiation by heater or wall materials(QR) and ventilators (fan or air conditioner) (QV). 36 xli University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 10.3.2. A A Adedeji Structured genetics algorithm The selection of an optimization algorithm depends on the peculiarities of a problem domain. The previous formulated problem in equations (24) to (26) has the following characteristics: If the following variables and corresponding number of alternatives (the number in parenthesis) are considered: orientation (2), aspect Ratio (1), WinType (3), WallType (3), RoofType (1), WinRatio (1), each WallLayer (1), then there are about 2xE6 or 2.5xE10 possible solutions to explore. Both continuous and discrete variables may exist in the same optimization problem. The shape of criteria space is unknown. Genetic Algorithms (GAs) are good at exploring large search space because of its implicit parallel computation mechanism. The binary string representation can deal with both continuous and discrete variable. Compared with conventional numerical methods, genetic algorithms are able to locate global optimum without trapping into local extreme point. All these advantages determine that GA is an appropriate candidate to solve the above formulated problem. Structured GA lies in its redundant genetic materials and a genetic activation mechanism. 10,3,3 Problem formulation The 14th (last) floor of a multi-story (Shell House) office building located in Lagos Island, Nigeria, is a building in which the environmental and physical data has been measured and used in this example. The results of measurement and data (size of the rooms, area of opening sizes and types, wall materials and finishes, electrical lighting, fans and airconditioning power outputs) used were parts of the work carried out by Ojediran (2004). The floor plan has a total area of 238.336m2 with 50year life expectancy. The following assumptions (materials, and other physical properties) were made and used in the analysis: Only the energy, consumed in the hot season of March, April and May, has been used in the analysis. Rooftop units of aluminum are assumed to be used. xlii 37 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Two wall types are considered; cement plastered straw bale and sandcrete block (used for the construction of the specimen building) walls. Other properties are shown in Table 7. Because the sizes of the relatively expensive windows were small, even in the best energy-performance cases, the size values are not used in the analysis. Only one roof type has been considered with asbestos cement hanging ceiling, shielding the heat away from the room. So, the energy factor, through the roof at this stage, is negligible and it was not used in the analysis. Table 7. Average properties of materials Properties Strawbale wall Sandcrete wall Size, L x B x H (mm) 1066 x 406.4 x 584 445 x 215 x 215 Density (kg/m3 9300 1500 U-value (W/m2K) 0.13 (of 420mm thick) 1.73 (of 250mm thick) R-value (m K/W) 13.21(of 420mm thick) 0.58 (of 250mm thick) Reliability of wall 0.89 0.77 Note: U –value = thermal conductivity, R-value = thermal resistivity Energy factors produced and consumed during the three months as the annual peak energy consumption and demand (CExC) in section 3.1 are shown in Table 8 and were obtained using equations (a1) to (a5) in Appendix III.). Table 8. Energy consumed per hour Energy factor QH QL QE QR QV Total Energy consumed (MJ) Strawbale wall Sandcrete wall South East East South East East 0.076 0.076 0.362 0.362 0.476 0.476 0.133 0.133 0.162 0.162 0.567 0.567 0.059 0.067 0.222 0.222 1.417 1.417 6.909 6.909 2.190 2.190 8.193 8.193 Note: (QH) by human, lighting (QL), electric motor engine (QE), radiation by heater or conduction from sun’s heat through wall materials(Q R) and ventilators (fan or air conditioner) (QV). xliii 38 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji For definitions of the energy factors, see Appendix IV. Cumulative energy consumption per hour is 2.190 MJ for the building walls built with strawbale and 8.193 MJ for the building with sandcrete. The general inflation rate, discount rate, and energy escalation rate of 30% is not included in the computation as that varies and the addition could be made as required. In October 2005, the electricity rate was N5.187/h (kW) of billing demand of the electricity consumption. Single glazing is the window panel-type used for this building. There are two wall types: masonry sandcrete block wall built as infill into the reinforced concrete frame. In this analysis, the first wall type is composed of cement plastered strawbale as shown in Fig. 10a. The second wall type is composed of sandcrete blocks, and finished with cement plasters as shown in Fig.10b. The south-wall absorptivity was always at high values, either 0.6 or 0.8 while the north-wall absorptivity had more random values, because solar gains were not significant in that direction. Hence, its absorptivity values were not used in the analysis. Plaster – Strawbale – Plaster Plaster – Sandcrete - Render Direction of Environmental Microclimatic conditions Region tplaster tstraw tplaster tplaster t tsandcrete tplaster t Figure 10 Sections of the walls Another set of simulation was done with the building rotated by 30o so that it would face South-East. Energy-consumption levels were always higher for this orientation than for South-North, as expected. However, costs remained lower, Considered Genetic algorithms operations are: - Global search algorithms: GA Local search algorithm: gradient method xliv 39 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering - A A Adedeji Population size: 20 Crossover rate 0.1 Mutation; 0.1 Reproduction rate: 2 offsprings Generations: 3 of 0.15 Tournament selection and elitist strategy are used in this GA implementation. 10.4. Results and Conclusion Four weighting sets are used in this example. The two extreme cases (case 1 and case 3) are actually single performance criterion optimization with the life cycle environmental impact and life-cycle cost as the objective function respectively. The minimum function value was obtained from the two extreme weighting cases 2 and 4. The programme for each weighting set are used to normalize the life-cycle environmental impact and life-cycle cost in weighting sets are used to normalize the life-circle environmental impact and life –cycle cost in weighting case 2 and 4. The optimal values of variables obtained from the best run of each weighting set are presented in Table 9 and in Figs 11 and 12. It can be seen from this table and the figures that: (1) The optimal aspect ratio is about 0.33 when the optimization criterion is the life-cycle environmental impact, for the strawbalewalled building and 0.80 for the life-cycle cost for sandcrete-walled building. (2) When environmental performance is the only criterion, the plastered strawbale walled building is economically viable than the building of sandcrete walls. However, sandcrete block wall is recommended when the life-cycle cost is considered in the overall criterion. (3) The minimum allowed window area is preferred for both environmental and economical performance. (4) Threshold is 0.48 in the sandcrete walled building and 076 in strawbale house when considering the cost of material and service as a design criterion. (5) At the weight value of 1, the energy consumption of the two wall materials is the same. It was observed that the energy consumption of strawbale house increases with time, but decreases in the building of sandcrete walls. 40 xlv University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Table 9 Optimal values of variables from the weighting sets Variables & performanc e Orientation Aspect ration WinRatio WallType 1 (Strawbale) WallType 2 (Sandcrete) w1=0.7, w2=0.3 1 w1=0.3, w2=0.7 2 w1=1, w2=0 3 W1=0, w2=1 4 30 0.1 0 0.9 0 0.8 0 0.33 0.54 1 0.54 1 0.54 1 0.54 1 1 1 1 1 SB 7.71 E4 7.39 E6 LCEI (MJ) LCC (N) SC 1.0853 E5 3.245 E7 SB 4.778 E3 3.6240 E7 SC 1.309 E5 1.398 E7 SB 2.753 E4 1.057 E7 SC 1.5062 E5 1.507 E4 SB 1.0062 E5 4.6315 E7 SC 8.500 E4 9.030 E4 COST DUE TO MATERIAL AND 6 SERVICES (LCC) x10 (N) Note: LCEI = Life-cycle by environmental impact due to energy resource consumption, LCC =cost due to service. SB = strawbale wall, SC = sandcrete block wall. Note: 1N = $0.0074 (Nov., 2007). 80 Sandcrete wall R2 = 0.4617 60 40 Strawbale wall, R2 = 0.7824 20 0 -20 0 0.3 0.7 1 ENERGY CONSUMPTION ON LIFECYCLE (L CEi) MJ WEIGHTS (w 1 and w 2) Figure 11 Priority cases (w1, w2) due to life cycle for cost criteria on microclimate condition 40 35 Sandcrete wall, y = -11.237Ln(x) + 37.18 30 25 20 15 10 Strawbale wall, y = 12.926Ln(x) + 4.8086 5 0 0 0.3 0.7 WEIGHTS (w1, w2) Figure 12. Priority cases(w1, w2) due to life-cycle for energy consumption on microclimate xlvi 41 1 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji The building performance corresponding to each optimal solution is also shown at the bottom of Table 9. The evolution of the best solution ever found for life-cycle environmental impact and life-cycle cost in Figure 11. The process evolves rapidly during the first 30 generations and then slowly at later generations. This demonstrates that genetic algorithms can perform better in locating the optimal region than in local search. It can be observed that the optimization is effective to improve building performance. In Figs 11 and 12, it is shown that cost of materials and the service is low in a sandcrete walled building during its life cycle. The strawbale building consumes less energy during its early service at the weighted value of 1. it is shown in Fig. 13 that strawbale walled building resists environmental impact than the sandcrete-walled house at the generation of 0.6 and 0.1 respectively. 1.2 Sandcrete wall FITTNESS 1 Strawbale wall 0.8 0.6 0.4 0.2 0 10 20 30 40 50 60 GENERATION Figure 6 Life-cycle environmental impact convergence. Exergy, which is also an example stated in this book, is a useful concept to be employed in life-cycle environmental optimization problems. It can overcome the difficultly brought by integrating impacts with varied magnitudes and units. With expanded cumulative energy consumption, the optimization problem can be simplified by incorporating all impact categories into one objective function. The results have shown the threshold of 0.48 in the sandcrete walled building and 076 in strawbale house when considering the cost of material and service as a design criterion. 42 xlvii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji At the weight value of 1, the energy consumption of the two wall materials is the same. It was observed that the energy consumption of strawbale house increases with time, but decreases in the building of sandcrete walls. 43 xlviii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji 11 Conclusion and Recommendations This book has illustrated how genetic algorithms model the design process. They mirror the three-stage model of analysis, synthesis and evaluation searching through a large space of possible designs for nearoptimal structures. In interactive systems where human designers can help evaluate ill-defined criteria (beauty, elegance etc.), GAs only need pairwise comparisons of candidate solutions and do not need other more time consuming evaluations. Because of its simplicity and ease of coding the floating point GA procedure described here can be applied to a wide variety of optimization problems. It has been shown here that GA can be also used successfully in the discrete weight optimization of structures. Despite the large design space of permissible solutions, the procedure converged rapidly towards the best possible solution. A floor-planning problem was used to illustrate the issues involved in analyzing and encoding a problem for a genetic algorithm. Nevertheless, there are problems. Usually, domain information resides in the evaluation function, but performance of a GA depends on the suitability of the encoding. That is, whether it follows the two principles of GA encodings. Domain knowledge also plays a large part in deciding if a particular encoding is appropriate. But given the same problem and encoding, is a genetic algorithm expected to perform better than other blind search algorithms? And whatever the underlying values of a knowledge-base and its representation, there is first the problem of encoding this domain knowledge for a GA. Third, although GAs may be expected to invent new designs, analysis of why the design works and what are its strong and weak points is difficult. Finally, the time to convergence -- the time that a GA should run -- must be bounded before a computational tool can be advanced. Because the economical performance and environmental performance cannot take optimal values at the same time, a multi-criteria optimization model is highly useful for decision-making in an environmental – friendly building design. A disadvantage of the weighted scarlarization technique is that only one optimal value is obtained for each weighting set. Different weighting sets need to be tested to explore different optimal solution. Nevertheless, the application of the weighted values gives the quick view of the conditions to take into consideration in design. 44 xlix University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji 12. References Ayres, R.U., Ayres, L.W., and Martinas, K. (1998), Energy, waste accounting, and life-cycle analysis, Energy, Vol.23, No5,pp.351-363. Barnthouse, L., Noesen, S. Norris, G., Owens, J., (1998), .Life cycle impact assessment: The state – of- the art, 2nd edition, Setac press, Pensacola, FL. British Standards, BS 5950, Steel Design, BSI, London Cai, J and Thierauf, G. (1993) Discrete structural optimization using evolution strategies, Technical Report, Dept. of Civil Eng., University of Essen, Essen, Germany. Caldas, L. G. and Norford, L. K. (2003), Genetic algorithms for optimization of building envelopes and design and control of HVAC system, Journal of Solar Energy Environment, Vol. 125, pp.343 - 350 Coello, C.A. (1994) Discrete optimization of trusses using genetic algorithms, EXPERSYS-94, I.I.T.T., 331-336. Coley, D.A. and Schukal, S. (2002). Low-energy design: Combining computer-based optimization and human judgment, Building and Environment, Vol.37, pp.1241-1247. Dawkins, R, (1986) The blind watchmaker: Why the evidence of evolution reveals a universe without design, W. W. Norton. De Jong, K. A. (1975), An analysis of the behaviour of a class of genetic adaptive systems, Doctoral dissertation, University of Michigan, Diss. Abstract (No. 76-9381) on international 36(10), 51408. Fain, B. and Rudnick, J. (1999), Conformations of closed DNA, Physical Review E 60, 7239-7252. Forrest , S. (1993) Genetic algorithms principles of natural selection applied to computation, Science, Vol.261, pp.872 – 678. 45 l University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Finnveden, G. (1994). Methods for describing and characterizing resource depletion in the context of life-cycle assessment, Technical Report, Swedish Environmental Research Institute, Stockholm, Sweden. Goldberg, D.E. and Samtani, M.P. (1986) Engineering optimization via genetic algorithm, Proc. 9th Conf. on Electronic Computation, ASCE, New York, NY, 471-484. Galante, M. (1996) Genetic Algorithms as an Approach to Optimize Real-World Trusses, Int J. Num. Meth. Engng.,39,361-382. Gillet, V.,(2002) Reactant and product-based approaches to the design of conbinatorial libraries, Journal of Computers Molecular Design, Vol. 16, pp 371 – 380. Ghasemi, M.R., Hilton, E. and Wood, R. D. (1999) Optimization of Trusses Using Genetic Algorithms for Discrete and Continuous variables, Engineering Computations, 3, 272-301 Haupt, R. and Haupt, S. E., (1998) Practical genetic algorithms, John Wiley & Sons. Holland, J.H. (1975) Adaptation in Natural and Artificial Systems, The University of Michigan Press, Ann Arbor. Holland, J.H. (1992) Genetic algorithms, Scientific American, July 1992, pp.66-72. Jekayinfa, S. O.(2006). Energy consumption pattern of selected of mechanical farms in South-Western Nigeria, The CIGRE Journal. Vol III. Obayashi, S., Daisuke, S., Yukihiro, T. and Naoki, H. (2000) Multiobjective evolutionary computation fro supersonic wing0shape optimisation, IEEE Transactions on evolutionary computation, Vol.4, No.2, pp.183 – 187. Ojediran, A., (2004), Ventilation assessment in a strawbale walled building, B.Eng. Project submitted to the Departmrnt of Civil Engineering, University of Ilorin, Ilorin, pp 1-71. 46 li University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Oviemuwo, A. O, (2001), The changing structure of Nigeria economy, http//www.ela.doe.gov/emeu/merc/merc94/ei/ei_html Porto, V., Fogel, D. and Lawrence. F. (1995) Alternative neural network training methods, IEEE Expert, Vol.10 No.3, pp.16-22 Radford, A. D. and Gero, J. S.(1998), design by optimisation in architecture, building and construction, Van Nostrand Reinhold Company, N.Y. Rawlins, G. J. E.,(1991) Introduction . in Rawlins, G. J. E. editor, Foundations of Genetic Algorithms 1, pp 1 – 12, Morgan Kaufmann. Sasaki, D., Masashi, M., Obayashi, S. and Nakahashi, K. (2001) Aerodynamic shape optimisation of supersonic wings by adaptive range multiobjective genetic algorithms, First International Conference EMO 2001, Zurich., Proceedings, K. Deb, L. Theile, C, Coello, D. corne and E. Zitler (Eds), Vol. 1993, pp.639 –452. Springer-Verlag. Sato , S. K., Otori, A. Tukizawa, H., Sakai, Y. A and Kawamura, H., (2002) Applying genetic algorithms to the optimum design of a concert hall, journal of sound and Vibration, Vol.258 No.3, pp.517 –526. Stump, D. M. Fraser, W. B. and Gates, K. E. (1997), The writhing of circular cross-section rods: undersea cables to DNA supercoils, Proc. R. Soc.Lond. A454, 2125 – 2156 Arbor. Wang, X, Jiye, T.,(2002) Parallel multi-frontal algorithm for structural shakedown analysis, Journal of Northeastern University, Vol.23,No.51, pp.115 –117. Weimin, W., Hugues, R., Radu, G. Z.(2003), Optimizing building design with respect to life-cycle environmental impacts, 8th International Conference, Eindhoven, Netherlands, pp 1355-1361. 47 lii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Appendix I Binary/Decimal Conversion Conversion to and from other numeral systems Decimal To convert from a base-10 integer numeral to its base-2 (binary) equivalent, the number is divided by two, and the remainder is the least-significant bit. The (integer) result is again divided by two, its remainder is the next most significant bit. This process repeats until the result of further division becomes zero. For example, 11810, in binary, is: Operation Remainder 118 ÷ 2 = 59 0 59 ÷ 2 = 29 1 29 ÷ 2 = 14 1 14 ÷ 2 = 7 0 7÷2=3 1 3÷2=1 1 1÷2=0 1 To convert from base-2 to base-10 is the reverse algorithm. Starting from the left, double the result and add the next digit until there are no more. For example to convert 1100101011012 to decimal: Result Remaining digits 0 110010101101 0×2+1=1 10010101101 1×2+1=3 0010101101 3×2+0=6 010101101 6 × 2 + 0 = 12 10101101 12 × 2 + 1 = 25 0101101 25 × 2 + 0 = 50 101101 50 × 2 + 1 = 101 01101 101 × 2 + 0 = 202 1101 202 × 2 + 1 = 405 101 405 × 2 + 1 = 811 01 811 × 2 + 0 = 1622 1 1622 × 2 + 1 = 3245 The result is 324510. The fractional parts of a number are converted with similar methods. They are again based on the equivalence of shifting with doubling or halving. In a fractional binary number such as .110101101012, the first digit is , the second , etc. So if there is a 1 in the first place after the decimal, then the number is at least , and vice versa. Double that number is at least 1. This suggests the algorithm: Repeatedly double the number to be converted, record if the result is at least 1, and then throw away the integer part. liii 48 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering For example, 10, in binary, is: Converting A A Adedeji Result 0. 0.0 0.01 0.010 0.0101 Thus the repeating decimal fraction 0.3... is equivalent to the repeating binary fraction 0.01... . Or for example, 0.110, in binary, is: Converting Result 0.1 0. 0.1 × 2 = 0.2 < 1 0.0 0.2 × 2 = 0.4 < 1 0.00 0.4 × 2 = 0.8 < 1 0.000 0.8 × 2 = 1.6 ≥ 1 0.0001 0.6 × 2 = 1.2 ≥ 1 0.00011 0.2 × 2 = 0.4 < 1 0.000110 0.4 × 2 = 0.8 < 1 0.0001100 0.8 × 2 = 1.6 ≥ 1 0.00011001 0.6 × 2 = 1.2 ≥ 1 0.000110011 0.2 × 2 = 0.4 < 1 0.0001100110 The final conversion is from binary to decimal fractions. The only difficulty arises with repeating fractions, but otherwise the method is to shift the fraction to an integer, convert it as above, and then divide by the appropriate power of two in the decimal base. For example: X = 1100 .101110011100... = 1100101110 .0111001110... = 11001 .0111001110... = 1100010101 X = (789/62)10 Another way of converting from binary to decimal, often quicker for a person familiar with hexadecimal, is to do so indirectly—first converting (x in binary) into (x in hexadecimal) and then converting (x0 Representing real numbers Non-integers can be represented by using negative powers, which are set off from the other digits by means of a radix point (called a decimal point in the decimal system). For example, the binary number 11.012 thus means: liv49 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering 1 × 21 (1 × 2 = 2) plus 1 × 20 (1 × 1 = 1) plus -1 0 × 2 (0 × ½ = 0) A A Adedeji plus 1 × 2-2 (1 × ¼ = 0.25) For a total of 3.25 decimal. All dyadic rational numbers have a terminating binary numeral—the binary representation has a finite number of terms after the radix point. Other rational numbers have binary representation, but instead of terminating, they recur, with a finite sequence of digits repeating indefinitely. For instance = = 0.0101010101...2 = = 0.10110100 10110100 10110100...2 The phenomenon that the binary representation of any rational is either terminating or recurring also occurs in other radix-based numeral systems. See, for instance, the explanation in decimal. Another similarity is the existence of alternative representations for any terminating representation, relying on the fact that 0.111111... is the sum of the geometric series 2-1 + 2-2 + 2-3 + ... which is 1. Binary numerals which neither terminate nor recur represent irrational numbers. For instance, 0.10100100010000100000100.... does have a pattern, but it is not a fixed-length recurring pattern, so the number is irrational 1.0110101000001001111001100110011111110... is the binary representation of , the square root of 2, another irrational. It has no discernible pattern, although a proof that is irrational requires more than this. See irrational number. [edit] References 1. ^ W. S. Anglin and J. Lambek, The Heritage of Thales, Springer, 1995, ISBN 038794544X online 2. ^ Bacon, Francis The Advancement of Learning, Book 6, Chapter 1, 1605. Online here. lv 50 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Appendix II PseudoCode 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. proc Step_Up(cea) : for s = 1 to MAX_STEPS do for x = 1 to WIFTH do for y = 1 to HEIGHTdo n_list = Compute_Neigh(cea, position(x,y)) ; Selected_inds = Perform_Selection(n_list) ; aux_pop = Apply_Reproduction_Operators(selected_index) ; end_for ; end-for ; cea= Replace(cea, aux-pop) ; Evaluate>population(cea) ; end_for ; end_proc STEP_UP ; OseudoCode of a simple GA Move the pointer over the words Present a brief explanation with the mean of the main algorithm’s line LINE 2 The algorithm runs until one of the two following stopping conditions is satisfied: The algorithm finds an optimal solution to the problem The algorithm reaches a certain number of generation (represented by MAX_STEPS) without finding an optimal solution and stops LINE 3 and 4 In such generation, the algorithm examines all the individuals of the population. This population is hold in a 2_D toroidal grid shape of size WIGTH x HEIGHT (more details). LINE 5 The neighbours of the individual placed on position (x, y) are stored in an empty list. LINE 6 The parents of the individual of position (x, y) are selected from the list created in line 5 and placed in a neqw list. Line 7 The parents of the individual of position (x,y) are selected from the list created in line 5 and placed in a new list LINE LINE LINE LINE LINE 9 End 10 Replace 11 Evaluate fo the population 12 End 13: set up lvi 51 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji APPENDIX III Flowchart (Executional Steps) of Genetic Programming Genetic programming is problem-independent in the sense that the flowchart specifying the basic sequence of executional steps is not modified for each new run or each new problem. Figure III below is a flowchart showing the executional steps of a run of genetic programming. The flowchart shows the genetic operations of crossover, reproduction, and mutation as well as the architecture-altering operations. This flowchart shows a twooffspring version of the crossover operation. Figure II Executional Steps for genetic algorithms Overview of Flowchart Genetic programming starts with an initial population of computer programs composed of functions and terminals appropriate to the problem. The individual programs in the lvii 52 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji initial population are typically generated by recursively generating a rooted point-labeled program tree composed of random choices of the primitive functions and terminals (provided by the user as part of the first and second preparatory steps of a run of genetic programming). The initial individuals are usually generated subject to a preestablished maximum size (specified by the user as a minor parameter as part of the fourth preparatory step). In general, the programs in the population are of different size (number of functions and terminals) and of different shape (the particular graphical arrangement of functions and terminals in the program tree). Each individual program in the population is executed. Then, each individual program in the population is either measured or compared in terms of how well it performs the task at hand (using the fitness measure provided in the third preparatory step). For many problems (including all problems in this book), this measurement yields a single explicit numerical value, called fitness. The fitness of a program may be measured in many different ways, including, for example, in terms of the amount of error between its output and the desired output, the amount of time (fuel, money, etc.) required to bring a system to a desired target state, the accuracy of the program in recognizing patterns or classifying objects into classes, the payoff that a game-playing program produces, or the compliance of a complex structure (such as an antenna, circuit, or controller) with user-specified design criteria. The execution of the program sometimes returns one or more explicit values. Alternatively, the execution of a program may consist only of side effects on the state of a world (e.g., a robot’s actions). Alternatively, the execution of a program may produce both return values and side effects. The fitness measure is, for many practical problems, multi-objective in the sense that it combines two or more different elements. The different elements of the fitness measure are often in competition with one another to some degree. For many problems, each program in the population is executed over a representative sample of different fitness cases. These fitness cases may represent different values of the program’s input(s), different initial conditions of a system, or different environments. Sometimes the fitness cases are constructed probabilistically. The creation of the initial random population is, in effect, a blind random search of the search space of the problem. It provides a baseline for judging future search efforts. Typically, the individual programs in generation 0 all have exceedingly poor fitness. Nonetheless, some individuals in the population are (usually) more fit than others. The differences in fitness are then exploited by genetic programming. Genetic programming applies Darwinian selection and the genetic operations to create a new population of offspring programs from the current population. The genetic operations include crossover (sexual recombination), mutation, reproduction, and the architecture-altering operations. These genetic operations are applied to individual(s) that are probabilistically selected from the population based on fitness. In this probabilistic selection process, better individuals are favored over inferior individuals. However, the best individual in the population is not necessarily selected and the worst individual in the population is not necessarily passed over. After the genetic operations are performed on the current population, the population of offspring (i.e., the new generation) replaces the current population (i.e., the now-old 53 lviii University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji generation). This iterative process of measuring fitness and performing the genetic operations is repeated over many generations. The run of genetic programming terminates when the termination criterion (as provided by the fifth preparatory step) is satisfied. The outcome of the run is specified by the method of result designation. The best individual ever encountered during the run (i.e., the best-so-far individual) is typically designated as the result of the run. All programs in the initial random population (generation 0) of a run of genetic programming are syntactically valid, executable programs. The genetic operations that are performed during the run (i.e., crossover, mutation, reproduction, and the architecture-altering operations) are designed to produce offspring that are syntactically valid, executable programs. Thus, every individual created during a run of genetic programming (including, in particular, the best-of-run individual) is a syntactically valid, executable program. There are numerous alternative implementations of genetic programming that vary from the foregoing brief description. Creation of Initial Population of Computer Programs Genetic programming starts with a primordial ooze of thousands of randomly-generated computer programs. The set of functions that may appear at the internal points of a program tree may include ordinary arithmetic functions and conditional operators. The set of terminals appearing at the external points typically include the program's external inputs (such as the independent variables X and Y) and random constants (such as 3.2 and 0.4). The randomly created programs typically have different sizes and shapes.. Main Generational Loop of Genetic Programming The main generational loop of a run of genetic programming consists of the fitness evaluation, Darwinian selection, and the genetic operations. Each individual program in the population is evaluated to determine how fit it is at solving the problem at hand. Programs are then probabilistically selected from the population based on their fitness to participate in the various genetic operations, with reselection allowed. While a more fit program has a better chance of being selected, even individuals known to be unfit are allocated some trials in a mathematically principled way. That is, genetic programming is not a purely greedy hill-climbing algorithm. The individuals in the initial random population and the offspring produced by each genetic operation are all syntactically valid executable programs. After many generations, a program may emerge that solves, or approximately solves, the problem at hand. Mutation Operation In the mutation operation, a single parental program is probabilistically selected from the population based on fitness. A mutation point is randomly chosen, the subtree rooted at that point is deleted, and a new subtree is grown there using the same random growth process that was used to generate the initial population. This asexual mutation operation is typically performed sparingly (with a low probability of, say, 1% during each generation of the run). lix 54 University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji Crossover (Sexual Recombination) Operation In the crossover, or sexual recombination operation, two parental programs are probabilistically selected from the population based on fitness. The two parents participating in crossover are usually of different sizes and shapes. A crossover point is randomly chosen in the first parent and a crossover point is randomly chosen in the second parent. Then the subtree rooted at the crossover point of the first, or receiving, parent is deleted and replaced by the subtree from the second, or contributing, parent. Crossover is the predominant operation in genetic programming (and genetic algorithm) work and is performed with a high probability (say, 85% to 90%). Reproduction Operation The reproduction operation copies a single individual, probabilistically selected based on fitness, into the next generation of the population. Architecture-Altering Operations Simple computer programs consist of one main program (called a result-producing branch). However, more complicated programs contain subroutines (also called automatically defined functions, ADFs, or function-defining branches), iterations (automatically defined iterations or ADIs), loops (automatically defined loops or ADLs), recursions (automatically defined recursions or ADRs), and memory of various dimensionality and size (automatically defined stores or ADSs). If a human user is trying to solve an engineering problem, he or she might choose to simply prespecify a reasonable fixed architectural arrangement for all programs in the population (i.e., the number and types of branches and number of arguments that each branch possesses). Genetic programming can then be used to evolve the exact sequence of primitive workperforming steps in each branch. However, sometimes the size and shape of the solution is the problem (or at least a major part of it). Genetic programming is capable of making all architectural decisions dynamically during the run of genetic programming. Genetic programming uses architecture-altering operations to automatically determine program architecture in a manner that parallels gene duplication in nature and the related operation of gene deletion in nature. Architecture-altering operations provide a way, dynamically during the run of genetic programming, to add and delete subroutines and other types of branches to individual programs to add and delete arguments possessed by the subroutines and other types of branches. These architecture-altering operation quickly create an architecturally diverse population containing programs with different numbers of subroutines, arguments, iterations, loops, recursions, and memory and, also, different hierarchical arrangements of these elements. Programs with architectures that are wellsuited to the problem at hand will tend to grow and prosper in the competitive evolutionary process, while programs with inadequate architectures will tend to wither away under the relentless selective pressure of the problem's fitness measure. Thus, the architecture-altering operations relieve the human user of the task of prespecifying program architecture. There are several different architecture-altering operations (described below). They are each applied sparingly during the run (say, with a probability of 1/2% of 1% on each generation). 55 lx University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji The subroutine duplication operation duplicates a preexisting subroutine in an individual program gives a new name to the copy and randomly divides the preexisting calls to the old subroutine between the two. This operation changes the program architecture by broadening the hierarchy of subroutines in the overall program. As with gene duplication in nature, this operation preserves semantics when it first occurs. The two subroutines typically diverge later, sometimes yielding specialization. The argument duplication operation duplicates one argument of a subroutine, randomly divides internal references to it, and preserves overall program semantics by adjusting all calls to the subroutine. This operation enlarges the dimensionality of the subspace on which the subroutine operates. The subroutine creation operation can create a new subroutine from part of a main result-producing branch thereby deepening the hierarchy of references in the overall program, by creating a hierarchical reference between the main program and the new subroutine. The subroutine creation operation can also create a new subroutine from part of an existing subroutine further deepening the hierarchy of references, by creating a hierarchical reference between a preexisting subroutine and a new subroutine and a deeper and more complex overall hierarchy. The architecture-altering operation of subroutine deletion deletes a subroutine from a program thereby making the hierarchy of subroutines either narrower or shallower The argument deletion operation deletes an argument from a subroutine thereby reducing the amount of information available to the subroutine, a process that can be viewed as generalization. Other architecture-altering operations add and delete automatically defined iterations, automatically defined loops, automatically defined recursions, and automatically defined stores (memory). 56 lxi University of Ilorin, Ilorin, Nigeria Department of Civil Engineering A A Adedeji APPENDIX IV Definitions of Symbols QH = Ψ(He, Hc,, Hr,, Hs) (a1) where He is Heat loss due to evaporation, Hc is the heat loss/gained by convention, Hr is the heat gained by radiation and Hs is the restored in the body. QL = Ψ(P, c1, c2), (a2) where P is the total energy loss due to radiation, c1 = coefficient of light which depends on the production of heat and c2 = coefficient of electric light (average of 13.0) QE = Ψ(c3, c4, n, m) (a3) where c3, c4 are coefficients for moving electric motor (average of 0.7), residual coefficient (1.0), n = power of motor(maximum of 3000 Watts and m is the motor efficiency ranging from 0.5 kW to 40 kW for efficiency of 70% to 92% respectively. QR = Ψ(Ao, Aos, Lo, Co, S), (a4) where Ao is the effective window area of incoming air, Aos is the area of window exposed to sun’s radiation Lo is total intensity of the sun heating the window, Co is the corrective coefficient ( 1 for a city like Lagos, and1.5 for a rural area) and S is shadow coefficient (ranging from 0.13 to 0.56 of a 45o opened but dark window to translucent semi-dark open 450 illumination) for window glass panel. QV = Ψ (V, Pv, nfa) (a5) where V is the air flow rate given off by ventilator, Pv is the total pressure of ventilation nfa is the ventilation offect on the ventilator (= 0.5) 57 lxii