Skip to main content
. 2019 Sep 12;19(18):3934. doi: 10.3390/s19183934
Algorithm 3 Simulated Annealing Algorithm
Letx=x0.
n = length(x0)
T=T0
M = 100, % m is the iteration times at different temperatures
Tmin = 1e-3
Partition = [[];
While T >  Tmin
Temp = zeros(m,n + 1);
for k = 1:m
If rand(1) > 0.6
RC_PNB search algorithm,xnewneighbor(x)
else
PN_VC search algorithm,xnewneighbor(x)
end
If F(xnew) < F(x0)
x xnew
Elseif /(1+  eF(xnew) F(x0)T ) ≥ random(0, 1):
x xnew
End
temp(k,:) = [ x, F(x)];
end
[Fmin,index] = min(temp(:,end)); %Find the optimal partition at current temperature.
Partition = [partition; temp(index,end)];
T =  T×σ; here σ is cooling rate
End
[ Fopt ,index1] = min(Partition (:,end));
xopt = Partition (index1,1:end-1); %the final state is xopt , optimal value of objective function is Fopt