Clear Filters
Clear Filters

Error "array exceeds maximum array size preference"

4 views (last 30 days)
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 Comments
the cyclist
the cyclist on 2 Nov 2019
Can you upload your code, using the paper clip icon?
S AsZ
S AsZ on 3 Nov 2019
Edited: S AsZ on 3 Nov 2019
My code working properly with intlinprog solver but I have this problem with ga solver!

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Nov 2019
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 Comments
Walter Roberson
Walter Roberson on 3 Nov 2019
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!