Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2010-04-16
年龄: 36
帖子: 1
声望力: 0 ![]() |
![]()
编了一个基于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 ![]() 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'); 此帖于 2010-04-17 08:49 被 windyz2010 编辑。 原因: 精简了提问 |
![]() |
![]() |