## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Evolution

Biological Evolution:

In the natural world, an organism's "fitness" can be measured by its ability to successfully reproduce. A fit organism must survive long enough in its environment, by finding food and avoiding being killed by another organism, so it can find a mate and reproduce. Reproduction ensures that its genes will survive in the species' gene pool for at least one more generation. Over time, this process of natural selection increases the number of "fit" genes in the gene pool while "unfit" genes become scarce. Reproduction combines, or crosses over, half of the genes from each parent to form a complete set of genes in the new offspring. Sometimes this crossover results in an offspring, which is even fitter than its parents, increasing its own chance of reproducing. During this crossover, errors or mutations occur that introduce new gene sequences to the population. In the rare case when such a mutation is beneficial, the lucky offspring becomes fitter and thus more likely to pass this mutation on to future generations and, ultimately, the entire population's gene pool. Evolution's creations are miraculous. One look at the myriad of specialized life forms living along a coral reef, a hydrothermal vent, or a tropical rain forest illustrates the amazing abilities species have evolved to adapt to diverse and sometimes harsh environments. Consider the use of sonar by dolphins and bats, the engineering triumph of binocular vision, or even the

hardy single-celled creatures that survive miles below the surface of the earth under hellish pressure and heat. Only through the positive feedback of evolution, occurring over millions of years, have these masterpieces developed.

**Simulating Evolution on the Computer:
**

Evolutionary computing techniques, such as genetic algorithms (GAs), attempt to simulate this biological process on the computer in order to solve difficult problems. Pioneered by John Holland in the 1970s, GAs have yet to create a better eye or a bat that can sing. But programmers have employed them for such diverse tasks as optimizing networks, calculating neural network weights, maximizing mathematical functions, scheduling resources more efficiently, minimizing costs in architectural designs while still meeting design constraints, and designing proteins in the pursuit of new drugs. Instead of a biological conundrum such as "How do I evolve to thrive in this highly competitive coral reef community?", GA programmers are more likely to ask something like "How do I rearrange this scheduling sequence to minimize the resources required?". And instead of using actual chromosomes comprised of DNA, you might model chromosomes as character strings (e.g., "AFGEHKI") where each letter (a gene) represents a resource to be scheduled. Starting with an initial population of random chromosomes (each of which represents a candidate solution to your problem) and a fitness function to calculate the fitness of a given chromosome, you can start your simulated evolution. In the case of optimizing a scheduling sequence, your fitness function would calculate the resource "cost" of a given schedule sequence. The lower the cost required by a given sequence (chromosome), the higher the corresponding fitness value will be. For example, schedule "ABCDE" might have a lower cost than schedule "BCADE".

Since the initial pool of chromosome "candidate solutions" is randomly generated, they are probably terrible solutions. Despite this, some of the solutions will be slightly better than others. Over time, you hope that good solutions or even an ideal solution will evolve in your chromosome pool.

**DYNAMIC-PROGRAMING SOLUTION TO THE HYDROTHERMAL SCHEDULING PROBLEM
**

Dynamic programming may be applied to the solution of the hydrothermal scheduling problem. The mutation, hydraulically coupled system offer computational difficulties that make it difficult to use that type of system to illustrate the benefits of applied DP to this problem. Instead we will illustrate the application with a single hydroplant operated in conjunction with a thermal system. Figure shows a single, equivalent steam plant, Ps , and a hydroplant with storage, PH, serving a single series of load, PL. Time interval are denoted by j, where j runs between 1 and jmax. Let: rj = net inflow rate during period j Vj = storage volume at the end of period j qj = flow rate through the turbine during period j PHj = power output during period j Sj = spillage rate during period j Psj = load level PLoad j = load level Fj =fuel cost rate for period j

Both starting and ending storage volume, Vo and Vjmax, are given, as are the period loads. The steam plant is assumed to be on for the entire period. Its input-output characteristic is Fj = a + bPsj + cPsj2 Rs./hr The water use rate characteristic of the hydroelectric plant is qj = d + gPHj + hPHj2, acre-ft/h and =0 for PHj = 0 for PHj > 0

the coefficients a through h are constraints. We will take the units of water flow rate as acre-ft/hr. If each interval, j, is nj hours long, tye volume in storage changes as Vj = Vj-1 + nj(rj ± qj ± sj) Spilling water will not be permitted (i.e., all sj = 0). If Vi and Vk denote two different volume states, and

Vj - 1 = Vi Vj = Vk

Then the rate of flow through the hydro-unit during interval j is

qj = (Vj ± Vj - 1)/nj + rj

Where qj must be nonnegative and is limited to some maximum flow rate, qmax, which corresponds to the maximum power output of the hydro-unit. The scheduling problem involves finding the minimum cost trajectory (i.e., the volume at each stage).

The DP algorithm is quite simple. Let:

{i} = The volume states at the start of the period j {k} = The states at the end of j TCk (j)= the total cost from the start of the scheduling period to the end of period j for the reservoir storage state Vk. PC (i, j-1: k, j) = Production cost of the thermal system in period j to go from an initial volume of Vi to an end of period volume Vk. The forward dynamic programming algorithm is then, TCk (0) = 0 And TCk (j) = Min [TCi (j-1) + PC (i, j-1: k, j)] {i}

