1 / 6

最大流问题的 LINGO 求解

设有向图共有 个节点,其赋权图的容量矩阵为 . 表示节点 到 的允许的最大容量。. 现求根节点 到节点 的最大流量。. 最大流问题的 LINGO 求解. 其线性规划模型为:. 决策变量:设 表示节点 到节点 的实际流量。. 目标函数为:. 1. 从节点 1 流出的就是流量,故有:. 2. 对终点流入的也是流量,故有:. 3 .中间所有点满足流入与流出相等,约束为:. 4 .每个节点上的流量不超过容量. 总的线性规划模型为:. 示例演示. 例 2 有 6 个点的有向图见图 1 ,求起始点 1 到终点 6 的最大流量。.

rehan
Download Presentation

最大流问题的 LINGO 求解

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 设有向图共有个节点,其赋权图的容量矩阵为 . 表示节点到的允许的最大容量。 现求根节点到节点的最大流量。 最大流问题的LINGO求解 其线性规划模型为: 决策变量:设表示节点到节点的实际流量。 目标函数为:

  2. 1. 从节点1流出的就是流量,故有: 2. 对终点流入的也是流量,故有: 3.中间所有点满足流入与流出相等,约束为: 4.每个节点上的流量不超过容量

  3. 总的线性规划模型为:

  4. 示例演示 例2 有6个点的有向图见图1,求起始点1到终点6的最大流量。 图2 有向图初始网络

  5. 其Lingo实现程序为: !最大流问题; model: sets: point/1..6/; link(point,point):C,f; endsets data: C=0,8,7,0,0,0, 0,0,5,9,0,0, 0,0,0,0,9,0, 0,0,2,0,0,5, 0,0,0,6,0,10, 0,0,0,0,0,0; enddata

  6. max=flow; n=@size(point); flow=@sum(point(j):f(1,j)); !流量为从起始点流出的量; gui=@sum(point(i):f(i,n)); !流入终点的量; gui=flow; !中间各点流入与流出的量相等; @for(point(i)|i#ne#1#and#i#ne#n:@sum(point(j):f(i,j))=@sum(point(k):f(k,i))); @for(link(i,j):f(i,j)<=c(i,j)); end 结果为maxZ=14 F(1,2)=7 F(1,3)=7 F(2,3)=2 F(2,4)=5 F(3,5)=9 F( 4,6)=5 F(5,6)=9 结果见图3 图3 计算结果图

More Related