Simulation and Optimal Routing of Data Flows Using a Fluid Dynamic Approach

There are various approaches to telecommunication and data networks (see for example Alderson et al. (2007), Baccelli et al. (2006), Baccelli et al. (2001), Kelly et al. (1998), Tanenbaum (1999), Willinger et al. (1998)). A first model for data networks, similar to that used for car traffic, has been proposed in D’Apice et al. (2006), where two algorithms for dynamics at nodes were considered and existence of solutions to Cauchy Problems was proved. Then in D’Apice et al. (2008), following the approach of Garavello et al. (2005) for road networks (see also Coclite et al. (2005); Daganzo (1997); Garavello et al. (2006); Holden et al. (1995); Lighthill et al. (1955); Newell (1980); Richards (1956)), sources and destinations have been introduced, thus taking care of the packets paths inside the network.

In this Chapter we deal with the fluid-dynamic model for data networks together with optimization problems, reporting some results obtained in Cascone et al. (2010); D' Apice et al. (2006;2008;. A telecommunication network consists in a finite collection of transmission lines, modelled by closed intervals of R connected by nodes (routers, hubs, switches, etc.). Taking the Internet network as model, we assume that: 1) Each packet seen as a particle travels on the network with a fixed speed and with assigned final destination; 2) Nodes receive, process and then forward packets which may be lost with a probability increasing with the number of packets to be processed. Each lost packet is sent again.
Since each lost packet is sent again until it reaches next node, looking at macroscopic level, it is assumed that the packets number is conserved. This leads to a conservation law for the packets density ρ on each line: The flux f (ρ) is given by v(ρ) · ρ where v is the average speed of packets among nodes, derived considering the amount of packets that may be lost.

Telecommunications Networks
The key point of the model is the loss probability, used to define the flux function. Indeed the choice of a non reasonable loss probability function could invalidate the model. To achieve the goal of the validation of the model assumptions, the loss probability function has been compared with the behaviour of the packet loss derived from known models used in literature to infer network performance and the shape of the velocity and flux functions has been discussed. All the comparisons confirm the validity of the assumptions underlying the fluid-dynamic model (see D'Apice et al. (2010)).
To describe the evolution of networks in which many lines intersect, Riemann Problems (RPs) at junctions were solved in D' Apice et al. (2006) proposing two different routing algorithms: (RA1) Packets from incoming lines are sent to outgoing ones according to their final destination (without taking into account possible high loads of outgoing lines); (RA2) Packets are sent to outgoing lines in order to maximize the flux through the node.
One of the drawback of (RA2) is that it does not take into account the global path of packets, therefore leading to possible cycling to bypass congested nodes. These cyclings are avoided if we consider that the packets originated from a source and with an assigned destination have paths inside the network.
Taking this in mind the model was refined in D' Apice et al. (2008). On each transmission line av e c t o rπ describing the traffic types, i.e. the percentages of packets going from a source to a destination, has been introduced. Assuming that packets velocity is independent from the source and the destination, the evolution of π follows a semilinear equation hence inside transmission lines the evolution of π is influenced by the average speed of packets.
Different distribution traffic functions describing different routing strategies have been analysed: • at a junction the traffic started at source s and with d as final destination, coming from the transmission line i,isroutedonanassignedlinej; • at a junction the traffic started at source s and with d as final destination, coming from the transmission line i, is routed on every outgoing lines or on some of them.
In particular two ways according to which the traffic at a junction is splitted towards the outgoing lines have been defined. Starting from the distribution traffic function, and using the vector π, the traffic distribution matrix, which describes the percentage of packets from an incoming line that are addressed to an outgoing one, has been assigned. Then, methods to solve RPs according to the routing algorithms (RA1) and (RA2) have been proposed. Optimizations results have been obtained for the model consisting of the conservation law (1). In particular priority parameters and traffic distribution coefficients have been considered as controls and two functionals to measure the efficiency of the network have been defined in Cascone et al. (2010): 1) The velocity of packets travelling through the network.
2) The travel time taken by packets from source to destination.
Due to the nonlinear relation among cost functionals, the optimization of velocity and travel time can give different control parameters.
The analytical treatment of a complex network is very hard due to the high nonlinearity of the dynamics and discontinuities of the I/O maps. For these reasons, a decentralized strategy has been adapted as follows: Step 1. The optimal controls for asymptotic costs in the case of a single node with constant initial data is computed.
Step 2. For a complex network, the (locally) optimal parameters at every node are used. Thus, the optimal control is determined at each node independently.
The optimization problem for nodes of 2 × 2 type, i.e. with two entering and two exiting lines, and traffic distribution coefficient α and priority parameter p as control parameters, constant initial data and asymptotic functionals has been completely solved.
Then a test telecommunication network, consisting of 24 nodes, each one of 2 × 2t y p eh a s been studied. Three different choices have been tested for the traffic distribution coefficients and priority parameters: (locally) optimal, static random and dynamic random. The first choice is given by Step 1. By static random parameters, we mean a random choice done at the beginning of the simulation and then kept constant. Finally, dynamic random coefficients are chosen randomly at every instant of time for every node. The results present some interesting features: the performances of the optimal coefficients are definitely superior with respect to the other two. Then, how the dynamic random choice, which sometimes is equal in performance to the optimal ones, may be not feasible for modelling and robustness reasons has been discussed.
The Chapter is organized as follows. Section 2 reports the model for data networks. Then, in Section 3, we consider possible choices of the traffic distribution functions, and how to compute the traffic distribution matrix from the latter functions and the traffic-type function. We describe two routing algorithms, giving explicit unique solutions to RPs. In Section 4, we discuss the validity of the assumption on the loss probability function, the velocity and flux. The subsequent Section 5 is devoted to the analysis of the optimal control problem introducing the cost functionals. Simulations for three different choices of parameters (optimal, static and dynamic random) in the case of a complex network are presented. The paper ends with conclusions in Section 6.

