exit flag -2

2 ビュー (過去 30 日間)
DrLoz
DrLoz 2018 年 10 月 14 日
コメント済み: Walter Roberson 2018 年 10 月 16 日
Hi, I have the following code which returns exit flag -2. I've tried using different algorithms and different initial starting values. But I'm not sure what to do next. Thanks!
for iPt = 1:nFrontierPts %This is only looping over the FX overlay - I'm adding the exogenous portfolio at the final step
%Max iter and funevals small while debugging - need to increase to deal with exit flag 0
%Currency Specific Frontier
options = optimoptions(@fmincon,'Algorithm','interior-point','MaxIter',1000,'MaxFunEvals',10000);
targetVar_cs = minVar_cs + (iPt-1)*VarIncr_cs;
[tempWts_cs,FVAL_cs,EXITFLAG_cs,OUTPUT_cs] =fmincon(@(w) ERObjective(w,ExpFXret_cs_t),w0_cs,[],[],[],[],LB_cs,UB_cs, @(w) nonlcon2(w,targetVar_cs,teCap,AssetReturns(t-59:t,1),csAssetReturns(t-59:t,2:7),equRet(t-59:t),covCap),options);
% [tempWts_cs,FVAL_cs,EXITFLAG_cs,OUTPUT_cs] =fmincon(@(w) ERObjective(w,ExpFXret_cs_t),w0_cs,[],[],[],[],LB_cs,UB_cs, @(w) nonlcon2(w,targetVar_cs,100,AssetReturns(t-59:t,1),csAssetReturns(t-59:t,2:7),equRet(t-59:t),100),options);
if EXITFLAG_cs ==-2
w0_cs = UB_cs';
options = optimoptions(@fmincon,'Algorithm','sqp','MaxIter',1000,'MaxFunEvals',10000);
[tempWts_cs,FVAL_cs,EXITFLAG_cs,OUTPUT_cs] =fmincon(@(w) ERObjective(w,ExpFXret_cs_t),w0_cs,[],[],[],[],LB_cs,UB_cs, @(w) nonlcon2(w,targetVar_cs,teCap,AssetReturns(t-59:t,1),csAssetReturns(t-59:t,2:7),equRet(t-59:t),covCap),options);
if EXITFLAG_cs==-2
options = optimoptions(@fmincon,'Algorithm','active-set','MaxIter',1000,'MaxFunEvals',10000);
[tempWts_cs,FVAL_cs,EXITFLAG_cs,OUTPUT_cs] =fmincon(@(w) ERObjective(w,ExpFXret_cs_t),w0_cs,[],[],[],[],LB_cs,UB_cs, @(w) nonlcon2(w,targetVar_cs,teCap,AssetReturns(t-59:t,1),csAssetReturns(t-59:t,2:7),equRet(t-59:t),covCap),options);
end
if EXITFLAG_cs==-2
for ct = 1:10
w0_cs = UB_cs'*rand(1);
options = optimoptions(@fmincon,'Algorithm','active-set','MaxIter',1000,'MaxFunEvals',10000);
[tempWts_cs,FVAL_cs,EXITFLAG_cs,OUTPUT_cs] =fmincon(@(w) ERObjective(w,ExpFXret_cs_t),w0_cs,[],[],[],[],LB_cs,UB_cs, @(w) nonlcon2(w,targetVar_cs,teCap,AssetReturns(t-59:t,1),csAssetReturns(t-59:t,2:7),equRet(t-59:t),covCap),options);
if EXITFLAG_cs ~= -2
break;
end
end
end
end
end
I'm not sure what else to do next. Thanks!
  21 件のコメント
DrLoz
DrLoz 2018 年 10 月 15 日
oh... I guess this is not looking promising at all... thanks Walter.
Walter Roberson
Walter Roberson 2018 年 10 月 16 日
Okay, I will look at it when I am able. I have some dental work when in the morning, so I am not sure whether I will feel up to doing anything for a couple of days.

サインインしてコメントする。

回答 (0 件)

カテゴリ

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

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by