Error "array exceeds maximum array size preference"
5 次查看(过去 30 天)
显示 更早的评论
Hi I have a mixed integer linear programming model and I attemp to solve it by ga function but it show me this error:
Error using ==
Requested 3381035460x1 (25.2GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
How can I resolve this error?
2 个评论
采纳的回答
Walter Roberson
2019-11-3
The code in eqnsolv() converts LB and UB constraints into linear constraints by adding entries to the A, b matrices. It does needs one row per variable, for LB essentially constructs
N = 141660;
zeros(1,0) -1 zeros(1,N-1)
zeros(1,1) -1 zeros(1,N-2)
zeros(1,2) -1 zeros(1,N-3)
and so on, except that it uses -eye(N) to build it. This can be a huge matrix. Only once it is constructed does it filter out non-finite bounds.
And if it were to succeed at that, it would construct the same kind of matrix except with +1 instead of -1 for representing upper bound.
You might possibly be able to get further by using the problem based optimization system to construct a system with no upper bounds or lower bounds, and break that into pieces and call ga() on the pieces imposing appropriate LB and UB constraints. Maybe. But you are working with a lot of variables!
With that many variables, I would not expect any meaningful progress in a reasonable amount of time.
3 个评论
Walter Roberson
2019-11-3
but why do I get the answer in about a minute when I solve this model with the same variables with problem-based optimization system and intlinprog solver while the ga function show me this error?
The answer is "Because that is the way that Mathworks programmed handling of bounds."
32768 variables is the point at which MATLAB would need 8 gigabytes to store the converted lower bounds; the converted upper bounds would take the same.
temp = which('-all', 'eqnsolv');
edit(temp{1})
Now look at roughly line 36 at the section "% Handle bounds as linear constraint"
You can open a technical support case with Mathworks pointing out that this code is a problem for large number of variables.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!