Basic definitions
A telecommunication network is a finite collection of transmission lines connected together by nodes, some of which are sources and destinations. Formally we introduce the following definition: and only if j is not outgoing for any node. We assume that S = ∅; Destinations D is the subset of {1, ..., N} representing lines leading to traffic destinations, Thus, j ∈Dif and only if j is not incoming for any node. We assume that D = ∅; Traffic distribution functions R is a finite collection of functions (also multivalued) r J :I n c(J) × S×D→Out(J). For every J, r J (i, s, d) indicates the outgoing direction of traffic that started at source s has d as final destination and reached J from the incoming road i.

Dynamics on lines
Following D' Apice et al. (2008), we recall the model used to define the dynamics of packet densities along lines. We make the following hypothesis: (H1) Lines are composed of consecutive processors N k , which receive and send packets. The packets number at N k is indicated by R k ∈ [0, R max ]; (H2) There are two time-scales: Δt 0 , the physical travel time of a single packet from node to node (assumed to be independent of the node for simplicity); T, the processing time, during which each processor tries to operate the transmission of a given packet; (H3) Each processor N k tries to send all packets R k at the same time. Packets are lost according to a loss probability function p : [0, R max ] → [0, 1],computedatR k+1 ,andlostpacketsare sent again for a time slot of length T; (H4) The number of packets not transmitted for a whole processing time slot is negligible.
Since the packet transmission velocity on the line is assumed constant, it is possible to compute an average velocity function and thus an average flux function.
Let us focus on two consecutive nodes N k and N k+1 , assume a static situation, i.e. R k and R k+1 are constant. Indicate by δ the distance between the nodes, Δt av the packets average transmission time,v = δ Δt 0 the packet velocity without losses and v = δ Δt av the average packets velocity. Then, we can compute: indicates the floor function) represents the number of attempts of sending a packet and T is the length of a processing time slot. The hypothesis (H4) corresponds to assume Δt 0 << T or, equivalently, M ∼ +∞. Making the identification, M =+∞,weget: Let us call now ρ the averaged density and ρ max its maximum. We can interpret the probability loss function p as a function of ρ and, using (3), determine the corresponding flux function, given by the averaged density times the average velocity. A possible choice of p is the following: and Loss probability, average velocity and flux behaviours for ρ max = 1, σ = 1 2 ,v = 1. To simplify the treatment of the corresponding conservation laws, we will assume the following: exists a unique maximum point σ ∈]0, 1[. Notice that the "tent" function and the parabolic flux satisfy the assumption (F).

Dynamics on the network
On each transmission line I i we consider the evolution equation where we use the assumption (F). Therefore, the network load evolution is described by a finite set of functions Moreover, inside each line I i we define a traffic-type function π i , which measures the portion of the whole density coming from each source and travelling towards each destination:

Definition 2. A traffic-type function on a line I i is a function
In other words, π i (t, x, s, d) specifies the density fraction ρ i (t, x) that started from source s and is moving towards the final destination d.
Assuming, on the discrete model, that a FIFO policy is used at nodes, it is natural that the averaged velocity, obtained in the limit procedure, is independent from the original sources of packets and their final destinations. In other words, we make the following hypothesis: (H5) On each line I i , the average velocity of packets depends only on the value of the density ρ i and not on the values of the traffic-type function π i .
As a consequence of hypothesis (H5), we deduce the semilinear equation This equation is coupled with equation (9) on each line I i . More precisely, equation (10) depends on the solution of (9), while in turn at junctions the values of π i will determine the traffic distribution on outgoing lines as explained below.
For simplicity and without loss of generality, we assume from now on that the fluxes f i are all the same and we indicate them with f . Thus, the model for a single transmission line, consists in the system of equations: To treat the evolution at junctions, let us introduce some notations. Fix a junction J with n incoming transmission lines, say I 1 , ..., I n ,andm outgoing transmission lines, say I n+1 , ..., I n+m (junction of n × m type). The basic ingredient for the solution of Cauchy Problems by Wave Front Tracking method is the solution of Riemann Problems (RPs) (see Bressan (2000), Dafermos (1999), Serre (1999)).
Define the maximum flux that can be obtained by a single wave solution on each transmission line as follows: and Finally denote with is the solution of the RP at the junction. Now, we discuss some possible choices for the traffic distribution function: If r J is of type 1), then each packet has a deterministic route, it means that, at the junction J, the traffic that started at source s and has d as final destination, coming from the transmission line I i , is routed on an assigned line I j (r J (i, s, d)=j).
Instead if r J is of type 2), at the junction J, the traffic with source s and destination d coming from a line I i is routed on every line I j ∈ Out(J) or on some lines I j ∈ Out(J).W ec a nd e fi n e r J (i, s, d) in two different ways: In case 2a) we have to specify in which way the traffic at junction J is splitted towards the outgoing lines.
The definition 2b) means that, at the junction J, the traffic with source s and destination d coming from line I i is routed on the outgoing line I j , j = n + 1, ..., n + m with probability Let us analyze how the distribution matrix A is constructed using π and r J .

Definition 4. A distribution matrix is a matrix
for each i = 1, ..., nandj= n + 1, ..., n + m, where α j,i is the percentage of packets arriving from the i-th incoming transmission line that take the j-th outgoing transmission line.
In case 1) we can define the matrix A in the following way. Fix a time t and assume that for all i ∈ Inc(J), s ∈Sand d ∈D, π i (t, ·, s, d) admits a limit at the junction J, i.e left limit at b i .F o r i ∈{1, ..., n}, j ∈{n + 1, ..., n + m},weset .
The fluxes f i (ρ i ) to be consistent with the traffic-type functions must satisfy the following relation: Let us analyze how to define the matrix A in the case 2a). We may assign ϕ(i, s, d) ∈ r J (i, s, d) and set However, it is more natural to assign a flexible strategy defining a set of admissible matrices A in the following way Finally, we treat now the case 2b). In this case the matrix A is unique and is defined by We describe two different RSs at a junction that represent two different routing algorithms: (RA1) We assume that (A) the traffic from incoming transmission lines is distributed on outgoing transmission lines according to fixed coefficients; (B) respecting (A) the router chooses to send packets in order to maximize fluxes (i.e., the number of packets which are processed). (RA2) We assume that the number of packets through the junction is maximized both over incoming and outgoing lines.
In case 2a) first we observe that the set A is convex. The admissible region given by is convex at least for the case of junctions of 2 × 2.
If the region Ω adm is convex than rules (A) and (B) amount to the Linear Programming problem: max This problem has clearly a solution, which may not be unique.
Let us consider the case 2b). We need some more notations.
In order to maximize the number of packets through the junction over incoming and outgoing lines we define Thus we want to have Γ as flux through the junction.
One easily see that to solve the RP, it is enough to determine the fluxesγ i = f (ρ i ), i = 1, 2. In fact, to have simple waves with the appropriate velocities, i.e. negative on incoming lines and positive on outgoing ones, we get the constraints (14), (15). Observe that we computê γ i = f (ρ i ), i = 1, 2 without taking into account the type of traffic distribution function.
We have to distinguish two cases: Let us analyze the second case in which we use the priority parameter q. Not all packets can enter the junction, so let C be the amount of packets that can go through: qC packets come from first incoming line and (1 − q)C packets from the second. In the space (γ 1 , γ 2 ),d e fi n e the following lines: and P the point of intersection of r q and r Γ . Recall that the final fluxes should belong to the region: We distinguish two cases: a) P belongs to Ω in ,  Fig. 2. P belongs to Ω in and P is outside I nt h efi r s tc a s ew es e t(γ 1 ,γ 2 ) = P, while in the second case we set (γ 1 ,γ 2 ) = Q,w i t h Q = proj Ω in ∩r Γ (P) where proj is the usual projection on a convex set, see Figure 2.
As for the algorithm (RA1)π s,d i = π s,d i,0 , i = 1, 2. Let us now determineγ j , j = 3, 4. We have to distinguish again two cases : In the first caseγ j = γ max j , j = 3, 4. Let us determineγ j in the second case, using the traffic distribution parameter α. Since not all packets can go on the outgoing transmission lines, we let C be the amount that goes through. Then αC packets go on the outgoing line I 3 and (1 − α)C on the outgoing line I 4 . Consider the space (γ 3 , γ 4 ) and define the following lines: We have to distinguish case 2a) and 2b) for the traffic distribution function.

Case 2a)
Let us introduce the connected set and G 1 and G 2 its endpoints. Since in case 2a) we have an infinite number of matrices A,each of one determines a line r α , we choose the most "natural" line r α , i.e. the one nearest to the statistic line determined by measurements on the network.
Otherwise, if r Γ has a priority over G we set (γ 3 ,γ 4 ) = min γ∈Ω out F (γ, r α , G) where F is a convex functional which depends on γ, r α and on the set G of the routing standards.
The vectorπ s,d i , j = 3, 4 are computed in the same way as for the algorithm (RA1).

Case 2b)
In case 2b) we have a unique matrix A. The fluxes on outgoing lines are computed as in the case without sources and destinations.
We distinguish two cases: a) P belongs to Ω, b) P is outside Ω.
In the first case we set (γ 3 ,γ 4 ) = P, while in the second case we set (γ 3 ,γ 4 ) = Q,w h e r e Q = proj Ω adm (P). Again, we can extend to the case of m outgoing lines.
Once solutions to RPs are given, one can use a Wave Front Tracking algorithm to construct a sequence of approximate solutions.

Model assumptions
The aim of this section is to verify that the assumptions underlying the data networks fluid-dynamic model (shortly FD model) are correct. Here we focus on the fixed-point models to describe TCP, and considering various set-ups with TCP traffic in a single bottleneck topology, we investigate queueing models for estimating packet loss rate. In what follows we suppose ρ max = 1andσ = 1 2 .

