PDA

查看完整版本 : [MATLAB基础] 【求助】最小费用最大流程序改错


windyz2010
2010-04-16, 22:37
编了一个基于BellmanFord搜索的最小费用最大流的程序,可总是报错
每次在主程序调用BellmanFord时,总是出现The expression to the left of the equals sign is not a valid target for an assignment.的错误,
奇怪的是BellmanFord函数并没有返回值,我只是用它来更新网络,
不知哪位高手能指教一下,感激不尽~
BellmanFord函数如下:
function y=BellmanFord()
global n
global MaxCost
global cost
global net
global path
nodeCost=zeros(1,n)+MaxCost
nodeCost(1)=0
for i=1:(n-1)
for j=1:n-1
if nodeCost(j)~=MaxCost
for k=1:n-1
if net(j,k)>0&&nodeCost(j)>nodeCost(i)+cost(i,j)
nodeCost(j)=nodeCost(i)+cost(i,j);
path(j)=i;
end
end
end
end
end
if nodeCost(n)=MaxCost
error('no resolution');