how to get the optimal combination of a large data matrix??
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a 50*24 matrix .. i used a code which reshuffles the elements of each row randomly. using a while loop, i can generate many combinations, but i need the optimal one, but the problem is, there is a huge number of combinations for a 50*24 matrix, what's the way so that i cam extract the optimal one among all the possible combinations. the code which i used to randomly shuffle the matrix, is given below and i found it from here MATLAB file exchange..
[M,N]=size(B1);
% rowIndex=repmat((1:M)',[1 N]);
% [~,randomizedColIndex]=sort(rand(M,N),2);
% newLinearIndex=sub2ind([M,N],rowIndex,randomizedColIndex);
% B=B1(newLinearIndex);
% Btotal=[Afixed;B]
댓글 수: 0
채택된 답변
Walter Roberson
2017년 2월 21일
If you need the optimal combinations of a large matrix like that, you should not be proceeding randomly. The number of possibilities is huge and you could never be sure you had achieved the optimum if you only ran for a "reasonable" amount of time.
Analyzing the properties of the "optimum" calculation would probably be very useful.
I have thought of a way in which the independent shuffling of the rows of an M x N matrix can be represented through binary mixed integer programming with an input vector of M * N^2 bits and a linear equality constraint matrix of M * N^2 rows (about 800 megabytes of constraints for 50 x 24). That isn't small, but there are algorithms for analyzing it systematically.
댓글 수: 2
Walter Roberson
2017년 2월 22일
If you are permuting a vector of length 25, then the permutation can be expressed as a vector of indices into the original elements, and each index can be expressed in ceil(log2(25)) = 5 bits. This permits any one row to be expressed as 25 entries of 5 bits each
AAAAA BBBBB CCCCC ... YYYYY
Each row would create a group of 25*5 = 625 bits. The rows would be computed independently, but the results would then be put together into a grand vector 25*5*50 bits long. That would express one permutation state as a binary vector, and this would then give you the potential to express the objective function as mixed integer programming, where the integers were each 0 or 1.
Sometimes the special case of 0 or 1 is named with the term "Binary Integer Programming", bint, but bint more typically is used when all of the calculations involve only integers, which is something we as outsiders do not know about your case. The representation would work fine for a vector of floating point values; you would convert each group of 5 bits into an integer and use that to index the table of floating point values.
Now that we have a bit encoding of a state, we have to ask whether we can create a linear constraint matrix that expresses that each element in a group is to be selected only once.
Darn, I thought I had a method yesterday but thinking again it would not work.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!