Loss probability function
It is reasonable to assume that the loss probability function p is null for some interval, which is a right neighborhood of zero. This means that at low densities no packet is lost. Then p should be increasing, reaching the value 1 at the maximal density, the situation of complete stuck. With the above assumptions the loss probability function in (4) can be written as: We analyze some models used in literature to evaluate the packets loss rate with the aim to compare its behaviour with the function depicted in Figure 1.

The proportional-excess model
Let us consider the transmission of two consecutive routers. The node that transmits packets is called sender, while the receiving one is said receiver. Among the nodes, there is a link or channel, with limited capacity. Assume that the sender and the receiver are synchronized each other, i.e. the receiver is able to process in real time all packets, sent by the sender. In few words, no packets are lost. The packets loss can occur only on the link, due to its finite capacity. Under the zero buffer hypotheses the loss rate is defined as the proportional excess of offered traffic over the available capacity. If R is the sender bit rate and C is the link capacity, we have a loss if R > C.T h em o d e li ss a i dproportional-excess or briefly P/E and suppose deterministic arrivals. The packets bit rate is: In Figure 3, loss probability for P/E model (continuous curve) and FD model (dashed curve) are shown, assuming C = σ = 1/2. For values C < ρ < 2C, the FD model overestimates the loss probability. Observe that the P/E model is not realistic. In fact, the sender and the receiver are never synchronized each other and whatever transmission protocol is used by the transport layer, the receiver has a finite length buffer, where the packets wait to be processed and eventually sent to the next node. Thus queueing models are needed, to infer about network performance.

Models with finite capacity
Queueing models are good at predicting loss in a network with many independent users, probably using different applications. Consider the traffic from TCP sources that send packets through a bottleneck link. The traffic is aggregated and used as an arrival process for the link. The arrival process, being the aggregation of independent sources, is approximated as a Poisson process, and the aggregated throughput is used as the rate of the Poisson process (see Wierman et al. (2003)). These considerations justify the assumption that the times between the packets arrivals are exponentially distributed. Depending on the hypothesis on the length of 433 Simulation and Optimal Routing of Data Flows Using a Fluid Dynamic Approach www.intechopen.com packets arriving to the queue the data transmission can be modelled with different queueing models, as M/D/1/B and M/M/1/B, characterized by deterministic and exponentially distributed lengths, respectively, and a buffer with capacity B − 1. From the queue length distribution, known in closed formulas or iteratively in the finite buffer case, expected time in queue and in the system, as well as packet loss rate can be derived. In what follows we denote the arrival intensity by λ, the service intensity by μ and define the load as ρ = λ/μ.

Fixed packets dimension
In a scenario where all senders use the same data packets size, the queueing model M/D/1/B is the most natural choice. The probability that the buffer is full gives the loss rate: where   (16) and (18), assuming B = 10. However, an M/D/1/B queue predicts a lower loss rate and higher throughput than is seen in the true network. This is due to fact that in real routers packet sizes are not always fixed to the maximum segment size, therefore packet sizes are more variable than a deterministic distribution.

