These Simulink blocks contain transfer functions that model the pressure and flow transients for axisymmetric 2D viscous flow of a compressible fluid in a straight rigid circular cross section pipelines. Three models are available:
(1) pressures at the ends
(2) flow rates at the ends
(3) pressure at one end and flow rate at the other
Filtering is incorporated to reduce numerical oscillation (Gibbs phenomenon). See J. Dyn. Systems, Meas. & Control vol 122 (2000) pp. 153-162.
Floyd-Warshall算法描述
1)適用范圍:
a)APSP(All Pairs Shortest Paths)
b)稠密圖效果最佳
c)邊權(quán)可正可負
2)算法描述:
a)初始化:dis[u,v]=w[u,v]
b)For k:=1 to n
For i:=1 to n
For j:=1 to n
If dis[i,j]>dis[i,k]+dis[k,j] Then
Dis[I,j]:=dis[I,k]+dis[k,j]
c)算法結(jié)束:dis即為所有點對的最短路徑矩陣
3)算法小結(jié):此算法簡單有效,由于三重循環(huán)結(jié)構(gòu)緊湊,對于稠密圖,效率要高于執(zhí)行|V|次Dijkstra算法。時間復雜度O(n^3)。
考慮下列變形:如(I,j)∈E則dis[I,j]初始為1,else初始為0,這樣的Floyd算法最后的最短路徑矩陣即成為一個判斷I,j是否有通路的矩陣。更簡單的,我們可以把dis設成boolean類型,則每次可以用“dis[I,j]:=dis[I,j]or(dis[I,k]and dis[k,j])”來代替算法描述中的藍色部分,可以更直觀地得到I,j的連通情況。
out< "please input the number of the nodes"<<endl
cin>>nodesNum
cout<<"please input the graph"<<endl
for( i = 1 i<=nodesNum i++)
for( j = 1 j <= nodesNum j++)
cin>>graph[i][j] */