If the quadprog problem is infeasible, how i can solve it with a certain tolerance?

조회 수: 15 (최근 30일)
F1=[0.2700; 0.2300; 0.2500; 0.2400; 0.2400; 0.2400; 0.2500; 0.2500; 0.2400; 0.2500; 0.2400; 0.2600; 0.2600; 0.2300; 0.2600;
0.2700; 0.3100; 0.3200; 0.3500; 0.3700; 0.3700; 0.4000; 0.4100; 0.4600; 0.4800; 0.4400; 0.5000; 0.4800; 0.5000; 0.4800;
0.4800; 0.4700; 0.4500; 0.4700; 0.4500; 0.4700];
F2=[1.8900; 1.8600; 0.3700; 0.7400; 0.1400; 1.8000; 0.6100; 1.6900; 0.4000; 0.3000; -0.9700; 0.4800; 1.3900; -1.7800; -2.3000;
-0.8300; 0; -0.1800; 1.8400; 0.1400; -1.4400; -0.0700; -0.1800; 0.8000; 1.9000; 2.1700; 0.6800; 1.3100; 3.9500; 0.6600; -0.2500;
1.1700; 0.9500; 1.4700; 1.4400; 1.4400];
F3=[0.8100; 1.3600; 2.1100; -2.4200; 2.6500; 0.2700; -0.4200; 3.7900; -0.7900; 2.0800; -1; 1.2200; 3.3800; -2.7100; -4.3900; 1.2900;
1.6300; -2.4700; 3.2800; 4.0800; -2.4500; 2.2500; -3.6500; 1.4600; 2.5800; 3.8800; 2.9500; 2.9400; 3.9500; 2.3100; 3.3000; 0.2500;
4.2300; -0.3600; 4.3800; 1.9300];
F4=[2.0700; -1.4100; 3.3800; -3.3800; 4.0700; 0.7700; 0.4400; 4.3600; 2.0900; 1.2800; -3.0300; 3.3500; 2.9300; -1.4500; -4.5100;
0.8600; -0.4200; -3.0900; 2.6900; 4.8700; -1.0200; 0.5200; -3.9500; 1.2500; 0.9200; 4.0700; 2.2600; 1.8100; 2.2700; 4.6800; 5.8600;
2.5700; 2.7200; -2.7300; 4.1200; 1.1800];
F5=[0; 0.8600; 5.1000; 2.1200; 1.5800; -1.3600; 0.4000; 8.8600; -0.2700; 3.7200; -2.1900; 7.6600; 4.7100; -3.6200; -3.0100; 4.9100;
-4.1100; -1.1100; 5.2900; 2.9600; -4.0800; 4.0800; -3.8400; 0.5200; -0.6000; 1.9700; 3.9400; 4.2000; 2.5600; 1.2100; 5.2200; -3.9700;
3.0300; -0.5700; 0.5800; 3.0800];
F6=[-0.2600; 4.5100; 12.3100; 15.8200; 4.1000; -2.7200; 5.7800; 3.1000; -3.4500; 2.2900; -14.3100; 6.9000; 11.3500; 2.3000; -5.3700;
4.7600; 2.5300; 2.9800; -1.9900; 1.6900; -2.4900; 2.3900; -5.6600; 0.9800; -6.1000; -2.8200; 6.9800; 5.0800; -3.8800; -4.4000;
7.2300; -3.8500; 1; -4.8700; 4.9300; 4.8700];
R=[2.197; 2.707; 3.189; 3.191; 1.62; 0.07845; 1.318; 3.396; -0.9583; 0.6649; -1.762; 2.268; 2.688; -1.746; -4.104; -0.8574; 0.1571;
-1.031; 1.917; 0.9404; -0.7029; -1.181; -1.434; 0.08219; 0; 2.197; 1.682; 1.027; 1.878; 1.091; 1.461; 0.2271; 0.9026;
-0.9091; 2.829; 1.644];
numberOfAssetClass=6;
T=length(F1);
Fmatrix=[F1,F2,F3,F4,F5,F6];
F1mean=mean(F1);
F2mean=mean(F2);
F3mean=mean(F3);
F4mean=mean(F4);
F5mean=mean(F5);
F6mean=mean(F6);
FmeanVector=[F1mean; F2mean; F3mean; F4mean; F5mean; F6mean];
Rmean=mean(R);
H=NaN(numberOfAssetClass,numberOfAssetClass);
for i=1:numberOfAssetClass
for j=1:numberOfAssetClass
H(i,j) = 0;
for t=1:T
H(i,j) = H(i,j) + (Fmatrix(t,i)-FmeanVector(i))*(Fmatrix(t,j)-FmeanVector(j));
end
H(i,j) = H(i,j)/T;
end
end
H=H*2;
f=NaN(numberOfAssetClass,1);
for i=1:numberOfAssetClass
f(i) = 0;
for t=1:T
f(i) = f(i) + 2*(-R(t) + Rmean)*(Fmatrix(t,i)-FmeanVector(i));
end
f(i) = f(i)/T;
end
Aeq=Fmatrix;
beq=R;
lb = zeros(6,1);
ub = ones(size(lb));
b=quadprog(H,f,[],[],Aeq,beq,lb,ub);

채택된 답변

Matt J
Matt J 2021년 7월 24일
편집: Matt J 2021년 7월 24일
It never really makes sense to have more equality constraints (here 36) than you do unknowns ( here 6). In order for the problem to be feasible, some of the constraints would have to be redundant.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by