?? gmjprey.asv
字號:
function [XXnext] = gmjprey(XX,Try_number,Visual,Step,a1,b1,a2,b2)pp=0;for j=1:Try_number XXj=XX+rand*Visual; if(maxf(XX)<maxf(XXj)) XXnext=XX+rand*Step*(XXj-XX)/norm(XXj-XX); if(XXnext(1)>b1) XXnext(1)=b1; end if(XXnext(1)<a1) XXnext(1)=a1; end if(XXnext(2)>b2) XXnext(2)=b2; end if(XXnext(2)<a2) XXnext(2)=a2; end pp=1; break endendif(~pp) XXnext=XX+rand*Step; if(XXnext(1)>b1) XXnext(1)=b1; end if(XXnext(1)<a1) XXnext(1)=a1; end if(XXnext(2)>b2) XXnext(2)=b2; end if(XXnext(2)<a2) XXnext(2)=a2; endend
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -