Shortest Path in Directed Graph

w={160,140,400,30,80,150}

A={{1,1,1,0,0,0},{-1,0,0,1,1,0},{0,-1,0,-1,0,1},{0,0,-1,0,-1,-1}};A//MatrixForm

b={1,0,0,-1}

f0=Dot[w,Array[x,6]]

diff=A.Array[x,6]-b

validpath=Table[diff[[k]]==0,{k,1,4}]

bounds=Table[0≤x[k]≤1,{k,1,6}]

Minimize[{f0,validpath,bounds},Array[x,6]]