Responder dúvida

Seja o primeiro a responder

Optimizacao multi objectiva em matlab

Outras linguagens de programação Matlab Matlab
Boa tarde,
Gostaria de minimizar os dois primeiros objetivos e maximizar o terceiro,dentro das restricoes impostas.
E depois plotar uma 3D Pareto front , tudo em matlab.
Atualmente o codigo tem erros entao ,seria possivel alguem me corrigir o codigo por favor 
 
codigo:
 
prob.Objective.one = [(x(2)/x(3)*x(18))/(1+x(1)+x(16))*((x(17)^2)/2)-((x(18)^2)/2),((x(2)/x(3))*x(18))/(x(1)*x(19)*x(20))];
prob.Objective.two =[-((x(1)/(x(2)/x(3))), -(10^13)*(x(4)/(1.4*(10^6)))*exp(-71442/x(5))*(7.56*(x(6)^7.2)-1.6)*(x(7)^0.64)), -(x(9)*(1-(x(11)/x(9))-(x(12)/x(9))))),-(x(9)-x(10)), -(x(9)*(1-(x(11)/x(9))-(x(12)/x(9)))), -x(13)/x(14), -x(15)/(x(24)/x(2))];
prob.Objective.three = 1 - x^2;
prob.ObjectiveSense = "max";
prob.ObjectiveSense.one = "minimize";
prob.Objective.two = "minimize";
prob.Objective.three = "maximize";
fun = @(x)exp(x(1) + 2*x(2));
nonlcon = @ellipseparabola;
x0 = [0 0];
A = []; % No other constraints
b = [];
Aeq = [];
beq = [];
lb = [];
ub = [];
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon);
function [c,ceq] = ellipseparabola(x)
c(1) = x(1)-1; % f= fuel to air ratio
c(2) = x(2)-1; % Fn= net thurst
c(3) = x(3)-1; % m0= air mass flow rate
c(4) = x(4)-1; % p3=inlet pressure
c(5) = x(5)-1; % Tpz=primary zone temperature
c(6) = x(6)-1; % o=equivalence ratio
c(7) = x(7)-1; % t=residence time
c(8) = x(8)-1; % aa=pressure term
c(9) = x(9)-1; % Wto=take off weight
c(10) = x(10)-1; % Wlanding=landing weight
c(11) = x(11)-1; % Wf=fuel weight
c(12) = x(12)-1; % WE=empty weight
c(13) = x(13)-1; % Wpl=payload weight
c(14) = x(14)-1; % Wc=crew weight
c(15) = x(15)-1; % Fuel load mass
c(16) = x(16)-1; % afterburner fuel-to-air ratio
c(17) = x(17)-1; % exhaust velocity
c(18) = x(18)-1; % cruising speed
c(19) = x(19)-1; % fuel heating value
c(20) = x(20)-1; % burner efficiency
c(21) = x(21)-1; % inlet temperature
c(22) = x(22)-1; % ambient static temperature
c(23) = x(23)-1; % lift
c(24) = x(24)-1; % density
c(25) = x(25)-1; % velocity
c(26) = x(26)-1; % wing area
c(27) = x(27)-1; % wing span
c(28) = x(28)-1; % Trapezoidal wing area in ft
c(29) = x(29)-1; % zero fuel weight
c(30) = x(30)-1; % upper dimension of wing
c(31) = x(31)-1; % right dimension side of wing
c(32) = x(32)-1; % left dimension side of wing
c(33) = x(33)-1; % wing span
c(34) = x(34)-1; % root chord
c(35) = x(35)-1; % lenght
c(36) = x(36)-1; % moment
c(37) = x(37)-1; % gross weight of aicraft
c(38) = x(38)-1; % maximum demonstrated level airpeed
c(39) = x(39)-1; % stalling speed
c(40) = x(40)-1; % stalling speed with flaps retracted
c(41) = x(41)-1; % Gust alleviation factor
c(42) = x(42)-1; % reference gust velocity
c(43) = x(43)-1; % design cruise speed
c(44) = x(44)-1; % pi number
c(45) = x(45)-1; % vertical gust velocity
c(46) = x(46)-1; % distance in ft penetrated into the gust
c(47) = x(47)-1; % Mean geometric chord
c(48) = x(48)-1; % i dont know the name
c(49) = x(49)-1; % Drag
c(50) = x(50)-1; % fuel weight fraction for the cruise segment
c(51) = x(51)-1; % lift coefficient
c(52) = x(52)-1; % drag coefficient
c(53) = x(53)-1; % Area
c(54) = x(54)-1; %3-dimensional lift curve slope
c(55) = x(55)-1; % 56 variable B=log(Y)
ceq = [];
end
[sol,fval,exitflag,output] = solve(prob,...
Solver="gamultiobj",...
Options=options);
sol = solve(prob);
paretoplot(sol)
% Plot Pareto front
pareto(fval(:,1:nobj/2), -fval(:,nobj/2+1:end));
xlabel('Objective 1');
ylabel('Objective 2');
zlabel('Objective 3');
Foto de Henrique A.
Henrique perguntou há 1 ano