We must be given the loads and natural inflows. The discharge rate through the hydro-unit is, of course, fixed by the initial and ending storage levels and this, in turn establishes the values of PH and Ps. The computation of the thermal production cost follows directly.

There may well be volume states in the set Vk that are unreachable from some of the initial volume states Vi because of the operating limits on the hydro plants. There are many variations on the hydraulic constraints that may be incorporated in the DP computation.

**GENETIC ALGORITHM SOLUTION METHOD:
**

Genetic algorithms are search algorithms based on the mechanics of natural selection and natural genetics. They combine survival of the fittest among string structures with a structured yet randomized information exchange to form a search algorithm with some of the innovative flair of human search. In every generation, a new set of artificial creatures (strings) is created using bits and pieces of the fittest of the old; an occasional new part is tried of good measure. While randomized, Gas is no simple random walk. They efficiently exploit historical information to speculate on new search points with expected improved performance.

Individuals in the GA population mate and reproduce as in nature. Different population members are assigned reproduction rates proportional to their fitness. The fitness derived from the problem objective function.

A GA solution to a problem frequently uses a representation similar to biological gene structures. The population of a GA is a subset of a larger set of individuals whose members include all the possible solutions of the problems. This larger set of possible solutions is usually too large to be enumerated and hence the need for a technique such as GA to sample this large search space. A

GA uses a combined set of genetic operators to search for an optimal solution over the coded parameter space.

A brief description of the main components of the genetic algorithm process is given in the following sections.

1. SELECTION:

The selection step of the GA cycle is the process of determining the number of copies of each individual parent that can participate in the reproduction or mating process. There are several ways of implementing the selection mechanism. The main ones are Roulette wheel selection, Tournament selection and stochastic remainder selection.

Fitness scaling is usually applied to the fitness values to prevent premature convergence, which is caused by lack of diversity in the population due to a decrease in the variance of fitness.

2. CROSSOVER&MUTATION:

The crossover operator is mainly responsible for the global search property of the GA. The operator basically combines substructures of two parent chromosomes to produce new structures with a chosen probability. The most commonly used crossover methods are single point, two points and uniform crossover.

The mutation operator changes 1 to 0 and vice versa with a small mutation probability, Pm. The bit wise mutation is performed bit by bit by flipping a coin with a probability of Pm.

If at any bit, the outcome is true then the bit is altered, otherwise the bit is kept unchanged. The need for mutation is to create a point in the neighborhood of the current point, there by achieving a local search around the current solution. The mutation is also used to maintain diversity in the population.

POPULATION SIZE & INTIALIZATION:

A genetic algorithm is a population based search technique that derives its power from the fact that it advances its search based on feedback from a number of potential solutions to the problem, each searching different regions of search space at same time. The initial population of solutions is usually generated randomly, although sometimes the search can benefit from inclusion of good previous solutions, if available, but this must be done with utmost care since lack of sufficient diversity in the initial population can easily result in premature convergence. The size of the population is one of the major GA control parameters. A number of theoretical and empirical studies provide guidelines on the choice of the size of population. However there is no empirical formulae linking the population size to other GA variables or any problem specific parameters.

PARENT REPLACEMENT METHOD:

In moving from one generation to the next, the old population should be replaced by the newly created offspring population in some optimal way that keep search for better solutions for the appropriate track. This step is important for GA because it determines the degree of exploitation of the new search

material in the advancement of search for the optimal solution. Sometimes, it is good to keep track of the best solution obtained so far as optimization progresses. This is achieved in GA by an ³Elitist´ strategy that retain in tact a copy of the best solution in successive generation.

Theoretical basis of genetic algorithms:

Although genetic algorithms have shown high success rates in solving number of complex problems previously unsolved by other methods, the theoretical bases of the performance is still the subject of intensive research.

Schema Analysis:

The genetic algorithm uses a population of candidate solutions to the problem, which individually and in combination with other members of the group provide information about the various substructures making up the complete solution string. Through the process of selection and recombination, the number of instances of a sub string (building blocks), changes in proportion to the relative observed performance of each string in each generation. If a fitness proportional selection method is used, as is usually the case then an exponentially increasing number of copies are made of the sub strings of above average fitness, enabling them to dominate the future populations. The basic explanation of the robust performance of the genetic algorithm is based on the schema theorem, which postulates that while the fitness function is evaluated based on the performance of the whole string, information is gathered about all the component parts that make up the string.

A schema is a subset of strings in a population with similarities at certain string positions. The schema theorem provides a lower bound for schema growth in a GA population. Consider a schema H existing in a population at a given time t. After selection, scheme numbers change according to M (H, t + s) >= M (H, t)[f (H, t) / favg] and after crossover, mutation and other operators M (H, t+1) >= M (H, t)[f (H, t) / favg] x [1-e (H, t)]

Where M (H, t) is the number of strings with schema H at time t, M (H, t+s) the number of strings with schema H after selection, favg the average fitness of the strings in the population and e (H, t) the probability that a schema has been disrupted by an operator such as crossover or mutation. Using the theorem, the minimum proportion of a particular schema that is expected to be present in the succeeding generation of the trial can be evaluated.

