exit flag -2

조회 수: 4 (최근 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 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