https://github.com/cadam00/egcorrs

Evolutionary Game Corridors

https://github.com/cadam00/egcorrs

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.1%) to scientific vocabulary

Keywords

corridors ecological-modelling evolutionary-game-theory game-theory graph-theory r r-package
Last synced: 9 months ago · JSON representation

Repository

Evolutionary Game Corridors

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
corridors ecological-modelling evolutionary-game-theory game-theory graph-theory r r-package
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

README.md

CRAN status Developmental version R-CMD-check Codecov test coverage <!-- badges: end -->

This research was conducted at the Department of Marine Sciences, University of the Aegean, Greece, supported by the European Union’s Horizon 2020 research and innovation programme HORIZON-CL6–2021-BIODIV-01–12, under grant agreement No 101059407, “MarinePlan – Improved transdisciplinary science for effective ecosystem-based maritime spatial planning and conservation in European Seas”.

Introduction to the EGCorrs Package (tutorial)

Biodiversity conservation can be substantially enhanced through the modeling of species corridors based on predicted behaviors. In this package, a dynamic evolutionary congestion game is formulated to generate species corridors. The primary advantage of this model lies in its utilization of vector fields as input layers, rendering it particularly suitable for simulating species distributions in marine environments characterized by current layers. The population of hypothetical agents is transported from an origin to a destination in space using a directed weighted graph, with each agent's utility being maximized. An equilibrium state is reached after numerous iterations, illustrating the paths selected by the agents. Furthermore, a congestion parameter is incorporated to represent the tendency of populations to aggregate. Detailed presentation of the algorithm and its theoretical background is done by Nagkoulis et al. (forthcoming).

Installation

Development version of the package can be installed using: r if (!require(remotes)) install.packages("remotes") remotes::install_github("cadam00/EGCorrs")

Illustration example

Packages required in this vignette are listed and imported below:

``` r

Import packages

library(EGCorrs) library(sf)

Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sfuses2() is TRUE

r library(terra)

terra 1.7.83

r library(tmap)

Breaking News: tmap 3.x is retiring. Please test v4, e.g. with

remotes::install_github('r-tmap/tmap')

r tmap_mode("view")

tmap mode set to interactive viewing

```

Currents information about the flow directions is usually split into horizontal ($u$) and vertical ($v$) components, regarding the horizontal and the vertical flow of the currents, respectively. As an example we use a cropped subset of the Aegean Sea site (Clementi et al., 2021) provided in the form of SpatRaster elements. In Figure 1 these two directions of components $u$ and $v$ are presented. This can be plotted using the following:

``` r

Get example u and v components

componentu <- getcomponentu() componentv <- getcomponentv()

Plot each component

par(mfrow=c(1,2), las=1) plot(componentu, main="u") plot(componentv, main="v") ```

Figure 1: Currents u (left) and v (right) components

Figure 1: Currents $u$ (left) and $v$ (right) components.

In Figure 2 an example of one origin and one destination area is used, using a subset of the NATURA 200 data (European Environment Agency, 2023) at this cropped area of Aegean Sea is utilized. For illustration purposes, the area around the left island (Kythira) -in neon green- is considered as the origin area and the area around the right island (Milos) -in mikado yellow- as the destination area. Additional rows on each area could be added using rbind, indicating more areas of the origin or destination area should be taken into consideration by the analysis.

```r

Read origin area

originareas <- getorigin_areas()

Reading layer `origin_areas' from data source

`C:\Program Files\R\R-4.4.2\library\EGCorrs\external\originareas\originareas.shp'

using driver `ESRI Shapefile'

Simple feature collection with 1 feature and 1 field

Geometry type: POLYGON

Dimension: XY

Bounding box: xmin: 22.86969 ymin: 36.04912 xmax: 23.13855 ymax: 36.39421

Geodetic CRS: WGS 84

r

Read destination area

destinationareas <- getdestination_areas()

Reading layer `destination_areas' from data source

`C:\Program Files\R\R-4.4.2\library\EGCorrs\external\destinationareas\destinationareas.shp'

using driver `ESRI Shapefile'

Simple feature collection with 1 feature and 1 field

Geometry type: POLYGON

Dimension: XY

Bounding box: xmin: 24.3053 ymin: 36.62173 xmax: 24.49323 ymax: 36.75966

Geodetic CRS: WGS 84

r

Plot both of them

tmshape(originareas) + tmpolygons(col="#1AFF1A") + tmshape(destinationareas) + tmpolygons(col="#FFC20A") ```