Although the schema theorem has provided many insights on GA performance and has enabled tremendous advancement of the work on genetic algorithms, it does not give an exact distribution of the schemata in the population. The mathematical expression is an inequality that ignores string gains created by crossover and underestimates the string losses. It is based on a normally distributed population, a condition that is only accurate in the first generation before the population is biased by selection and other GA operators, thus it can only accurately predict the GA behavior in the first generation.

DIFFERENCES BETWEEN GAs AND TRADITIONAL METHODS:

GAs work with a string coding of variables instead of variables. The advantage of working with a coding variables is that the coding discretizes the search space, even though the function may be continuous. On the other hand, since GAs require only function values at various discrete points, a discrete or discontinues function can be handled with no extra cost. This allows GAs to be applied to a wide variety of problems. Another advantage is that the GA operators exploit the similarities in string-structures to make an effective search.

The most striking difference between GAs and many traditional optimization methods is that GAs work with a population of points instead of a single point. Because there is more than one string being processed simultaneously, it is very likely that the expected GA solution may be a global solution. Even though some traditional algorithms are population based, like box¶s evolutionary optimization and complex search methods, those methods do not use previously obtained information efficiently.

In Gas, previously found good information is emphasized using reproduction operator and propagated adaptively through crossover and mutation operators. Another advantage with a population-based algorithm is that multiple optimal solutions can be captured in the population easily, there by reducing effort to use same algorithm many times.

In fact, GAs does not require any auxiliary information except the objective function values. Although the direct search methods used in traditional optimization methods do not explicitly require the gradient information search directions that are similar in concept to the gradient of the function. Moreover, some direct search methods work under the assumption that the function to be optimized is unimodal and continuous. In GAs, no such assumption is necessary.

One other difference in the operation of GAs is the use of probabilities in their operators. None of the genetic operators work deterministically. In the reproduction operator, even though a string is expected to have Fi / Favg copies in the mating pool, a simulation of the roulette-wheel selection scheme is used

to assign the true number of copies. In the crossover operator, even though good strings (obtained from the mating pool) are crossed, strings to be crossed are created at random and cross-sites are created at random. In the mutation operator, a random bit is suddenly altered. The action of these operators may appear to be naïve, but careful studies may provide some interesting insights about this type of search. The basic problem with most of the traditional methods is that they use fixed transition rules to move from one point to another. For instance in the steepest descent method the search direction is always calculated as the negative of the gradient at any point, because in that direction the reduction in function value is maximum. In trying to solve a multimodal problem with many local optimum points, search procedures may easily get trapped in one of the local optimum points.

However the conve3ntionalk methods can be best applied to a special class of proble4ms suitable for the se methods. For example, the gradient search methods will outperform any algorithm in solving continuous unimodal problems, bit they are not suitable for multimodal problems. Thus in general, traditional methods are not robust. A robust algorithm can be designed in such a way that it uses the steepest descent direction most of the time, but also uses the steepest ascent direction (or any other direction) with some probability. Such a mixed strategy may require more number of function evaluations to solve continuous, unimodal problems, because of extra computations involved in trying with non-descent directions. But this strategy may be able to solve complex, multi modal problems to global optimality. GAs use similar search strategies by using probability in all their operators. Since an initial random population is used to start with, the search can proceed in any direction and no major decisions are made in the beginning. Later on, when the population begins to converge in some bit positions, the search direction narrows and a

near optimal solution is achieved. This nature of narrowing the search space as the search progresses is adaptive and is a unique characteristic of genetic algorithms.

**Genetic Algorithm Problem Representation:
**

The solution to the short range hydro thermal scheduling problem can be defined by specifying the actual load allocated to various hydro and thermal plants at each time step, over the scheduling period. In hydro generation, the basic performance curve is expressed in terms of the water input versus power output hence the turbine water discharge can be4 used as the problem decision variable. In this project it is assumed that the thermal unit commitment decision is already known and that the thermal generation provides the generation that cannot be supplied by hydel plant.

The basic optimal hydrothermal scheduling sequence is: Assuming a given thermal unit commitment, lad demand and hydraulic inflows, allocate load to the hydro and thermal units while satisfying the individual unit loading limits, hydraulic constraints and power network constraints so that the total operation cost is minimized. Included with hydraulic constraints is the desire to satisfy end point conditions of the scheduling period in order to conform to medium term water release targets. For the GA solution method, the water discharge through the turbines during each optimization interval is used as the main control variable. Knowing the water discharge at each plant, the reservoir inflows and the unit characteristic power outputs can easily be evaluated. In the GA binary problem representation, the various water discharge rates at each reservoir for each time interval are represented by a given number

of binary strings. The number of binary bits representing the reservoir depends in the required (resolution) accuracy within which the turbine discharge level can be varied.

In a GA optimization process using binary encoding, the solution accuracy depends on the number of bits used to represent the decimal equivalent of the control parameter. The higher the number of bits used the finer the resolution. The precision required is chosen according to the solution accuracy desired.

FITNESS FUNCTION:

