I have 9 nodes and 20 transceivers. How can I have all possible distributions of transceivers between nodes ?
2 views (last 30 days)
Show older comments
Mahmoud Ahmed
on 31 May 2017
Answered: Walter Roberson
on 31 May 2017
I have 9 nodes and 26 transceivers. How can I have all possible distributions of transceivers between nodes ? Hint: The maximum number of transceivers at any node = 3 The minimum number of transceivers at any node = 1
1 Comment
Walter Roberson
on 31 May 2017
See https://www.mathworks.com/matlabcentral/answers/327941-row-column-summation-constraints-in-random-binary-matrix#answer_257192 for the random distribution case
Accepted Answer
Walter Roberson
on 31 May 2017
This is the Integer Partition Problem.
Because you have a minimum of one transceiver at any node, and 9 nodes, create 9 bins with initial value 1, and reduce the total 20 by 9*1 to get 11. You now have the problem of integer partition of 11 elements across 9 bins with a maximum of 2 to be added to any one bin.
There are various ways to program that partitioning. There are some suitable File Exchange Contributions, including https://www.mathworks.com/matlabcentral/fileexchange/12009-partitions-of-an-integer . There are other ways that might perhaps be less efficient but are easy to program, including making use of dec2base()
0 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!