I need an example for the use of GUI about simulated annealing !

1 次查看(过去 30 天)
Greetings everyone: I am a student to learn matlab,and want to use the GUI about simulated annealing for my Optimization computation,so I want for an simple example for the use of GUI about simulated annealing to start my study. Thanks very much!

回答(1 个)

Walter Roberson
Walter Roberson 2013-12-2
function GUI
uicontrol('Style', 'pushbutton', 'Units', 'norm', 'Position', [.1 .9 .05 .09], 'Callback', @anneal_it);
end
function anneal_it(src, evt)
X0 = rand(1,2);
[x, fval] = sa(@function_to_anneal, X0);
fprintf('Minimum value %g at location (%g, %g)', fval, x(1), x(2));
end
function y = function_to_anneal(X)
y = (4 - 2.1*x(1)^2 + x(1)^4/3)*x(1)^2 + x(1)*x(2) + ...
(-4 + 4*x(2)^2)*x(2)^2;
end

类别

Help CenterFile Exchange 中查找有关 Simulated Annealing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by