Optimization: principles and algorithms, by Michel Bierlaire
runDivergence.m
Go to the documentation of this file.
1 %> \file
2 %> Calculate the divergence of the example in Figure 21.10 of \cite Bier15-book
3 %>
4 %> @note Calls \ref nodeDivergence
5 %>
6 %> @ingroup Running
7 %> @author Michel Bierlaire
8 %> @date Sun Mar 29 17:31:46 2015
9 %> @ingroup chap21
10 
11 A = [0 1 0 0 0 0 0 0 ;
12  0 0 2 3 0 0 0 0 ;
13  4 0 0 0 5 0 0 0 ;
14  0 6 0 0 7 0 0 0 ;
15  0 0 0 8 0 0 0 0 ;
16  0 0 0 0 0 0 9 0 ;
17  0 0 0 0 0 10 0 0 ;
18  0 0 0 0 0 0 0 0 ] ;
19 
20 
21 flow = [ 2.3 ; # (1,2)
22  -1 ; # (2,3)
23  -2.1 ; # (2,4)
24  4 ; # (3,1)
25  0 ; # (3,5)
26  3 ; # (4,2)
27  -5 ; # (4,5)
28  -5 ; # (5,4)
29  3 ; # (6,7)
30  2.5 # (7,6)
31  ];
32 
33 d = nodeDivergence(A,flow)
34 
35 
function nodeDivergence(in adj, in flow)
Compute the divergence of a flow vector.
Copyright 2015-2016 Michel Bierlaire