How can I vary a vector's element order in an optimization routine?

1 visualización (últimos 30 días)
Gary
Gary el 7 de Nov. de 2014
Comentada: Gary el 8 de Nov. de 2014
I am trying to set up an optimization routine which will take a vector, say, [0, 10, 20, 30, 40], and vary the element order in order to minimize a function. To illustrate, potential options could be [40, 30, 20, 10, 0] or [20, 40, 30, 10, 0]. The vector elements will be provided by myself, and to be clear, I don't want the values to change, I just want to vary the order.
The function I'm trying to minimize is nonlinear.
There may be a simple way to do this, but at the moment I'm having trouble with the implementation. If it helps, I have access to both the standard and global optimization toolboxes.
I really appreciate any ideas that you all may have on the matter.

Respuestas (1)

Torsten
Torsten el 7 de Nov. de 2014
Use "perms" if the vector length is not that big (<=10).
Best wishes
Torsten.
  1 comentario
Gary
Gary el 8 de Nov. de 2014
Thank you for the tip! However, I don't think that actually helps me out here, as running through all the different permutations would defeat the point of the optimization algorithm.
Hypothetically, if my vector length was 5, I could imagine setting the optimization up with upper and lower bounds of [1,5] for each element, and then having it vary that way. I would have a separate function which assigns the element order based on the selection, and I would just need a way of ensuring they don't ever share a position. Perhaps a constraint could enforce this - I'm thinking on that at the moment.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by