Ill-posed quadratic programing with linear inequality constraint
Show older comments
I have the problem
min |Q*x-d| subject to A*x <= b and x>0
The matrix Q has very large condition number. How can I solve this using Matlab? I looked at Hansen's regularization tool package but it does not appear to handle the linear inequality and nonnegativity. Thanks very much for help
Answers (1)
An old question, so my answer is completely irrelevant to Benjamin. Sorry about being late on this. But the solution is not that difficult. First, don't use quadprog or quadratic programming for this. The simple solution uses lsqlin anyway.
A = rand(2,10);
b = rand(2,1);
Q = randn(30,9)*randn(9,10);
d = randn(30,1);
lb = zeros(10,1);
So Q is clearly rank deficient. It has rank exactly 9 by construction, and the condition number of Q is effectively a numerical inf in terms of double precision.
rank(Q)
cond(Q)
lsqlin(Q,d,A,b,[],[],lb)
Yes, we could solve it using quadprog with a regularization. Entirely doable. But why bother? lsqlin is able to solve it.
3 Comments
Walter Roberson
on 6 Oct 2020
It has rank exactly 9 by construction
Pedantically speaking, it could have lower rank... it just isn't likely!!
For example, a pseudo-random normal distribution that cannot produce 9 zeros in a row is statistically different than a true random number generator. A true random-normal distribution should produce exactly 0 with probability about 0.24 so it should produce 9 zeros in a row about 3 in a million times.
In practice, randn() does not appear to produce exact zeros -- not even 1 in 1e10 tries.
John D'Errico
on 7 Oct 2020
true, in that it could be lower rank. A highly improbable event though.
John D'Errico
on 7 Oct 2020
BTW, one of my first posts using "run". works nice.
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!