A genetic algorithm conventionally searches for the optimal solution by maximizing a given fitness function, and therefore an evaluation function which provides a measure of the quality of the problem solution must be provided. For the hydrothermal coordination problem, the evaluation function is a combination of the thermal cost function and penalty function terms that take into account the various system, unit and hydraulic network violations. The evaluation function should differentiate between good and poor solutions, both in the feasible and infeasible search domains. The fitness value is critical to the functioning of the genetic algorithm; since it is this function that determines the individual¶s ability (chance) to undergo selection hence propagate its features to future generation. Since a GA maximizes the fitness function, the minization objective function must be transformed into a maximization problem. Solution of the scheduling problem involves a minimization of the function F=(APs2 + BPs + C) Where F-is the optimal dispatch cost of the thermal plants;

A, B, C- are the cost coefficient of the composite cost curve of the group of steam power plants whose unit commitment is assumed to be known in the present problem of consideration. The thermal fuel cost is implicitly related to the hydropower generation and the load demand according to the system load balance equation: Ps + PH = PLoad + PLoss Where Ps - steam power generation, PH- hydel power generation, PLoad - load power demand, PLoss - loss of power in the system. The power output of a hydro unit during any interval is dependent on the reservoir volume, head of the water available and the discharge of the water into hydraulic turbine. In this current problem the hydel power is assumed to be dependent only on the discharge so as to obtain a linear relation between hydel power and the amount of water.

The coded binary solution string gives the actual decimal values of the plant discharge over the scheduling period, which is then used to obtain the fitness value through a sequence of the following events. The GA process generates a set of discharge values for the hydroelectric plant over the scheduling period. Using the discharge values and the hydropower output equation, calculate the hydropower output of each plant. Using the load balance equation, calculate the thermal generation and hence evaluate the cost of thermal generation.

Using the given (calculated) values of the initial reservoir volume, water inflow rates and water discharge rate, calculate the volume of the reservoir at the end of the time interval. Use the evaluated reservoir storage levels and unit generations to determine the constraint violations. The fitness function is evaluated by using a suitable transformation such as 1/(1 + F (x)).

IMPLEMENTATION OF HYDRO-THERMAL GENETIC ALGORITHM:

Once a method of awarding fitness to each member of the population has been determined, the standard GA search sequence of population creation, selections, crossover, mutation and parent replacement can be applied to the chosen GA model. A simple genetic algorithm is applied to the problem of hydrothermal scheduling to solve the scheduling problem. In any optimization process an appropriate step length for changing each parameter variable at each of the optimization sequence must be chosen. If the step lengths are too small, it can take a large number of iteration to reach the optimal solution, while if the step length is too large, the optimum solution can only be crudely approach and the optimization can easily get stuck at a local optimum. For a GA search, the smaller the resolution, the longer the string lengths, which results in longer solution times. The GA performance can greatly be enhanced by performing a multiple step search using different string lengths for different stages of optimization. This allows a coarse grained search in the initial stages of the GA process, which are used as starting points for later runs with finer resolutions

**Problem formulation and description
**

The simulated system is a simple one consisting of only one hydroelectric plant and group of steam power plants whose thermal unitcommitment is already known. A composite cost curve of quadratic form is assumed for the group of thermal power plant. The hydroelectric power characteristic is assumed to dependent on only the turbine discharge so that the hydro-power characteristic can be leniarized. The constraints on the hydrothermal scheduling are very much varied in nature and are much difficult to handle. Out of the possible various constraints, the following constraints are chosen in the present problem. I. Final volume of the reservoir should be equal to the specified end volume. II. The hydroelectric power generated should be within the specified limits. III. The steam power generation should not exceed the specified maximum value of the steam power generation. IV. The steam power generation should not go below the specified minimum value of steam power generation. V. The reservoir volume should not go below the specified minimum volume. VI. The reservoir volume should not go above the specified maximum volume. VII. The discharge through the turbine should go beyond the specified maximum value.

PROBLEM DATA:

1. Composite cost curve of the thermal system is given by: (1/2000*Ps2 + 4.8*Ps + 700) Rs/hour Where Ps is steam power in MW. 2. The hydropower characteristic is given by: PH = (q-260)/10 MW Where q-discharge in acre-foot/hour. 3. Initial and final reservoir volumes are 10000 acre-foot. 4. maximum hydroelectric power is 200 MW. 5. Minimum hydroelectric power is 0 MW. 6. Maximum thermal power is 1200 MW. 7. Minimum thermal power is 200 MW. 8. Inflow to the reservoir is 1000 acre-foot/hour.

LOAD DATA

PERIOD j

LOAD IN MW

1

600

2

1000

3

900

4

500

5

400

6

300

ALGORITHMS

General Genetic Algorithm Procedure:

1.

Choose a coding to represent problem parameters, a selection operator, a crossover operator, and a mutation operator. Choose a population size, n, crossover probability, Pc, and mutation probability, Pm. Initialize a random population of strings of size 1. Choose a maximum allowable generation number and set generation count to zero.

2. 3.

Evaluate each string in the population. If generation count is greater than maximum generations or if the termination criterion is satisfied, TERMINATE.

4. 5. 6. 7.

Perform reproduction on the population Perform crossover on random pairs of strings. Perform mutation on every string. Evaluate strings in the new population. Increment the generation counter and go to step 3. The algorithm is straight forward with repeated application of three operators to a population of points.

