Thanks for everyone's reply. I will explain here. Suppose there is a given matrix
x y B = [5,-4,5,-6]
[[0,0,0,0], [[0,1,0,1],
[0,0,0,0], [0,0,0,0],
[0,0,0,0], [0,0,0,1],
[0,0,0,0]] [0,0,0,0]]
for example a feasible solution is [[0,4,0,1],[0,0,0,0],[0,0,0,5],[0,0,0,0]] 4+1-0 == 5 0-4 == -4 5-0 == 5 0 - 5-1 == -6
I want to update x to make sure:
(1) if y[i][j] == 0:
x[i][j] = 0
(2) x[0][0]+x[0][1]+x[0][2]+x[0][3]-x[0][0]-x[1][0]-x[2][0]-x[3][0] = B[0]
x[1][0]+x[1][1]+x[1][2]+x[1][3]-x[0][1]-x[1][1]-x[2][1]-x[3][1] = B[1]
...
How to program to find the feasible x?
See Question&Answers more detail:os