Biological Background, Schema, Theorem, GA Operators: Crossover, Mutation and Its Types-GA Algorithm, Variations Of GA: Adaptive GA and Real Coded GA
Biological Background, Schema, Theorem, GA Operators: Crossover, Mutation and Its Types-GA Algorithm, Variations Of GA: Adaptive GA and Real Coded GA
SA algorithm is one of the most preferred heuristic methods for solving optimization problems.
It is a probabilistic technique which is an effective and general form of optimization.
It is useful in finding global optima of a given function when there is lot of local optima.
“Annealing” (heat (metal or glass) and allow it to cool slowly, in order to remove internal stresses and toughen it) refers to an analogy with thermodynamics, specifically with the way that metals cool and anneal.
Simulated annealing uses the objective function of an optimization problem instead of the energy of a material.
Simulated annealing is based on metallurgical practices by which a material is heated to a high temperature and cooled. At high temperatures, atoms may shift unpredictably, often eliminating impurities as the material cools into a pure crystal. This is replicated via the simulated annealing optimization algorithm, with energy state corresponding to current solution.
Physical Annealing:
Another important part of this analogy is the following equation from Thermal Dynamics:
This equation calculates the probability that the Energy Magnitude will increase. We can calculate this value given some Energy Magnitude and some temperature t along with the Boltzmann constant k.
Implementation of SA is surprisingly simple. The algorithm is basically hill-climbing except instead of picking the best move, it picks a random move. If the selected move improves the solution, then it is always accepted. Otherwise, the algorithm makes the move anyway with some probability less than 1. The probability decreases exponentially with the “badness” of the move, which is the amount ΔE by which the solution is worsened (i.e., energy is increased.)
Acceptance Criteria
The law of thermodynamics state that at temperature, T, the probability of
an increase in energy of magnitude, ΔE, is given by
P(ΔE) = e−ΔE/kT
where k is a constant that relates temperature to energy known as Boltzmann’s constant.
At higher values of T, uphill moves are more likely to occur. As T tends to zero, they become more and more unlikely, until the algorithm behaves more or less like hill-climbing.
In a typical SA optimization, T starts high and is gradually decreased according to an “annealing schedule”.
A certain number of iterations are carried out at each temperature and then the temperature is decreased. This is repeated until the system freezes into a steady state.
This equation is directly used in simulated annealing, although it is usual to drop the Boltzmann constant as this was only introduced into the equation to cope with different materials. Therefore, the probability of accepting a worse state is given by the equation
P = e−ΔE/T > r
where, ΔE= the change in the evaluation function
T= the current temperature
r= a random number between 0 and 1
The probability of accepting a worse move is a function of both the temperature of the system and of the change in the cost function.
As the temperature of the system decreases the probability of accepting a worse move is decreased. This is the same as gradually moving to a frozen state in physical annealing.
Also if the temperature is zero then only better moves will be accepted which effectively makes simulated annealing act like hill climbing.
Simulated annealing is typically used in discrete, but very large, configuration spaces, such as the set of possible orders of cities in the Traveling Salesman problem and in VLSI routing. It has a broad range of application that is still being explored.
The mapping of time to temperature and how fast the temperature decreases is called the Annealing Schedule.
The
algorithm starts initially with set to a high value (or infinity), and then it is decreased at each step following some annealing schedule—which may be specified by the user, but must end with
towards the end of the allotted time budget. In this way, the system
is expected to wander initially towards a broad region of the search
space containing good solutions, ignoring small features of the energy
function; then drift towards low-energy regions that become narrower and
narrower; and finally move downhill according to the steepest descent heuristic.
For any given finite problem, the probability that the simulated annealing algorithm terminates with a global optimal solution approaches 1 as the annealing schedule is extended. This theoretical result, however, is not particularly helpful, since the time required to ensure a significant probability of success will usually exceed the time required for a complete search of the solution space.
The following pseudocode presents the simulated annealing heuristic as described above. It starts from a state s0 and continues until a maximum of kmax steps have been taken. In the process, the call neighbour(s) should generate a randomly chosen neighbour of a given state s; the call random(0, 1) should pick and return a value in the range [0, 1], uniformly at random. The annealing schedule is defined by the call temperature(r), which should yield the temperature to use, given the fraction r of the time budget that has been expended so far.
E(), neighbour(), P(), temperature() s and e to sbest and ebest
and perhaps restart the annealing schedule. The decision to restart
could be based on several criteria. Notable among these include
restarting based on a fixed number of steps, based on whether the
current energy is too high compared to the best energy obtained so far,
restarting randomly, etc.