**Algorithm For Hydrothermal Scheduling Using Genetic Algorithm:
**

The objective function for the hydrothermal scheduling problem is: Minimize F = (0.0005*Ps2 + 4.8*Ps + 700)/hr Subject to the constraints 200 <= Ps <= 1200; 0 <= PH <= 200; Vfinal >= 10000; 6000 <= V <= 18000; Where Ps ± thermal power generated, PH ±hydroelectric power generated, Vfinal ±final reservoir volume, V ±reservoir water volume. In the interval 260 < q < 2260

Step1: (Encoding Variable And Setting GA parameters) In order to solve this problem using genetic algorithms, we choose binary coding to represent variable µq¶. In this problem 32 bits are chosen for the variable. With 32 bits, we get a solution accuracy of (2260-260)/(232-

1)=0.0004E-3 in the interval (260,2260). We choose a roulette-wheel selection, a single point crossover, and a bit-wise mutation operator. The crossover and mutation probabilities are assigned to be 0.85 and 0.08 respectively. We decide to have 20 points in the population. We set maximum generations as 27 and initialize the generation count at zero.

Step2: (Decoding Of Variables And Evaluating Fitness) Next step is to evaluate each string in the population. We calculate the fitness of the first string. The string is decoded as §(2i *si ) i = 0,1,««.(l - 1) ; Si (0, 1). (In case more than one variable is used, the string is decoded as Xi = Xi(l) + (Xi(u) ± Xi(l) ) / (2li - 1) * decoded value where decoded value is obtained as stated above.) These values can now be substituted in the objective function expression to obtain the function value. We now calculate the fitness function value at this point by using the transformation rule 1/(1+f(x)). This value is used in the reproduction operation. Similarly, other strings in the population are evaluated and fitness values are calculated.

Step 3:( Checking for maximum Generations) Since generations are lesser than the maximum number of generations, we proceed to the next step.

Step4: (Performing Reproduction on the Population)

At this step we select good strings in the population to form the mating pool. In order to use the Roulette-Wheel selection procedure, we first calculate the average fitness of the population. By adding the fitness values of all the strings dividing the sum by the population size, average fitness value is obtained. The next step is to compute the expected count as (individual fitness/average fitness). In other words we can compute the probability of each string being copied in the mating pool by dividing these numbers with the population size. Once these probabilities are calculated, the cumulative probability can also be calculated. In order to form the mating pool, we create random numbers between 0 and 1 and identify the particular string, which is specified by each of these random numbers. After this, selection procedure is repeated n times (n is the population size), the number of selected copies for each string counted. The inferior points will be probabilistically eliminates from further consideration. Notice that not all selected points are better than all rejected points. Although the above Roulette-wheel selection is easier to implement, it6 is noisy. Amore stable version of this selection operator is sometimes used. After the expected count for each individual string is calculated, the strings are first assigned copies exactly equal to the mantissa of the expected count. Thereafter, the regular Roulette-wheel selection is implemented using the decimal part of the expected count as the probability of selection. This selection method is less noisy and is known as the µStochastic remainder¶ selection.

Step 5: (Performing Crossover)

At this step, the strings in the mating pool are used in the crossover operation. In a single point crossover, two strings are selected at random and crossed at a random site. Since the mating pool contains strings at random, we pick pairs of strings from the top of the list. When two strings are chosen for crossover, first a coin is flipped with a probability Pc = 0.85 to check whether a crossover is desired or not. If the outcome of the coin flipping is true, meaning that a crossover is required to be performed. The next step is to find a cross-site at random. We choose a site by creating random integer between (0, l-1) i.e., (0.31). After crossover the children strings are placed in the intermediate population. In case the coin flipping is false the strings are directly copied in to the intermediate population, With Pc = 0.85 the expected number of population of size of 20 is (0.85*20/2) or 9(approx). Some good points are created after crossover. In some cases, points far away from the parent points are created and in some cases points close to the parent points are created.

Step6: (Performing Mutation) The next step is to perform mutation on the strings in the intermediate population. For bit-wise mutation, we flip a coin with a probability Pm = 0.08 for every bit. If the outcome is true we alter the bit to 1 or 0 depending on the bit value. With a probability of 0.08, a population size 20, and a string length 32, we can expect to alter a total of about 0.08*20*32 or 51 bits in the population. In some cases the mutation operator changes a point locally and in some other it can bring a large change. It is interesting to note that if only one bit is mutated in a string, the point is moved along a particular variable only. Like the crossover operator, the mutation operator will create some points better and some points worse than the original points. This flexibility enables GA operators to explore search space properly before converging to a region

prematurely. Although this requires some extra computation, this flexibility is essential to solve global optimization problems.

Step 7: The resulting population becomes the new population. We again decode and evaluate fitness of each string in the new population. This completes one iteration of the genetic algorithm. We increment generation counter to one and proceed to step 3 for the next iteration.

MATLAB Code for Short term Hydrothermal Scheduling using Genetic Algorithm.