Exponentially distributed packets size
Assume the packet size is exponentially distributed. This assumption is true if we consider the total amount of traffic as the superposition of traffic fluxes, coming from different TCP sources, each configured to use its own packet size. The M/M/1/B queue is a good approximation of the simulated bottleneck link shared among TCP sources under any traffic load (Wierman et al. (2003)). The loss rate for the M/M/1/B queueing model is: In Figure 5,  In fact, the loss probability of the FD model represents for σ = 1(uptoascalefactorequalto 2) a limit case of (19): The loss probability for the queueing model (dashed line) and the P/E one (continuous line) is shown in Figure 5, right. The two curves almost match for small bit rate values, i.e. in the load range 0.9σ < ρ < 1.1σ. For greater loads values, the P/E model overestimates the loss probability.
Theoretical and simulative studies pointed out that M/D/1/B and M/M/1/B queueing models give good prediction of the loss rate in network with many independent users performing short file transfers (shorts FTP). In literature other queueing models have been considered to describe different scenarios, as bach arrivals. For a comparison among different models see Figure 6, where the packet loss rate for M/D/1/B, M/M/1/B, M 2 /M/1/B, M 5 /M/1/B and the P/E models are reported for the case B = 100 and loads in the interval 0.8 < ρ < 1.1. Observe that M r /M/1/B denotes a queue with Poisson batch arrivals of size r and describes the fact that TCP traffic is likely to be quite bursty due to synchronized loss events that are experienced by multiple users. Significant difference are restricted to the range 0.9σ < ρ < 1.1σ. As the load increases above 1.1 the loss estimates become very close in the different queueing models. Any of these models  (2003) that M/D/1/B queues estimations of the loss rate can be used for transient sources. However, for sources with a slightly longer on and off periods, M/M/1/B queues best predict the loss rate, and for (homogeneous) persistent sources, M r /M/1/B queues give better performance inferences, due to the traffic burstiness stemming from the TCP slow-start and source synchronization effect. Even if some models are more appropriate in situations of low load, others when the load is heavy, Figure 6 shows that the assumption on the loss probability function of the FD model is valid.

Velocity
The loss probability, influencing the average transmission time, has effects on the average velocity of packets: v(ρ)=v (1 − p(ρ)) .

The behaviour of the average velocity in the FD model
is depicted in Figure 1. Notice that the velocity is constant if the system is free (no losses). Over the threshold, losses occur, and the average travelling time increasing reduces the velocity. The average packet velocity for the P/E model and the M/M/1/B model is plotted in Figure  7. Such two curves fit the curve of the FD model, confirming the goodness of its assumptions.

Flux
Once the velocity function is known, the flux is given by: In case of the FD model

