I need help for solving quadratic programming, on how to avoid solution(x) of the objective function to be zero ?

x0=10*[1;1;1;1;1;1;1;1;1;1;1;1;1]; lb=-10^8*ones(13,1); ub=100000000*ones(13,1); f=zeros(1,13); Y=eye(13,13); H=Y*2; A1=[-0.048042 -0.049226 -0.233376 -0.205312 -0.036378 -0.060762 -0.0812 -0.138498 -0.14592 -0.061104 -0.02225 -0.006138 -0.12585; 0.048048 0.049296 0.24528 0.202608 0.034882 0.066138 0.09165 0.169776 0.167552 0.06072 0.022826 0.045762 0.0252;-0.022896 -0.288798 0.20091 0.159904 -0.050274 -0.033066 0.008216 0.06513 0.075168 -0.030576 -0.079928 -0.021504 0.361248; 0.014448 0.26 -0.018262 -0.010864 -0.0372 -0.16687 -0.485306 -0.027456 -0.017936 -0.0588 -0.052098 -0.04221 0.030528;0.003842 0.01435 -0.043898 -0.01955 -0.09216 0.172966 0.488186 0.02784 0.01817 -0.00528 -0.091014 -0.058086 -0.005776; 0.004576 0.014378 -0.149152 -0.13632 0.18048 0.02541 -0.01457 -0.123 -0.124352 0.088506 0.22287 0.130088 -0.238502;-0.037506 -0.078336 -0.46295 -0.47376 -0.13867 -0.164328 -0.200046 -0.28741 -0.305592 -0.172666 -0.113046 -0.180072 -0.430122;-0.118144 -0.073944 0.714432 0.68579 0.028942 0.086592 0.186648 0.40369 0.424974 0.09792 -0.039064 0.097384 0.670704; 0.154882 0.138574 -0.488394 -0.374976 0.081168 0.01536 -0.072922 -0.224472 -0.231054 0.02584 0.135424 0.03675 -0.400582;0.00075 0.00917 0.10229 0.00889 0.00681 0.030336 0.03753 0.063 0.05787 0.01953 0.005678 0.013376 0.067158;1.8E-05 0.004446 0.12555 0.1568 0.018944 0.02772 0.069192 0.1344 0.13904 0.040086 -0.001232 0.03952 0.212842;-0.00624 -0.26775 -0.271478 -0.198522 -0.0368 -0.074226 -0.125 -0.2254 -0.22523 -0.073486 -0.01351 -0.068208 -0.318682; -0.03813 -0.226106 0.543368 0.41245 0.02519 0.06693 -0.068442 0.245752 0.249504 0.053728 -0.002808 0.03465 0.440794;-0.029326 0.3176 0.0184 0.015198 -0.581094 -0.197064 0.07241 -0.047104 -0.063714 -0.3498 -0.455328 -0.423168 -0.035754; 0.073728 0.176418 -0.269346 -0.219648 0.59607 0.209814 0.102982 -0.009386 -0.033136 0.361862 0.482976 0.453606 -0.14863;-2E-06 -8E-06 -0.00739 0.002672 -0.000638 -0.004224 -0.0084 -0.02511 -0.00095 -0.015824 -0.003848 0.002562 -0.011178;-0.00024 -0.00064 -0.03213 -0.01352 0.000728 -0.002838 -0.0048 -0.007104 0.008406 0.017264 0.003648 -0.00325 -0.01935;0.000242 0.000646 0.035098 0.012186 -0.000128 0.004598 0.008778 0.01728 0.009834 0.00616 -0.00201 0.002482 0.0256; -1.8E-09 1.99181E-06 0.002820976 -4.67625E-05 0.000199784 0.001267978 0.00071502 0.007641212 0.01315048 -0.002705872 0.000590152 -0.001887964 -0.001825876;-0.000721998 -0.002887992 -0.080142976 -0.040379238 -0.129031784 -0.024387978 -0.03741102 -0.080691212 -0.11655248 -0.093756128 -0.093150152 -0.140192036 -0.234712124;0.000718339 0.002864398 0.087019892 0.043901594 0.1285613 0.026382439 0.043309201 0.094963676 0.13103198 0.095754939 0.090999358 0.142984658 0.261219522;-0.000446339 -0.006938398 -0.015649892 -0.010205594 0.0003987 -0.002668439 -0.005773201 -0.016243676 -0.01745398 -0.002826939 0.003354642 -0.002378658 -0.027169522];
A=-A1; b=zeros(22,1); [x,fval,exitflag,output,lambda]=quadprog(H,f,A,b,[],[],lb,ub,x0) % [x,fval,exitflag,output]=quadprog(H,f,A,b,[],[],[],[],x0)
I have tried varying ub lb and x0, but sometimes it gives me vector of zero as solution, which i dont wish, kindly tell me as to how to avoid this, by making any changes in objective function or something? Thank you, your reply will be appreciated.

回答(1 个)

Use b=-ones(22,1),e.g.
Best wishes
Torsten.

2 个评论

hey Torsten, thank you for the reply!! Actually, the inequality equation is Ax<=b , and in my constraints, b =0.
If all the settings from above are fixed, then x=0 is the solution for your optimization problem.
So if you wish or not - quadprog will always return the zero solution.
Best wishes
Torsten.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Surrogate Optimization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by