I want to iteratively sum the minimum value across different rows.
I have a matrix:
I would like to find the minimum value of this matrix by starting at row 1 (selected value not 0). Then iteratively, selecting the column that provides minimum value in row 1. Next, choose next row number which is the same number as the previously selected column and so on. Finally, sum the total numbers.
For example, start at row 1 and select column 4 because it provides the minimum value as 13.924. Then, moving to row 4 and finding the min value again which could be column 3 as 46.789. Then, moving to row 3 and finding the min value in this row which is in column 2 as 71.950. Then, from row 2, column 5 is selected.
For this example:
mat_test[1,4] + mat_test[4,3] + mat_test[3,2] + mat_test[2,1]
13.924 + 46.789 + 71.950 + 25.579
total sum = 158.242