Circuit Partitioning & Placement
Hardware/Software Partitioning
Graph Partitioning
VLSI: Placement, routing
Image Processing
Strategy Scheduling for capital products with complex product structure
Umpire scheduling in US open tournament
Event-based learning situations
Practical Issues
The maximum temperature
Scheme for decreasing temperature
Strategy for proposing updates
Simulated Annealing versus Hill Climbing
REF
https://www.geeksforgeeks.org/simulated-annealing/
https://en.wikipedia.org/wiki/Simulated_annealing
https://www.sciencedirect.com/topics/engineering/simulated-annealing-algorithm
https://towardsdatascience.com/optimization-techniques-simulated-annealing-d6a4785a1de7
Before getting into S & L attributed definitions, we need to look on,
For eg. let’s say A -> BC is a production of a grammar, and A’s attribute is dependent on B’s attributes or C’s attributes then it will be synthesized attribute.
For example, let’s say A -> BC is a production of a grammar and B’s attribute is dependent on A’s attributes or C’s attributes then it will be inherited attribute.
S- Attributed SDT
L-attributed SDT
Note – If a definition is S-attributed, then it is also L-attributed but NOT vice-versa
Syntax Tree
A sentence id + id * id would have the following syntax tree:
Parse Tree
A parse tree is an ordered, rooted tree that represents the syntactic structure of a string according to some context-free grammar.
Parsing tree, derivation tree, and concrete syntax tree are some other names for parse tree
Production
S= S+ S | S * S
S = a|b|c
Input:
a * b + c
Annotated Parse Tree – The parse tree containing the values of attributes at each node for given input string is called annotated or decorated parse tree.
Features –

Difference
The main difference between parse tree and syntax tree is that parse tree is a hierarchical structure that represents the derivation of the grammar to obtain input strings while syntax tree is a way of representing the syntax of a programming language as a hierarchical tree similar structure.
Moreover, parse tree contains records of the rules (tokens) to match input texts while syntax tree contains records of the syntax of programming language. Hence, this is another major difference between parse tree and syntax tree.
Compiler, Computer software that translates (compiles) source code written in a high-level language (e.g., C++) into a set of machine-language instructions that can be understood by a digital computer’s CPU.
Compilers are very large programs, with error-checking and other abilities.
Some compilers translate high-level language into an intermediate assembly language, which is then translated (assembled) into machine code by an assembly program or assembler. Other compilers generate machine language directly.
The Structure of a Compiler
There are two parts: analysis and synthesis.
Analysis (Front End)
Different Phases
Some compilers have a machine-independent optimization phase between the front end and the back end. The purpose of this optimization phase is to perform transformations on the intermediate representation, so that the back end can produce a better target program than it would have otherwise produced from an unoptimized intermediate representation. Since optimization is optional, one or the other of the two optimization phases will be missing.
token-name ; attribute-value
that it passes on to the subsequent phase, syntax analysis.
In the token, the first component token-name is an abstract symbol that is used during syntax analysis, and the second component attribute-value points to an entry in the symbol table for this token.
Input: stream of characters
Output: Token
example:
ip: position = initial + rate * 60 (lexemes)
op: <id, 1> <=> <id, 2> <+> <id, 3> <*> <60> (tokens)
2. Syntax Analysis (Parsing)
Input: Tokens
Output: Abstract Syntax tree
3. Semantic Analysis
o Post-fix notation
o Three address code
o Syntax tree
Most commonly used form is the three address code (It makes use of at most three addresses and one operator to represent an expression and the value computed at each instruction is stored in temporary variable generated by compiler.).
t1 = inttofloat(60)
t2 = id3 * t1
t3 = id2 + t2
id1 = t3
MULF R2, # 60.0
LDF R1, id2
ADDF R1, R2
STF id1, R1
