how could i use a metaheuristic algorithm to solve a problem solved by fminsearchbnd?

Hi,
could you help me to implemented a metaheuristic algorithm as GA which gives a similar results as fminsearchbnd as follows:
clear all
clc
% % %%%read data
filename = 'D_test2.xlsx';
sheet = 1;
xlRange = 'A2:E60';
Mm = xlsread(filename, sheet, xlRange);
% % %Get the data
% % %X=(Mm(:,1:13)); %%% money ens data
HB=(Mm(:,2)); %%% home
P=(Mm(:,3)); %%% pone
QTU=(Mm(:,1));%%deep
Rg=(Mm(:,4));
k=0.00981;
m=(Mm(:,5));
x1=QTU(:);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% options = optimset('PlotFcns',@optimplotfval);
%options = optimset('PlotFcns',@optimplotfval);
opts = optimset('fminsearch');
%opts = optimset('fminsearch',@optimplotfval);
opts.Display = 'iter';
%opts.TolX = 1.e-12;
opts.TolFun = 1.e-12;
opts.MaxFunEvals = 100;
sse =@(x)sum((x1 - x(3)./(k.*x(2).*x(4))).^ 2);
x0=[HB(:),P(:),Rg(:)]
n=length(x0);
LB=[36.5*ones(n,1) 50*ones(n,1) 0.73*ones(n,1)];
UB=[41.5*ones(n,1) 396*ones(n,1) 0.94*ones(n,1)];
%sse = fminsearch(sse,x0,options)
%xsol = fminsearchbnd(sse,x0,LB,UB,opts)
[xsol,fval,exitflag,output] = fminsearchbnd(sse,x0,LB,UB)
%Here i expect to find a predictor vector which minimizes my objective function. I attached here a "D_test2" need in this programm.

Answers (0)

Categories

Asked:

on 12 Jun 2019

Community Treasure Hunt

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

Start Hunting!