LSQLIN For sparse matrices?
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I've run into the problem that I need to solve an optimization problem for very large matrices. The equality constraint matrix is around 75000 by 75000, but only represents around 190 equalities (to this extent, I might be doing things inefficiently). There are no other constraints. The only way I can make such a large matrix is using sparse, but lsqlin's constraints do not cooperate with sparse matrices. Is there some other way I can formulate the problem so I can specify these 190 constraints?
Any and all replies are really appreciated!
~Andy
Afterthought: Reading the error message more carefully, I see it's saying that I could use bound constraints for sparse matrices. Is this accurate? If so, would it make sense to form bound constraints in two directions? Would MATLAB be able to solve this?
0 个评论
回答(3 个)
Harish Guruprasad
2011-5-10
Hi Andy,
If you really have only 190 equality constraints but 75000 variables , it must mean that your equality constraint matrix consists of linearly dependent rows the best way would obviously be to remove the dependent rows and work with the rest. But if you are somehow just given the huge matrix, (and if you know the exact number of independent equality constraints) you can start with an empty matrix and keep on adding rows from the constraint matrix till you reach the required rank.
And no, even if you have just equality constraints for separate variables(not linear combinations of variables), you can't enforce them using the lower and upper bound constraints. But in that case you can easily reduce the problem yourself analytically.
Harish.
0 个评论
Harish Guruprasad
2011-5-11
An 190 by 75000 double matrix takes about 100 MB memory, which Matlab can handle (with some difficulty) on a decent machine.
If not, your best bet would be 'quadprog', you can always rewrite a least squares problem as a quadratic optimization , and I think quadprog accepts sparse equality constraints. But there might be trouble if the matrix H of quadprog(equivalent to C'*C of the lsqlin formulation) is singular.
Also you might save a significant amount of time as your formulation can be solved using the large scale formulation of quadprog, whereas lsqlin would automatically use the medium scale algorithm in the presence of equality constraints.
Harish.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!