In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "Python mathematical modeling learning simulated annealing algorithm multivariable function optimization method tutorial", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and study the "Python mathematical modeling learning simulated annealing algorithm multivariable function optimization method tutorial"!
1. Simulated annealing algorithm
Annealing is a process in which the metal cools slowly from the molten state and finally reaches the equilibrium state with the lowest energy. Based on the similarity between the optimization problem solving process and the metal annealing process, the simulated annealing algorithm takes the optimization objective as the energy function, the solution space as the state space, and randomly disturbs the thermal motion of simulated particles to solve the optimization problem ([1] KIRKPATRICK,1988).
The simulated annealing algorithm has a simple structure, which is composed of temperature update function, state generation function, state acceptance function, inner loop and outer loop termination criterion.
Temperature update function refers to the realization scheme of slow decrease of annealing temperature, also known as cooling schedule.
The state generating function refers to the method of randomly generating new candidate solutions from the current solution.
The state acceptance function refers to the mechanism of accepting candidate solutions, usually using the Metropolis criterion.
External circulation is a temperature cycle controlled by a cooling schedule.
The inner loop is the number of times the cycle iterates to produce a new solution at each temperature, also known as the length of the Markov chain.
The basic flow of simulated annealing algorithm is as follows:
(1) initialization: initial temperature T, initial solution state s, iterations L
(2) for each temperature state, repeat L cycles to generate and probabilistic acceptance of new solutions:
(3) A new solution s'is generated from the current solution s by the transformation operation.
(4) calculate the energy difference ∆ E, that is, the difference between the objective function of the new solution and the objective function of the original solution.
(5) if ∆ E 1e-3: # verifies the objective function print ("Error 2: Wrong total millage!") Return else: print ("\ nOptimization by simulated annealing algorithm:") for i in range (nVar): print ('\ tx [{}] = {: .6f} '.format (I, xBest [I]) print ('\ n\ tf (x): {: .6f} '.format (fxBest)) return# bold style def main (): # parameter settings, optimize problem parameter definition Simulated annealing algorithm parameter setting [cName, nVar,xMin,xMax,tInitial,tFinal,alfa,meanMarkov,scale] = ParameterSetting () # print ([nVar,xMin,xMax,tInitial,tFinal,alfa,meanMarkov,scale]) # simulated annealing algorithm [kIter,xBest,fxBest,fxNow,recordIter,recordFxNow,recordFxBest,recordPBad]\ = OptimizationSSA (nVar,xMin,xMax,tInitial,tFinal,alfa,meanMarkov,scale) # print (kIter, fxNow, fxBest PBadAccept) # result check and output ResultOutput (cName, nVar,xBest,fxBest,kIter,recordFxNow,recordFxBest,recordPBad,recordIter) if _ _ name__ = ='_ _ main__': main () 4, program running result x_Initial:-143.601793331.160277, f (x_Initial): 959.785447iRank 0 t (I): 100.00, badAccept:0.469136, f (x) _ best:300.099320i:10,t (I): 81.71 BadAccept:0.333333, f (x) _ best:12.935760i:20,t (I): 66.76, badAccept:0.086022, f (x) _ best:2.752498...i:200,t (I): 1.76, badAccept:0.000000, f (x) _ best:0.052055i:210,t (I): 1.44, badAccept:0.000000, f (x) _ best:0.009448i:220,t (I): 1.17, badAccept:0.000000 F (x) _ best:0.009448improve:18Optimization by simulated annealing algorithm: X [0] = 420.807471 x [1] = 420.950005 f (x): 0.003352 Thank you for your reading The above is the "Python mathematical modeling learning simulated annealing algorithm multivariable function optimization method tutorial" content, after the study of this article, I believe that everyone on the Python mathematical modeling learning simulated annealing algorithm multivariable function optimization method tutorial has a deeper understanding of this problem, the specific use of the need for practice to verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.