% Genetic algorithm program %popsize = 20; %strlen = 32; flag = 0; tcost = 0; pload = [600; 1000; 900; 500; 400; 300]; [ns] = input('Enter no. of variables : '); fprintf('\nEnter no. of Generations : '); [nofg] = input(''); fprintf('\n'); [popsize] = input('Enter the required Population Size : '); fprintf('\n'); [strlen] = input('Enter the required String length : '); for i = 1:1:popsize for j = 1:1:(ns*strlen) substr(i, j) = random(2); end end for i = 1:1:ns

fprintf('\n Enter lower and upper on the variable %d as : ',i); [alow(i)] = input(''); [ahigh(i)] = input(''); end fprintf('\n'); [nop] = input('Enter the Period for which the output is required : '); psit(popsize,1) = 0; mutstr(popsize, ns*strlen) = 0; for per = 1:1:nop ng = nofg; while(ng ~= 0) x = psit; if (flag == 1) substr = mutstr; end if (flag == 0) for i = 1:1:ns for j = 1:1:popsize

x(j, 1, i) = alow(i) + ((ahigh(i) alow(i))/((2^strlen)-1))*bs2d(substr(j, :), strlen, i); ph(j, 1, i) = (x(j, 1, i) - 260)/10; ps(j, 1, i) = pload(per, 1) - ph(j, 1, i); end end end for i = 1:1:popsize f(i, 1) = (1/2000)*ps(i, 1, 1)*ps(i, 1, 1) + 4.8*ps(i, 1, 1) + 700; end if (flag == 0) fprintf('\n Is problem Maximization or Minimization,\n Enter 1 --> Maximization\n 2 --> Minimization'); fprintf('\nEnter your choice : '); [ch] = input(''); end for i = 1:1:popsize if (ch == 1)

Fx(i, 1) = f(i, 1); elseif (ch == 2) Fx(i, 1) = 1.0/(1.0 + f(i, 1)); else fprintf('\n Invalid input'); end end Fsum = 0; for i = 1:1:popsize Fsum = Fsum + Fx(i, 1); end Favg = Fsum/popsize; for i = 1:1:popsize A(i, 1) = Fx(i, 1)/Favg; B(i, 1) = A(i, 1)/popsize; end C(1, 1) = B(1, 1); for i = 2:1:popsize C(i, 1) = B(i, 1) + C(i-1, 1); D(i, 1) = random(1000)/1000; end

for i = 1:1:popsize for j = 1:1:popsize-1 if ((D(i, 1) > C(j, 1)) & (D(i, 1) < C(j+1, 1))) E(i, 1) = j+1; end end end for i = 1:1:popsize count = 0; for j = 1:1:popsize if (i == E(j, 1)) count = count + 1; end end F(i, 1) = count; end if (flag == 0) flag = 1; fprintf('\n Enter Cross over probability : ');

[coprob] = input(''); fprintf('\n Enter Mutation probability : '); [mprob] = input(''); end for i = 1:2:popsize-1 if (flip(coprob) == 1) cosite(i, 1) = random(ns*strlen - 1); if (cosite(i, 1) == 0) cosite(i, 1) = 1; end G(i, 1) = 1; G(i+1, 1) = 1; cosite(i+1, 1) = cosite(i, 1); else G(i, 1) = 0; G(i+1, 1) = 0; cosite(i, 1) = NaN; cosite(i+1, 1) = cosite(i, 1); end end for i = 1:2:popsize-1

if (G(i, 1) == 1) [intstr(i:i+1, :)] = swap(cosite(i, 1), ns*strlen, substr(i:i+1, :)); else intstr(i:i+1, :) = substr(i:i+1, :); end end % Mutation for i = 1:1:popsize mutstr(i, :) = intstr(i, :); for j = 1:1:(ns*strlen) if (flip(mprob) == 1) if (mutstr(i, j) == 1) mutstr(i, j) = 0; else mutstr(i, j) = 1; end end end end for i = 1:1:ns

for j = 1:1:popsize xit(j, 1, i) = alow(i) + ((ahigh(i) alow(i))/((2^strlen)-1))*bs2d(mutstr(j, :), strlen, i); phit(j, 1, i) = (xit(j, 1, i) - 260)/10;

psit(j, 1, i) = pload(per, 1) - phit(j, 1, i);

end end for i = 1:1:popsize fit(i, 1) = (1/2000)*psit(i, 1, 1)*psit(i, 1, 1) + 4.8*psit(i, 1, 1) + 700; end for i = 1:1:popsize if (ch == 1) Fxit(i, 1) = fit(i, 1); else Fxit(i, 1) = 1.0/(1.0 + fit(i, 1)); end end ng = ng - 1; end max = Fxit(1, 1);

pos = 1; for i = 1:1:popsize-1 if (Fxit(i+1, 1) > max) max = Fxit(i+1, 1); pos = i+1; end end for i = 1:1:ns for j = 1:1:popsize ph1(j, 1, i) = pload(per) - psit(j, 1, i); if (ph1(j, 1, i) > 0) pgen(j, 1, i) = ph1(j, 1, i); psit(j, 1, i) = pload(per) - ph1(j, 1, i); else ph1(j, 1, i) = 0; psit(j, 1, i) = pload(per); end if (ps(j, 1, i) > 200 & ps(j, 1, i) < 1200) fit(j, 1) = (1/2000)*psit(i, 1, 1)*psit(i, 1, 1) + 4.8*psit(i, 1, 1) + 700;