Optimal control problems for telecommunication networks
Now we state optimal control problems on the network. We have a network (I, J ), with nodes of at most 2 × 2 type, and an initial data ρ 0 = (ρ i,0 ) i=1,...,N . The evolution is determined by equation (9) on each line I i and by Riemann Solvers RS J , depending on priority and traffic distribution parameters, q and α, respectively. For the definition of RS J see the case when the traffic distribution function is of type 2b).
We now consider α and q as controls. To measure the efficiency of the network, it is natural to consider two quantities: 1) The average velocity at which packets travel through the network.
2) The average time taken by packets from source to destination.
Clearly, to optimize 1) and 2) is the same if we refer to a single packet, but the averaged values may be very different (since there is a nonlinear relation among the two quantities). As the model consider macroscopic quantities, we can estimate the averages integrating over time and space the average velocity and the reciprocal of average velocity, respectively. We thus define the following: and, to obtain finite values, we assume that the optimization horizon is given by [0, T] for some T > 0. Notice that this corresponds to the following operation: -average in time and then w.r.t packets, to compute the probability loss function; -average in space, to pass to the limit and get model (9); -integrate in space and time to get the final value.
The value of such functionals depends on the order in which averages and integrations are taken.
Summarizing, we get the following optimal control problems: Dynamics. Equation (9) on each line I ∈Iand Riemann Solver RS J for each J ∈J , depending on controls α and q.
Control Variables. Traffic distribution parameter t → α J (t) and priority parameter t → q J (t), i.e. two controls for every node J ∈J.
Cost functions. Integrated functionals: Definition 7. We call (P i ) the optimal control problem referred to the functional J i : J 1 , subject to (9).
The direct solution of problems (P i ) corresponds to a centralized approach. We propose the alternative approach of decentralized algorithm more precisely: Step 1 For every node J and Riemann Solver RS J , solve the simplified optimal control problem: max (or min) J i (T), for T sufficiently big, on the network formed only by J with constant initial data, taking approximate solutions when there is lack of existence.
Step 2 Apply the obtained optimal control at every time t in the optimization horizon and at every node J, taking the value at J on each line as initial data.
Notice that, for T sufficiently big, we can assume that the datum is constant on each line: this strongly simplifies the approach.
We consider a single node J with incoming lines, labelled by 1 and 2, and with outgoing lines, labelled by 3 and 4. Since ρ = γ,0 ≤ ρ ≤ 1 2 ,a n d ρ = 1 − γ, 1 2 ≤ ρ ≤ 1, we have that v ρ ϕ = H −s ϕ + with: Then, for T sufficiently big, with We want to maximize the cost J 1 (T) and to minimize the cost J 2 (T) with respect to the parameters α and q. In Marigo (2006) and Cascone et al. (2007), you can find a similar approach for telecommunication networks and road networks, respectively, modelled with flux function (8). Let Theorem 8. Consider a junction J of 2 × 2 type. If Γ = Γ in = Γ out and T is sufficiently big, the cost functionals J 1 (T) and J 2 (T) depend neither on α nor q. If Γ = Γ in , the cost functionals J 1 (T) and J 2 (T) depend only on α. The optimal values for J 1 (T) are the following: the optimal values for J 2 (T) are the following: 1+β − ,1 . If Γ = Γ out , the cost functionals J 1 (T) and J 2 (T) depend only on q. The optimal values for J 1 (T) and J 2 (T) are the same for α when Γ = Γ in , if we substitute α with q, β − with p − ,andβ + with p + .
As for case B, instead, we consider the same initial conditions of case A, but boundary data equal to 0.75. Table 2 contains initial and boundary conditions for case C. An initial condition of 0.75 is assumed for the inner lines of the network, that are not present in Table 2.
As in Bretti et al. (2006), we consider approximations obtained by the numerical method of Godunov (Godunov (1959)), with space step Δx = 0.0125 and time step determined by the CFL condition (Godlewsky et al. (1996)). The telecommunication network is simulated in a time interval [0, T],w h e r eT = 50 min. We study four simulation cases, choosing the flux function (7) or the flux function (8):   Table 2. Initial conditions and boundary data for the lines of the network for case C.
1. at each node parameters, that optimize the cost functionals J 1 and J 2 (optimal case); 2. random α and q parameters (static random case) chosen in a random way at the beginning of the simulation process (for each simulation case, 100 static random simulations are made); 3. dynamic random parameters (dynamic random case) which change randomly at every step of the simulation process.
In the following pictures, we show the values of the functionals J 1 and J 2 ,c o m p u t e do n the whole network, as function of time. A legend for every picture indicates the different simulation cases.
The algorithm of optimization, which is of local type, can be applied to complex networks, without compromising the possibility of a global optimization. This situation is evident if we  Fig. 11. J 2 for flux function (8), case B, and zoom around the optimal and dynamic random case (right).  (7), case C.
consider the behaviour of J 1 for case A and J 2 for case B. For cases A and B, the cost functionals simulated with flux function (7) are constant, which is not surprising since the initial data on the lines is less than 1 2 . In case C, we present the behaviour of the cost functionals J 1 and J 2 for flux function (7). Boundary data are of Dirichlet type (unlike case A and B where we have considered Neumann boundary conditions) and the network is simulated with high incoming fluxes for the incoming lines and high initial conditions for inner lines. We can see, from Figure  12, that J 1 and J 2 are not constant as in cases A and B. Moreover, we have to take in mind that we have two different optimization algorithms for J 1 and J 2 . Notice that the dynamic random case follows the optimal case for J 2 and not for J 1 . Indeed, the optimal algorithm for J 1 presents an interesting aspect. When simulation begins, it is worst than the static random configuration. In the steady state, instead, the optimal configuration is the highest.

