What do I need to fix in this code to get the maximum value?
1 view (last 30 days)
Show older comments
kyungdoo lee
on 26 Oct 2021
Commented: Star Strider
on 26 Oct 2021
%% optimmization algorithm
% source : https://sites.google.com/a/hydroteq.com/www/
clc
% HS: Harmony Search minimization
% Use the Matlab startup random number sequence:
rand('twister',5489); % Commment out to start rand from current position
% Specify objective function and bounds
f = Zq;
xL = [0.01 0.01]; % minimum range
xU = [0.81 0.81]; % maximum range
% Set HS algorithm parameters
HSparams.HMS = 10;
HSparams.MaxImp = 10000;
HSparams.HMCR = 0.8;
HSparams.PAR = 0.4;
HSparams.b = (xU-xL)/1000;
% Perform minimization
[xbest,fbest] = harmony(f,xL,xU,HSparams);
fprintf('Best solution found:\n')
disp(xbest)
fprintf('Function value = %f\n', fbest)
I want the max but I get the min
What do I need to fix in this code to get the maximum value?
0 Comments
Accepted Answer
Star Strider
on 26 Oct 2021
This is at least the second time (the first that I°m aware of is how to get maximum value of this code) you’ve asked the same question and still haven’t supplied the necessary information!
4 Comments
Star Strider
on 26 Oct 2021
As always, my pleasure!
Please just be patient and provide the requested information, if it is not provided initially.
.
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!