ESII: SimAnneal 1 Design and Architectures for Design and Architectures for Embedded Systems (ESII) Embedded Systems (ESII) Prof Dr J Henkel M Shafique Prof Dr J Henkel M Shafique Prof. Dr. J. Henkel, M. Shafique Prof. Dr. J. Henkel, M. Shafique CES - CES - Chair for Embedded Systems Chair for Embedded Systems Karlsruhe Institute of Technology, Germany Karlsruhe Institute of Technology, Germany Add Add- -on Slides: Simulated Annealing on Slides: Simulated Annealing http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 2 Simulated Annealing (SA) Simulated Annealing (SA) � SA belongs to group of simple optimization algorithms: � SA belongs to group of simple optimization algorithms: SA belongs to group of simple optimization algorithms: SA belongs to group of simple optimization algorithms: � Steepest Ascent: start with feasible solution and choose best Steepest Ascent: start with feasible solution and choose best neighbor to continue from neighbor to continue from � Next Ascent: continue if there is Next Ascent: continue if there is any any better solution in neighborhood better solution in neighborhood � Stochastic Gradient Approach: Stochastic Gradient Approach: � Next neighbor selected with a certain probability � Next neighbor selected with a certain probability Next neighbor selected with a certain probability Next neighbor selected with a certain probability � Probability function is given Probability function is given � Enables to escape local optima Enables to escape local optima ( (-> Hill Climbing) > Hill Climbing) Hill Cli Hill Cli bi bi ) ) cost � Iterative SA Iterative SA � Extension of stochastic gradient Extension of stochastic gradient g x x S1 approach approach � Acceptance function depends on Acceptance function depends on x control parameter control parameter t t l l t t S2 http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 3 Basic idea of SA Basic idea of SA � Simulates the annealing process of steel: Simulates the annealing process of steel: � A � As steel cools down A As steel cools down slowly t t l l l d l d slowly , lattice arranges itself to obtain lower l l l l , lattice arranges itself to obtain lower l tti l tti it it lf t lf t bt i bt i l l energy states (= better solution) energy states (= better solution) � If temperature decrease is too fast, lattice order is If temperature decrease is too fast, lattice order is frozen p p , , frozen in a high in a high- g - energy state (= bad solution) energy state (= bad solution) � Therefore: cooling process i.e. temperature T needs to be Therefore: cooling process i.e. temperature T needs to be controlled -> cooling schedule controlled controlled -> cooling schedule controlled > cooling schedule > cooling schedule � If a solution ‘a’ is worse than a solution ‘b’, accept a with probability If a solution ‘a’ is worse than a solution ‘b’, accept a with probability E(S2)]/(kb x T) – the metropolis condition e -[E(S1) [E(S1)- -E(S2)]/(kb x T) the metropolis condition p � In the beginning (high temperature T) worse solutions are more In the beginning (high temperature T) worse solutions are more likely to get accepted; at the end (low T) it is less likely likely to get accepted; at the end (low T) it is less likely � SA for optimization developed by Kirkpatrick/ SA for optimization developed by Kirkpatrick/Gelatt/Vecchi Gelatt/Vecchi (IBM) (IBM) � When decreasing T infinitely slow, it can be shown that SA always finds When decreasing T infinitely slow, it can be shown that SA always finds the best solution the best solution the best solution the best solution http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 4 SA: Metropolis Loop SA: Metropolis Loop Begin Choose some random initial configuration S; Repeat S’ := Some random initial configuration S; ( ) ( ) Δ = − E E S ' E ( S ); − Δ = k B T Probabilit y : min( 1 , e ); ≤ S = If Then random ( 0 , 1 ) Probabilit y : S ' ; Until false End http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 5 Generic SA Algorithm Generic SA Algorithm Begin Begin S := Initial solution S 0 ; T := Initial temperature T 0 ; While stop criteria is not satisfied While stop criteria is not satisfied Do Do Begin While not yet in equilibrium Do Begin Begin S’ := Some random neighboring solution of S; ( ) Δ = − C C S ' C ( S ); − Δ = Probabilit Probabilit y y : : min( min( 1 1 , e e T ); ); ≤ S = If Then random ( 0 , 1 ) Probabilit y : S ' ; End U d t Update T; T End Output best solution; End http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 6 Using SA with various constraints Using SA with various constraints � Fast temperature decrease, sufficient number of iterations Fast temperature decrease, sufficient number of iterations 1.2 1 0.8 ality 0.6 0 6 Qua 0.4 0.2 0 0 1 Time http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 7 Using SA with various g constraints (cont’d) � Slow temperature decrease, not sufficient number of iterations (no Slow temperature decrease, not sufficient number of iterations (no equilibrium) equilibrium) 1.2 1 0.8 ality 0 6 0.6 Qua 0.4 0.2 0 0 1 Time http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 8 Summary SA Summary SA � Simulates the annealing process of steel and interprets it Simulates the annealing process of steel and interprets it as an optimization process as an optimization process � Features: Features: � Neighbouring solutions are explored in random order Neighbouring solutions are explored in random order � New solutions can worsen or improve to previous one � New solutions can worsen or improve to previous one New solutions can worsen or improve to previous one New solutions can worsen or improve to previous one � Statistically controls acceptance of worse solutions Statistically controls acceptance of worse solutions � Displays asymptotic convergence to the optimum Displays asymptotic convergence to the optimum http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
ESII: SimAnneal 9 References and Sources References and Sources � [Jan03] The Electronic Design Automation Handbook, D. Jansen (Ed.), Kluwer 2003. � [SpeC01] System Design: A practical guide with SpecC, A. Gerstlauer, R. Doemer, J. Peng, D. Gajski, Kluwer, 2001. � � [Cai04] Estimation and Exploration Automation of System Level Design L Cai Ph D Dissertation UC [Cai04] Estimation and Exploration Automation of System Level Design, L. Cai, Ph.D Dissertation, UC Irvine, 2004. � [Gajski03], Transaction Level Modeling: An Overview, D. Gajski, L. Cai, Presented at IEEE/ACM Codes-ISSS Conference, Newport Beach, CA, 2003. � [Wolf01], Computers as Components, W. Wolf, Morgan Kaufmann Publishers, 2001. http://ces.itec.kit.edu J. Henkel, M. Shafique, KIT, WS1011
Recommend
More recommend