442
Telecommunications Networks -Current Status and Future Trends www.intechopen.com As for the dynamic random simulation, its behaviour looks very similar to the optimal one for cases A and B (for case C, only J 2 presents optimal and dynamic random configurations, that are very similar). Hence, we could ask if it is possible to avoid the optimization of the network, and operate in dynamic random conditions. Indeed, this last case originates strange phenomena, that cannot be modelled, hence it is preferred to avoid such a situation for telecommunication network design. To give a confirmation of this intuition, focus the attention on line 13, that is completely inside the network and it is strongly influence by the dynamics at various nodes. In Figure 13, we see that, using optimal parameters, the density on line 13 shows a smoother profile than the one obtained through a dynamic random simulation.  Figure 9, for t = 10, flux function (7), case C, in optimal and dynamic random simulations. Dashed line: optimal simulation for J 2 ; solid line: dynamic random simulation.

Conclusions
A fluid-dynamic model for data networks has been described. The main advantages of this approach, with respect to existing ones, can be summarized as follows. The fluid-dynamic models are completely evolutive, thus they are able to describe the traffic situation of a network every instant of time, overcoming the difficulties encountered by many static models. An accurate description of queues formation and evolution on the network is possible. The theory permits the development of efficient numerical schemes for very large networks. The model is based on packets conservation at intermediate time scales, whose flux is determined via a loss probability function (at fast time scales) and on a semilinear equation for the evolution of the percentage of packets going from an assigned source to a given destination. The choice of the loss probability function is of paramount importance in order to achieve a feasible model. The fluid dynamic model has been compared with those obtained using various queueing paradigms, from proportional/excess to models with finite capacity, including different distributions for packet sizes. The final result is that such models give rise to velocity profiles and flux functions which are quite similar to the fluid dynamic ones. In order to solve dynamics at node,Riemann Solvers have been defined considering different traffic distribution functions (which indicate for each junction J the outgoing direction of traffic that started at source s,h a sd as final destination and reached J from an assigned incoming road) and rules RA1 and RA2. The algorithm RA1, already used for road traffic models, requires the definition of a traffic distribution matrix, whose coefficients describe the percentage of packets, forwarded from incoming lines to outgoing ones. Using the algorithm RA2, not considered for urban traffic as redirections are not expected from modelling point of view (except in particular cases, as strong congestions or road closures), priority parameters, indicating priorities among flows of incoming lines, and distribution coefficients have to be assigned. The main differences between the two algorithms are the following. The first one simply sends each packet to the outgoing line which is naturally chosen according to the final packet destination. The algorithm is blind to possible overloads of some outgoing lines and, by some abuse of notation, is similar to the behaviour of a "switch". The second algorithm, on the contrary, sends packets to outgoing lines in order to maximize the flux both on incoming and outgoing lines, thus taking into account the loads and possibly redirecting packets. Again by some abuse of notation, this is similar to a "router" behaviour. Hence, RA1 forwards packets on outgoing lines without considering the congestion phenomena, unlike RA2. Observe that a routing algorithm of RA1 type working through a routing table, according to which flows are sent with prefixed probabilities to the outgoing links, is of "distance vector" type. Reverse, an algorithm of RA2 type can redirect packets on the basis of link congestions, so it works on the link states (hence on their congestions) and so it is of "link-state" type. The performance analysis of the networks was made through the use of different cost functionals, measuring average velocity and average travelling time, using the model consisting of the conservation law. The optimization is over parameters, which assign priority among incoming lines and traffic distribution among outgoing lines. A complete solution is provided in a simple case, and then used as local optimal choice for a complex test network. Three different choices of parameters have been considered: locally optimal, static random, and dynamic random (changing in time). The local optimal outperforms the others. Then, the behaviour of packets densities on the lines, that permits to rule out the dynamic random case has been analyzed. All the optimization results have been obtained using a decentralized approach, i.e. an approach which sets local optimal parameters for each junction of the network. The cooperative aspect of such decentralized approach is the following. When a router optimizes the (local) functionals, it takes into considerations entering and exiting lines. Such lines reach other nodes, which benefit from the optimal choice. This in fact reflects in good global behavior as showed by simulations, described below. In future we aim to extend the optimization results to more general junctions and to explore global optimization techniques.