Figure 2: Origin on the left (Kythira) and destination on the right
  (Milos).

Figure 2: Origin on the left (Kythira) -neon green- and destination in the right (Milos) -mikado yellow.

Therefore, horizontal and vertical currents' components, as well as origin and destination areas, are the minimum spatial data requirements for conducting an analysis using the EGCorrs package. Additional non-spatial arguments of the function are about used like the number of nearest neighbors (k_neighbors and nearest_grid_nodes). For each one of the niters iterations, npoints agents are added in the game, whose behavior is affected by the setting of a parameter named lambda ($\lambda$).

``` r set.seed(42)

Warnings are thrown because of reassuring that components u/v and

origin/destination areas are intersecting

corridors <- EGCorrs(componentu = componentu, componentv = componentv, originareas = originareas, destinationareas = destinationareas, npoints = 10, niters = 100)

|================================================================================================| 100%

Warning messages:

1: attribute variables are assumed to be spatially constant throughout all

geometries

2: attribute variables are assumed to be spatially constant throughout all

geometries

``` The final corridors and origin/destination points produced from the algorithm can be plotted using the following:

```r names(corridors$solution_edges)[6] <- "uₗ"

tmshape(stassf(corridors$netresultcongestion, "edges"))+ tmlines(col = "black",alpha = 0.05) + tmshape(corridors$solutionedges) + tmlines(col = "uₗ",lwd="uₗ", scale=10, palette=colorRampPalette(c("blue", "red"))(10), n=10)+ tmshape(corridors$originpoints) + tmdots(col="#1AFF1A", size=0.1) + tmshape(corridors$destinationpoints) + tm_dots(col="#FFC20A", size=0.1)

Legend for line widths not available in view mode.

```

Figure 3: Final solution of the algorithm. Stronger corridors origin on
  the left (Kythira) to the destination on the right (Milos) are indicated with
  more red and wider lines. The origin random points are in neon green and the
  destination points in mikado yellow.

Figure 3: Final solution of the algorithm. Stronger corridors origin on the left (Kythira) to the destination on the right (Milos) are indicated with more red and wider lines. The origin random points are in neon green and the destination points in mikado yellow.

Convergence of the algorithm can be seen using, for example, the following plot of $RMSE(u{l{perc}})$:

```r

Restore device to a single plot

par(mfrow=c(1,1), las=1)

Plot convergence of rmseul_perc

plot(x = corridors$metricsdf$niters, y = corridors$metricsdf$rmseulperc, main = expression(RMSE(u[l[perc]])), xlab = "Number of iterations", ylab = "", lwd = 2, type = "l") ```

<img src="vignettes/rmseulperc.png" alt="Figure 4: Convergence of the RMSE(u{l{perc}}), representing the convergence of the selected corridors from the algorithm." width="100%" />

Figure 4: Convergence of the $RMSE(u{l{perc}})$, representing the convergence of the selected corridors from the algorithm.

References

Clementi, E., Aydogdu, A., Goglio, A. C., Pistoia, J., Escudier, R., Drudi, M., Grandi, A., Mariani, A., Lyubartsev, V., Lecci, R., Cretí, S., Coppini, G., Masina, S., & Pinardi, N. (2021). Mediterranean Sea Physical Analysis and Forecast (CMEMS MED-Currents, EAS6 system) (Version 1) [Data set]. Copernicus Monitoring Environment Marine Service (CMEMS). https://doi.org/10.25423/CMCC/MEDSEAANALYSISFORECASTPHY006013_EAS8. Last Access: 16/10/2024.

European Environment Agency. (2023). Natura 2000 data - the European network of protected sites. European Environment Agency. Retrieved from https://www.eea.europa.eu/en. Last Access: 16/10/2024.

Nagkoulis N, Mazaris A, Adam C, Katsanevakis S. (forthcoming). An Evolutionary Game Theoretic Model for Species Corridors Estimation.

Owner

  • Login: cadam00
  • Kind: user

GitHub Events

Total
  • Watch event: 2
  • Push event: 11
  • Create event: 1
Last Year
  • Watch event: 2
  • Push event: 11
  • Create event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 13
  • Total Committers: 1
  • Avg Commits per committer: 13.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 13
  • Committers: 1
  • Avg Commits per committer: 13.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
unknown p****4@g****m 13

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • igraph * imports
  • methods * imports
  • sf * imports
  • sfnetworks * imports
  • terra * imports
  • utils * imports
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
  • tmap * suggests