exit flag -2
古いコメントを表示
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 件のコメント
Walter Roberson
2018 年 10 月 15 日
(exit flag 2 is "No feasible point was found.")
Probably your non-linear constraints are difficult to satisfy.
It is not easy for us to give more advice without the initial values and code for ERObjective and nonlcon2
Walter Roberson
2018 年 10 月 15 日
So for initial values I should use
nFrontierPts = 1;
minVar_cs = rand();
VarIncr_cs = rand();
w0_cs = rand(6,1); %60x6 array * w must be size 60x1
ExpFXret_cs_t = rand(1, 6); %ExpRet * w must be scalar, and w is 6 x 1 so this must be 1 x 6
LB_cs = randn(1, 6);
UB_cs = abs(LB_cs) + rand(1, 6);
targetVar_cs = rand();
teCap = rand();
max_ass = 70;
t = randi([60 max_ass-1]);
AssetReturns = rand(max_ass, 7);
csAssetReturns = rand(max_ass, 7);
equRet = rand(1, max_ass);
covCap = rand();
?
DrLoz
2018 年 10 月 15 日
Walter Roberson
2018 年 10 月 15 日
.. That's a question. You said nothing about the sizes or ranges of the various arrays, so I had to analyze the code to figure out what the sizes should be, but I have no information about the ranges. And I don't really expect random values to correlate well.
DrLoz
2018 年 10 月 15 日
DrLoz
2018 年 10 月 15 日
Walter Roberson
2018 年 10 月 15 日
Your tolerances are really tight, and it is doubtful that they can be reached.
By substituting symbolic values for w in your nonlinear constraint, you get the constraints (approximated)
3.464101615137755*(0.01694915254237288*abs(0.02886816362771872*W1 - 0.03919406352959544*W2 - 0.01471540136021817*W3 + 0.001764295435917194*W4 + 0.02169337934246846*W5 + 0.003808776033319812*W6 - 0.007810693788828932)^2 + 0.01694915254237288*abs(0.02855036042080595*W1 + 0.05246672670654582*W2 + 0.01344316226620105*W3 + 0.05689676429094718*W4 + 0.02513266972362289*W5 + 0.01493600721644268*W6 + 0.006573339283632679)^2 + 0.01694915254237288*abs(0.1008818933232127*W1 + 0.03363397981747138*W2 + 0.09193710929326652*W3 + 0.06260122318826636*W4 + 0.0314784317932701*W5 - 0.01638339436670971*W6 - 0.0362581320732622)^2 + 0.01694915254237288*abs(0.009944527705669346*W1 + 0.004801202173645304*W2 + 0.03746771896868998*W3 + 0.04024934172509101*W4 - 0.009168549520271511*W5 + 0.07719767506189507*W6 - 0.01752969683179822)^2 + 0.01694915254237288*abs(0.001443991565420401*W1 + 0.009336049413569379*W2 + 0.01642127430543069*W3 - 0.01760146926307485*W4 + 0.06357473155100584*W5 + 0.02317444687843411*W6 - 0.009756550245816604)^2 + 0.01694915254237288*abs(0.06386285687709857*W1 + 0.03216806993093482*W2 + 0.03733988696681619*W3 + 0.05808236721427315*W4 + 0.03579942317781597*W5 - 0.004628231701378556*W6 - 0.02568921578155649)^2 + 0.01694915254237288*abs(0.1637096021144607*W1 + 0.06431269847065455*W2 + 0.232211118801498*W3 + 0.06894874064470538*W4 + 0.0386202329205308*W5 + 0.1252409436547383*W6 - 0.09657637505125539)^2 + 0.01694915254237288*abs(0.070467758765154*W1 + 0.005039429448805956*W2 + 0.08544372221730149*W3 + 0.02197201985753841*W4 + 0.0259575410724639*W5 + 0.0005507631252086938*W6 - 0.03480264849756702)^2 + 0.01694915254237288*abs(0.00009767920594915454*W1 - 0.002344294880547639*W2 + 0.03711707855930765*W3 + 0.00483001928496737*W4 - 0.004560979806947093*W5 + 0.0007797227047124304*W6 - 0.004590387658694567)^2 + 0.01694915254237288*abs(0.01069903165890184*W1 - 0.01591310058623983*W2 + 0.03116878745387571*W3 + 0.02216149003455678*W4 + 0.01005456699799805*W5 + 0.004097689286192633*W6 + 0.002063401415436799)^2 + 0.01694915254237288*abs(0.001360938054981699*W2 - 0.004697382636704596*W1 + 0.00796215864036113*W3 - 0.02769392943175905*W4 - 0.02065530264663334*W5 + 0.00009188255972420641*W6 + 0.03210173899669516)^2 + 0.01694915254237288*abs(0.02147919509426887*W1 + 0.04967523403587983*W2 + 0.004574993153138882*W3 + 0.02089555764946435*W4 + 0.008364072833520079*W5 + 0.05465864399232639*W6 - 0.0173887004394178)^2 + 0.01694915254237288*abs(0.01053879537020961*W2 - 0.01335690571895142*W1 + 0.02128161380304675*W3 + 0.009715067362178451*W4 - 0.00409195917243104*W5 - 0.01744772201190397*W6 + 0.0125760864740233)^2 + 0.01694915254237288*abs(0.004613012626886746*W1 + 0.01279167251159617*W2 - 0.02261524565034841*W3 + 0.004714555441240696*W4 - 0.01146464856401379*W5 + 0.009068086926069481*W6 + 0.005816171087468841)^2 + 0.01694915254237288*abs(0.008714953183499454*W1 + 0.02467649678914332*W2 - 0.002113740479597927*W3 + 0.05293642609160639*W4 - 0.008093406863126714*W5 + 0.02478805726830163*W6 - 0.01200860133889904)^2 + 0.01694915254237288*abs(0.009356529420095148*W2 - 0.01842066629845896*W1 - 0.04097180554439187*W3 + 0.0008109601687445696*W4 + 0.01593669157010873*W5 - 0.03990493268042156*W6 + 0.007767448121098935)^2 + 0.01694915254237288*abs(0.03675987811621339*W1 + 0.0267677261170123*W2 + 0.03299204879710223*W3 + 0.02015164250031051*W4 + 0.01844290288900468*W5 + 0.02171165920971024*W6 - 0.02863963427756737)^2 + 0.01694915254237288*abs(0.01970217439079637*W1 - 0.01153316632893588*W2 + 0.04586317454692194*W3 + 0.01086909741888479*W4 + 0.002600131096182242*W5 - 0.008331068828564873*W6 - 0.02599386882117953)^2 + 0.01694915254237288*abs(0.01738464430445396*W1 + 0.008138446520113994*W2 + 0.01841051171356863*W3 - 0.0003549281839545818*W4 - 0.01241626814822922*W5 + 0.005290320568326172*W6 - 0.01532518460600704)^2 + 0.01694915254237288*abs(0.0007080707274939128*W1 + 0.01571896844807583*W2 - 0.01164908599804523*W3 + 0.01034580887364392*W4 - 0.02739758150760346*W5 + 0.01741575509731348*W6 - 0.04891144590277257)^2 + 0.01694915254237288*abs(0.02413262620627333*W1 - 0.02064897381491306*W2 - 0.05103433808968146*W3 + 0.01026435982902011*W4 + 0.02607308067454012*W5 - 0.008873788536872977*W6 + 0.01768482292562261)^2 + 0.01694915254237288*abs(0.06651952597416343*W1 - 0.03541481294911939*W2 + 0.018732931926384*W3 + 0.1152631439344755*W4 + 0.05049041486163024*W5 - 0.06304357864392114*W6 - 0.007451690392748649)^2 + 0.01694915254237288*abs(0.02153799254550616*W1 + 0.04422940792410311*W2 + 0.01373271323502815*W3 + 0.03590135205744508*W4 + 0.03824231158959929*W5 + 0.03943289428943315*W6 + 0.01259271173448739)^2 + 0.01694915254237288*abs(0.0717409791567266*W1 + 0.004668159722943009*W2 + 0.05347797804619644*W3 + 0.0195776598052941*W4 + 0.03936132432209754*W5 + 0.04133345983698927*W6 - 0.03090593363542517)^2 + 0.01694915254237288*abs(0.09657826715945107*W1 + 0.01571544797081934*W2 + 0.100432340144781*W3 + 0.09617273145565445*W4 + 0.08725383366515311*W5 + 0.01209452300468334*W6 - 0.03844215465488828)^2 + 0.01694915254237288*abs(0.008205755614250419*W1 + 0.02451384853872283*W2 - 0.04554785127616386*W3 + 0.02571331112252121*W4 + 0.01012366048490227*W5 + 0.01770004250771912*W6 + 0.01405875797119326)^2 + 0.01694915254237288*abs(0.04730605195656722*W1 + 0.02231075431262044*W2 + 0.07019703195027168*W3 + 0.0251992351735952*W4 + 0.03169533687847153*W5 + 0.02766700002858129*W6 - 0.01179722528059325)^2 + 0.01694915254237288*abs(0.01990904417022955*W1 + 0.01257948064757184*W2 - 0.001553445057516832*W3 + 0.02060348454891173*W4 + 0.01637651213666353*W5 - 0.009213775962750019*W6 - 0.01531287918276451)^2 + 0.01694915254237288*abs(0.07675846419670106*W1 + 0.02997639671899546*W2 + 0.09506455291229428*W3 + 0.07392825387771304*W4 + 0.06492076833202558*W5 + 0.055292815255988*W6 - 0.04147173977469168)^2 + 0.01694915254237288*abs(0.04445628667505274*W1 + 0.0451927398822294*W2 + 0.04536829115820803*W3 + 0.009528929502412544*W4 - 0.01117507648879752*W5 + 0.04994402302580141*W6 - 0.04582373592017678)^2 + 0.01694915254237288*abs(0.03511086104418825*W1 + 0.01222483262253007*W2 + 0.01519705758928299*W3 + 0.03005925775667203*W4 + 0.02017964095510976*W5 + 0.0009838003227123286*W6 + 0.009305891398178395)^2 + 0.01694915254237288*abs(0.03167144235429219*W1 + 0.01501248308608252*W2 + 0.01854407487268968*W3 + 0.01379518151441924*W4 - 0.04571970230315487*W5 + 0.01967977718481455*W6 - 0.04516663450600488)^2 + 0.01694915254237288*abs(0.02062678364226011*W1 + 0.0287471584998519*W2 + 0.07316802271921027*W3 + 0.02157885454130878*W4 - 0.01425129164017187*W5 + 0.00614409706634094*W6 - 0.033947254887092)^2 + 0.01694915254237288*abs(0.09291853992042099*W1 + 0.03564336641889741*W2 + 0.07895923204055603*W3 + 0.01542179478356823*W4 + 0.05557052912962496*W5 + 0.03951972740886073*W6 + 0.02060317154796509)^2 + 0.01694915254237288*abs(0.03068083387529287*W1 + 0.004481926838663865*W2 + 0.02259161346734443*W3 + 0.01795008279303581*W4 + 0.006191976388562455*W5 + 0.03983644146444127*W6 - 0.006569421445265661)^2 + 0.01694915254237288*abs(0.05852351269317634*W1 + 0.01141742941119108*W2 + 0.03895911804021065*W3 + 0.0134632636713636*W4 + 0.03190474502824164*W5 + 0.0005404305666641333*W6 - 0.007143288844499157)^2 + 0.01694915254237288*abs(0.007351466116568027*W2 - 0.002744092368167093*W1 + 0.08070136826717774*W3 + 0.009656192658019171*W4 + 0.0344816366307748*W5 + 0.007520494113197044*W6 + 0.04505940766613334)^2 + 0.01694915254237288*abs(0.01774539921618855*W1 - 0.001038117044324529*W2 - 0.02430172683174207*W3 + 0.01339682855518195*W4 + 0.02356065275932056*W5 - 0.02453008372812855*W6 + 0.05433962935367405)^2 + 0.01694915254237288*abs(0.01422999148685899*W1 + 0.00811154474464739*W2 + 0.0229023186701592*W3 - 0.01773257107535245*W4 + 0.02939326454724505*W5 + 0.008614005424517005*W6 + 0.01455559199487116)^2 + 0.01694915254237288*abs(0.07988302531680714*W1 + 0.04255412700524384*W2 + 0.09958224847621659*W3 + 0.06213093505626047*W4 + 0.07864722184644252*W5 + 0.05701718833217712*W6 - 0.06581721877353225)^2 + 0.01694915254237288*abs(0.03976964395545513*W1 + 0.04171074031032727*W2 + 0.0147283638633409*W3 + 0.04806033319211359*W4 + 0.03062828804891377*W5 + 0.03767065691454358*W6 + 0.009119733703566463)^2 + 0.01694915254237288*abs(0.02187649009169988*W2 - 0.0008708627629635442*W1 + 0.000645029398526988*W3 + 0.02056945797945245*W4 + 0.001368802453779746*W5 + 0.01084112710461711*W6 + 0.01390151494002642)^2 + 0.01694915254237288*abs(0.09883784473949696*W1 + 0.02786747463804919*W2 + 0.06881421102385962*W3 + 0.001787444081364078*W4 + 0.007431345470142618*W5 + 0.03417390687223425*W6 - 0.01753818715216062)^2 + 0.01694915254237288*abs(0.01269965081111655*W2 - 0.006372856437174658*W1 - 0.07083798506604063*W3 + 0.006174279909978018*W4 + 0.006098107686905393*W5 + 0.006811474495690591*W6 + 0.01906262378045479)^2 + 0.01694915254237288*abs(0.0300307654600832*W1 + 0.03881263854402153*W2 + 0.07651566535041584*W3 + 0.0238818035595951*W4 + 0.01322822667289574*W5 + 0.0741498722542096*W6 - 0.02885959161555577)^2 + 0.01694915254237288*abs(0.08663745146844481*W1 + 0.0505143870948255*W2 + 0.1057912237691433*W3 + 0.05169978521196713*W4 + 0.03744007910851359*W5 + 0.0555552505902806*W6 - 0.04380691989679501)^2 + 0.01694915254237288*abs(0.02272880768513409*W1 + 0.06446656714912356*W2 + 0.05734536362869006*W3 + 0.02440153079080457*W4 - 0.0143362593885688*W5 + 0.06683179101301179*W6 - 0.01522531603641933)^2 + 0.01694915254237288*abs(0.04106554194433897*W1 + 0.01902369380630933*W2 + 0.007176824787647549*W3 + 0.05742440613446706*W4 + 0.01940767541003335*W5 + 0.02330414834268506*W6 - 0.02823965936763612)^2 + 0.01694915254237288*abs(0.02303682116615236*W1 + 0.02216294830708219*W2 + 0.04887160656807747*W3 - 0.01615221673861241*W4 + 0.0004364875809205822*W5 - 0.02722208829187605*W6 - 0.02757853653765512)^2 + 0.01694915254237288*abs(0.02186690145853986*W1 + 0.02747736010074244*W2 - 0.02344962372301732*W3 - 0.004106753612478174*W4 + 0.01352986107272541*W5 - 0.04394316612113153*W6 + 0.01519501356801259)^2 + 0.01694915254237288*abs(0.003658019308915174*W1 + 0.0189640407344436*W2 + 0.01201269451553751*W3 - 0.004828204757109798*W4 + 0.007224338524628275*W5 + 0.02979886464320074*W6 + 0.002367141739534034)^2 + 0.01694915254237288*abs(0.02714227056037189*W1 - 0.001580288180818921*W2 + 0.02966903457573703*W3 + 0.00598819109032903*W4 + 0.01050571944190854*W5 - 0.01679695803207653*W6 - 0.01320834443851661)^2 + 0.01694915254237288*abs(0.009647696036338184*W1 + 0.01201657592918461*W2 + 0.03078168790750854*W3 + 0.00752507913211772*W4 - 0.004219437441703785*W5 + 0.02148067402142711*W6 - 0.006982495025288621)^2 + 0.01694915254237288*abs(0.006643264589449395*W2 - 0.01356666494521429*W1 + 0.02495696052099853*W3 - 0.01181219581776135*W4 + 0.01237951066004357*W5 + 0.003231539612815922*W6 + 0.01786206023749115)^2 + 0.01694915254237288*abs(0.08865234512085652*W1 + 0.01492985268638401*W2 + 0.1126044951091742*W3 + 0.04295748112475387*W4 + 0.06207727202256225*W5 + 0.01742142085389659*W6 - 0.04395458372847656)^2 + 0.01694915254237288*abs(0.007427875772974859*W2 - 0.001373830505684394*W1 + 0.006405223055394406*W3 - 0.02262951055810488*W4 + 0.003719920206690049*W5 + 0.01074196001641798*W6 - 0.0111897654915931)^2 + 0.01694915254237288*abs(0.01080930116484092*W1 - 0.02488816117353245*W2 + 0.015239595777126*W3 + 0.003206867420322533*W4 + 0.006785536461568272*W5 - 0.02048685150945678*W6 + 0.0007355850513886606)^2 + 0.01694915254237288*abs(0.02905721305567356*W1 + 0.02841750527579865*W2 + 0.02591283182092389*W3 + 0.02102079191746823*W4 + 0.005657597731049853*W5 - 0.0008183338529095733*W6 - 0.02206339253037922)^2 + 0.01694915254237288*abs(0.08246047322210136*W1 + 0.006477885181060537*W2 + 0.07855880497071929*W3 + 0.05590772703907129*W4 + 0.04766182200749685*W5 + 0.05344205647378235*W6 - 0.03084950438817905)^2 + 0.01694915254237288*abs(0.02981846512621948*W3 - 0.01129701039935573*W2 - 0.004078084838608044*W1 + 0.01259153543717576*W4 + 0.007142905549828057*W5 - 0.01381147224345163*W6 + 0.00182754627427228)^2)^(1/2) - 0.00000074804 <= 0
3.464101615137755*(0.01694915254237288*abs(0.0717409791567266*W1 + 0.004668159722943009*W2 + 0.05347797804619644*W3 + 0.0195776598052941*W4 + 0.03936132432209754*W5 + 0.04133345983698927*W6)^2 + 0.01694915254237288*abs(0.070467758765154*W1 + 0.005039429448805956*W2 + 0.08544372221730149*W3 + 0.02197201985753841*W4 + 0.0259575410724639*W5 + 0.0005507631252086938*W6)^2 + 0.01694915254237288*abs(0.00009767920594915454*W1 - 0.002344294880547639*W2 + 0.03711707855930765*W3 + 0.00483001928496737*W4 - 0.004560979806947093*W5 + 0.0007797227047124304*W6)^2 + 0.01694915254237288*abs(0.01970217439079637*W1 - 0.01153316632893588*W2 + 0.04586317454692194*W3 + 0.01086909741888479*W4 + 0.002600131096182242*W5 - 0.008331068828564873*W6)^2 + 0.01694915254237288*abs(0.01990904417022955*W1 + 0.01257948064757184*W2 - 0.001553445057516832*W3 + 0.02060348454891173*W4 + 0.01637651213666353*W5 - 0.009213775962750019*W6)^2 + 0.01694915254237288*abs(0.008714953183499454*W1 + 0.02467649678914332*W2 - 0.002113740479597927*W3 + 0.05293642609160639*W4 - 0.008093406863126714*W5 + 0.02478805726830163*W6)^2 + 0.01694915254237288*abs(0.004613012626886746*W1 + 0.01279167251159617*W2 - 0.02261524565034841*W3 + 0.004714555441240696*W4 - 0.01146464856401379*W5 + 0.009068086926069481*W6)^2 + 0.01694915254237288*abs(0.01069903165890184*W1 - 0.01591310058623983*W2 + 0.03116878745387571*W3 + 0.02216149003455678*W4 + 0.01005456699799805*W5 + 0.004097689286192633*W6)^2 + 0.01694915254237288*abs(0.0007080707274939128*W1 + 0.01571896844807583*W2 - 0.01164908599804523*W3 + 0.01034580887364392*W4 - 0.02739758150760346*W5 + 0.01741575509731348*W6)^2 + 0.01694915254237288*abs(0.008205755614250419*W1 + 0.02451384853872283*W2 - 0.04554785127616386*W3 + 0.02571331112252121*W4 + 0.01012366048490227*W5 + 0.01770004250771912*W6)^2 + 0.01694915254237288*abs(0.02153799254550616*W1 + 0.04422940792410311*W2 + 0.01373271323502815*W3 + 0.03590135205744508*W4 + 0.03824231158959929*W5 + 0.03943289428943315*W6)^2 + 0.01694915254237288*abs(0.001360938054981699*W2 - 0.004697382636704596*W1 + 0.00796215864036113*W3 - 0.02769392943175905*W4 - 0.02065530264663334*W5 + 0.00009188255972420641*W6)^2 + 0.01694915254237288*abs(0.02147919509426887*W1 + 0.04967523403587983*W2 + 0.004574993153138882*W3 + 0.02089555764946435*W4 + 0.008364072833520079*W5 + 0.05465864399232639*W6)^2 + 0.01694915254237288*abs(0.05852351269317634*W1 + 0.01141742941119108*W2 + 0.03895911804021065*W3 + 0.0134632636713636*W4 + 0.03190474502824164*W5 + 0.0005404305666641333*W6)^2 + 0.01694915254237288*abs(0.01422999148685899*W1 + 0.00811154474464739*W2 + 0.0229023186701592*W3 - 0.01773257107535245*W4 + 0.02939326454724505*W5 + 0.008614005424517005*W6)^2 + 0.01694915254237288*abs(0.04730605195656722*W1 + 0.02231075431262044*W2 + 0.07019703195027168*W3 + 0.0251992351735952*W4 + 0.03169533687847153*W5 + 0.02766700002858129*W6)^2 + 0.01694915254237288*abs(0.001038117044324529*W2 - 0.01774539921618855*W1 + 0.02430172683174207*W3 - 0.01339682855518195*W4 - 0.02356065275932056*W5 + 0.02453008372812855*W6)^2 + 0.01694915254237288*abs(0.03068083387529287*W1 + 0.004481926838663865*W2 + 0.02259161346734443*W3 + 0.01795008279303581*W4 + 0.006191976388562455*W5 + 0.03983644146444127*W6)^2 + 0.01694915254237288*abs(0.04445628667505274*W1 + 0.0451927398822294*W2 + 0.04536829115820803*W3 + 0.009528929502412544*W4 - 0.01117507648879752*W5 + 0.04994402302580141*W6)^2 + 0.01694915254237288*abs(0.03167144235429219*W1 + 0.01501248308608252*W2 + 0.01854407487268968*W3 + 0.01379518151441924*W4 - 0.04571970230315487*W5 + 0.01967977718481455*W6)^2 + 0.01694915254237288*abs(0.02187649009169988*W2 - 0.0008708627629635442*W1 + 0.000645029398526988*W3 + 0.02056945797945245*W4 + 0.001368802453779746*W5 + 0.01084112710461711*W6)^2 + 0.01694915254237288*abs(0.02413262620627333*W1 - 0.02064897381491306*W2 - 0.05103433808968146*W3 + 0.01026435982902011*W4 + 0.02607308067454012*W5 - 0.008873788536872977*W6)^2 + 0.01694915254237288*abs(0.09657826715945107*W1 + 0.01571544797081934*W2 + 0.100432340144781*W3 + 0.09617273145565445*W4 + 0.08725383366515311*W5 + 0.01209452300468334*W6)^2 + 0.01694915254237288*abs(0.07675846419670106*W1 + 0.02997639671899546*W2 + 0.09506455291229428*W3 + 0.07392825387771304*W4 + 0.06492076833202558*W5 + 0.055292815255988*W6)^2 + 0.01694915254237288*abs(0.02272880768513409*W1 + 0.06446656714912356*W2 + 0.05734536362869006*W3 + 0.02440153079080457*W4 - 0.0143362593885688*W5 + 0.06683179101301179*W6)^2 + 0.01694915254237288*abs(0.0300307654600832*W1 + 0.03881263854402153*W2 + 0.07651566535041584*W3 + 0.0238818035595951*W4 + 0.01322822667289574*W5 + 0.0741498722542096*W6)^2 + 0.01694915254237288*abs(0.007351466116568027*W2 - 0.002744092368167093*W1 + 0.08070136826717774*W3 + 0.009656192658019171*W4 + 0.0344816366307748*W5 + 0.007520494113197044*W6)^2 + 0.01694915254237288*abs(0.02344962372301732*W3 - 0.02747736010074244*W2 - 0.02186690145853986*W1 + 0.004106753612478174*W4 - 0.01352986107272541*W5 + 0.04394316612113153*W6)^2 + 0.01694915254237288*abs(0.03511086104418825*W1 + 0.01222483262253007*W2 + 0.01519705758928299*W3 + 0.03005925775667203*W4 + 0.02017964095510976*W5 + 0.0009838003227123286*W6)^2 + 0.01694915254237288*abs(0.09291853992042099*W1 + 0.03564336641889741*W2 + 0.07895923204055603*W3 + 0.01542179478356823*W4 + 0.05557052912962496*W5 + 0.03951972740886073*W6)^2 + 0.01694915254237288*abs(0.04106554194433897*W1 + 0.01902369380630933*W2 + 0.007176824787647549*W3 + 0.05742440613446706*W4 + 0.01940767541003335*W5 + 0.02330414834268506*W6)^2 + 0.01694915254237288*abs(0.02303682116615236*W1 + 0.02216294830708219*W2 + 0.04887160656807747*W3 - 0.01615221673861241*W4 + 0.0004364875809205822*W5 - 0.02722208829187605*W6)^2 + 0.01694915254237288*abs(0.02062678364226011*W1 + 0.0287471584998519*W2 + 0.07316802271921027*W3 + 0.02157885454130878*W4 - 0.01425129164017187*W5 + 0.00614409706634094*W6)^2 + 0.01694915254237288*abs(0.009647696036338184*W1 + 0.01201657592918461*W2 + 0.03078168790750854*W3 + 0.00752507913211772*W4 - 0.004219437441703785*W5 + 0.02148067402142711*W6)^2 + 0.01694915254237288*abs(0.03976964395545513*W1 + 0.04171074031032727*W2 + 0.0147283638633409*W3 + 0.04806033319211359*W4 + 0.03062828804891377*W5 + 0.03767065691454358*W6)^2 + 0.01694915254237288*abs(0.02714227056037189*W1 - 0.001580288180818921*W2 + 0.02966903457573703*W3 + 0.00598819109032903*W4 + 0.01050571944190854*W5 - 0.01679695803207653*W6)^2 + 0.01694915254237288*abs(0.08246047322210136*W1 + 0.006477885181060537*W2 + 0.07855880497071929*W3 + 0.05590772703907129*W4 + 0.04766182200749685*W5 + 0.05344205647378235*W6)^2 + 0.01694915254237288*abs(0.01269965081111655*W2 - 0.006372856437174658*W1 - 0.07083798506604063*W3 + 0.006174279909978018*W4 + 0.006098107686905393*W5 + 0.006811474495690591*W6)^2 + 0.01694915254237288*abs(0.09883784473949696*W1 + 0.02786747463804919*W2 + 0.06881421102385962*W3 + 0.001787444081364078*W4 + 0.007431345470142618*W5 + 0.03417390687223425*W6)^2 + 0.01694915254237288*abs(0.07988302531680714*W1 + 0.04255412700524384*W2 + 0.09958224847621659*W3 + 0.06213093505626047*W4 + 0.07864722184644252*W5 + 0.05701718833217712*W6)^2 + 0.01694915254237288*abs(0.08663745146844481*W1 + 0.0505143870948255*W2 + 0.1057912237691433*W3 + 0.05169978521196713*W4 + 0.03744007910851359*W5 + 0.0555552505902806*W6)^2 + 0.01694915254237288*abs(0.004078084838608044*W1 + 0.01129701039935573*W2 - 0.02981846512621948*W3 - 0.01259153543717576*W4 - 0.007142905549828057*W5 + 0.01381147224345163*W6)^2 + 0.01694915254237288*abs(0.08865234512085652*W1 + 0.01492985268638401*W2 + 0.1126044951091742*W3 + 0.04295748112475387*W4 + 0.06207727202256225*W5 + 0.01742142085389659*W6)^2 + 0.01694915254237288*abs(0.003658019308915174*W1 + 0.0189640407344436*W2 + 0.01201269451553751*W3 - 0.004828204757109798*W4 + 0.007224338524628275*W5 + 0.02979886464320074*W6)^2 + 0.01694915254237288*abs(0.01080930116484092*W1 - 0.02488816117353245*W2 + 0.015239595777126*W3 + 0.003206867420322533*W4 + 0.006785536461568272*W5 - 0.02048685150945678*W6)^2 + 0.01694915254237288*abs(0.007427875772974859*W2 - 0.001373830505684394*W1 + 0.006405223055394406*W3 - 0.02262951055810488*W4 + 0.003719920206690049*W5 + 0.01074196001641798*W6)^2 + 0.01694915254237288*abs(0.006643264589449395*W2 - 0.01356666494521429*W1 + 0.02495696052099853*W3 - 0.01181219581776135*W4 + 0.01237951066004357*W5 + 0.003231539612815922*W6)^2 + 0.01694915254237288*abs(0.02905721305567356*W1 + 0.02841750527579865*W2 + 0.02591283182092389*W3 + 0.02102079191746823*W4 + 0.005657597731049853*W5 - 0.0008183338529095733*W6)^2 + 0.01694915254237288*abs(0.02886816362771872*W1 - 0.03919406352959544*W2 - 0.01471540136021817*W3 + 0.001764295435917194*W4 + 0.02169337934246846*W5 + 0.003808776033319812*W6)^2 + 0.01694915254237288*abs(0.02855036042080595*W1 + 0.05246672670654582*W2 + 0.01344316226620105*W3 + 0.05689676429094718*W4 + 0.02513266972362289*W5 + 0.01493600721644268*W6)^2 + 0.01694915254237288*abs(0.1008818933232127*W1 + 0.03363397981747138*W2 + 0.09193710929326652*W3 + 0.06260122318826636*W4 + 0.0314784317932701*W5 - 0.01638339436670971*W6)^2 + 0.01694915254237288*abs(0.001443991565420401*W1 + 0.009336049413569379*W2 + 0.01642127430543069*W3 - 0.01760146926307485*W4 + 0.06357473155100584*W5 + 0.02317444687843411*W6)^2 + 0.01694915254237288*abs(0.009944527705669346*W1 + 0.004801202173645304*W2 + 0.03746771896868998*W3 + 0.04024934172509101*W4 - 0.009168549520271511*W5 + 0.07719767506189507*W6)^2 + 0.01694915254237288*abs(0.06386285687709857*W1 + 0.03216806993093482*W2 + 0.03733988696681619*W3 + 0.05808236721427315*W4 + 0.03579942317781597*W5 - 0.004628231701378556*W6)^2 + 0.01694915254237288*abs(0.1637096021144607*W1 + 0.06431269847065455*W2 + 0.232211118801498*W3 + 0.06894874064470538*W4 + 0.0386202329205308*W5 + 0.1252409436547383*W6)^2 + 0.01694915254237288*abs(0.009356529420095148*W2 - 0.01842066629845896*W1 - 0.04097180554439187*W3 + 0.0008109601687445696*W4 + 0.01593669157010873*W5 - 0.03990493268042156*W6)^2 + 0.01694915254237288*abs(0.01738464430445396*W1 + 0.008138446520113994*W2 + 0.01841051171356863*W3 - 0.0003549281839545818*W4 - 0.01241626814822922*W5 + 0.005290320568326172*W6)^2 + 0.01694915254237288*abs(0.03675987811621339*W1 + 0.0267677261170123*W2 + 0.03299204879710223*W3 + 0.02015164250031051*W4 + 0.01844290288900468*W5 + 0.02171165920971024*W6)^2 + 0.01694915254237288*abs(0.01053879537020961*W2 - 0.01335690571895142*W1 + 0.02128161380304675*W3 + 0.009715067362178451*W4 - 0.00409195917243104*W5 - 0.01744772201190397*W6)^2 + 0.01694915254237288*abs(0.06651952597416343*W1 - 0.03541481294911939*W2 + 0.018732931926384*W3 + 0.1152631439344755*W4 + 0.05049041486163024*W5 - 0.06304357864392114*W6)^2)^(1/2) - 0.0239 <= 0
0.0021 - 0.009297155142165595*W2 - 0.02916361600811235*W3 - 0.01287926224525597*W4 - 0.006723535156931461*W5 - 0.0138267870327616*W6 - 0.02357251266548311*W1 <= 0
In the first and second of those, you are adding a number of non-negative terms -- terms forced to be non-negative by the various abs() and ^2 . Then at the end you subtract 0.00000074804 from the first (which is your targetVar_cs) and 0.0239 from the second (which is your teCap). The first of those is going to be difficult to satisfy.
The third constraint puts some lower bounds on variables. If you make it the equality, you can solve for W1, and substitute into the first constraint. Once done, you can use repeated solving of the derivatives for 0 to find a set of values that (hopefully) minimizes the first constraint. If my calculations are correct, then about 0.08-ish is the minima -- but I need to cross-check that. If that is correct, then it is not possible to satisfy the constraint -- though possibly you could do better than 0.08-ish. I need to keep testing.
DrLoz
2018 年 10 月 15 日
Walter Roberson
2018 年 10 月 15 日
編集済み: Walter Roberson
2018 年 10 月 15 日
With further testing, I find that within the bounds you have established, it is difficult for c(1) of your nonlinear bounds to be smaller than about 0.06960, but for nonlinear constraints, all of the c values must be <= 0.
At the moment the smallest c(1) in my tests is found at [0.27095896530759056, 0.0879588055366868626, 0.0567802973620968668, 0.0280586544904970411, 0.0012036650345792555, 0.00935621223782138849] where it has a value of 0.0696019946898777109 . This is about 10^5 times larger than the cutoff you are asking for.
Walter Roberson
2018 年 10 月 15 日
If you leave the lower bound at 0 but remove the upper bound, then you can do a bit better. I am not sure yet how much better you can do.
DrLoz
2018 年 10 月 15 日
Walter Roberson
2018 年 10 月 15 日
Not a lot better. The c(1) value still does not get below about 0.0662 (needs to be negative or 0).
I guess negative porfolio ratings are not acceptable? I think you can reach the constraints with negative portfolios ;-)
Walter Roberson
2018 年 10 月 15 日
Ah, when I permit negatives as well, I still can't get c(1) below about 0.06065 in the range I tried (out to -10000). It is looking as if there might simply be no position at all that satisfies c(1) .
DrLoz
2018 年 10 月 15 日
Walter Roberson
2018 年 10 月 15 日
Out to -100000 finds the same thing.
DrLoz
2018 年 10 月 15 日
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 件)
カテゴリ
ヘルプ センター および File Exchange で MATLAB Parallel Server Licensing in the Cloud についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!