You are on page 1of 97

CHAPTER - 1

INTRODUCTION

Electric energy is an essential resource in today's life. No matter if we make our first cup of coffee or tea in the
morning or run a multi-million euro business, all the time we rely on a secure and inexpensive supply of electricity.
In this work we take the perspective of a large utility company, tackling their problems in modeling and planning
production assets, i.e. a multitude of power plants. Our goal is to fulfill the respective demand of energy over a time
horizon of several years, with respect to the total operating cost of all machinery.

Determining optimal maintenance schedules and production plans is not easy because of the number of alternatives
to assess. As the exact electricity demand of each forthcoming day is unknown and depends on a large variety of
factors (season, weather, holidays, etc.), this leads to the need of multiple uncertainty scenarios. Additionally, the
increasing proportion of renewable energies in today's energy mix makes things more complicated for an utility
company, because it has to feed the energy of third-party solar or wind power plants into its electricity networks and
regulate its own power plants accordingly.

The problem discussed in this thesis was proposed by the ROADEF/EURO Challenge 2010, a competition
announced by the French Operational Research and Decision Support Society (ROADEF) and the European
Operational Research Society (EURO). The model has been developed by the French utility company Electricite de
France (EDF). Since we started this work after the challenge's submission deadline for the qualification round passed,
we could not take part in the competition. Nevertheless, we will compare our results with the best results obtained
by the participants of the challenge.

Determining optimal maintenance schedules and production plans is not easy because of the number of alternatives
to assess. The scheduling of outages has to comply with various constraints, regarding safety, maintenance, logistics
and plant operation while it must lead to production programs with minimum costs. The examined problem comprises
three fields of optimization: maintenance scheduling, production planning and determining refueling amounts.

Our solution combines a Genetic algorithm formulation of the problem with several heuristics. We decompose the
problem and develop different solution strategies ranging from very simple approaches up to sophisticated ones.
Along with the presented solution methods we show our experimental results. All considered problem instances are
provided by the competition and are extracted from real world data.
1
1.1 Motivation

In the pursuit of machine intelligence, it makes sense to study the two natural archetypes of learning: the brain and
evolution. A genetic algorithm is as accurate a model of evolution as an artificial neural network is a model of the
brain. The reason why we choose genetic algorithms as our research topic is twofold. First, the processes of natural
evolution and natural genetics have been illuminated by a century of enormous progress in biology and molecular
biology . Second, with their great robustness, genetic algorithms have proven to be a promising technique for many
optimization, design, control, and machine learning application.

John Holland's provide only the abstract and the core of GA. When one wants to apply the GA to a particular problem,
one faces a huge number of choices about how to proceed. Mitchell wrote:

"John Holland's simple GA inspired all subsequent GAs and provided the basis for theoretical analysis of
GAs. For real problem solving and modeling, however, it is clear that the simple GA is limited in its power
in several respects. Not all problems should use bit-string encoding, fitness-proportionate selection is not
always the best method, and the simple genetic operators are not always the most effective or appropriate
ones. Furthermore, the simple GA leaves out many potentially useful ideas from real biology, several of
which were proposed for use in GAs by Holland (1975) but have not been examined systematically until
recently."
Instructor introduces kinds of implementations and issues in GA courses. On account of limitation of time and the
load on students, it's almost impossible for students to implement and test all kinds of implementations. Traditionally,
teachers give only a couple of assignments. However, practical work experience plays a very important role in
learning. But it is often difficult for students to practice all kinds of various implementations in GAs. Due to those
collide, compromise must be taken to obtain best educational result. Herein, we consider developing a training (or
simulation) tool to help students exercise as many studying cases as possible in short time. This tool must be simple
for the sake of easy operations. Moreover, the tool must be general enough to cover as many typical problems as
possible. By this tool students select system identifications (structural identification and parametric identification)
they want to simulate, and start the simulation. During the simulation the program returns information about the
running status immediately and students learns in the reaction between they and computer.

1.2 Organization of report

2
I got lot of information from many journals and papers published about Genetic Algorithm. This information is
mentioning in my project report.

Chapter 1 contains introduction of the problem which was proposed by RODEF/EURO challenge 2010. This includes
the introduction, motivation and organization of report. Information of new ideas about Genetic Algorithm given by
researchers discussed in chapter 2 of literature review. What is Genetic Algorithm and what are there elements will
be discusse in chapter 3.

There are many problems about optimization. These problems can be solving by evolutionary algorithms. Chapter 4
contains the steps of implementation of evolutionary algorithm. Chapter 5 contains problem statement which was
proposed by RODEF/ EURO Challenge 2010.

Problem will be solved by Genetic Algorithm in c# language with .net framework. Solution of this problem will be
discusse in chapter 6. Result by compairing standard result given by RODEF/ EURO Challenge 2010 is shown in
chapter 7. The advantages and difficulties are discussed in chapter 8.

CHAPTER- 2

3
Literature review

Genetic algorithm (GA) is a search heuristic that mimics the process of natural selection. This heuristic (also
sometimes called a metaheuristic) is routinely used to generate useful solutions to optimization and search problems.
Genetic algorithms belong to the larger class of evolutionary algorithms (EA), which generate solutions to
optimization problems using techniques inspired by natural evolution, such as inheritance, mutation, selection, and
crossover.
Genetic algorithms find application in bioinformatics, phylogenetics, computational science, engineering,
economics, chemistry, manufacturing, mathematics, physics, pharmacometris and other fields.
a) Genetic algorithm development and enhancement

In the 1960s, Rechenberg (1965, 1973) introduced "evolution strategies" (Evolutions strategie in the original
German), a method he used to optimize real−valued parameters for devices such as airfoils. This idea was further
developed by Schwefel (1975, 1977). The field of evolution strategies has remained an active area of research, mostly
developing independently from the field of genetic algorithms (although recently the two communities have begun
to interact). (For a short review of evolution strategies, see Back, Hoffmeister, and Schwefel 1991.) Fogel, Owens,
and Walsh (1966) developed "evolutionary programming," a technique in which candidate solutions to given tasks
were represented as finite−state machines, which were evolved by randomly mutating their state−transition diagrams
and selecting the fittest. A somewhat broader formulation of evolutionary programming also remains an area of
active research (see, for example, Fogel and Atmar 1993). Together, evolution strategies, evolutionary programming,
and genetic algorithms form the backbone of the field of evolutionary computation.

Several other people working in the 1950s and the 1960s developed evolution−inspired algorithms for
optimization and machine learning. Box (1957), Friedman (1959), Bledsoe (1961), Bremermann (1962), and Reed,
Toombs, and Baricelli (1967) all worked in this area, though their work has been given little or none of the kind of
attention or followup that evolution strategies, evolutionary programming, and genetic algorithms have seen. In
addition, a number of evolutionary biologists used computers to simulate evolution for the purpose of controlled
experiments (see, e.g., Baricelli 1957, 1962; Fraser 1957 ; Martin and Cockerham 1960). Evolutionary computation
was definitely in the air in the formative days of the electronic computer.

Genetic algorithms (GAs) were invented by John Holland in the 1960s and were developed by Holland and his
students and colleagues at the University of Michigan in the 1960s and the 1970s. In contrast with

4
evolution strategies and evolutionary programming, Holland's original goal was not to design algorithms to solve
specific problems, but rather to formally study the phenomenon of adaptation as it occurs in nature and to develop
ways in which the mechanisms of natural adaptation might be imported into computer systems.

b) Genetic algorithm Implementation Process

The original motivation for GA approach is biological analogy. In the selective breed of plants and animal, for
example, offspring are sought that have certain desirable characteristics – characteristics that are determined at the
genetic level by the way the parents’ chromosomes combine. In the case of GA, a population of spring is used, and
these strings are often referred to in the GA literature as chromosomes. The recombination of strings is carried out
using simple analogies of genetic crossover and mutation, the search is guided by the result of evaluating the
objective function for each string in the population. Based on these evolution, strings that have higher fitness can be
identified and these are giving more opportunity to breed.

5
CHAPTER -3

What is Genetic Algorithm?

Genetic Algorithm is adaptive heuristic search algorithm based on the evolutionary ideas of natural selection and
genetics. As such they represent an intelligent exploitation of a random search used to solve optimization problem.
Although randomized, GAs is by no mean random, instead they exploit historical information to direct the search
into the region of better performance with in the search space. The basic techniques of GAs are designs to simulate
processes in natural system necessary for evolution, especially those follow the principles first laid down by Charles
Darwin of “survival of the fittest”. Since in nature, competition among individuals for scanty resources result in the
fittest individuals dominating over the weaker ones.

GA was first used by John Holland, whose book Adaptation in Natural and Aritificial Systems of 1975 was
instrumental in creating what is now a flourishing field of research and application that goes much wider than the
original GA. Many people now use the term evolutionary computing or evolutionary algorithms (EAs) in order to
cover the developments of the last 10 years. A series of further studies followed the first conference on the nascent
subject was convened in 1985, and another graduate student of Holland’s David Goldberg produced first an award-
winning doctoral thesis on his application to gas pipeline optimization.

The basic idea in GA is to maintain a population of chromosomes. Each chromosome in the population has an
associated fitness to determine which chromosomes are used to form new ones in the competition process, which is
called selection. The new ones are created using genetic operators such as crossover and mutation. GAs had a great
measure of success in search and optimization problems. The reason for a great part of their success is their ability
to exploit the information accumulated about an initially unknown search space in order to bias subsequent searches
into useful subspaces, i.e., their adaptation. This is their key feature, particularly in large, complex, and poorly
understood search spaces, where classical search tools (enumerative, heuristic) are inappropriate, offering a valid
approach to problems requiring efficient and effective search techniques. Fixed length and binary coded strings for
the representation of the solutions have dominated GA research since there are theoretical results that show them to
be the most appropriate ones (Goldberg, 1991), and as they are amenable to simple implementation. But the GA’s
good properties do not stem from the use of bit strings.

One of the most important ones is the real number representation, which would seem particularly natural when
optimization problems with variables in continuous search spaces are tackled. So a chromosome is a vector of floating
point numbers whose size is kept the same as the length of the vector, which is the solution to the problem. Gases
based on real number representation are called realcoded GAs (RCGAs). The use of real coding initially appears in

6
specific applications, such as in (Lucasius et al., 1989) for chemometric problems, and in (Davis, 1989) for the use
of metaoperators in order to find the most adequate parameters for a standard GA. Subsequently, RCGAs have been
mainly used for numerical optimization on continuous domains. Until 1991 specific theoretical studies about RCGA
operation weren’t done and so the use of these algorithms was controversial; researchers familiar with fundamental
GA theory didn’t understand the great success of RCGAs since this suggested that binary coding should be more
effective than codings based on large alphabets. Later, tools for the theoretical treatment of RCGAs were proposed
and so their power was corroborated. Other evolution algorithms based on real coding are the Evolution Strategies
(ES). The similarity between RCGAs and ES allows some of their genetic operators to be exchanged.

3.1 Elements of GA

(i)Chromosomes

During the division process of the human cells the chromatin (contained in the nucleus and built from DNA
(deoxyribonucleic acid), proteins and RNA (ribonucleic acid)) become shorter and thicker and forms spiral strings –
chromosomes. In these chromosomes are the genes that carry the inherited cell information. Every gene codes
particular protein and is independent factor of the genetic information, which determines the appearance of different
peculiarities. For the genetic algorithms, the chromosomes represent set of genes, which code the independent
variables. Every chromosome represents a solution of the given problem. Individual and vector of variables will be
used as other words for chromosomes. From other hand, the genes could be Boolean, integers, floating point or string
variables.A set of different chromosomes (individuals) forms a generation. By means of evolutionary operators, like
selection, recombination and mutation an offspring population is created.

(ii)Selection

In the nature, the selection of individuals is performed by survival of the fittest. The more one individual is adapted
to the environment - the bigger are its chances to survive and create an offspring and thus transfer its genes to the
next population.

In GA the selection of the best individuals is based on an evaluation of fitness function or fitness functions. Examples
for such fitness function are the sum of the square error between the wanted system response and the real one; the
distance of the poles of the closed-loop system to the desired poles, etc. If the optimization problem is a minimization
one, than individuals with small value of the fitness function will have bigger chances for recombination and
respectively for generating offspring.

(iii) Crossover
7
The first step in the reproduction process is the recombination (crossover). In it the genes of the parents are used to
form an entirely new chromosome. The typical recombination for the GA is an operation requiring two parents, but
schemes with more parent area also possible.

The crossover is a method for sharing information between chromosomes. It combines the features of two parent
chromosomes to form two offspring, with the possibility that good chromosomes may generate better ones. The
crossover operator is not usually applied to all pairs of chromosomes in the intermediate population. A random choice
is made, where the likelihood of crossover being applied depends on probability defined by a crossover rate, the
crossover probability. The crossover operator plays a central role in GAs, in fact it may be considered to be one of
the algorithm’s defining characteristics and it is one of the components to be borne in mind to improve the GA
behavior. Definitions for this operator are very dependent on the particular representation choosen .

