Find Optimal Arrangement for Elements

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

Which are the knowns and which are the design variables?
Everything is known, the design variables I think you can say are the weights.
But more their distribution than the actual weights.

Sign in to comment.

Answers (1)

Stephen23
Stephen23 on 5 Jun 2019
Edited: Stephen23 on 5 Jun 2019
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

Thank you,
I will check it out and see if I can make use of it.

Sign in to comment.

Categories

Products

Release

R2017a

Asked:

on 5 Jun 2019

Edited:

on 5 Jun 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!