Index Matching 2 Matrices

Hello,
I'm having trouble with an indexing issue. I have 2 matrices. Matrix A has 6 columns, and I'd like my first output to be all of the possible combinations of 6 cells (one each from the 6 columns down any row) that fall under a certain threshold.
Next, I'd like to take this output and match it to Matrix B (same dimensions) to give me an added list of index values for Matrix B.
For example, Matrix A would look something like:
Column 1 Column 2 Column 3 Column 4 Column 5 Column 6
100 150 125 200 300 400
150 200 100 100 200 250
300 320 200 200 200 100
I'd like to obtain all combinations of 6 cells that would e.g. be <1000.
Then, I'd like to index these combinations to Matrix B, and add all of the 6 cells in a single combination to give me a single number.
Please let me know if I need to elaborate further.
Thanks!

5 comentarios

Matt J
Matt J el 11 de Abr. de 2013
In your example, all of the data is <1000. That means the entire matrix A is eligible to participate in combinations? Also, how many rows does A have?
Chris
Chris el 11 de Abr. de 2013
Correct, all of the individual cells would be <1000, but I'd like to call for all combinations of 6 cells that would be <1000; e.g. the combination of [3,1; 2,2; 3,3; 1,4; 1,5; 2,6] would be INELIGIBLE since they add to >1000.
Matrix A would have roughly 30 rows, nothing too extensive. Does this help? Thanks!
Matt J
Matt J el 11 de Abr. de 2013
Editada: Matt J el 11 de Abr. de 2013
Seems like a brute force evaluation of something to me. If none of the combinations fall below the threshold, it would take no less than 4GB to hold the indices and no less than 32GB to hold the A matrix data themselves, assuming A is double floating point.
Maybe you should back up and describe why you need this.
Chris
Chris el 11 de Abr. de 2013
It's for a business development course assignment. Matrix A has 6 columns, with each column describing a separate "feature" of a product. Within each column, the different variations of a single "feature" are listed in the rows, each with a single "cost." Therefore, I'd like to calculate which combinations of "features" (using only 1 cell for each column) will result in a complete product (6 total features) with an expense between a certain range (the <1000 example above).
Matrix B has what we can call "reviews" for each of the features in Matrix A, such that once I obtain a combination of product features from Matrix A that falls within a certain cost, I can then feed that into the "reviews" (matrix B) to give me the combination of features that has the "highest" review traits.
Does this help?
Matt J
Matt J el 11 de Abr. de 2013
So you're not really interested in all combinations, even those with cost <1000. You're only interested in the one particular combination with optimum review.

Iniciar sesión para comentar.

Respuestas (1)

Matt J
Matt J el 11 de Abr. de 2013

0 votos

You might be able to use BINTPROG to solve it where X is an Nx6 matrix of unknown binary variables. You would minimize
dot(-B(:),X(:))
with linear equality constraints
sum(X,1)=1;
and linear inequality constraints on the costs
dot(X(:),A(:))<=1000

Categorías

Preguntada:

el 11 de Abr. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by