I have some numbers in an array and i want to model a LP problem that generates the absolute sequence of the numbers (according to their growing order). For example
input [4,2,1,5] ---> output [3,2,1,4]
That is,if i sort [4,2,1,5], 4 has the third position, 2 is at the second position, and so on.
Can you help me ?
Why is this such a big deal? It's just a few lines of code in any language. Here is a Python version that uses inefficient bubble sort, but it can be modified to use any other sorting algorithm: