Can someone help me to optimize this matrix?
2 次查看(过去 30 天)
显示 更早的评论
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-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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surrogate Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!