All resources on this site are high-quality and available for download.
matlab
initialTemp = 1000; % 初始温度
coolingRate = 0.95; % 温度衰减系数
objectiveFunc = @(x) x(1)^2 + x(2)^2; % 目标函数
initialSolution = [1, 2]; % 初始解
maxIterations = 10000; % 最大迭代次数
- 运行优化:调用主函数执行算法:
``matlab
[bestSolution, bestValue, history] = main(initialTemp, coolingRate, objectiveFunc, initialSolution, maxIterations);