Find Optimal Arrangement for Elements
Show older comments
Hello,
I have a problem curently which I am trying to solve.
I have 30 (arbitrary number, could be more, could be less) different elements, distributed along 30 slots circularly and evenly distributed. Each of the elements has a specific weight. In this sense each element can be characterized by a triplet like (W_i, x_i, y_i) where the position can be any one of the 30 available slots in circular distribution (the z position is irrelevant).
Additionally, exists a deviation in the distribution in the form of a 31st triplet like (W_d, x_d, y_d), the position of the deviation is fixed.
My final objective is to neutralize the deviation, something in the sense of: 
Is there a function or a simple way (which I'm not catching) to setup a routine that will distribute the elements along the positions in order to minimize this function? Any suggestions are welcome, but I understand if this isn't doable this way and I have to setup some more advanced algorithms.
Thank you very much,
2 Comments
Matt J
on 5 Jun 2019
Which are the knowns and which are the design variables?
Lourenço Murteira
on 5 Jun 2019
Answers (1)
I recently solved a very similar problem in my FEX submission maxdistcolor:
In my case the "slots" are the entire color gamut (which can be millions of colors). The user selects N colors they want from this gamut, and the code repeatedly applies a greedy algorithm to find the N colors are maximally distinct from each other. The algorithm stops when the selected colors cannot be moved any further away from each other.
In my code the distance is linearly scaled, but you could easily add weighting to this, as you require.
Take a look at the code, the main greedy algorithm (the while loop and nested for loop) is quite straightforward. I recommend that you try it with the 'disp' option set to 'verbose', which prints information at each iteration, including the current minimum distance.
It is worth noting that this method is not guaranteed to find the global solution, but in practice it works quite well when the gamut/slots are reasonably regularly spaced.
1 Comment
Lourenço Murteira
on 5 Jun 2019
Categories
Find more on Startup and Shutdown 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!