Can someone help me to optimize this matrix?
이전 댓글 표시
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
Walter Roberson
2017년 11월 27일
I already described a strategy using ga() .
David Mueller
2017년 11월 27일
편집: Walter Roberson
2017년 11월 27일
Walter Roberson
2017년 11월 27일
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
2017년 11월 27일
You can't use an optimization tool to optimize an objective that has randomness inside it.
the cyclist
2017년 11월 27일
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
2017년 11월 27일
Walter Roberson
2017년 11월 27일
The volunteers are often dealing with multiple posted questions simultaneously, and with emailed questions... and laundry, and cooking, and dishes...
David Mueller
2017년 11월 27일
Walter Roberson
2017년 11월 28일
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
2017년 11월 28일
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
2017년 11월 28일
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
2017년 11월 28일
편집: David Mueller
2017년 11월 28일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!