Fmincon and multistart results

1 view (last 30 days)
Meddour Aissam riad
Meddour Aissam riad on 26 Feb 2020
Edited: Meddour Aissam riad on 26 Feb 2020
I'm using the following code to calculacte the three coefficient 'x' ti minimise my function f which is need to run a for loop before we can get the final results of the objective function
% function f=FunMINCON(c)
% clear all
% clc
load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\temp_HE.mat')
% load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\temp_HP.mat')
load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\temps_temperature.mat')
load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\V_HE_opt.mat')
% load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\V_HP_opt.mat')
load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\C_HED.mat')
% load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\C_HP.mat')
load('C:\Users\aissam.meddour\Desktop\Optimization algo\DATA\Ncycle.mat')
% c=[-1.3475221222842815E-7 11.308641442925296 0.9054638310592784]
c=[0.000001 4 1]
% c=[-1.3475221222842815E-7 12.655809411675296 1.1459423466842784];
T0=25;
V0=3.7;
DELTAT=10;
DELTAV=0.1;
Capa=100;
lb=[-10 -10 -10];
ub=[20 13 20];
C=[];
TT=[];
j=1:1:7301;
for Cycle=1:1:Ncycle(end)
TT=Capa*(1+c(1).*sqrt((temps_temperature(j))).*c(2).^((temp_HE(j)-T0)./DELTAT).*c(3).^(V_HE_opt(j)-V0)./DELTAV);
Capa=TT(Cycle);
C(Cycle)=TT(Cycle);
end
Ncycle(1)=[];
Capacite=[];
Capac=[];
Capac=C(Ncycle);
Capac2=[100,Capac];
Capacite=Capac2';
I1=sum((Capacite-C_HED).^2);
I2=sum(abs(Capacite-C_HED));
f=@(c)(I1+I2);
opts = optimoptions(@fmincon,'Algorithm','sqp');
problem = createOptimProblem('fmincon','objective',...
f,'x0',c,'lb',lb,'ub',ub,'options',opts);
ms = MultiStart('PlotFcns',@gsplotbestf);
[x,fval,exitflag,outpt,solutions] = run(ms,problem,1000);
% end
i'm getting a constant value of the objective function for all the ittiration, i know it's a code error but since it's my first time using this function i'm hoping to get some help here
  1 Comment
Meddour Aissam riad
Meddour Aissam riad on 26 Feb 2020
Edited: Meddour Aissam riad on 26 Feb 2020
If you need the data i can providee them of course

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!