How can I define two function in function handle for GAMULTIOBJ?

13 ビュー (過去 30 日間)
Hannah Mohebi
Hannah Mohebi 2022 年 10 月 6 日
編集済み: Torsten 2022 年 10 月 6 日
I have 3 decision variables and 2 objective functions.
This is my code:
lb=[0.01,0.0075,0.01];
ub=[0.2,0.07,0.07];
func=@(x) [efficiency,LCCfunc];
[x,fvar]=gamultiobj(func,3,[],[],[],[],lb,ub);
My question:
Efficiency and LCCfunc are my objective functions. For example LCCfuns is:
function y=LCCfunc(var)
delta_PCM=var(3);
L=1.5;
W=1;
rho_PCMs=880;
m_PCM=W*L*delta_PCM*rho_PCMs;
phi_np=var(1);
m_nano=phi_np*m_PCM/(1-phi_np);
U_C_nano=100;
U_C_PCM=1;
cost_nanoPCM=(U_C_nano*m_nano)+(U_C_PCM*m_PCM);
IC=cost_nanoPCM;
k=0.2;
INR=0.12;
IFR=0.03;
MC=zeros(1,24);
MC(2)=1300*(1+IFR);
MCDiscount=zeros(1,24);
RC=zeros(1,24);
RC(2)=cost_nanoPCM;
RCDiscount=zeros(1,24);
% CRF=;
% RC=
% MC=k*IC*CRF;
for i=2:25
MC(i+1)=MC(i)*(1+IFR);
MCDiscount(i)=MC(i)/((1+INR)^(i-1));
end
MCtotal=sum(MCDiscount);
for i=2:25
RC(i+1)=RC(i)*(1+IFR);
RCDiscount(i)=RC(i)/((1+INR)^(i-1));
end
RCtotal=sum(RCDiscount);
LCC=IC+MCtotal+RCtotal;
y=LCC;
end
How can I define these two objective function in one function handle for using in GAMULTIOBJ?

採用された回答

Torsten
Torsten 2022 年 10 月 6 日
編集済み: Torsten 2022 年 10 月 6 日
Since the functions are that long, better keep them separated.
But use
func=@(x) [efficiency(x),LCCfunc(x)];
instead of
func=@(x) [efficiency,LCCfunc];
to avoid an error message.
If you want to combine them in one function, simply use
func = @combined
and supply both columns in
function y = combined(x)
y(:,1) = ...;
y(:,2) = ...;
end
with y having 2 columns.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultiobjective Optimization についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by