# Optimal transportation for species interaction networks

By solving an *optimal transportation* problem, one can estimate the interaction intensities given (1) a matrix of interaction utility values (i.e., the preferences for certain interactions between the species) and (2) the abundances of the top and bottom species. It hence allows predicting *how* species will interact. The interactions estimated intensities are given by the ecological coupling matrix $Q$, which has the optimal trade-off between utility (enriching for prefered interactions) and entropy (interactions are distributed as randomly as possible). The function `optimaltransportation`

has the following inputs:

- a utility matrix
`M`

; - the (relative) abundances of the top and bottom species
`a`

and`b`

; - the entropic regularization parameter
`λ`

(set default to 1).

For details, we refer to the paper presenting this framework.

`EcologicalNetworks.optimaltransportation`

— Function```
optimaltransportation(M::AbstractArray;
[a, b, λ=1, ϵ=1e-10, maxiter=100])
```

Performs optimal transportation on an ecological network. Here, `M`

is treated as an utility matrix, quantifying the preference the species of the two throphic levels have for interacting with another. One can fix both, one or none of the species abundances by given `a`

(row sums, corresponding to top species) and/or `b`

(column sums, corresponding to bottom species). The strengh of entropic regularisation is set by `λ`

, where higher values indicate more utitlity and lower values more entropy.

ϵ and `maxiter`

control the number of Sinkhorn iterations. You likely won't need to change these.

This version works on arrays.

Stock, M., Poisot, T., & De Baets, B. (2021). « Optimal transportation theory for species interaction networks. » Ecology and Evolution, 00(1), ece3.7254. https://doi.org/10.1002/ece3.7254

```
optimaltransportation(M::AbstractBipartiteNetwork;
[a, b, λ=1, ϵ=1e-10, maxiter=100])
```

Performs optimal transportation on an ecological network. Here, `M`

is treated as an utility matrix, quantifying the preference the species of the two throphic levels have for interacting with another. One can fix both, one or none of the species abundances by given `a`

(row sums, corresponding to top species) and/or `b`

(column sums, corresponding to bottom species). The strengh of entropic regularisation is set by `λ`

, where higher values indicate more utitlity and lower values more entropy.

ϵ and `maxiter`

control the number of Sinkhorn iterations. You likely won't need to change these.

Stock, M., Poisot, T., & De Baets, B. (2021). « Optimal transportation theory for species interaction networks. » Ecology and Evolution, 00(1), ece3.7254. https://doi.org/10.1002/ece3.7254

## References

Stock, M., Poisot, T., & De Baets, B. (2021). « Optimal transportation theory for species interaction networks. » Ecology and Evolution, 00(1), ece3.7254. https://doi.org/10.1002/ece3.7254