简介
一直以为是一个高深的算法,好像据说在量子计算机中可以应用。发现原理并不难
参考链接
算法缺点
这个算法怎么感觉概率的地方基本不受控制,温度降到最后还是大量接受随机解?
模拟退火就是这样的,因为它到了最优解过后还能跳出最优解域,因此能找到别的解域的最优解的值。因此一定要记录下历史最优解。
算法流程图
code
对https://blog.csdn.net/wfrainn/article/details/80303138进行的代码更新
result
直接输出 39.72958243492729 -32148.550564632504
记录最小数值 40.033185051881034 -32154.066628802473
发现保留的最小值确实更接近最小值
code
#coding=utf-8
import numpy as np
from monituihuo import aimFunction
import math
T=1000 # initiate temperature
Tmin=10 # minimun value of terperature
x = np.random.uniform(low=0, high=100) # initiate x
k=50 # times of internal circulation
y = 0 # initiate result
t=0 # time
xmin = 100