Optimization: principles and algorithms, by Michel Bierlaire
runMaxFlowTrans.m
Go to the documentation of this file.
1 %> \file
2 %> Solve the max flow problem as a transhipment problem (Figure 22.6 of \cite Bier15-book)
3 %>
4 %> Calls \ref transhipment
5 %>
6 %> @ingroup Running
7 %> @ingroup chap22
8 %> @author Michel Bierlaire
9 %> @date Sat Apr 11 11:19:43 2015
10 
11 adj = [ 0 1 2 0 0 ;
12  0 0 3 4 0 ;
13  0 0 0 0 5 ;
14  0 0 0 0 6 ;
15  7 0 0 0 0 ] ;
16 
17 % Arc 1 : 1->2
18 % Arc 2 : 1->3
19 % Arc 3 : 2->3
20 % Arc 4 : 2->4
21 % Arc 5 : 3->5
22 % Arc 6 : 4->5
23 % Arc 7 : 5->1
24 cost = [0 ; 0 ; 0 ; 0 ; 0 ; 0 ; -1];
25 lb = [ 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0] ;
26 ub = [ 2 ; 3 ; 3 ; 4 ; 2 ; 1 ; 99 ] ;
27 
28 supply = [ 0 ; 0 ; 0 ; 0 ; 0 ] ;
29 
30 useGlpk = 0 ;
31 [x, copt] = transhipment(adj,cost,lb,ub,supply,useGlpk)
32 
33 useGlpk = 1 ;
34 [x, copt] = transhipment(adj,cost,lb,ub,supply,useGlpk)
35 
function transhipment(in adj, in cost, in lb, in ub, in supply, in useGlpk)
Solve the transhipment problem with bound constraints.
Copyright 2015-2016 Michel Bierlaire