(iv ) Mutation

The newly created by means of selection and crossover population can be further applied to mutation. Mutation
means that some elements of the DNA are changed. Those changes are caused mainly by mistakes during the copy
process of the parent’s genes. In the terms of GA, mutation means random change of the value of a gene in the
population Figure 3.1 (a). The chromosome, which gene will be changed and the gene itself are chosen by random
as well Figure 3.1 (b).

Fig: 3.1 a) mutation in a chromosome

Fig: 3.2 b) mutation places in the population

8
CHAPTER -4

4.1 Scheme of the Genetic Algorithms

The GA holds a population of individuals (chromosomes), which evolve my means of selection and other operators
like crossover and mutation. Every individual in the population gets an evaluation of its adaptation (fitness) to the
environment. In the terms of optimization this means, that the function that is maximized or minimized is evaluated
for every individual. The selection chooses the best gene combinations (individuals), which through crossover and
mutation should drive to better solutions in the next population.

One of the most often used schemes of GA is shown on Figure 4.1.

1. Generate initial population - In most of the algorithms the first generation is randomly generated by selecting
the genes of the chromosomes among the allowed alphabet for the gene. Because of the easier computational
procedure it is accepted that all populations have the same number (N) of individuals.
2. Calculation of objective function - Calculate the values of the function that we want to minimize or maximize.
3. Termination - Check for termination of the algorithm as in the most optimization algorithms. it is possible to
stop the genetic optimization by:

 Value of the function – the value of the function of the best individual is within defined range around a set
value. It is not recommended to use this criterion alone because of the stochastic element in the search
procedure, the optimization might not finish within sensible time.
 Maximal number of iterations – this is the most widely used stopping criteria. It guarantees that the algorithms
will give some results within some time, whenever it has reached the extremist or not.
 Stall generation – if within initially set number of iterations (generations) there is no improvement of the
value of the fitness function of the best individual the algorithms stops.

4. Selection – Between all individuals in the current population are chose those who will continue and by means
of crossover and mutation will produce offspring population. At this stage elitism could be used, the best n
individuals are directly transferred to the next generation. The elitism guarantees that the value of the
optimization function cannot get worst (once the extremist is reached it would be kept).

9
Fig 4.1: Genetic Algorithm process

10
5. Crossover – The individuals chosen by selection recombine with each other and new individuals will be
created. The aim is to get offspring individuals that inherit the best possible combination of the characteristics
(genes) of their parents.
6. Mutation – By means of random change of some of the genes, it is guaranteed that even if none of the
individuals contain the necessary gene value for the extreme, it is still possible to reach the extreme.
7. New generation – the elite individuals chosen from the selection are combined with those who passed the
crossover and mutation, and form the next generation.

4.2 Choose run parameters

In general there are several parameters which control the operation of evolution that maybe worth changing,
depending on the problem being attacked.

a) Population size – The number of individuals created for each generation.Larger values slow
down the time it takes to produce a new generation and small values often lead to lack of
diversity in a population.For most difficult problems, bigger is better and actual size selected
depends on what will easily fit in RAM.
b) Maximum Generations – The number of generations to evaluate before assuming that a
particular run has converged prematurely and should be aborted. Typically evolution
progresses most quickly early on and further improvements take more and more generation,
the exact point that it becomes counterproductive to continue a run is only approximateable
via statistical analysis of a collection of runs.
c) Maximum initial program length/ Tree depth – When creating the initial population, this
specifies the maximum size of each new individual. The meaning of this value is wholly
dependant on the representation of the programming language used. Overly large values will
slow the initial evaluation of fitness. Overly small values will not allow enough variation
between individuals to maintain population diversity and will decrease the likelihood that
there will be interesting difference in fitness between randomly generated members.
d) Maximum program length/ tree depth – This setting determines how large individuals can
grow during the process of run. Unless the fitness function biases against non functional code,
evolved programs tend to grow in size with each passing generation.this is not necessary a bad
thing, as long as the growth is limited to keep programs from consuming exceedingly large
amounts of computational resources.
11
e) Success criteria – For some problems it is easy to tell when the solution has been found. For
symbolic regression this is frequently when fitness reaches 0. On the other hand, perfect fitness
canat time be very hard to achieve (particularly, if floating point numbers are manipulated in
the process of producing the result). For that case, the success criteria might be that the total
fitness be within 5% of perfect or that the performance on each fitness case has no more than
1% error.
f) % Crossover, % Mutation, % Duplication etc – In any genetic programming system that has
more than one method for producing children, the percentage that each “ genetic operator” is
applied must be specified. Usually this is done by setting the percentage of children in each
generation that are produce by different opratores.

12
CHAPTER -5

PROBLEM STATEMENT

The proposed subject Challenge ROADEF/EURO 2010 consists of modeling the production assets and finding an
optimal outage schedule and includes of two dependent sub problems:

1. Determining a schedule of plant outages. The schedule must satisfy constraints in order to
Comply with limitations on resources which are necessary to perform refueling and maintenance
Operation.

2. Determining an optimal production plan to satisfy demand, i.e. a quantity of energy to produce
By each plant at each time step for each scenario. Production must satisfy some technical constraints.

In medium-term electricity management numerous uncertainties have to be taken into account


(Demand, generation units availability, spot market prices, quantities that can be bought or sold,),
Which leads to the need to consider multiple scenarios.

The objective is to minimize the expected cost of production.

5.1 General Definitions:

Time Step: The time horizon is split into discrete periods of time of the same length. A time step is the smallest unit
of time we deal with, i.e., our world is constant during a time step.

Week: A (per data set) fixed number of successive time steps. Note that power plant outages are scheduled in weeks,
while production levels will be planned for each time step.

Scenario: The demand to be satisfied by all plants is given in the form of different uncertainty scenarios. Each
scenario is given as a vector of concrete production amounts (i.e., one value per time step), which can be seen as the
result of some stochastic process.

The following terms apply only to Type-2 power plants:

13
Outage: A series of weeks during which a plant is offline.

Production Campaign: A series of weeks during which a plant can produce.

Cycle: The succession of an outage and a production campaign.

Decoupling: The first week of an outage.

Coupling: The first week of a production campaign.

Reloading/Refueling: The amount of fuel provided during an outage.

Modulation: The sum of the differences between the maximum allowed and actual production over all time steps of
a production campaign.

Imposed Power Profile: A constraint imposing that the production level of a plant has to follow a given profile if
the fuel level is below a certain threshold.

5.1.1 Indices

A dataset comprises various sets of entities. Let S denote the set of the scenarios, J the set of Type-1 power plants
and I the set of Type-2 power plants. Our timeline consists of T uniform time steps spanning over W weeks in total,
where T is always a multiple of W. We define the corresponding sets for time steps as T = {0,....,T-1} and weeks as
W = {0,...,W-1}.

We denote the number of cycles of each Type-2 power plant as K and the corresponding set as K = {0,....,K-1}. K is
equal for all Type-2 power plants.

Furthermore, we denote the cycle and production campaign each plant starts with (i.e., during time step 0) as the
initial cycle and use k = -1 for it.

Similarly, we use K, T and W in the upcoming parameters to denote the end of our time horizon.The following lower
case indices will be used throughout this document to access single entities of the given type: s ϵ S, j ϵ J , I ϵ I, t ϵ T
, w ϵ W, k ϵ K.

14
5.1.2 Decision Variables

The following three types of decision variables make up our problem:

Decoupling Dates: Each Type-2 power plant regularly goes offline for refueling and maintenance. Let hai,k є {-1}
U W denote the week of decoupling of plant i in cycle k. Note that there are two special cases. First, for the initial
cycle of each plant we define hai,-1 := 0. Second, if a cycle is not scheduled, i.e., its decoupling date is postponed
behind the time horizon, then hai,k will be set to -1.

Refueling Amounts: During each outage a Type-2 power plant can be supplied with a certain of amount of fuel. Let
ri,k ≤ R≤ 0 denote this amount of plant i in cycle k. We define the refueling amount of postponed cycle as 0.

Production Levels: In a solution all power plants (i.e., both types) need to have an absolute real-valued production
level assigned for each time step and scenario. Let pj,s,t/pi,s,t є R>=0 denote this level of power plant j=i during time
step t in scenario s.

Note that a power plant's production levels may vary between demand scenarios of a dataset, while outage dates and
refueling amounts are decision variables of the dataset, i.e, they are equal in all scenarios.

5.1.3 Global Parameters

DEMs,t: Demand to satisfy for scenario s and time step t


D: Length of a time step (all time steps have equal length)

5.1.4 Parameters of each Type-1 Power Plant j

PMINs, t,j : Minimum production level during time step t of scenario s

PMAXs, t,j : Maximum production level during time step t of scenario s

Cs, t,j : Cost of production per unit during time step t of scenario s

15
5.1.5 Parameters of each Type-2 Power Plant i

PMAXt,i: Maximum production level during time step t in all scenarios.

XIi: Initial fuel level (i.e., in time step 0)

Ci,T: Discount per unit for residual fuel at the end of the time horizon

The following parameters are provided for each cycle k of a Type-2 power plant:

Dai,k: Duration of the outage in weeks (note the special case Dai,-1 := 0)

Ci,k: Cost of refueling per unit during this cycle's outage

RMINi,k: Minimum refueling amount

RMAXi,k: Maximum refueling amount

MMAXi,k: Maximum modulation over production campaign

Qi,k: Refueling coefficient

Boi,k: Fuel level threshold activating the imposed power profile for this campaign

Pbi,k: Decreasing power profile (a piecewise linear concave function: R≥0→ [0, 1])

ϵ : Tolerance for the imposed power profile

AMAXi,k: Upper bound of fuel level before refueling

SMAXi,k: Upper bound of fuel level after refueling

Additionally, the parameters MMAXi,-1, Boi,-1 and Pbi,-1 will also be provided.

16
5.2 Constraints

In this section we define the constraints that make up our model. We adopt the numbering from the official problem
statement of the competition. In the first part we model plant operations (production levels, fuel level variation, fuel
level restrictions). The second part presents different types of outage constraints between Type-2 power plants which
arise from limited resources (staff, tools,), legal restrictions and production safety considerations.

[CT 1] Coupling load and production

The sum of production of all Type-1 power plants and all Type-2 power plants equals the demand DEMs,t in all
scenarios s and time steps t:

∑ pj,s,t + ∑ pi,s,t =DEMs,t s ϵ S; t ϵ T; j ϵ J; i ϵ I

[CT 2] Bound of production of Type-1 power plants

The production pj,s,t of a Type-1 power plant j has to stay between its lower bound PMINs,t j and upper bound PMAXs,t
j . These bounds may also model outages which are outside the scope of our problem:

PMINs,tj ≤ pj,s,t ≤ PMAXs,t j j є J ; s є S; t є T

[CT 3] Offline power

During every time step t where a Type-2 power plant i is on outage, its production pi,s,t equals zero in all scenarios
s:

pi,s,t = 0 i є I; s є S ;t є T

[CT 4] Bound of production of Type-2 power plants

During every time step t the production pi,s,t of a Type-2 power plant i is between zero and the upper bound PMAXti
:

0 ≤ pi,s,t ≤ PMAXti i є I; s є S; t є T

[CT 5] Maximum power before power profile imposition

We merged this constraint with CT 4.

17
[CT 6] Maximum power after power profile imposition

If the fuel level x(i, s, t) of a Type-2 power plant i drops below the cycle's threshold BOi,k, then the production pi,s,t is fixed to
the given ratio PBi,k : R≥0 → [0, 1] of PMAXti within a tolerance of , as long as there is enough fuel x(i, s, t) to cover the current
consumption:

Pbi,k(x(i, s, t)).PMAXti .D ≤x(i, s, t) < Boi,k =>

(1 - є )(Pbi,k(x(i,s,t)) PMAXti) ≤pi,s,t ≤ (1 + є )(Pbi,k(x(i, s, t)) .PMAXti)

If there is not enough fuel left to fulfill the imposed production amount, then this power plant cannot produce anything:

