I also forgot some necessary data (included in 'dataparadeigma5') Hu=42500 T1=293, W=10000, cf=0.2, cp=1.005, k=0.2857, t=27000000
fmincon - wrong results
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, I need some help about an optimization problem. It's a nonlinear constraint problem and the code is given. All the equations and data are checked for the case of mistake.The right results are
var(1)=16,49335
var(2)=0,98298
var(3)=5,01839
var(4)=0,85024
var(5)=0,89775
Calculations give back other (wrong) results. Also, the 'optimum' value of objective function is not the same with the last calculated by the program and I can't understand why. Thank you!
% script paradeigma5.m
% Επιλύει το πρόβλημα 5
clear
% ΜΗ ΑΠΑΡΑΙΤΗΤΟ ΑΠΟ ΕΔΩ:
% Δήλωση global μεταβλητών
global Hu T1 W cf cp k t;
load dataparadeigma5
% ΩΣ ΕΔΩ
var0=[15,0.998,6,0.85,0.9];
lbounds=[1,0,3,0,0];
ubounds=[100,0.994,7,0.899,0.9199];
options=optimset('Algorithm','sqp');
[var,C]=fmincon(@objparadeigma5,var0,[],[],[],[],lbounds,ubounds,@paradeigma5constraints,options);
disp('η βέλτιστη τιμή της συνάρτησης είναι C='),disp(C),disp('Για rc, rb, t3, nc, nt =')
disp(var)
OBJECTIVE FUNCTION FILE
function [ C ] = objparadeigma5( var )
% Περιέχει την αντικειμενική συνάρτηση του προβλήματος 5
rc=var(1);
rb=var(2);
t3=var(3);
nc=var(4);
nt=var(5);
% Δήλωση global μεταβλητών
global Hu T1 W cf cp k t;
% Σχέσεις Μετατροπής
t2=1+(rc^k-1)/nc
rT=rb*rc
t4=t3*(1-nt*(1-rT^(-k)))
ma=W/(cp*T1*(t3-t4-t2+1));
mf=ma*cp*T1*(t3-t2)/Hu;
Z1=(6.22*ma*rc*log(rc))/(0.9-nc);
Z2=4.03*ma*(1+5*exp(0.018*t3*T1-28))/(0.995-rb);
Z3=41.93*ma*(log(rT))*(1+5*exp(0.036*t3*T1-56))/(0.92-nt);
% Αντικειμενική Συνάρτηση
C=Z1+Z2+Z3+cf*mf*t
end
CONSTRAINTS FUNCTION FILE
function [c,ceq] = paradeigma5constraints( var )
% περιέχει τον περιορισμό τ2<τ3 και (τ3-τ4-τ2+1>0);
rc=var(1);
rb=var(2);
t3=var(3);
nc=var(4);
nt=var(5);
% Δήλωση global μεταβλητών
global Hu T1 W cf cp k t;
% Σχέσεις Μετατροπής
t2=1+(rc^k-1)/nc;
rT=rb*rc;
t4=t3*(1-nt*(1-rT^(-k)));
ma=W/(cp*T1*(t3-t4-t2+1));
mf=ma*cp*T1*(t3-t2)/Hu;
Z1=(6.22*ma*rc*log(rc))/(0.9-nc);
Z2=4.03*ma*(1+5*exp(0.018*t3*T1-28))/(0.995-rb);
Z3=41.93*ma*(log(rT))*(1+5*exp(0.036*t3*T1-56))/(0.92-nt);
% περιορισμοί
c=[t2-t3;t4+t2-t3-1];
ceq=[];
end
Antworten (0)
Siehe auch
Kategorien
Mehr zu Nonlinear Optimization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!