end end end fprintf('\nGood ones is : %d',psit(pos, 1, 1)); ptherm(per, 1) = psit(pos, 1, 1); %tcost = tcost + fit(pos, 1); end fprintf('\n'); pline; fprintf('\n\t\t\t\t\tOutput of Genetic Algorithm\n'); pline; fprintf('\nS.no.\t Fitness\t Discharge\t Function value\t

A\t\tB\t\tC\t\tD\t\tE\tF\tG\tH\t\t

Discharge after Generation\tFitness after Generation\n'); pline; for i = 1:1:popsize fprintf('\n %7.4f\t %d\t %8.4f\t %7.4f\t %7.4f\t

%8.4f\t\t%8.6f\t%7.4f\t

\t%d\t%d\t%d\t%d\t\t\t%8.4f\t\t

%8.6f',i,ps(i, 1, 1),f(i, 1),Fx(i, 1),A(i, 1),B(i, 1),C(i, 1),D(i, 1),E(i, 1),F(i, 1),G(i, 1),cosite(i, 1),psit(i, 1, 1),Fxit(i, 1));

end fprintf('\n'); pline; fprintf('\n\n'); pline; fprintf('\n\t\t\t\t\tHydrothermal Scheduling\n'); pline; fprintf('\nPeriod\t\t\tLoad Demand in MW\t\t\tHydro Generation in MW\t\t\tThermal Generation in MW\n'); for k = 1:1:nop fprintf('\n 1)); end fprintf('\n'); pline; tcost = 0; for i = 1:1:6 tcost = tcost + ((1/2000)*ptherm(i, 1)*ptherm(i, 1) + 4.8*ptherm(i, 1) + 700); end fprintf('\n Total cost is : %d\n',tcost); %d\t\t\t\t%d\t\t\t\t %8.4f\t\t\t\t

%8.4f',k,pload(k),pload(k)-ptherm(k, 1),ptherm(k,

Function Coding Starts here:

**% Converts binary string into decimal value
**

function [dval] = bs2d (subst, strlen, sno)

dval = 0; for c = (sno*strlen):-1:((sno - 1)*strlen + 1) dval = dval + subst(c)*(2^(strlen-c)); end

% Subroutine for Flip function function [flip1] = flip (prob) if ((prob == 1) | ((random(100)/100) <= prob)) flip1 = 1; else flip1 = 0; end

**% Random number generator
**

function [ran] = rand1()

**a1 = rand*100000; ran = ceil(a1);
**

if (ran == 0)

ran = 1; end

**% Random function generating random values below max value given
**

function [rannum] = random(inp)

rannum = mod(rand1, inp);

**% Swaps the bits required between two strings
**

function [interst] = swap (crossite, length, sstr)

temp1 = sstr(1, crossite:length); temp2 = sstr(2, crossite:length); interst = sstr; interst(1, crossite:length) = temp2; interst(2, crossite:length) = temp1;

% prints the line

function pline() for l = 1:1:200 fprintf('*'); end

OUTPUT

GAFHTS

Enter no. of variables : 1

Enter no. of Generations : 1

Enter the required Population Size : 20

Enter the required String length : 32

Enter lower and upper on the variable 1 as : 260 2260

Enter the Period for which the output is required : 6

Is problem Maximization or Minimization, Enter 1 --> Maximization 2 --> Minimization Enter your choice : 2

Enter Cross over probability : .8

Enter Mutation probability : .2

Good ones is : 4.030391e+002 Good ones is : 8.008368e+002 Good ones is : 7.228181e+002 Good ones is : 3.169680e+002 Good ones is : 2.029270e+002 Good ones is : 1.029037e+002

**************************************************************************************** Output of Genetic Algorithm ****************************************************************************************** S.no. Discharge Function Fitness value A B C D E F G H disacharge after generation Fitness after generation

****************************************************************************************** 1. 459.5464 3011.4141 0.000332 1.0406 0.0520 0.0520 0.0000 0 0 1 6 266.2085 287.8925 0.000496 0.000471 0.000821 0.000701 0.000507 0.000569 0.000639 0.000562 0.000821 0.000654 0.000718 0.000515 0.000626 0.000506 0.000833 0.000793 0.000641 0.000616 0.000693 0.000460

2. 579.6384 3650.2546 0.000274 0.8585 0.0429 0.0950 0.5880 13 0 1 6

3. 537.4791 3424.3417 0.000292 0.9151 0.0458 0.1407 0.5590 12 1 1 20 106.5012 4. 424.2223 2826.2493 0.000354 1.1087 0.0554 0.1961 0.6880 14 0 1 20 148.6670 5. 574.2643 3621.3581 0.000276 0.8654 0.0433 0.2394 0.5240 11 0 1 29 257.6819 6. 495.0821 3198.9474 0.000313 0.9796 0.0490 0.2884 0.4400 10 2 1 29 215.1532 7. 527.9072 3373.2978 0.000296 0.9290 0.0464 0.3348 0.2620 6 1 1 13 176.6040 8. 449.4752 2958.4948 0.000338 1.0592 0.0530 0.3878 0.5950 13 1 1 13 219.9205 9. 472.3454 3078.8131 0.000325 1.0178 0.0509 0.4387 0.2690 6 1 0 10. 445.4496 2937.3708 0.000340 1.0668 0.0533 0.4920 0.9130 19 1 0 106.6166 169.4196

11. 513.3967 3296.0923 0.000303 0.9507 0.0475 0.5396 0.5770 12 2 1 11 141.9816 12. 582.0064 3662.9965 0.000273 0.8555 0.0428 0.5824 0.3660 8 2 1 11 251.7514 13. 403.0539 2715.8847 0.000368 1.1538 0.0577 0.6400 0.9850 20 3 1 13 183.2809 14. 491.4169 3179.5464 0.000314 0.9856 0.0493 0.6893 0.5080 11 2 1 13 259.0241 15. 469.9173 3066.0141 0.000326 1.0221 0.0511 0.7404 0.5840 13 0 1 18 102.9037 16. 593.2727 3723.6950 0.000268 0.8416 0.0421 0.7825 0.3200 7 0 1 18 115.1493 17. 437.7377 2896.9483 0.000345 1.0817 0.0541 0.8366 0.9830 20 0 1 25 175.6001 18. 432.4989 2869.5224 0.000348 1.0920 0.0546 0.8912 0.6700 14 0 1 25 188.5163 19. 420.9767 2809.2990 0.000356 1.1154 0.0558 0.9470 0.1040 3 1 1 6 20. 448.5839 2953.8162 0.000338 1.0609 0.0530 1.0000 0.4340 9 2 1 6 152.3442 297.6563

******************************************************************************************

****************************************************************************************** Hydrothermal Scheduling ****************************************************************************************** Period Load Demand in MW Hydro Generation in MW in MW Thermal Generation

******************************************************************************************

1 2 3 4 5 6

600 1000 900 500 400 300

196.9609 199.1632 177.1819 183.0320 197.0730 197.0963

403.0391 800.8368 722.8181 316.9680 202.9270 102.9037

****************************************************************************************** Total cost is : 7.111198e+004

- 2 .a New Approach for Shortest Path Routing Problem by Random Key-Based GA
- Genetic Algorithms for Composite Laminate Design and Optimization Grant A. E. Soremekun
- GA1
- LossReduction-GA
- Elbeltagi-BMS03805
- Comparison Among Five Evolutionary-based Optimization Algorithms
- A Generic Genetic Algorithm using Phenotype Building Functions
- GA
- IRJET-IMAGE MINING BASED ON EVOLUTIONARY COMPUTING
- Kokone Paper Word
- Linard_1999-IsD_System Dynamics of Employment Planning - Employment Optimization
- CARDIS.pdf
- Evaluation of Operational Quality of a Supply Chain Using Genetic Algorithm
- tauseefahmad
- Data Allocation Algorithm
- Ga See Examples
- SPEA2- Improving the Strength Pareto Evolutionary Algorithm
- multiobjective MR damper
- math1010 eportfolio
- Evolutionary Computation Perl
- HIDINGDATAINIMAGESBYSIMPLELSBSUBSTITUTIONfullreport
- Load Flow Notes
- Optiizacion de Circuitos de Molienda Clasificacion
- How to Do Research
- Towards Using Genetic Algorithms in Lossy Audio Compression 2008
- Evolutionary Algorithmical Approach for VLSI Physical Design- Placement Problem
- Automatic Class Timetable Generation Using a Hybrid Genetic and Tabu Algorithm
- Thesis Poland
- Why_I_am_Muslim
- B7

- Comparative Analysis of Optimization Algorithms Based on Hybrid Soft Computing Algorithm
- The Optimizing Multiple Travelling Salesman Problem Using Genetic Algorithm
- Adoption of Parallel Genetic Algorithms for the Solution of System of Equations
- Appraisal of PSO Algorithm over Genetic Algorithm in WSN Using NS2
- Help the Genetic Algorithm to Minimize the Urban Traffic on Intersections
- Scheduling Resources In a Hetero-Gene Cloud Using Genetic Algorithm
- Survey Paper on Designing of FIR Filter using Genetic Algorithm
- Optimal Power Flow Analysis of Bus System using Practical Swarm Optimization
- Planning of Supply when lead time uncertain
- Optimization Approach for Capacitated Vehicle Routing Problem Using Genetic Algorithm
- Survey
- Timetable Alert Apllication
- A Novel Approach to Genetic Algorithm Based Cryptography
- Performance of Node Deployment Techniques in WSN
- Mining Frequent Item set Using Genetic Algorithm
- Introduction To Multilevel Association Rule And Its Methods
- tmp9C3B.tmp
- Optimal Location of Multi-types of FACTS Devices using Genetic Algorithm
- ACO better as Optimization Technique in MANET
- Intrusion Detection System Using Genetic Algorithm

Sign up to vote on this title

UsefulNot usefulRead Free for 30 Days

Cancel anytime.

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Close Dialog## This title now requires a credit

Use one of your book credits to continue reading from where you left off, or restart the preview.

Loading