(x(i, s, t) < Boi,k)^(x(i, s, t) < Pbi,k(x(i,s, t)) .PMAXti .D =˃ pi,s,t = 0

[CT 7] Bounds of refueling

If a cycle k of Type-2 power plant i is scheduled (i.e., hai,k ≠ -1), then the performed refueling ri,k is between its lower bound
RMINi,k and upper bound RMAXi,k:

RMINi,k ≤ ri,k ≤ RMAXi,k I ϵ I; k ϵ K

[CT 8] Initial fuel level

For each Type-2 power plant i, the fuel level x(i, s, t) of the first time step equals the plant's initial fuel level parameter XIi:

x(i, s, 0) = XIi i ϵ I; s ϵ S

[CT 9] Fuel level variation during a production campaign

Fuel levels are passed between successive time steps and adjusted by the fuel consumption, which is calculated from the
production level pi;s;t and the time steps duration D:

x(i, s, t + 1) = x(i, s, t) – pi,s,t . D i ϵ I; s ϵ S; t ϵ T

[CT 10] Fuel level variation during an outage

18
In the process of refueling a Type-2 power plant i, a certain amount of unspent fuel has to be removed to make the addition of
new fuel possible. The refueling coecient Qi,k helps to quantify this amount. Note that the fuel threshold Boi,k is in reality part
of the reload refueling ri,k and threshold Boi,k have been separated in the formulation because one is a decision variable and the
other is imposed (a technical parameter).

Refueling is performed entirely during the first timestep t-i,k of an outage:

x(i,s, t-i,k + 1) = Qi,k -1/Qi,k(x(i, s, t- i,k) – Boi,k-1) + ri,k + Boi,k i є I; s є S; k є K

[CT 11] Fuel level bounds around refueling

The fuel levels before and after refueling of a Type-2 power plant i and cycle k are restricted by AMAXi,k and SMAXi,k
respectively:

0 ≤ x(i,s, t-i,k) ≤ AMAXi,k

x(i, s, t-i,k + 1) ≤ SMAXi,k i ϵ I; s ϵ S; k ϵ K

[CT 12] Maximum modulation over a cycle

While production is not imposed (see CT 6), the production campaign's aggregated deviation from the maximum production
PMAXti is limited by MMAXi,k. If the fuel level is below Boi,k then the imposed power prole determines the exact production
level.

∑ (PMAXti – pi,s,t).D ≤ MMAXi,k i є I; s є S; k є K


+
t*i,k ≤t≤t i,k

x(i ,s,t)≥Boi,k

19
5.2.1 Outage Scheduling Constraints

The following constraints set up relations between outages of different Type-2 power plants. A dataset might contain
multiple instances of the constraint types 14 to 21 for varying subsets of plants and with different parameters. Note
that all these constraint instances are independent and do not share any parameters.

[CT 13A] Earliest and latest date of outage

An outage has to start during a given interval or may not be scheduled.

Data:

i: The given Type-2 power plant

k: The given outage/cycle

TOi,k: First possible week of decoupling

Tai,k: Latest week of decoupling (or -1 if the cycle can be postponed)

Constraint:

Tai,k ≠ -1 => Toi,k ≤ hai,k ≤ Tai,k

Tai,k = -1 => hai,k = -1 ˅ Toi,k ≤ hai,k

[CT 13B] Order of outage

Outages of a Type-2 power plant i appear in the same order as presented in the dataset and do not overlap (remember
Dai,k as outage duration). Therefore, if we decide not to schedule an outage, all successive outages of the same plant
have to be postponed, too.

Constraint:

hai,k = -1 => hai,k-1 + Dai,k-1≤ hai,k

hai,k-1 = -1 => hai,k = -1 i ϵ I; k ϵ K

20
5.2.2 Outage Dependency Constraints

The following constraints operate on a subset of Type-2 power plants A I and only on their scheduled cycles.

Data:

A: Set of considered Type-2 power plants

5.2.2.1 Spacing Constraints

The following constraints define minimum spacings (or maximum overlappings, respectively) between scheduled
cycles from power plants of the set A.

Data:

Se: Duration in weeks of minimum authorized spacing. Negative values are interpreted as maximum authorized
overlapping.

[CT 14] Minimum spacing/Maximum overlapping between outages

This constraint defines a set of Type-2 power plants A whose outages have to be scheduled with a minimum pair
wise spacing (or maximum overlapping) of Se weeks.

Constraint:

(hai,k – hai‘,k′ - Dai‘,k‘ ≥ Se)˅

(haiˈ,k' – hai,k – Dai,k ≥Se) I, i' ϵ A; k, k' ϵ K; i ≠ I'

[CT 15] Minimum spacing/Maximum overlapping between outages during a

Specific period

Outages of a set A of Type-2 power plants that intersect an interval [ID; IF] have to be scheduled with a minimum
pair wise spacing (or maximum overlapping) of Se weeks.

21
Data:

ID: First week of the specific period

IF: Last week of the specific period

Constraint:

(ID - Dai,k +1 ≤ hai,k ≤ IF)^ (ID – Dai',k' +1 ≤ hai',k' ≤ IF) →

(hai,k – hai',k' – Dai',k' ≥Se) ˅ (hai',k' - hai,k – Dai,k ≥Se)

I, I' ϵ A; k, k' ϵ K; i ≠ i'

[CT 16] Minimum spacing between decoupling dates

Decoupling dates of outages from set A of Type-2 power plants have to be spaced by at least Se weeks.

Constraint:

|hai,k – hai',k' | ≥ Se I, i' є A; k, k' є K; i ≠ I'

[CT 17] Minimum spacing between coupling dates

Coupling dates of outages of set A of Type-2 power plants have to be spaced by at least Se weeks.

Constraint:

|hai,k + Dai,k -hai',k' - Dai',k' | ≥ Se I, i' є A; k, k' є K; i ≠ I'

[CT 18] Minimum spacing between decoupling and coupling dates

Decoupling dates and coupling dates of outages of a set A of Type-2 power plants have to be spaced by at least Se
weeks.

Constraint:

|hai,k + Dai,k -hai',k' | ≥ Se I, i' ϵ A; k, k' ϵ K; i ≠ I'

22
5.2.2.2 Resource Constraints

The following constraints aggregate values if a condition holds. Therefore, we first define an indicator function:

[CT 19] Limited resources

Each outage of a set A of Type-2 power plants requires one unit of the given resource during certain weeks of its
outage. All outages have to be scheduled with respect to the limited availability of the resource, i.e., there is no week
w where the resource limit is exceeded.

Data:

Li,k: First week of resource usage (0 ≤ Li;k ≤ DAi;k)

Tui,k: Time of usage of the resource in weeks (0 ≤ Tui,k; Li,k + Tui,k ≤ Dai,k)

Q: Available quantity of the resource

Constraint:

∑ 1((hai,k+ Li,k,hai,k+Li,k+TUi,k),w)≤Q w ϵ W

iϵ A

k ϵK

hai,k≠-1

[CT 20] Maximum number of outages during a given week

The number of outages among set A of Type-2 power plants during a Specific week can be limited.

Data:

H: The considered week

N: Maximum number of outages during this week

23
Constraint:

∑1((hai,k, hai,k +Dai,k),H)≤ N

iє I

kєK

hai,k≠-1

[CT 21] Maximum online power capacity during a specific period

During the given period the aggregated maximum production capacity of all plants on outage from a set A can be
limited.

Data:

ID: First time step of period

IF: Last time step of period

IMAX: Maximum offline power capacity

Constraint:

∑ PMAXti ≤ IMAX t ϵ T; ID ≤ t ≤ IF

iϵA

5.4 Objective Function

While satisfying all given constraints (CT 1 - 21) the sum of the following two terms is to be minimized:

The expected production cost of all Type-1 power plants over all scenarios. The total refueling cost of all Type-2
power plants reduced by the expected value of residual fuel at the end of the time horizon over all scenarios.

We can formalize our objective function as follows:

∑ ∑ Ci,k . ri,k +(1/|S|)∑ ( ∑ ( ∑ Cjs,t . pj,s,t . D) - ∑ Ci,T . x( i,s,T) )

24
iє I kєK s єS t єT j єJ i єI

Note that the refueling amounts and refueling unit costs are constant in all scenarios. Contrary, the unit production
costs of Type-1 power plants and residual fuel amounts of Type-2 power plants can vary between scenarios and have
to be averaged.

25
CHAPTER-6

Solution of the problem

Given problem is try to solve by genetic algorithm. Solution will be given in c# language in .net framework. For
solving this problem ROADEF/EURO Challenge 2010 has provided few data. Here we are using these ones.

Step 1:

For solving this problem, first these data of data 1 table will be coded in c# in .net framework.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace PlantConsole
{
class Program
{
public static CommonData cd = new CommonData();
public static List<Plant1> p1 = new List<Plant1>();
public static List<Plant2> p2 = new List<Plant2>();
public static List<Campaign_Profile> campaigns = new List<Campaign_Profile>();
public static List<Constraint> constraints = new List<Constraint>();

public static int i = 0, pmaxi = 0, costi = 0;


enum ProcessStatus { START_MAIN, END_MAIN, START_PLANT1, START_PLANT2, END_PLANT1,
START_CONSTRAINT, START_PERIOD, END_CONSTRAINT };
public enum CampaignType { STD, CURRENT };

static string plant1Index;


static string plant2Index;
26
public static Plant1 plt1;
public static Plant2 plt2;
public static CampaignType ct;
public static Campaign_Profile currentProfile;
public static Campaign_Profile cp;
public static Constraint constraint;
public static Period period;
static string dataFileName;
static string outputFileName;
static string constraintFileName;

static System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();


static void Main(string[] args)
{

try
{
try
{
dataFileName = args[0];
outputFileName = args[1];
constraintFileName = args[2];
}
catch (IndexOutOfRangeException)
{
Console.WriteLine("Error: No file name supplied. Now using default file names.");
Console.WriteLine("-------------------------------------------------------");

dataFileName = "data1.txt";

outputFileName = "output.cpp";

constraintFileName = "constraints.txt";
}
27
finally
{
Console.WriteLine("Input File Name: data1.txt");
Console.WriteLine("Output File Name: output.cpp");
Console.WriteLine("Constraint Output File Name: constraints.txt");
Console.WriteLine("-------------------------------------------------------");
sw.Start();
var lines = File.ReadAllLines(dataFileName);
ProcessStatus p = ProcessStatus.START_MAIN;

foreach (string line in lines)


{
switch (line)
{
case "begin main": p = ProcessStatus.START_MAIN;
break;
case "end main": p = ProcessStatus.END_MAIN;
break;
case "type 1": p = ProcessStatus.START_PLANT1;
break;
case "end powerplant":
if (p.Equals(ProcessStatus.START_PLANT1))
{
p = ProcessStatus.END_PLANT1;
p1.Add(plt1);
plt1 = null;
}
if (p.Equals(ProcessStatus.START_PLANT2))
{
p = ProcessStatus.END_PLANT1;
p2.Add(plt2);
plt2 = null;
}
break;
28
case "type 2": p = ProcessStatus.START_PLANT2;
break;
case "begin current_campaign_profile": ct = CampaignType.CURRENT;
currentProfile = new Campaign_Profile();
break;
case "end current_campaign_profile": ct = CampaignType.STD;
break;
case "begin profile": cp = new Campaign_Profile();
break;
case "end profile": plt2.campaign_profiles.Add(cp);
break;
case "begin constraint": p = ProcessStatus.START_CONSTRAINT;
break;
case "end constraint": p = ProcessStatus.END_CONSTRAINT;
break;
case "begin period": p = ProcessStatus.START_PERIOD;
break;
}
switch (p)
{
case ProcessStatus.START_MAIN: processMainData(line);
break;
case ProcessStatus.END_MAIN: break;
case ProcessStatus.START_PLANT1:
if (line.Split(' ')[0].Equals("index")) //If currently reading line is similar to 'index 0'
{
if (line.Equals(plant1Index) == false) //This means next plant
{
plant1Index = line;
plt1 = new Plant1(); //created new empty plant
plt1.index = int.Parse(line.Split(' ')[1]); //second element of the array returned from Split()
i = 0;
pmaxi = 0;
costi = 0;
29
}
}
else
if (plt1 != null)
processPlant1Data(line); //continue processing data if plant index is not changed
break;
case ProcessStatus.START_PLANT2:
if (line.Split(' ')[0].Equals("index"))
{
if (line.Equals(plant2Index) == false)
{
plant2Index = line;
plt2 = new Plant2();
plt2.index = int.Parse(line.Split(' ')[1]);
}
}
else if (plt2 != null)
{
processPlant2Data(line);
}
break;
case ProcessStatus.START_CONSTRAINT:
if (line.Split(' ')[0].Equals("type")) //if new constraint is read
{
constraint = new Constraint(); //create empty constraint
constraint.type = int.Parse(line.Split(' ')[1]);
}
processConstraint(line);
break;
case ProcessStatus.END_CONSTRAINT:
if (constraint != null)
constraints.Add(constraint); //Add a copy of the constraint to the 'constraint' list if not null
break;
case ProcessStatus.START_PERIOD:
30
processPeriod(line);
break;

}
}
generateOutput(p1, p2, cd, constraints); //Perform calculations on collected data and write to output file
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("----Technical Details----");
Console.WriteLine(e.StackTrace);
}
finally
{
Console.Read();
}
}

//Utility Functions.................................................
public static int[] parseStringArrayToIntArray(string[] str)
{
int i = 0; int[] res = new int[str.Length];
foreach (string s in str)
{
res[i++] = int.Parse(s);
}

return res;
}
31
public static double[] parseStringArrayToDoubleArray(string[] str)
{
int i = 0; double[] res = new double[str.Length];
foreach (string s in str)
{
res[i++] = double.Parse(s);
}
return res;
}
public static long[] parseStringArrayToLongArray(string[] str)
{
int i = 0; long[] res = new long[str.Length];
foreach (string s in str)
{
res[i++] = long.Parse(s);
}
return res;
}

//Common Data Processing Functions..................................


public static void processMainData(string data)
{

string com = data.Split(' ')[0];


string[] val = data.Remove(0, com.Length + 1).Split(' ');

switch (com)
{
case "timesteps": cd.timesteps = int.Parse(val[0]);
break;
case "weeks": cd.weeks = int.Parse(val[0]);
break;
case "campaigns": cd.campaingns = int.Parse(val[0]);
break;
32
case "scenario": cd.scenario = int.Parse(val[0]);
break;
case "epsilon": cd.epsilon = double.Parse(val[0]);
break;
case "powerplant1": cd.powerplant1 = int.Parse(val[0]);
break;
case "powerplant2": cd.powerplant2 = int.Parse(val[0]);
break;
case "constraint13": cd.constraint13 = int.Parse(val[0]);
break;
case "constraint14": cd.constraint14 = int.Parse(val[0]);
break;
case "constraint15": cd.constraint15 = int.Parse(val[0]);
break;
case "constraint16": cd.constraint16 = int.Parse(val[0]);
break;
case "constraint17": cd.constraint17 = int.Parse(val[0]);
break;
case "constraint18": cd.constraint18 = int.Parse(val[0]);
break;
case "constraint19": cd.constraint19 = int.Parse(val[0]);
break;
case "constraint20": cd.constraint20 = int.Parse(val[0]);
break;
case "constraint21": cd.constraint21 = int.Parse(val[0]);
break;
case "durations": cd.durations = parseStringArrayToIntArray(val);
break;
case "demand": setDemands(val);
break;
default: break;
}

33
}
public static void setDemands(string[] str)
{
int j, x = 0;
if (i == 0)
cd.demand = new double[cd.scenario, cd.timesteps];
if (i < cd.scenario)
{
for (j = 0; j < cd.timesteps; j++)
{
cd.demand[i, j] = double.Parse(str[x++]);
}
}
i++;
}

//Power Plant 1 Processing Functions................................


public static void setpmin(string[] str)
{
int j, x = 0;
if (i == 0)
plt1.pmin = new double[cd.scenario, cd.timesteps];
if (i < cd.scenario)
{
for (j = 0; j < cd.timesteps; j++)
{
plt1.pmin[i, j] = double.Parse(str[x++]);
}
}
i++;
}
public static void setpmax(string[] str)
{
int j, x = 0;
34
if (pmaxi == 0)
plt1.pmax = new double[cd.scenario, cd.timesteps];
if (pmaxi < cd.scenario)
{
for (j = 0; j < cd.timesteps; j++)
{
plt1.pmax[pmaxi, j] = double.Parse(str[x++]);
}
}
pmaxi++;
}
public static void setcost(string[] str)
{
int j, x = 0;
if (costi == 0)
plt1.cost = new double[cd.scenario, cd.timesteps];
if (costi < cd.scenario)
{
for (j = 0; j < cd.timesteps; j++)
{
plt1.cost[costi, j] = double.Parse(str[x++]);
}
}
costi++;
}
public static void processPlant1Data(string data)
{
string com = data.Split(' ')[0];
string[] val = data.Remove(0, com.Length + 1).Split(' ');

plt1.index = int.Parse(plant1Index.Split(' ')[1]);

switch (com)
{
35
case "pmin": setpmin(val);
break;
case "pmax": setpmax(val);
break;
case "cost": setcost(val);
break;
default: break;
}
}

//Power Plant 2 Processing Functions................................


public static void processPlant2Data(string data)
{
string com = data.Split(' ')[0];
string[] val = data.Remove(0, com.Length + 1).Split(' ');

switch (com)
{
case "index": plt2.index = int.Parse(val[0]);
break;
case "stock": plt2.stock = long.Parse(val[0]);
break;
case "campaigns": plt2.campaigns = int.Parse(val[0]);
break;
case "durations": plt2.durations = parseStringArrayToIntArray(val);
break;
case "current_campaign_max_modulus": plt2.current_campaign_max_modulus = long.Parse(val[0]);
break;
case "max_modulus": plt2.max_modulus = parseStringArrayToLongArray(val);
break;
case "max_refuel": plt2.max_refuel = parseStringArrayToLongArray(val);
break;
case "min_refuel": plt2.min_refuel = parseStringArrayToLongArray(val);
break;
36
case "refuel_ratio": plt2.refuel_ratio = parseStringArrayToIntArray(val);
break;
case "current_campaign_stock_threshold": plt2.current_campaign_stock_threshold = long.Parse(val[0]);
break;
case "stock_threshold": plt2.stock_threshold = parseStringArrayToLongArray(val);
break;
case "pmax": plt2.pmax = parseStringArrayToDoubleArray(val);
break;
case "max_stock_before_refueling": plt2.max_stock_before_refueling =
parseStringArrayToLongArray(val);
break;
case "max_stock_after_refueling": plt2.max_stock_after_refueling = parseStringArrayToLongArray(val);
break;
case "refueling_cost": plt2.refueling_cost = parseStringArrayToDoubleArray(val);
break;
case "fuel_price": plt2.fuel_price = double.Parse(val[0]);
break;
case "campaign_profile":
if (ct == CampaignType.CURRENT)
plt2.current_campaign_profile.campaign_profile = int.Parse(val[0]);
else
{
cp.campaign_profile = int.Parse(val[0]);
}
break;
case "profile_points":
if (ct == CampaignType.CURRENT)
plt2.current_campaign_profile.profile_points = int.Parse(val[0]);
else
{
cp.profile_points = int.Parse(val[0]);
}
break;
case "decrease_profile":
37
if (ct == CampaignType.CURRENT)
plt2.current_campaign_profile.decrease_profile = parseStringArrayToDoubleArray(val);
else
{
cp.decrease_profile = parseStringArrayToDoubleArray(val);
}
break;
}
}

//Constraint 13 Processing Functions................................


public static void processConstraint(string data)
{
string com = data.Split(' ')[0];
string[] val = data.Remove(0, com.Length + 1).Split(' ');

switch (com)
{
case "index": constraint.index = int.Parse(val[0]);
break;
case "powerplant": constraint.powerplant = int.Parse(val[0]);
break;
case "campaign": constraint.campaign = int.Parse(val[0]);
break;
case "earliest_stop_time": constraint.earliest_stop_time = int.Parse(val[0]);
break;
case "latest_stop_time": constraint.latest_stop_time = int.Parse(val[0]);
break;
case "set":
foreach (int set in parseStringArrayToIntArray(val))
{
constraint._set.Add(set);
}
break;
38
case "spacing": constraint.spacing = int.Parse(val[0]);
break;
case "week": constraint.week = int.Parse(val[0]);
break;
case "max": constraint.max = double.Parse(val[0]);
break;
case "startend":
foreach (int startend in parseStringArrayToIntArray(val))
{
constraint.startend.Add(startend);
}
break;
case "quantity": constraint.quantity = int.Parse(val[0]);
break;
default: break;
}
}

//Period Processing Functions.......................................


public static void processPeriod(string data)
{
string com = data.Split(' ')[0];
string[] val = data.Remove(0, com.Length + 1).Split(' ');

switch (com)
{
case "powerplant":
if (period != null)
{
constraint.periods.Add(period);
}
period = new Period();
period.powerplant = int.Parse(val[0]);
break;
39
case "start":
foreach (int start in parseStringArrayToIntArray(val))
{
period.start.Add(start);
}
break;
case "duration":
foreach (int duration in parseStringArrayToIntArray(val))
{
period.duration.Add(duration);
}
break;
default: break;
}
}

public static void generateOutput(List<Plant1> p1, List<Plant2> p2, CommonData cd, List<Constraint>
constraints)
{
int generation = 3;
Console.Write("Initializing...");
OutputData od = new OutputData();
OutputData od1 = null;
List<OutputData> odList = new List<OutputData>();
List<string> linesToWrite = new List<string>();
Console.WriteLine("Done");
Console.Write("Analyzing " + dataFileName + "...");
//Processing code goes here
od = new Logic().populationGeneration(p1.ToArray(), p2.ToArray(), cd, constraints); //Actual calculations
for first output file is done here

od = new ConstraintChecking(constraints).feasibilityCheck(cd, p1.ToArray(), p2.ToArray(), constraints,


od);
//od = new Logic().selectionOrderByCost(od, p1.ToArray(), p2.ToArray(), cd);
40
od = new Logic().crossOver(od, cd, p1.ToArray(), p2.ToArray());
od = new Logic().mutation(od, cd, p1.ToArray(), p2.ToArray()); //uncomment mutation part whenever
needed

int lowestCostIndex = od.cost.IndexOf(od.cost.Min());

// Managing results data in output file format

Console.Write("Collecting results and writing them to " + outputFileName + "(This will take some time)...");
linesToWrite.Add("");
linesToWrite.Add("Results For 0 Generation");
linesToWrite.Add("begin main"); // Data collection starts
linesToWrite.Add("team_identifier " + od.team_identifier);
linesToWrite.Add("solution_time_date " + DateTime.Today.ToShortDateString() + " " +
DateTime.Now.ToShortTimeString());
linesToWrite.Add("solution_running_time " + sw.Elapsed.Hours.ToString() + ":" +
sw.Elapsed.Minutes.ToString() + ":" + sw.Elapsed.Seconds.ToString() + ":" + sw.Elapsed.Milliseconds.ToString());
linesToWrite.Add("name_of_data_set_used_for_solution " + dataFileName);
linesToWrite.Add("cost " + od.cost[lowestCostIndex]);
linesToWrite.Add("end main");
linesToWrite.Add("begin outages"); List<long> temp1 = new List<long>();
List<double> temp2 = new List<double>();
int jas = 0;
foreach (Outages o in od.outages) //Fetch each outages from od.outages List and write them in output file in
some specific format
{
jas++;
try
{
linesToWrite.Add("name PowerPlant_2_" + o.index);
linesToWrite.Add("index " + o.index);
temp1 = new List<long>();
temp2 = new List<double>();
41
for (int s = 0; s < o.outage_dates.ToArray().Length; s++)
{

temp1.Add(o.outage_dates[s][lowestCostIndex]);
temp2.Add(o.reloaded_fuel[s][lowestCostIndex]);

}
linesToWrite.Add("outage_dates" + getListAsStringLine(temp1));
linesToWrite.Add("reloaded_fuel " + getListAsStringLine(temp2));

}
catch (Exception e)
{
throw e;
}
}
linesToWrite.Add("end outages");
linesToWrite.Add("begin power_output");

int pp1 = cd.powerplant1;


int pp2 = cd.powerplant2;

try
{

linesToWrite.Add("scenario " + i);


linesToWrite.Add("begin type1_plants");

for (int j = 0; j < pp1; j++)


{
string p = "name PowerPlant_1_" + j + " ";
temp2 = new List<double>();
42
for (int scn = 0; scn < cd.scenario; scn++)
{

for (int m = 0; m < cd.timesteps; m++)


{

temp2.Add(od.type1_productions[j].production[scn * m][lowestCostIndex]);

}
}
linesToWrite.Add(p + getListAsStringLine(temp2));
}
linesToWrite.Add("end type1_plants");
linesToWrite.Add("begin type2_plants");

linesToWrite.Add("end type2_plants");

List<double> temp3 = null;


List<double> temp4 = null;
for (int j = 0; j < pp2; j++)
{
temp2 = new List<double>();
temp3 = new List<double>();
temp4 = new List<double>();
for (int m = 0; m < cd.timesteps; m++)
{
temp2.Add(od.type2_productions[j].production[m][lowestCostIndex]);
temp3.Add(od.type2_productions[j].fuel_variation[m][lowestCostIndex]);

}
temp4.Add(od.type2_productions[j].remaining_fuel_at_the_end[0][lowestCostIndex]);
linesToWrite.Add("name PowerPlant_2_" + j + " " + getListAsStringLine(temp2));
linesToWrite.Add("fuel_variation " + getListAsStringLine(temp3));
43
linesToWrite.Add("remaining_fuel_at_the_end " + getListAsStringLine(temp4));

}
}
catch (IndexOutOfRangeException e)
{
throw e;
}

linesToWrite.Add("end power_output"); //Data collection completes

odList.Add(od);

for (int i = 1; i < generation; i++)


{

od = new Logic().calFuelVariationGen(p2.ToArray(), cd, od);


od = new Logic().setRemainingFuelGen(p2.ToArray(), cd, od);
od = new Logic().calculateCostGen(p1.ToArray(), p2.ToArray(), cd, od);
od = new ConstraintChecking(constraints).feasibilityCheck(cd, p1.ToArray(), p2.ToArray(), constraints,
od);
od = new Logic().crossOver(od, cd, p1.ToArray(), p2.ToArray());
od = new Logic().mutation(od, cd, p1.ToArray(), p2.ToArray());
lowestCostIndex = od.cost.IndexOf(od.cost.Min());

44
Step 2:

Selection of individuals (decision variables)

(i)Selection for production:- random production value will get by CT 1,CT 2,CT 3, CT4 and CT 5.

namespace PlantConsole
{
public class Logic
{
public double crossoverProbalityValue = 0.75;
public double mutationProbalityValue = 0.60;
public int noOfRandomVariableRequired = 4;
public double localDifference = 0;
public double globalDifference = 0;
public static OutputData od = new OutputData();
List<double> random1 = new List<double>();
List<double> random2 = new List<double>();
List<double> randomProductionType1AllPlants = new List<double>();
List<double> randomProductionType2AllPlants = new List<double>();
public static List<Constraint> cnts = new List<Constraint>();

void GetProduction(Plant1[] p1, Plant2[] p2, CommonData c)


{
try
{
List<double> randomProduction1 = null ;
List<double> randomProduction2 = null;
GetRandomProduction(p1, p2, c);
for (int m = 0; m <Math.Max(p1.Length, p2.Length) ; m++)
{
Type1_Plant_Production tp1 = new Type1_Plant_Production();
Type2_Plant_Production tp2 = new Type2_Plant_Production();

45
if (p1[m] != null || p2[m] != null)
{

for (int i = 0; i < c.scenario; i++)


{
for (int j = 0; j < c.timesteps; j++)
{
randomProduction1 = new List<double>();
randomProduction2 = new List<double>();
for (int f = 0; f < noOfRandomVariableRequired; f++)
{
int temp =(f * Math.Max(p1.Length, p2.Length)) + m + (j * Math.Max(p1.Length, p2.Length)
* noOfRandomVariableRequired) + (i * noOfRandomVariableRequired * Math.Max(p1.Length,
p2.Length)*c.timesteps);
randomProduction1.Add(randomProductionType1AllPlants[temp]);

}
tp1.production.Add(randomProduction1);//used to add random variable list in type 1 plnt
production

if (i < 1)

{
for (int f = 0; f < noOfRandomVariableRequired; f++)
{
randomProduction2.Add(randomProductionType2AllPlants[(f * Math.Max(p1.Length,
p2.Length)) + m + (j * Math.Max(p1.Length, p2.Length) * noOfRandomVariableRequired) ]);
}
tp2.production.Add(randomProduction2);
}

46
}
}

}
od.type1_productions.Add(tp1);
od.type2_productions.Add(tp2);
}
}

catch (Exception ex)


{
Console.Write(ex.ToString() + "\n" + ex.StackTrace);
}
}
void GetRandomProduction(Plant1[] p1, Plant2[] p2, CommonData c)
{
randomProductionType1AllPlants = new List<double>();
randomProductionType2AllPlants = new List<double>() ;
double p1Min = 0;
double p1Max = 0;
double p2Max = 0;
double demand = 0;
double demandVar = 0;
double plantLength=0;
int count=0;
for (int i = 0; i < c.scenario; i++)
{
for (int j = 0; j < c.timesteps; j++)
{
count=0;
if (i < 1)
{
demandVar = c.demand[i, j] / (p1.Length + p2.Length);
plantLength=p1.Length + p2.Length;
47
}
else
{
demandVar = c.demand[i, j] / (p1.Length);
plantLength=p1.Length;
}
while (count < noOfRandomVariableRequired)
{
globalDifference = 0;
demand = demandVar + count;
globalDifference=globalDifference- (count*plantLength);

random1 = new List<double>();


random2 = new List<double>();
for (int m = 0; m < Math.Max(p1.Length, p2.Length); m++)
{
if (p1[m] != null || p2[m] != null)
{

if (m < p2.Length && i<1)


{
p2Max = p2[m].pmax[j];
random2.Add(GetRandomProductionValue(0,p2Max,demand));
}
else if (m < Math.Max(p1.Length, p2.Length) && i < 1)
{
random2.Add(0);
}

if (m < p1.Length)
{
p1Min = p1[m].pmin[i, j];
p1Max = p1[m].pmax[i, j];
48
//random1.Add(r1.NextDouble() * (p1Max - p1Min) + p1Min);
random1.Add(GetRandomProductionValue(p1Min,p1Max,demand));

}
else
random1.Add(0);
}
}
double check = globalDifference;

double sumcheck = random1.Sum() + random2.Sum();


double demacheck = c.demand[i, j];
if ((Math.Round(c.demand[i, j]) >= Math.Round(random1.Sum() + random2.Sum()) &&
Math.Round(c.demand[i, j]) <= Math.Round(random1.Sum() + random2.Sum()) + 1) ||
((Math.Round(random1.Sum() + random2.Sum()) >= Math.Round(c.demand[i, j])) &&
(Math.Round(random1.Sum() + random2.Sum()) <= Math.Round(c.demand[i, j]) + 1)))
{
for (int o = 0; o < random1.ToArray().Length; o++)
{
randomProductionType1AllPlants.Add(random1[o]);
}
if (i < 1)
{
for (int o = 0; o < random2.ToArray().Length; o++)
{
randomProductionType2AllPlants.Add(random2[o]);
}
}
count++;
}

}
}
49
}
}

double GetRandomProductionValue(double pmin, double pmax, double value)


{
if (pmin < (value + globalDifference) && (value + globalDifference) < pmax)
{

value= value + globalDifference;


globalDifference = 0;
}
else if (pmin < (value ) && (value ) < pmax)
{
if (value + globalDifference < pmin)
{
localDifference = value - (pmin+1);
value = value - localDifference;
globalDifference = globalDifference + localDifference;

}
else if (value + globalDifference > pmax)
{
localDifference = (pmax - 1) - value;
value = value + localDifference;
globalDifference = globalDifference - localDifference;
}
}
else if (value < pmin)
{
localDifference = value - (pmin + 1);
value = value + (-(localDifference));
globalDifference = localDifference + globalDifference;

}
50
else if (value > pmax)
{
localDifference = value-(pmax-1);
value = value - localDifference;
globalDifference = globalDifference + localDifference;

double check = globalDifference;


return value;
}

Random selection of outage dates:

Random outage dates will be calculated from CT13.

public Constraint getContraint13(int powerplant, int campaign)


{
foreach (Constraint c1 in cnts)
{
if (c1.powerplant == powerplant && c1.campaign == campaign && c1.type == 13)
return c1;
}

return null;
}
void calcOutageNfuel(Plant2[] p2, CommonData c)
{
int j = 0, i = -1, f = 0;
Random r3 = null;
double prev_stock_threshold = 0;
List<long> randomOutageDate = null;
List<double> randomFuelVariation = new List<double>();
51
List<double> randomProduction = new List<double>();
Outages[] outs =od.outages.ToArray();
List<double> randomRelodedFuel = new List<double>();
double[] prev_fuel_variation = new double[noOfRandomVariableRequired];
foreach (Plant2 p in p2)
{
f = 0;
i++;

prev_stock_threshold = p.current_campaign_stock_threshold;
for (j = 0; j < p.campaigns; j++)
{
randomOutageDate = new List<long>();
r3 = new Random();

Constraint c13 = getContraint13(i, j);


if (c13 != null && c13.latest_stop_time != -1)
{
for (int e = 0; e < noOfRandomVariableRequired; e++)
{
randomOutageDate.Add(r3.Next(c13.earliest_stop_time, c13.latest_stop_time));

}
od.outages[i].outage_dates.Add(randomOutageDate);
od.outages[i].index = i;
od.outages[i].campaigns.Add(j);
}

double prev = 0; int z = 0; int y = 0;

for (int x = 0; x < c.timesteps; x++)


52
{
randomFuelVariation = new List<double>();
for (int e = 0; e < noOfRandomVariableRequired; e++)
{
randomOutageDate = null;

for (z = 0; z < outs[i].campaigns.ToArray().Length; z++)


{
randomOutageDate=outs[i].outage_dates[z];
if (x == randomOutageDate[e]*7)
{
f = z;
break;
}
}
for (y = f; y < outs[i].campaigns.ToArray().Length; y++)
{
randomOutageDate = null;
randomOutageDate = outs[i].outage_dates[y];
randomRelodedFuel = outs[i].reloaded_fuel[outs[i].campaigns[y]];

if (randomOutageDate[e] * 7 == x)// for outage timestep


{

prev = ((((p.refuel_ratio[outs[i].campaigns[y]] - 1) / p.refuel_ratio[outs[i].campaigns[y]]) * (prev_fuel_variation[e]


- prev_stock_threshold)) + randomRelodedFuel[e] + p.stock_threshold[outs[i].campaigns[y]]);
randomFuelVariation.Add(prev);
//od.type2_productions[i].fuel_variation.Add(prev);
prev_stock_threshold = p.stock_threshold[outs[i].campaigns[y]];
break;
}

53
else if (randomOutageDate[e] * 7 < x && x <= (randomOutageDate[e] * 7 + p.durations[outs[i].campaigns[y]]) *
7)// for during outage
{
randomFuelVariation.Add(prev_fuel_variation[e]);
//od.type2_productions[i].fuel_variation.Add(prev_fuel_variation[e]);
prev_stock_threshold = p.stock_threshold[outs[i].campaigns[y]];
break;
}

else// for production cycle


{

if (x != 0)
{
randomProduction = od.type2_productions[i].production[x ];
prev = (prev_fuel_variation[e] (randomProduction[e])*24);

if (prev < 0)

{
randomProduction[e] = 0;
od.type2_productions[i].production[x] = randomProduction;
prev = prev_fuel_variation[e];

}
randomFuelVariation.Add(prev);

//od.type2_productions[i].fuel_variation.Add(prev);
}
else
{
prev = p.stock;
randomFuelVariation.Add(p.stock);

54
}
prev_stock_threshold = p.stock_threshold[outs[i].campaigns[y]];
break;
}

}
prev_fuel_variation[e] = prev;
}
od.type2_productions[i].fuel_variation.Add(randomFuelVariation);

}
}
}

For the selection of reloaded fuel:

Random reloaded fuel will be calculated from CT 7.

void GetRefuel(Plant2[] p2)


{
Random r = null;// decleration
List<double> randomRelodedFuel = new List<double>();

for (int m = 0; m < p2.Length; m++)


{
Outages outage = new Outages();
for (int i = 0; i < p2[m].campaigns; i++)
{
randomRelodedFuel = new List<double>();// initiliazation
r = new Random();
for (int e = 0; e < noOfRandomVariableRequired; e++)
{
randomRelodedFuel.Add(r.NextDouble() * (p2[m].max_refuel[i] - p2[m].min_refuel[i]) + p2[m].min_refuel[i]);

55
}
outage.reloaded_fuel.Add(randomRelodedFuel);
}
od.outages.Add(outage);
}

Step 2: check fesibilty of indiviuals

Feasibility will be check by checking individuals with in constraints.

namespace PlantConsole
{
public class ConstraintChecking
{
public int noOfRandomVariableRequired = 4;
public static List<Constraint> cnts = new List<Constraint>();
public static List<Constraint> cnstraint = new List<Constraint>();
List<string> lines = new List<string>();
public ConstraintChecking(List<Constraint> cons)
{
cnts = cons;
}
List<Constraint> getContraint(int type)
{
cnstraint.Clear();
foreach (Constraint c in cnts)
{
if (c.type == type)
{
cnstraint.Add(c);
}
}
56
return cnstraint;
}

Constraint 16

public string CT16(Plant2[] p2, List<Constraint> cns , List<Outages> o)


{
List<long> previous_ha=new List<long>();
long ha=0;
List<long> randomOutage = null;
List<Constraint> ct16 = getContraint(16);
Random ran = new Random();

for (int i = 0; i < ct16.ToArray().Length; i++)


{

for (int j = 0; j < ct16[i]._set.ToArray().Length; j++)


{
// done for initilization default value of ha in list
previous_ha = new List<long>();
for (int a = 0; a < noOfRandomVariableRequired; a++)
{
previous_ha.Add(-2);
}

for (int m = 0; m < o[ct16[i]._set[j]].campaigns.ToArray().Length; m++)


{
randomOutage = o[ct16[i]._set[j]].outage_dates[o[ct16[i]._set[j]].campaigns[m]];
for (int n = 0; n < noOfRandomVariableRequired; n++)
{
ha = randomOutage[n];
if (previous_ha[n] != -2)
57
{

if ((ha - previous_ha[n]) >= (ct16[i].spacing))


{

//true
}
else
{
}
previous_ha[n] = ha;
}
else
{
//true
previous_ha[n] = ha;

}
}
}
}

return null;
}//checked

Constraint 14

public string CT14(Plant2[] p2, List<Constraint> cns, List<Outages> o)


{
List<long> previous_ha = new List<long>();// only just just for checking of first element
List<int> previous_duration = new List<int>() ;
58
int current_duration = 0;
long ha = 0;
List<long> randomOutage = null;
List<Constraint> ct14 = getContraint(14);
Random ran = new Random();
for (int i = 0; i < ct14.ToArray().Length; i++)
{
for (int j = 0; j < ct14[i]._set.ToArray().Length; j++)
{
// done for initilization default value of ha in list
previous_ha = new List<long>();
previous_duration = new List<int>();
for (int a = 0; a < noOfRandomVariableRequired; a++)
{
previous_ha.Add(-2);
previous_duration.Add(0);
}
for (int m = 0; m < o[ct14[i]._set[j]].campaigns.ToArray().Length; m++)
{
randomOutage = o[ct14[i]._set[j]].outage_dates[o[ct14[i]._set[j]].campaigns[m]];
for (int n = 0; n < noOfRandomVariableRequired; n++)
{
ha = randomOutage[n];
current_duration = p2[ct14[i]._set[j]].durations[o[ct14[i]._set[j]].campaigns[m]];

if (previous_ha[n] != -2)
{

if ((ha - previous_ha[n] - previous_duration[n]) >= (ct14[i].spacing))


{
//true
}
else
{
59
//false
//Constraint c13 = new Logic().getContraint13(ct14[i]._set[j], m);
//if (c13 != null && c13.latest_stop_time != -1)
//{
// randomOutage[n] = ran.Next(c13.earliest_stop_time, c13.latest_stop_time);
// o[ct14[i]._set[j]].outage_dates[o[ct14[i]._set[j]].campaigns[m]] = randomOutage;
// return CT14(p2, cns, o);
//}
}
}
else
{
//true

}
previous_ha[n] = ha;
previous_duration[n] = current_duration;
}
}
}

}
return null;
}//checked

Constraint 17
public string CT17(Plant2[] p2, List<Constraint> cns, List<Outages> o)
{
List<long> previous_ha = new List<long>();// only just just for checking of first element
List<int> previous_duration = new List<int>();
//long current_ha = 0;
long ha = 0;
int current_duration = 0;
List<long> randomOutage = null;
60
Random ran = new Random();

List<Constraint> ct17 = getContraint(17);


for (int i = 0; i < ct17.ToArray().Length; i++)
{
for (int j = 0; j < ct17[i]._set.ToArray().Length; j++)
{
// done for initilization default value of ha in list
previous_ha = new List<long>();
previous_duration = new List<int>();
for (int a = 0; a < noOfRandomVariableRequired; a++)
{
previous_ha.Add(-2);
previous_duration.Add(0);
}
for (int m = 0; m < o[ct17[i]._set[j]].campaigns.ToArray().Length; m++)
{
randomOutage = o[ct17[i]._set[j]].outage_dates[o[ct17[i]._set[j]].campaigns[m]];
for (int n = 0; n < noOfRandomVariableRequired; n++)
{
ha = randomOutage[n];
current_duration = p2[ct17[i]._set[j]].durations[o[ct17[i]._set[j]].campaigns[m]];

if (previous_ha[n] != -2)
{

if (((ha + current_duration) - (previous_ha[n] + previous_duration[n])) >= (ct17[i].spacing))


{
//true

}
else
{
61
//Constraint c13 = new Logic().getContraint13(ct17[i]._set[j], m);
//if (c13 != null && c13.latest_stop_time != -1)
//{
// randomOutage[n] = ran.Next(c13.earliest_stop_time, c13.latest_stop_time);
// o[ct17[i]._set[j]].outage_dates[o[ct17[i]._set[j]].campaigns[m]] = randomOutage;
// return CT17(p2, cns, o);
//}

}
}
else
{
//true
}
previous_ha[n] = ha;
previous_duration[n] = current_duration;
}
}
}

}
return null;
}//checked

Constraint 18

public string CT18(Plant2[] p2, List<Constraint> cns, List<Outages> o)


{
List<long> previous_ha = new List<long>();// only just just for checking of first element
List<int> previous_duration = new List<int>();
long ha = 0;
int current_duration = 0;
List<long> randomOutage = null;
62
Random ran = new Random();

List<Constraint> ct18 = getContraint(18);


for (int i = 0; i < ct18.ToArray().Length; i++)
{
for (int j = 0; j < ct18[i]._set.ToArray().Length; j++)
{
// done for initilization default value of ha in list
previous_ha = new List<long>();
previous_duration = new List<int>();
for (int a = 0; a < noOfRandomVariableRequired; a++)
{
previous_ha.Add(-2);
previous_duration.Add(0);
}

for (int m = 0; m < o[ct18[i]._set[j]].campaigns.ToArray().Length; m++)


{
current_duration = p2[ct18[i]._set[j]].durations[m];
randomOutage = o[ct18[i]._set[j]].outage_dates[o[ct18[i]._set[j]].campaigns[m]];
for (int n = 0; n < noOfRandomVariableRequired; n++)
{
ha = randomOutage[n];
if (previous_ha[n] != -2)
{
if (((ha + current_duration) - (previous_ha[n])) >= (ct18[i].spacing))
{
//true

}
else
{
//false
//Constraint c13 = new Logic().getContraint13(ct18[i]._set[j], m);
63
//if (c13 != null && c13.latest_stop_time != -1)
//{
// randomOutage[n] = ran.Next(c13.earliest_stop_time, c13.latest_stop_time);
// o[ct18[i]._set[j]].outage_dates[o[ct18[i]._set[j]].campaigns[m]] = randomOutage;
// return CT18(p2, cns, o);
//}

}
}
previous_ha[n] = ha;
previous_duration[n] = current_duration;
}
}
}

}
return null;
}// data in input file not available

Constraint 19

public string CT19(Plant2[] p2, List<Constraint> cns, List<Outages> o, List<Period> p)


{
int start = 0;
int duration = 0;
long ha = 0;
int quantity = 0;

64
bool check = false;
List<long> randomOutage = null;
Random ran = new Random();

List<Constraint> ct19 = getContraint(19);

for (int i = 0; i < ct19.ToArray().Length; i++)


{
p = ct19[i].periods;
for (int j = 0; j < ct19[i]._set.ToArray().Length; j++)
{
for (int m = 0; m < o[ct19[i]._set[j]].campaigns.ToArray().Length; m++)
{
start = p[i].start[ct19[i]._set[j]];
duration = p[i].duration[ct19[i]._set[j]];
randomOutage = o[ct19[i]._set[j]].outage_dates[o[ct19[i]._set[j]].campaigns[m]];
for (int n = 0; n < noOfRandomVariableRequired; n++)
{

ha = randomOutage[n];
if (ha == (ha + start) || ha == (ha + start + duration))
{
quantity++;
if (quantity > ct19[i].quantity)
{
//true
check = true;
break;
}
}
if (m == o[ct19[i]._set[j]].campaigns.ToArray().Length - 1 && check == false)
{
//false
//Constraint c13 = new Logic().getContraint13(ct19[i]._set[j], m);
65
//if (c13 != null && c13.latest_stop_time != -1)
//{
// randomOutage[n] = ran.Next(c13.earliest_stop_time, c13.latest_stop_time);
// o[ct19[i]._set[j]].outage_dates[o[ct19[i]._set[j]].campaigns[m]] = randomOutage;
// return CT19(p2, cns, o,p);
//}

}
}
}

}
return null;
}// chechked

Constraint 20

public void CT20(Plant2[] p2, List<Constraint> cns, List<Outages> o)


{
double duration = 0;
66
long ha = 0;
long week = 0;
List<long> randomOutage = null;

bool check = false;


List<Constraint> ct20 = getContraint(20);
for (int i = 0; i < ct20.ToArray().Length; i++)
{
int quantity = 0;
for (int j = 0; j < ct20[i]._set.ToArray().Length; j++)
{
for (int m = 0; m < o[ct20[i]._set[j]].campaigns.ToArray().Length; m++)
{
week = ct20[i].week;
duration = p2[j].durations[m];
randomOutage = o[ct20[i]._set[j]].outage_dates[o[ct20[i]._set[j]].campaigns[m]];
for (int n = 0; n < noOfRandomVariableRequired; n++)
{

ha = randomOutage[n];
if (week == ha || ha == (ha + duration))
{
quantity++;
if (quantity > ct20[i].max)
{
//false
check = true;
break;
}
}
if (m == o[ct20[i]._set[j]].campaigns.ToArray().Length - 1 && check == false)
{
//true

67
}

}
}
}

}// checked

Constraint 21

public void CT21(Plant2[] p2, List<Constraint> cns, List<Outages> o, List<Type2_Plant_Production> tp2)


{
double duration = 0;
long ha = 0;
double pmax = 0;
List<long> randomOutage = null;
List<double> randomProduction = null;

bool check = false;


List<Constraint> ct21 = getContraint(21);
for (int i = 0; i < ct21.ToArray().Length; i++)
{
if (ct21[i].startend == null)
break;
for (int j = 0; j < ct21[i]._set.ToArray().Length; j++)
{

for (int m = ct21[i].startend[0] * 7; m <= ct21[i].startend[1] * 7; m++)


{
pmax = 0;
randomProduction = tp2[ct21[i]._set[j]].production[m];
for (int n = 0; n < o[ct21[i]._set[j]].campaigns.ToArray().Length; n++)
68
{
duration = p2[j].durations[o[ct21[i]._set[j]].campaigns[n]];
randomOutage = o[ct21[i]._set[j]].outage_dates[o[ct21[i]._set[j]].campaigns[n]];
for (int z = 0; z < noOfRandomVariableRequired; z++)
{

ha = randomOutage[z];
if (m >= ha && m < ha + duration)
{
pmax = pmax + randomProduction[z];

}
if (pmax > ct21[i].max)
{
//true
check = true;
break;
}
else if (m == (ct21[i].startend[1] * 7) && check == false)
{
//false
break;

}
}
}

}
}
}// checked
69
Constrant 11

public void CT11(List<Outages> o, List<Plant2> p2, List<Type2_Plant_Production> t2)


{
double fuelVariationBeforeOutage = 0;
double fuelVariationAfterOutage = 0;
double maximumFuelBeforeRefueling = 0;
double maximumFuelAfterRefueling = 0;
List<long> randomOutage = null;
List<double> randomFuelVariationBeforeOutage = null;
List<double> randomFuelVariationAfterOutage = null;

for (int i = 0; i < p2.ToArray().Length; i++)


{
for (int j = 0; j < o[i].campaigns.ToArray().Length; j++)
{
randomOutage = o[i].outage_dates[o[i].campaigns[j]];

for (int n = 0; n < noOfRandomVariableRequired; n++)


{
int outage_dates = (int)(randomOutage[n]);
randomFuelVariationBeforeOutage = t2[i].fuel_variation[((outage_dates * 7) - 1)];
randomFuelVariationAfterOutage = t2[i].fuel_variation[(outage_dates * 7)];
fuelVariationBeforeOutage = randomFuelVariationBeforeOutage[n];
fuelVariationAfterOutage = randomFuelVariationAfterOutage[n];
maximumFuelBeforeRefueling = p2[i].max_stock_before_refueling[o[i].campaigns[j]];
maximumFuelAfterRefueling = p2[i].max_stock_after_refueling[o[i].campaigns[j]];
if (fuelVariationBeforeOutage <= maximumFuelBeforeRefueling && fuelVariationAfterOutage <=
maximumFuelAfterRefueling)
{
//true
70
}
else
{
//false

}
}
}
}// checked .

Constraint 12
public void CT12(Plant2[] p2, List<Outages> o, List<Type2_Plant_Production> tp2)
{
double production = 0;
double pmax = 0;
double sum = 0;
long u = 0;
List<long> randomOutageStrtTmstp = null;
List<long> randomOutageEndTmstp = null;
List<double> randomProduction = null;

for (int i = 0; i < p2.ToArray().Length; i++)


{
long startTimestep = -1;
for (int j = 0; j < o[i].campaigns.ToArray().Length; j++)
{

71
for (int n = 0; n < noOfRandomVariableRequired; n++)
{
// so that when we + 1 in for loop it become 0
sum = 0;
if (j != 0)
{
randomOutageStrtTmstp = o[i].outage_dates[j];
startTimestep = randomOutageStrtTmstp[n] * 7;

}
if (j == (o[i].campaigns.ToArray().Length) - 1)
{
break;
}
randomOutageEndTmstp = o[i].outage_dates[j + 1];
long endTimestep = randomOutageEndTmstp[n] * 7;
for (long a = startTimestep + 1; a < endTimestep; a++)
{
randomProduction = tp2[i].production[(int)a];
production = randomProduction[n];
pmax = p2[i].pmax[j];
sum = sum + (pmax - production) * 24;
u = n;

}
startTimestep = endTimestep + p2[i].durations[j];
if (sum > p2[i].max_modulus[j])
{
//false

}
else if (sum <= p2[i].max_modulus[j])
{
//true
72
}

}
}
}//checked

Constraint 15

public void CT15(Plant2[] p2, CommonData c, Constraint constraint15, List<Outages> o)


{
int I = p2.Length;
List<Outages> Am = o;
int Se = constraint15.spacing;
int ID = constraint15.earliest_stop_time;
int IF = constraint15.latest_stop_time;
int k;
List<long> randomóutageDate = null;

for (int i = 0; i < I; i++)


{
for (k = 0; k < c.campaingns; k++)
{
for (int n = 0; n < noOfRandomVariableRequired; n++)
{
randomóutageDate = o[i].outage_dates[k];
if (((ID - (p2[i].durations[k] + 1)) <= randomóutageDate[n]) && (randomóutageDate[n] <= IF))
{
Console.Write("True");
}

73
else
Console.Write("False");
}
}
}
}//data in input file not available

Constraint 6
public void CT6(CommonData c, Plant2[] p2, List<Outages> o, List<Type2_Plant_Production> tp2)
{

double fuelVariation = 0;
double pmax = 0;
double stockThreshold = 0;
double outageDate = 0;
double outageDuration = 0;
long maxModulus = 0;
List<double> randomFuelVaration = null;
List<long> randomOutagaeDate = null;
List<double> randomProduction = null;
for (int i = 0; i < p2.ToArray().Length; i++)
{

for (int j = 0; j < c.timesteps; j++)


{
for (int s = 0; s < noOfRandomVariableRequired; s++)
{
randomFuelVaration = tp2[i].fuel_variation[j];
fuelVariation = randomFuelVaration[s];
pmax = p2[i].pmax[j];
for (int n = 0; n < o[i].campaigns.ToArray().Length; n++)
{
randomOutagaeDate = o[i].outage_dates[n];
outageDate = randomOutagaeDate[s];
74
outageDuration = p2[i].durations[o[i].campaigns[n]];
if (j >= outageDate && j <= outageDate + outageDuration)
{
stockThreshold = p2[i].stock_threshold[o[i].campaigns[n]];
maxModulus = p2[i].stock_threshold[o[i].campaigns[n]];
break;
}
}

if (fuelVariation < stockThreshold && fuelVariation < maxModulus * fuelVariation * pmax * 24)
{
randomProduction = tp2[i].production[j];
randomProduction[s] = 0;
tp2[i].production[j] = randomProduction;

}
}
}
}
}// checked

Constraint 8,9,10
public OutputData calFuelVariationGen(Plant2[] p2, CommonData c , OutputData od)
{
int j = 0, i = -1, f = 0;
double prev_stock_threshold = 0;
List<long> randomOutageDate = null;
List<double> randomFuelVariation = new List<double>();
75
List<double> randomProduction = new List<double>();
Outages[] outs = od.outages.ToArray();
double[] prev_fuel_variation = new double[noOfRandomVariableRequired];
List<double> randomRelodedFuel = new List<double>();
foreach (Plant2 p in p2)
{
f = 0;
i++;

prev_stock_threshold = p.current_campaign_stock_threshold;

double prev = 0; int z = 0; int y = 0;


for (int x = 0; x < c.timesteps; x++)
{
randomFuelVariation = new List<double>();
for (int e = 0; e < noOfRandomVariableRequired; e++)
{
randomOutageDate = null;

for (z = 0; z < od.outages[i].campaigns.ToArray().Length; z++)


{
randomOutageDate =od.outages[i].outage_dates[z];
if (x == randomOutageDate[e])
{
f = z;
break;
}
}
for (y = f; y < outs[i].campaigns.ToArray().Length; y++)
{
randomOutageDate = null;
randomOutageDate = outs[i].outage_dates[y];
randomRelodedFuel = outs[i].reloaded_fuel[outs[i].campaigns[y]];
76
if (randomOutageDate[e] * 7 == x)
{
prev = ((((p.refuel_ratio[outs[i].campaigns[y]] - 1) / p.refuel_ratio[outs[i].campaigns[y]]) *
(prev_fuel_variation[e] - prev_stock_threshold)) + randomRelodedFuel[e] +
p.stock_threshold[outs[i].campaigns[y]]);
randomFuelVariation.Add(prev);
prev_stock_threshold = p.stock_threshold[outs[i].campaigns[y]];
break;
}

else if (randomOutageDate[e] * 7 < x && x <= (randomOutageDate[e] * 7 +


p.durations[outs[i].campaigns[y]]) * 7)
{
randomFuelVariation.Add(prev_fuel_variation[e]);
prev_stock_threshold = p.stock_threshold[outs[i].campaigns[y]];
break;
}

else
{
randomProduction = od.type2_productions[i].production[x];
if (x != 0)
{
prev = (prev_fuel_variation[e] - (randomProduction[e])*24);

if (prev < 0)
{
randomProduction[e] = 0;
od.type2_productions[i].production[x ] = randomProduction;
prev = prev_fuel_variation[e];

}
randomFuelVariation.Add(prev);
77
}
else
{
prev = p.stock;
randomFuelVariation.Add(p.stock);

}
prev_stock_threshold = p.stock_threshold[outs[i].campaigns[y]];
break;
}

}
prev_fuel_variation[e] = prev;
}

od.type2_productions[i].fuel_variation[x]=randomFuelVariation;

}
}
return od;
}
public OutputData setRemainingFuelGen(Plant2[] p2, CommonData cd , OutputData od)
{
for (int i = 0; i < p2.Length ; i++)
{
List<double> randomFuelVariation = null;
randomFuelVariation = od.type2_productions[i].fuel_variation[cd.timesteps - 1];
od.type2_productions[i].remaining_fuel_at_the_end[0]= randomFuelVariation;

}
return od;
}

78
public OutputData feasibilityCheck(CommonData cd, Plant1[] p1, Plant2[] p2, List<Constraint> cns, OutputData
od)
{
CT16(p2.ToArray(), cns, od.outages);
CT14(p2.ToArray(), cns, od.outages);
CT17(p2.ToArray(), cns, od.outages);
CT18(p2.ToArray(), cns, od.outages);
CT11(od.outages, p2.ToList(), od.type2_productions);
CT20(p2.ToArray(), cns, od.outages);
CT21(p2.ToArray(), cns, od.outages, od.type2_productions);
CT19(p2.ToArray(), cns, od.outages, getContraint(19)[0].periods);
CT12(p2.ToArray(), od.outages, od.type2_productions);
CT6(cd, p2.ToArray(), od.outages, od.type2_productions);
return od;
}
}
}

Step 3: crossover

Crossover will be done by generating random crossover point

private double generateRandomCrossovernMutationPoint(int NoOfVaraibles, Random r)


{
79
double div = r.Next(1,10);
double outputValue =NoOfVaraibles/div;
outputValue = Math.Round(outputValue);
if (outputValue % 2 != 0)
{
outputValue = outputValue + 1;
}
return outputValue;
}

Crossover for production in type 1 and type 2 power plant


public OutputData crossOver(OutputData od, CommonData cd, Plant1[] p1, Plant2[] p2)
{
int noOfTimesteps = cd.timesteps;
double variable;
long variablelong;
List<double> exchange1 = null;
List<long> exchangelong = null;
for (int i = 0; i < cd.scenario; i++)
{
Random r = new Random();

for (int j = 0; j < cd.timesteps; j++)


{
for (int p = 0; p < p1.ToArray().Length; p++)
{
for (int h = 0; h < noOfRandomVariableRequired-1; h++)
{

if (r.NextDouble() < crossoverProbalityValue)


{
exchange1 = od.type1_productions[p].production[j + (i * cd.timesteps)];

80
variable = exchange1[h];
exchange1[h] = exchange1[h + 1];
exchange1[h + 1] = variable;
od.type1_productions[p].production[j + (i * cd.timesteps)] = exchange1;
h++;
}

}
}
}
}

Random ran = new Random();


for (int j = 0; j <cd.timesteps ; j++)
{

for (int p = 0; p < p2.ToArray().Length; p++)


{
for (int h = 0; h < noOfRandomVariableRequired-1; h++)
{
if (ran.NextDouble() < crossoverProbalityValue)
{
exchange1 = od.type2_productions[p].production[j];
variable = exchange1[h];
exchange1[h] = exchange1[h + 1];
exchange1[h + 1] = variable;
od.type2_productions[p].production[j] = exchange1;
h++;
}
}
}
}

81
Crossover for fuel variation
ran = new Random();
for (int j = 0; j < cd.timesteps; j++)
{

for (int p = 0; p < p2.ToArray().Length; p++)


{
for (int h = 0; h < noOfRandomVariableRequired-1; h++)
{
if (ran.NextDouble() < crossoverProbalityValue)
{
exchange1 = od.type2_productions[p].fuel_variation[j];
variable = exchange1[h];
exchange1[h] = exchange1[h + 1];
exchange1[h + 1] = variable;
od.type2_productions[p].fuel_variation[j] = exchange1;
h++;
}
}
}
}

Crossover for outage dates


ran = new Random();
for (int p = 0; p < p2.ToArray().Length; p++)
{

82
ran = new Random();
for (int i = 0; i < od.outages[p].campaigns.ToArray().Length; i++)
{
exchangelong = od.outages[p].outage_dates[i];
for (int h = 0; h < noOfRandomVariableRequired-1; h++)
{
if (ran.NextDouble() < crossoverProbalityValue)
{
variablelong = exchangelong[h];
exchangelong[h] = exchangelong[h + 1];
exchangelong[h + 1] = variablelong;
od.outages[p].outage_dates[i] = exchangelong;
h++;
}
}
}
}

Crossover for remaining fuel at the end


for (int p = 0; p < p2.ToArray().Length; p++)
{

exchange1 = od.type2_productions[p].remaining_fuel_at_the_end[0];
for (int h = 0; h < noOfRandomVariableRequired-1; h++)
{
if (ran.NextDouble() < crossoverProbalityValue)
{
variable = exchange1[h];
exchange1[h] = exchange1[h + 1];
exchange1[h + 1] = variable;
od.type2_productions[p].remaining_fuel_at_the_end[0] = exchange1;
h++;
}
}
83
}

Crossover for reloaded fuel


ran = new Random();
for (int p = 0; p < p2.ToArray().Length; p++)
{
for (int i = 0; i < od.outages[p].campaigns.ToArray().Length-1; i++)
{
exchange1 = od.outages[p].reloaded_fuel[i];
for (int h = 0; h < noOfRandomVariableRequired-1; h++)
{
if (ran.NextDouble() < crossoverProbalityValue)
{
variable = exchange1[h];
exchange1[h] = exchange1[h + 1];
exchange1[h + 1] = variable;
od.outages[p].reloaded_fuel[i] = exchange1;
h++;
}
}
}
}
return od;
}

Step 4: Mutation

Mutation will be done by generating random mutation point

public OutputData mutation(OutputData od,CommonData cd,Plant1[] p1,Plant2[] p2)


84
{
List<double> exchangeVariable1= null;
List<long> exchangeVariable2 = null;
List<long> exchangeVariable4 = null;
List<double> exchangeVariable3 = null;
double multiplicationFactor1 = 0;
double multiplicationFactor2 = 0;

private double generateRandomCrossovernMutationPoint(int NoOfVaraibles, Random r)


{
double div = r.Next(1,10);
double outputValue =NoOfVaraibles/div;
outputValue = Math.Round(outputValue);
if (outputValue % 2 != 0)
{
outputValue = outputValue + 1;
}
return outputValue;
}

}
}

Mutation for type 1 power plant


for (int p = 0; p < p1.ToArray().Length ; p++)
{

for (int i = 0; i < cd.scenario; i++)

85
{
Random r = new Random();

for (int j = 0; j < cd.timesteps-1; j++)


{

exchangeVariable1 = od.type1_productions[p].production[j + (i * cd.timesteps)];


exchangeVariable3 = od.type1_productions[p].production[j+1 + (i * cd.timesteps)];
if (r.NextDouble() < mutationProbalityValue )
{
for (int h = 0; h < noOfRandomVariableRequired ; h++)
{

if (p1[p].pmax[i, j] == p1[p].pmin[i, j])


{
multiplicationFactor1 = ((double)exchangeVariable1[h] - (double)p1[p].pmin[i, j]) / (p1[p].pmax[i, j] - p1[p].pmin[i,
j]);
multiplicationFactor2 = ((double)exchangeVariable3[h] - (double)p1[p].pmin[i, j + 1]) /
(p1[p].pmax[i, j + 1] - p1[p].pmin[i, j + 1]);

exchangeVariable1[h] = p1[p].pmin[i, j] + (p1[p].pmax[i, j] - p1[p].pmin[i, j]) *


multiplicationFactor2;
exchangeVariable3[h] = p1[p].pmin[i, j + 1] + (p1[p].pmax[i, j + 1] - p1[p].pmin[i, j + 1])
* multiplicationFactor1;

}
else
{
multiplicationFactor1 = ((double)exchangeVariable1[h] - (double)p1[p].pmin[i, j]) /
((p1[p].pmax[i, j] + 0.2) - p1[p].pmin[i, j]);
multiplicationFactor2 = ((double)exchangeVariable3[h] - (double)p1[p].pmin[i, j + 1]) /
((p1[p].pmax[i, j + 1] + 0.2) - p1[p].pmin[i, j + 1]);

86
exchangeVariable1[h] = p1[p].pmin[i, j] + (p1[p].pmax[i, j] - p1[p].pmin[i, j]) *
multiplicationFactor2;
exchangeVariable3[h] = p1[p].pmin[i, j + 1] + (p1[p].pmax[i, j + 1] - p1[p].pmin[i, j + 1])
* multiplicationFactor1;

}
}

}
od.type1_productions[p].production[j + (i * cd.timesteps)] = exchangeVariable1;
od.type1_productions[p].production[j + 1 + (i * cd.timesteps)] = exchangeVariable3;
j++;
}
}
}

Mutation for type 2 power plant


for (int p = 0; p < p2.ToArray().Length; p++)
{

Random r = new Random();

for (int j = 0; j < cd.timesteps - 1; j++)


{

exchangeVariable1 = od.type2_productions[p].production[j ];
exchangeVariable3 = od.type2_productions[p].production[j + 1 ];
if (r.NextDouble() < mutationProbalityValue)
{
for (int h = 0; h < noOfRandomVariableRequired; h++)
{

multiplicationFactor1 = ((double)exchangeVariable1[h] - 0) / ((double)p2[p].pmax[j] - 0);

87
multiplicationFactor2 = ((double)exchangeVariable3[h] - 0) / ((double)p2[p].pmax[j + 1] - 0);

exchangeVariable1[h] = p2[p].pmax[j] * multiplicationFactor2;


exchangeVariable3[h] = p2[p].pmax[j+1] * multiplicationFactor1;

}
od.type2_productions[p].production[j ] = exchangeVariable1;
od.type2_productions[p].production[j + 1 ] = exchangeVariable3;
j++;
}
}

Mutation for outage dates


for (int p = 0; p < p2.ToArray().Length; p++)
{
Random r = new Random();
for (int i = 0; i < od.outages[p].campaigns.ToArray().Length - 1; i++)
{
Constraint c13Variable2 = getContraint13(p,i);
Constraint c13Variable4 = getContraint13(p, i+1);
exchangeVariable2 = od.outages[p].outage_dates[i];
exchangeVariable4 = od.outages[p].outage_dates[i+1];
if (r.NextDouble() < mutationProbalityValue)
{
for (int h = 0; h < noOfRandomVariableRequired ; h++)
{
multiplicationFactor1 =((double)exchangeVariable2[h] -
(double)c13Variable2.earliest_stop_time) / (c13Variable2.latest_stop_time -
c13Variable2.earliest_stop_time);
multiplicationFactor2 = ((double)exchangeVariable4[h] -
(double)c13Variable4.earliest_stop_time) / (c13Variable4.latest_stop_time - c13Variable4.earliest_stop_time);

exchangeVariable2[h] = Convert.ToInt64(c13Variable2.earliest_stop_time +
(c13Variable2.latest_stop_time - c13Variable2.earliest_stop_time) * multiplicationFactor1);

88
exchangeVariable4[h] = Convert.ToInt64(c13Variable4.earliest_stop_time + (c13Variable4.latest_stop_time -
c13Variable4.earliest_stop_time) * multiplicationFactor2);

}
}
od.outages[p].outage_dates[i] = exchangeVariable2;
od.outages[p].outage_dates[i + 1] = exchangeVariable4;
i++;
}
}

for (int p = 0; p < p2.ToArray().Length; p++)//fuel variation


{
Random ran = new Random();
for (int j = 0; j < cd.timesteps; j++)
{
if (ran.NextDouble() < crossoverProbalityValue)
{
exchangeVariable1=od.type2_productions[p].fuel_variation[j];
exchangeVariable3 = od.type2_productions[p].fuel_variation[j + 1];
List<double> temp = exchangeVariable1;

for (int h = 0; h < noOfRandomVariableRequired ; h++)


{
exchangeVariable1[h] = exchangeVariable3[h];
exchangeVariable3[h] = temp[h];

}
}
od.type2_productions[p].fuel_variation[j] = exchangeVariable1;

89
od.type2_productions[p].fuel_variation[j + 1] = exchangeVariable3;
j++;

}
}

Mutation for reloaded fuel

for (int p = 0; p < p2.ToArray().Length; p++)


{
Random ran = new Random();
for (int i = 0; i < od.outages[p].campaigns.ToArray().Length ; i++)
{
exchangeVariable1 = od.outages[p].reloaded_fuel[i];
exchangeVariable3 = od.outages[p].reloaded_fuel[i + 1];
if (ran.NextDouble() < crossoverProbalityValue)
{
for (int h = 0; h < noOfRandomVariableRequired; h++)
{
if (p2[p].max_refuel[i] == p2[p].min_refuel[i])
{
multiplicationFactor1 = ((double)exchangeVariable1[h] - (double)p2[p].min_refuel[i]) /
((p2[p].max_refuel[i] + 0.2) - p2[p].min_refuel[i]);
multiplicationFactor2 = ((double)exchangeVariable3[h] - (double)p2[p].min_refuel[i + 1]) /
((p2[p].max_refuel[i + 1] + 0.2) - p2[p].min_refuel[i + 1]);

exchangeVariable1[h] = p2[p].min_refuel[i] + (p2[p].max_refuel[i] - p2[p].min_refuel[i]) *


multiplicationFactor2;
exchangeVariable3[h] = p2[p].min_refuel[i + 1] + (p2[p].max_refuel[i + 1] - p2[p].min_refuel[i
+ 1]) * multiplicationFactor1;
}
else
{

90
multiplicationFactor1 = ((double)exchangeVariable1[h] - (double)p2[p].min_refuel[i]) /
(p2[p].max_refuel[i] - p2[p].min_refuel[i]);
multiplicationFactor2 = ((double)exchangeVariable3[h] - (double)p2[p].min_refuel[i + 1]) /
(p2[p].max_refuel[i + 1] - p2[p].min_refuel[i + 1]);

exchangeVariable1[h] = p2[p].min_refuel[i] + (p2[p].max_refuel[i] - p2[p].min_refuel[i]) *


multiplicationFactor2;
exchangeVariable3[h] = p2[p].min_refuel[i + 1] + (p2[p].max_refuel[i + 1] - p2[p].min_refuel[i
+ 1]) * multiplicationFactor1;
}

}
}
od.outages[p].reloaded_fuel[i] = exchangeVariable1;
od.outages[p].reloaded_fuel[i + 1] = exchangeVariable3;
i++;
}

}
return od;
}

Step 5: Checking fitness

In this solution, fitness will be check by calculating cost. Individuals which are giving less cost they are more fit
than the other.
void calculateCost(Plant1[] p1, Plant2[] p2, CommonData cd)
{
int k;

91
List<double> randomRelodedFuel = null;
List<double> randomProduction = null;
List<double> randomRemainingFuelAtEnd = null;
for (int s = 0; s < noOfRandomVariableRequired; s++)
{
double pp2_refuel_cost = 0;
double pp1_production_cost = 0;
double pp2_residual_fuel_refund = 0;
for (int i = 0; i < p2.Length - 1; i++)
{
for (k = 0; k < cd.campaingns; k++)
{
try
{
randomRelodedFuel=od.outages[i].reloaded_fuel[k];
pp2_refuel_cost = pp2_refuel_cost + (p2[i].refueling_cost[i] * randomRelodedFuel[s]);
}
catch (IndexOutOfRangeException)
{ break; }
}
}

for (int i = 0; i < cd.timesteps; i++)


{
for (k = 0; k < cd.powerplant1; i++)
{
try
{
randomProduction = od.type1_productions[k].production[i];
pp1_production_cost = pp1_production_cost + (p1[i].cost[i, k] * randomProduction[s] * 24);
}
catch (IndexOutOfRangeException)
{ break; }
92
}
}

for (k = 0; k < cd.powerplant2; k++)


{
try
{
randomRemainingFuelAtEnd=od.type2_productions[k].remaining_fuel_at_the_end[cd.timesteps-
1];
pp2_residual_fuel_refund = pp2_residual_fuel_refund + (p2[k].fuel_price
*randomRemainingFuelAtEnd[s] );
}
catch (IndexOutOfRangeException)
{ break; }
catch (ArgumentOutOfRangeException)
{
}
}

od.cost.Add(pp2_refuel_cost + ((pp1_production_cost - pp2_residual_fuel_refund) / cd.scenario));

// od.cost.Sort();

CHAPTER- 7
Results

Genetic programming always gives random solution because of random individuals. The minimum cost given by
RODEF Challenge is given below:
Cost 169538386903

93
The cost given by genetic programming is always random. But here we are comparing cost for 3 generation, 4
individuals, pc =0.75 and pm =0.60.

0th generation
Cost 4074251221.13513

1st generation
Cost 4375287228.14778

2nd generation
Cost 4249396914.49562

a) Graph between cost and generation

CHAPTER-8

Benefits and application area of genetic algorithm


Genetic algorithm is better than conventional AI in that it is more robust. Unlike older AI systems, they do not break
easily even if the inputs changed slightly or in the presence of reasonable noise. Also in searching a large state- space,
multi- modal state- space or n – dimensional surface, a genetic algorithm may offer significant benefits over more
typical search of optimization techniques.

94
Benefits of Genetic Algorithms

• Concept is easy to understand

• Modular, separate from application

• Supports multi-objective optimization

• Always an answer; answer gets better with time.

• Easy to exploit previous or alternate solutions

• Flexible building blocks for hybrid applications [6].

Application area of genetic programming

Genetic algorithms find application in bioinformatics, phylogenetics, computationa science, engineering, economics,
chemistry, manufacturing, mathematics, physics, pharmacometric and other fields.

CHAPTER- 9

Conclusion

The results reported here demonstrate that GP can be applied to the problem of minimizing cost of production in
production power plant. There are several Interesting questions related to the GP component of the process, for
example: Is crossover essential to the search? Are we using the optimal GP design? Would a multi-objective fitness
function improve results? Are we using optimal parameter settings? All answer of these questions given in this report.

95
Finally, we are interested in testing the individuals on given constraints as fitness values and minimizing objective
function.

While this exposition has covered the basic principles of GAs, the number of variations
that have been suggested is enormous. Many variations in population size, in initialization methods, in fitness
definition, in selection and replacement strategies, in crossover and mutation are done for better solution.

Don’t be afraid to run the GA several times.They can but in practice there are many other ‘attractors’ to which they
may converge and these may be some distance from global optimality so it makes sense to explore several
alternatives. This chapter has presented a brief survey of the history, theory and issues of implementation relating to
one of the most popular metaheuristics

References

1. Mitchell Melanie(1999): “An introduction to genetic algorithms”,Cambridge, Massachusetts • London, England.

2. Colin Reeves: “Genetic algorithum” , School of Mathematical and Information Sciences, Coventry university
96
3. http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol1/hmw/article1.html#introduction

4. K.F Man, K.S.Tang and S.Kwong (1996): “Genetic Algorithms: Concepts and Applications”, IEEE.

5. F. HERRERA, M.LOZANO & J.L.VERDEGAY(1998): “Tackling RealCoded Genetic Algorithms:


Operators and Tools for Behavioural analysis” Granada, Spain.

6. Felix Brandt(2010): “Solving a Large-Scale Energy Management Problem with Varied Constraints”
University of the State of Baden-Wuerttemberg and National Laboratory of the Helmholtz Association.

7. Marc PORCHERON, Agnès GORGE, Olivier JUAN, Tomas SIMOVIC and Guillaume DEREU: “Challenge
ROADEF/EURO (2010): A large-scale energy management problem with varied constraints”France.

8. Ying-Hong Liao, and Chuen-Tsai Sun(2001): “An Educational Genetic Algorithm LearningTool” IEEE.

9. Stephanie Forrest, ThanhVu Nguyen, Westley Weimer, Claire Le Goues:” A Genetic Programming
Approach to Automated Software Repair”

97

You might also like