# Wiki

# EmuMore / Subtree_output

# Dynamical tree output

Authors: | JuanPi Carbajal <ajuanpi@gmail.com> |
---|

Table of Contents

## 1 Introduction

### 1.1 The urban water network setting

A recurrent problem in operational urban water management, is that of simulating the flow at a given outlet connected to an upstream pipe network.

The upstream network usually has a tree topology. The edges of the tree represent conduits. The nodes of the tree represent points on which two or more conduits merge. There can also be an inlet at the node in which runoff flow into the network. The root node is the outlet at which the flow is simulated.

We can convert any tree in which inner nodes are inlets into a tree where all inlets are leaf nodes by adding virtual conduits.

Series of conduits without inlets or merges can be replaced by a single equivalent conduit

The previous observations allows us to define a rule to simplify the network:

- Make all inlets leaf nodes.
- Replace all conduits incident to nodes of degree 2 with its equivalent.
- Repeat the last step until there are no more nodes of degree 2.

The problems are then: 1) to find the transformation applied to the inflow along the path from inlet to outlet, 2) define the conduit replacement rule.

#### 1.1.1 Edge reduction

Note

Coming soon!

Hypotheses:

- All edges apply the same family of parametrized transformations, each edge is an instance with a given parameter vector \(\mathbf{\theta}_k\).
- Combining two edges produces the same type of operation with different parameters, i.e. the family is closed under concatenation.

### 1.2 Tree representation of a dynamical system

Here we deal with the output of a tree whose edges are linear operators and nodes are inputs to these operators.

A tree is fully specified by giving the predecessors list, i.e. for each node indicate the predecessor node:

Node (label and index) Predecessor 1 0 2 1 3 < 3 \(\ldots\) \(\ldots\) n < n

For example, consider the tree (0, 1, 1):

a -- c b -- c

where nodes a and b are connected to node c. The nodes a and b could be functions of time and the node c is the result of doing

In this example the tree takes two functions as inputs (\(a(t)\) and \(b(t)\)) on its leaf nodes and the edges delay those functions by \(delta_a\) and \(\delta_b\), respectively. The root node c is the the output of the tree \(c(t)\).

In general the edges can apply any linear operator to the input functions, for example they could take the function on the node as the input to a linear ODE

where \(f(t)\) is the input and \(\mathbf{y}(t)\) is the output.

In general we will write \(\mathcal{L}_i(f)\) to the effect of edge \(i\) on the input \(f\), i.e. \(\mathcal{L}_i\) is the input-output relation of the edge.

The output at node \(k\) in a tree with \(N_l\) leaf nodes is

where \(\bigodot\) stands for composition and \(\operatorname{path}(i,k)\) is the path from leaf node \(i\) to the node in question \(k\). In words, the input at each leaf is transformed down the path to node \(k\) , and the output is the sum of all transformed inputs.

## 2 Edge types

### 2.1 Delay edges

A simple input-output relation of an edge is a delay, i.e. \(\mathcal{L}_i(f(t)) = f(t - \tau_i)\). In this situation the output function is then given by

where \(\tau_i\) is the delay generated along the path from the root node to the leaf node \(i\) (i.e. \(\operatorname{path}(i)\)). There are \(N_l\) leaf nodes and correspoding paths (i.e. a tree).

The delay is always non-negative and zero only for virtual edges.

This results leads to the following questions:

- Given \(N_l\) functions \(x_i(t)\) and an delay array \(\lbrace \tau_i \rbrace\). What is the result of the delayed superposition?
- What is the result for a given distribution of the delay array?
- What is the result for the mean over many delay arrays?
- Can we estimate the delay array from data?

- What is the limiting distribution (\(N_l \to \infty\)) of the delay array for random trees?

We answer the first questions 1. and 2. in section Delayed superposition. We deal with question 4. in Estimating delays from data. Question 5. is studied in section Delay array distribution in large random trees.

#### 2.1.1 Delays in urban water networks

In the case of urban water networks, the value of the delay is related to the physical properties of the conduit, for example, it could be estimated using the Gauckler–Manning–Strickler formula for the cross-sectional average speed of flow

where \(L\) is the length of the conduit, \(n\) is the Gauckler–Manning coefficient, \(L_w\) is the wetted perimeter of the conduit, \(A\) is the conduit's flow cross-sectional area, and \(S\) the conduit's slope (or linear hydraulic head loss when the water depth is not constant along the conduit).

