MATLAB linear optimization out of memory

In summary, MATLAB says memory is full and suggests using sparse matrix functions. If the matrix dimensions are not too great, it might be a problem that the system will generate multiple copies of arrays of that size.
  • #1
OhMyMarkov
83
0
Hello everyone!

I'm trying to solve a linear optimization problem with a large-dimension matrix, MATLAB says memory is full. What to do?

Thanks!
 
Physics news on Phys.org
  • #2
OhMyMarkov said:
Hello everyone!

I'm trying to solve a linear optimization problem with a large-dimension matrix, MATLAB says memory is full. What to do?

Thanks!

See if you can use sparse matrix functions?

Check that you are not creating unnecessary copies of matrices and or temporary arrays?

How large is the large-dimension matrix?

CB
 
  • #3
I'm having the Out of memory error whenever I call "fmincon" as follows:x = fmincon("at"ftest, zeros(24583,1), -eye(24583), zeros(24583,1), PHI, S(:,1,1);Now, ftest is the L1 norm, PHI is the product of two matrices, a sampling 300x403 random matrix and a 403x24583 Gabor basis dictionary. Please note that one of the sampling matrix is in "full" representation while the larger matrix is in "sparse" representation. I also tried making PHI explicitly in sparse format to check but this didn't solve the problem?

It seems that the minimizer expands PHI.

Thank you for your time.

OMM
 
  • #4
OhMyMarkov said:
I'm having the Out of memory error whenever I call "fmincon" as follows:x = fmincon("at"ftest, zeros(24583,1), -eye(24583), zeros(24583,1), PHI, S(:,1,1);Now, ftest is the L1 norm, PHI is the product of two matrices, a sampling 300x403 random matrix and a 403x24583 Gabor basis dictionary. Please note that one of the sampling matrix is in "full" representation while the larger matrix is in "sparse" representation. I also tried making PHI explicitly in sparse format to check but this didn't solve the problem?

It seems that the minimizer expands PHI.

Thank you for your time.

OMM

That would not in itself be a problem (it is an ~79 MB structure), it is the fact that the system will generate multiple copies of arrays of that size in doing its work.

I presume the dimensions of S are not too great ...

CB
 
  • #5


Hello,

Thank you for reaching out with your question. It sounds like you are facing the common issue of running out of memory while trying to solve a linear optimization problem in MATLAB.

One possible solution is to try breaking down your problem into smaller sub-problems and solving them separately. You can then combine the solutions to get the final solution. This can help reduce the memory usage and allow you to solve the problem.

Another option is to increase the amount of memory available to MATLAB by adjusting the heap size. You can do this by going to the "Preferences" menu and selecting "General". From there, you can increase the heap size and try solving your problem again.

If these solutions do not work, it may be necessary to optimize your code to reduce the memory usage. This can involve using more efficient data structures or algorithms, or reducing the size of your input data.

I hope these suggestions help you solve your problem. If you continue to face difficulties, I recommend reaching out to the MATLAB community or consulting with a MATLAB expert for further assistance.

Best of luck with your optimization problem!

Sincerely,
 

Related to MATLAB linear optimization out of memory

1. Why am I getting an "out of memory" error when trying to run linear optimization in MATLAB?

The "out of memory" error in MATLAB can occur when the system does not have enough available memory to store the data used in the linear optimization process. This can happen due to large amounts of data being used, inefficient coding, or insufficient system memory.

2. How can I solve the "out of memory" error in MATLAB?

There are several ways to address the "out of memory" error in MATLAB. One option is to optimize the code by reducing unnecessary computations and using more efficient algorithms. Another solution is to increase the available memory on the system by closing other programs or adding more physical memory. You can also try using the "clear" function in MATLAB to free up memory space.

3. Can using a 64-bit version of MATLAB help with the "out of memory" error?

Yes, using a 64-bit version of MATLAB can help with the "out of memory" error as it allows for larger amounts of memory to be allocated compared to the 32-bit version. However, this may not completely solve the issue if the system still has limited memory available.

4. Is there a limit to the size of data that can be used in linear optimization in MATLAB?

Yes, there is a limit to the size of data that can be used in linear optimization in MATLAB. This limit depends on the available memory on the system and the amount of memory being used by other programs. In general, it is recommended to use smaller data sets or optimize the code to reduce memory usage.

5. Can parallel computing in MATLAB help with the "out of memory" error in linear optimization?

Yes, using parallel computing in MATLAB can help with the "out of memory" error as it allows for the distribution of memory-intensive tasks across multiple processors. This can help free up memory space and reduce the chances of getting an "out of memory" error. However, this may not be a viable solution if the system does not have enough available memory to begin with.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
864
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
882
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
365
Back
Top