Simulated annealing

14
Simulated Annealing Netreba Kirill Theoretical electrical engineering department, SPbSPU

Transcript of Simulated annealing

Page 1: Simulated annealing

Simulated Annealing

Netreba KirillTheoretical electrical engineering

department, SPbSPU

Page 2: Simulated annealing

12/04/23 2

Outline1. Introduction

2. SA algorithm

3. Example

4. Tuning algorithm

5. Conclusion

Нетреба Кирилл, СПбГПУ

Simulated Annealing

Netreba Kirill, SPbSPU

Page 3: Simulated annealing

12/04/23 3

Formal definition Simulated annealing – is a technique of

optimization based on the analogy between the way the metal cools and freezes in a minimum energy of the crystalline structure (the annealing process) and the search for a minimum in a more general system.

Netreba Kirill, SPbSPU

Simulated Annealing

Introduction

Page 4: Simulated annealing

12/04/23 4

Natural motivation Properties of structure depend on cooling factor after the substance was

heated to melting point. Slow cooling – large crystals are formed, that is useful for a substance structure. Spasmodic cooling– the weak structure is formed.

«Agitation» at a heat is accompanied by high molecular activity in physical system.

Disturbance

Disturbance

Netreba Kirill, SPbSPU

Introduction

Simulated Annealing

Page 5: Simulated annealing

12/04/23 5

SA algorithm The initial solution

For the majority of problems the initial solution is casual.

Solution estimation The solution estimation consists

of decoding of the current solution and performance of the necessary act, allowing to fathom its expediency for the solution of the given problem.

Casual search of the solution Solution search begins with

copying of the current solution in the working solution which is any way inoculated further.

Create the initial solution

Evaluate the solution

Change the solution in a random way

Evaluate the new solution

Criterion of the admission

Reduce temperature

The current solution

The working solution

The best solution

Netreba Kirill, SPbSPU

Simulated Annealing

Page 6: Simulated annealing

12/04/23 6

Criterion of the admission At this stage of algorithm two solutions are available.

First - the current solution, second - the working solution. Certain energy (E) is connected with each solution and represents its efficiency.

The working solution is accepted as the current solution if :

In the beginning of search the temperature has the greatest value and is close to 1. Therefore the sampling probability of the solution increasing value of energy is great. Taking of such solutions corresponds to movement to saddle point B, instead of to minimum A. As approaching a global minimum the temperature decreases and probability of increase in energy drops.

Create the initial solution

Evaluate the solution

Change the solution in a random way

Evaluate the new solution

Criterion of the admission

Reduce temperature

The current solution

The working solution

The current solution

ð ò

/T

E E E 0

0 & r, e , r [0,1]

Netreba Kirill, SPbSPU

SA algorithm Simulated Annealing

Page 7: Simulated annealing

12/04/23 7

Temperature decrease After a number of iterations on algorithm

at the given temperature we reduce it. There are a lot of alternatives of decrease in temperature. Simple function T=T, 0<<1 is usually used. Other strategy of decrease in temperature, including linear and nonlinear functions are also possible.

Iteration Several iterations are carried out at one

temperature. After iteration is finished temperature reduceed. The process continues until the temperature will not attain null..

Create the initial solution

Evaluate the solution

Change the solution in a random way

Evaluate the new solution

Criterion of the admission

Reduce temperature

The current solution

The working solution

The current solution

Netreba Kirill, SPbSPU

SA algorithm Simulated Annealing

Page 8: Simulated annealing

12/04/23 8

The N queens puzzle is the problem of placing N chess queens on an N×N chessboard so that none of them is able to capture any other using the standard chess queen's moves.:

Netreba Kirill, SPbSPU

One of 92 solutions of 8 queens puzzle

Example

Simulated Annealing

Page 9: Simulated annealing

12/04/23 9

Energy Energy of the solution is defined as quantity of conflicts which appear in the coding. The

problem consists in finding the coding at which energy is equal to null (that is on a board there are no conflicts).

Temperature For the given problem solution search began with temperature 100° and gradually decreased

it to null, using formula T=T. Thus value = 0,98. Apparently from the schedule the temperature shows at first sweeping decrease, and then a slow convergence to final temperature - to null.

At each change of temperature we will execute 100 iterations. It will allow algorithm to carry out some operations of search at each level.

Netreba Kirill, SPbSPU

Example of SA's realization for a problem with 40 queens

100

80

60

40

20

00 50 100 150 200 250 300

Accepted Energy

Temperature

Example

Simulated Annealing

Page 10: Simulated annealing

12/04/23 10

Example of solution of 40 queens puzzle

Netreba Kirill, SPbSPU

Example

Simulated Annealing

Page 11: Simulated annealing

12/04/23 11

Temperature

The initial temperature should be enough high to make possible sampling of other areas of a range of solutions. If the maximum distance between the next solutions is known it is easy to count initial temperature:

The initial temperature also can be changed dynamically. If the statistics on criterion of the admission of the worst solutions and a finding of new best solutions is set, it is possible to raise temperature until the necessary quantity of admission (opening of new solutions) will be attained. This process is analogous to heating of substance to its transition in the liquid form then already there is no sense to raise temperature.

Final temperature. Though the zero is convenient final temperature, geometrical function which is used in an instance, shows, that the algorithm will work much longer, than it is really necessary. Therefore the final temperature usually is accepted hardly more null (for example, 0.5)

Netreba Kirill, SPbSPU

/Te r (r [0,1], 0)

Настройка алгоритма

Simulated Annealing

Page 12: Simulated annealing

12/04/23 12

Advantages of annealing absence of restrictions of the form of the minimizing function;

search of a global minimum;

efficiency in a solving of the various classes of problems demanding optimization.

Annealing deficiencies the demand of infinitely slow cooling, in practice meaning

slow work of algorithm;

complexity of tuning

Netreba Kirill, SPbSPU

Conclusion Simulated Annealing

Page 13: Simulated annealing

12/04/23 13

Ranges of application way creation

image reconstruction

assignment routine and planning

network placement

global routing

detection and recognition of visual targets

design of special digital filters

Netreba Kirill, SPbSPU

Conclusion

Simulated Annealing

Page 14: Simulated annealing

12/04/23 14Netreba Kirill, SPbSPU

Thanks for your attention!