#### 2.1.2 Delayed superposition

Herein we explore the result of the superposition of a delayed waveform \(\varphi(t)\), i.e.

where the delays \(\lbrace \tau_i \rbrace \geq 0\) form the delay array \(\vec{\tau}\).

Assume that each delay is independently drawn from a given distribution \(\tau_i \sim p(\tau)\), then the delay array is a random variable (i.e. i.i.d. random variable)

Note

I expect that the delays will be correlated depending on the distance between the underlying pipes. Correlation in the terrain/pipe will be reflected in the delays, via slope and diameters.

We now calculate the **mean** delayed superposition (i.e. the average superposition over trees with the same number of leaf nodes but different delays drawn from \(P(\vec{\tau})\))

The second term in the last expression can be simplified to

due to the normalization of the distribution \(p(\tau)\). This is true for all terms, so applying this simplification to each term we obtain

the last expression is obtained form the fact that all the elements of the delay array are independently drawn from the same distribution (i.i.d. assumption).

##### 2.1.2.1 Weighted superposition

The results above can be easily generalized to weighted superpositions (i.i.d. weights),

Note

As before expect that the weights are correlated, and also correlated with the delays.

where \(\vec{w} \in \mathbb{R}^{N \times 1}\) is a vector of weights. Note that \(\Phi(t,\vec{\tau})^\top = \Phi(t,\vec{\tau}^\top)\)

This gives

where \(<w>\) is the mean of any of the components of the weight vector (i.i.d.)

Examples of these results are provided in the demo script s_delayed_superposition.m or its html report.

#### 2.1.3 Estimating delays from data

We now want to estimate the delays given observed data of the superposition \(y(r)\) (this is a vector of data with components \(y(r_i)\)) and some assumptions about the delay array.

##### 2.1.3.1 Effective number of delays: least square error

Recall the mean function over delay array and weight vector realizations

This function can be used to estimate a least square estimate of the effective number of terms in the superposition (i.e. effective delay array length or effective mean weight),

this means that we search for \(\tilde{N}\) that minimizes the square error

##### 2.1.3.2 Effective number of delays: maximum marginal likelihood

Now we derive an expression for the **deviation** from the mean:

The **covariance** function is obtained by doing

expectation of the first term:

using independence and that the delay array is identically distributed we obtain

where we defined

giving

Lets consider a limiting case: all weights are 1 with no variance.

With mean and covariance we can define a Gaussian process that approximates the data. The predictive mean of this GP is

where \(r\) are the times where we have data.

Equating to zero the derivative of the log marginal likelihood with respect to \(N\) gives the MAP estimate of that parameter (here assuming \(\sigma = 0\))

where \(n\) is the number of observations

For an example (see script s_delayed_decomp.m or its html report).

##### 2.1.3.3 More general parametrization of the waveforms

We would like to consider other kinds of parametrization of the waverforms, in particular

which can be used to represent scalings and translations of the waveform

The structure of the mean and covariance remain the same but the hatted functions change (assuming that the parameter vectors are i.i.d.)

Warning

From here on is not updated

##### 2.1.3.4 Effective upstream network

Herein we discuss the case in which the upstream network topology is not know, but we have a sample of the tree output and we are given the waveform, i.e. we know the result \(y(r)\) in

but we do not know \(N\), nor the weights, nor the elements in the delay array.

Approximate solutions to this problem have been widely studied in the literature
using greedy algorithms and the many guises of the *matching pursuit* algorithm.
In 2011 Ekanadham et al. [Ekanadham11] provided an algorithm to approximately
solve this problem without resourcing to arbitrary discretization: the *continuous basis pursuit*.

The solution is a sparse delay array. This delay array can be interpreted as the weighted path length from inlets to the root node of an effective upstream network. That is, it provides us with the rooted path length distribution of a family of trees. Using a generative algorithm we can generate the predecessors list of these trees.

Note

Coming soon!

#### 2.1.5 Rooted path length distribution

Note

Coming soon!

All delays equal to 1

Note

Coming soon!

Log-normal delays

## 3 References

[Ekanadham11] | Ekanadham, C., Tranchina, D., & Simoncelli, E. P. (2011). Recovery of Sparse Translation-Invariant Signals With Continuous Basis Pursuit. IEEE Transactions on Signal Processing, 59(10), 4735–4744. https://doi.org/10.1109/TSP.2011.2160058 |

Updated