exit flag -2

4 次查看(过去 30 天)
DrLoz
DrLoz 2018-10-14
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 CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by