1

I have the following problem that I need to address in MATLAB:

I am given an n by n matrix whose sum of elements is always defined to be 1 for all n. I would like to convert my matrix, call it Matrix A, to another Matrix, call it Matrix B, whose elements also sum up to be 1. However, Matrix B will have different elements. The "cost" to move any unit is defined to be the number of horizontal and vertical movements along the matrix * the deposition. For example,

1 0 0            0.2   0    0
0 0 0    to       0    0.3  0
0 0 0            0.5   0    0

My cost is 1.6 because I have moved 0.3 2 units (1 down and 1 right) for a total cost of 0.6 and I moved 0.5 2 units down for a total cost of 1.

I will need to do this for a 19 by 19 matrix with different entries, dispersed. How would I execute this? I understand this is a solution to the minimum cost flow problem, but I'm having difficulty implementing it in MATLAB.

Mike Shawn
  • 11
  • 4
  • Can you show us what you've tried so far? – rayryeng Jun 24 '15 at 16:21
  • So far, I have just initializing my A matrix and B matrix, and looking at different algorithms trying to get a feel for what they do. One of them is the Simplex algorithm. I was thinking of defining my elements as nodes, and then translocation of a unit defined as the differences in i's and j's of {aij} of an element * the difference between the element value of what is doing the depositing and what is in the deposited spot (a cost value). I can think of the routes well and understand MATLAB syntax well, but I have difficulty in implementing syntax. – Mike Shawn Jun 24 '15 at 17:13

0 Answers0