Problem with nonlinear objective function

조회 수: 15 (최근 30일)
Bashar
Bashar 2023년 3월 26일
댓글: Bashar 2023년 3월 28일
Hello all
I have problem with running a script that written to excute a multi-objective optimization problem using the solver " gamultiobj ", the error message that appears in the commnad window is " Objective must be an OptimizationExpression or a struct containing scalar OptimizationExpressions."
The optimization problem is a problem-based type and the part of script related to the objective functions is presented below:
% The First Objective Function
Jems = optimexpr;
for i = 0:Hp-1
if i+k <=Ns+Hp
Jems = Jems + ((CCb./(2.*Nc_b.*Eb)).*DT.*Pb_ch(i+k))...
+((CCb./(2.*Nc_b.*Eb)).*DT.*Pb_disch(i+k))...
+ (nfc.*((CCfc./Nh_fc) + Com_fc).*Delta_fc(i+k).*DT + Css_fc.* ASegma_fc(i+k))...
+ (nez.*((CCez./Nh_ez) + Com_ez).*Delta_ez(i+k).*DT + Css_ez.* ASegma_ez(i+k))...
+ (Bid_imp.*Pg_imp(i+k).*DT) - (Bid_exp.*Pg_exp(i+k).*DT);
else
break
end
end
show(Jems);
prob.Objective.OF1 = Jems;
%==============================
% The Second Objective Function
Eff = optimexpr;
for i = 0:Hp-1
if i+k <=Ns+Hp
Eff = Eff + ((Pfc(i+k)+Pb_disch(i+k))) ./ ((Pez(i+k)+Pb_ch(i+k)));
else
break
end
end
show(Eff)
prob.Objective.OF2 = Eff;
prob.Objective.OF2 = "max";
%========================
show(prob);
the optimization variables are presented below
Pb_ch = optimvar('Pb_ch',Nhr,'LowerBound',0,'UpperBound',nb*Pb_ch_max);
Pb_disch = optimvar('Pb_disch',Nhr,'LowerBound',0,'UpperBound',nb*Pb_disch_max);
Pg_imp = optimvar('Pg_imp',Nhr,'LowerBound',0,'UpperBound',Pg_imp_max);
Pg_exp = optimvar('Pg_exp',Nhr,'LowerBound',0,'UpperBound',Pg_exp_max);
Pfc = optimvar('Pfc',Nhr,'LowerBound',0,'UpperBound',nfc*Pfc_max);% Watch out here
Pez = optimvar('Pez',Nhr,'LowerBound',0,'UpperBound',nez*Pez_max);% Watch out here
SoCb = optimvar('SoCb',Nhr,'LowerBound',SoCb_min,'UpperBound',SoCb_max);
SoCH2 = optimvar('SoCH2',Nhr,'LowerBound',SoCH2_min,'UpperBound',SoCH2_max);
Delta_fc = optimvar('Delta_fc',Nhr,'LowerBound',0,'UpperBound',1,'Type','integer');
Delta_ez = optimvar('Delta_ez',Nhr,'LowerBound',0,'UpperBound',1,'Type','integer');
Delta_b_ch = optimvar('Delta_b_ch',Nhr,'LowerBound',0,'UpperBound',1,'Type','integer');
Delta_b_disch = optimvar('Delta_b_disch',Nhr,'LowerBound',0,'UpperBound',1,'Type','integer');
Delta_g_imp = optimvar('Delta_g_imp',Nhr,'LowerBound',0,'UpperBound',1,'Type','integer');
Delta_g_exp = optimvar('Delta_g_exp',Nhr,'LowerBound',0,'UpperBound',1,'Type','integer');
Segma_fc = optimvar('Segma_fc',Nhr,'LowerBound',-1,'UpperBound',1,'Type','integer');
Segma_ez = optimvar('Segma_ez',Nhr,'LowerBound',-1,'UpperBound',1,'Type','integer');
ASegma_fc = optimvar('ASegma_fc',Nhr,'LowerBound',0,'Type','integer');
ASegma_ez = optimvar('ASegma_ez',Nhr,'LowerBound',0,'Type','integer');
Kindly, I need to know what is the wrong associated with the objective functions formulation, especially the second functions.
Thanks in advance

채택된 답변

Matt J
Matt J 2023년 3월 26일
편집: Matt J 2023년 3월 26일
prob.Objective.OF2 = "max";
"max" is just a string. There is no optimization expression that can be interpreted from it.
  댓글 수: 1
Bashar
Bashar 2023년 3월 28일
Thanks a lot @Matt J
The problem has been solved.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by