MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 【求助】最小费用最大流程序改错 (https://www.labfans.com/bbs/showthread.php?t=11342)

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');


所有时间均为北京时间。现在的时间是 11:32

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.