Error "array exceeds maximum array size preference"

4 次查看(过去 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 个评论
the cyclist
the cyclist 2019-11-2
Can you upload your code, using the paper clip icon?
S AsZ
S AsZ 2019-11-3
编辑:S AsZ 2019-11-3
My code working properly with intlinprog solver but I have this problem with ga solver!

请先登录,再进行评论。

采纳的回答

Walter Roberson
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
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 CenterFile Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by