Can someone help me to optimize this matrix?
Mostrar comentarios más antiguos
I have the following matrix
wall0 = [0 0 0 0 0 0 0 0 0 0;...
0 0 0 0 0 0 0 0 0 0;...
0 a 0 b 0 a 0 0 0 0;...
0 0 a 0 b 0 a 0 0 0;...
0 0 0 a 0 a 0 0 0 0;...
0 a 0 b 0 a 0 0 0 0;...
0 0 a 0 b 0 a 0 0 0;...
0 0 0 a 0 a 0 0 0 0;...
0 0 b 0 b 0 b 0 0 0;...
0 0 0 0 0 0 0 0 0 0];
Where
a = 0.3;
b = 0.5;
The numbers in the matrix represent probabilities that a 'sound wave' would be absorbed, where 0 is a zero probability.
All this means is that a cell is chosen randomly in my code, and an 'if' statement determines whether or not the 'wave' is absorbed based on another random number between 0 and 1 that is attached to it.
An algorithm that randomizes the rows, as follows:
[rows,cols] = size(wall0) ;
for i=1:rows
idx = randperm(cols) ;
wallR(i,idx) = wall0(i,:);
end
An example of what I mean is:
wave1 hits wall0 (randomly) at [4,3] -> wall0(4,3) = a
if (different) random number for wave1 < a, wave1 is absorbed
number of absorptions += 1
repeat x number of times
The only constraints are that the matrix dimensions are fixed; and the number of a's and b's (and zeros) are fixed and can only move within the rows.
Basically, I would like to optimize this matrix such that the number of absorptions is maximized. I am hoping that someone may be able to help as I am a beginner in regards to optimization.
12 comentarios
Walter Roberson
el 27 de Nov. de 2017
I already described a strategy using ga() .
David Mueller
el 27 de Nov. de 2017
Editada: Walter Roberson
el 27 de Nov. de 2017
Walter Roberson
el 27 de Nov. de 2017
You did not seem to pay attention to my description of how to use ga() for this problem, and you have deleted all the work I put into that.
I'm out.
John D'Errico
el 27 de Nov. de 2017
You can't use an optimization tool to optimize an objective that has randomness inside it.
the cyclist
el 27 de Nov. de 2017
David, why did you delete the original version of this question where Walter and I both tried to help you? You are now wasting at least three volunteer's time, because John is now asking a question that Walter addressed in his comments on the former question.
David Mueller
el 27 de Nov. de 2017
Walter Roberson
el 27 de Nov. de 2017
The volunteers are often dealing with multiple posted questions simultaneously, and with emailed questions... and laundry, and cooking, and dishes...
David Mueller
el 27 de Nov. de 2017
Walter Roberson
el 28 de Nov. de 2017
Today I'm my mother's systems administration, and her computer has just failed to reboot during an OS upgrade... she's 1000 miles away...
ren yanze
el 28 de Nov. de 2017
I want to help you,but not understand clearly. Does wave1 have the same dimension to wall0? Can wave1 taken as the random matrix completely? You want to optimize the wallR to make the maximum number of absorptions when wave1 hits wallR,right?
Walter Roberson
el 28 de Nov. de 2017
The a and b are fixed as to their rows and the number of each in a given row, but may move within the row. The matrix therefore cannot be taken fully randomly.
You could take a random matrix within those constraints, but the problem is doing meaningful optimization against that, short of just trying all of the possibilities.
David Mueller
el 28 de Nov. de 2017
Editada: David Mueller
el 28 de Nov. de 2017
Respuestas (0)
Categorías
Más información sobre Surrogate Optimization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!