%%%%%%%%%%%%%%%%%%%%%%模拟退火算法解决函数极值%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%初始化%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; %清除所有变量
close all; %清图
clc; %清屏
XMAX= 5; %搜索变量x最大值
XMIN= -5; %搜索变量x最小值
YMAX= 5; %搜索变量y最大值
YMIN= -5; %搜索变量y最小值
%%%%%%%%%%%%%%%%%%%%%%%%%%%冷却表参数%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
L = 100; %马可夫链长度
K = 0.99; %衰减参数
S = 0.02; %步长因子
T=100; %初始温度
YZ = 1e-8; %容差
P = 0; %Metropolis过程中总接受点
%%%%%%%%%%%%%%%%%%%%%%%%%%随机选点 初值设定%%%%%%%%%%%%%%%%%%%%%%%%%
PreX = rand * (XMAX-XMIN)+XMIN;
PreY = rand * (YMAX-YMIN)+YMIN;
MATLAB求解二元函数极值--模拟退火算法
最新推荐文章于 2024-06-03 13:22:42 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)