README.md

Package patrolR

Background

This package is affiliated with Dhanjal-Adams et al. (2016) and is aimed at optimising patrolling efforts for rangers. It uses a Genetic Algorithm to determine which sites have the greatest number of species impacted by human disturbances for the least cost to patrol. It can therefore be used to determine which sites to visit within a given budget to deliver the best outcomes for biodiverrsity.

Getting Started

Prerequisites

Installing

To install this package from github, make sure you first have devtools installed.

install.packages("devtools")

The github package can be installed:

devtools::install_github("KiranLDA/patrolR")

Load and test

To make sure the package works run the following

# load library
library(patrolR)

#load in package data for testing
data(patrol_info)

# list of sites
sites = rownames(patrol_info)

# Specify the benefit of managing each site
benefit = patrol_info[,"Total number of birds"] * patrol_info[,"Total number of species"]* patrol_info[,"Average number of disturbances per count"]

#specify the cost of managing each site
cost = patrol_info[,"Caloundra patrol cost"]

#specify the available budget
budget = 2000

# find which sites to patrol within budget, which provide the best bang for your buck
solutions = staticPATROL(sites, benefit, cost, budget)

Print optimal solution

cat(summary(solutions))

# # GA Settings
# #   Type                  = binary chromosome
# #   Population size       = 200
# #   Number of Generations = 100
# #   Elitism               = TRUE
# #   Mutation Chance       = 0.01
# # 
# # Search Domain
# #   Var 1 = [,]
# #   Var 0 = [,]
# # 
# # GA Results
# #   Best Solution : 0 0 1 0 1 1 0 1 0 0


Look at all solutions

solutions


# # GA Results
# #   Best Solution : 0 0 1 0 1 1 0 1 0 0 
# # > solutions
# # $`type`
# # [1] "binary chromosome"
# # 
# # $size
# # [1] 10
# # 
# # $popSize
# # [1] 200
# # 
# # $iters
# # [1] 100
# # 
# # $suggestions
# # NULL
# # 
# # $population
# #        [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
# #   [1,]    0    0    1    0    1    1    0    1    0     0
# #   [2,]    0    0    1    0    1    1    0    1    0     0
# #   [3,]    0    0    1    0    1    1    0    1    0     0
# #   [4,]    0    0    1    0    1    1    0    1    0     0
# #   [5,]    0    0    1    0    1    1    0    1    0     0
# #   [6,]    0    0    1    0    1    1    0    1    0     0
# #   [7,]    0    0    1    0    1    1    0    1    0     0
# #   [8,]    0    0    1    0    1    1    0    1    0     0
# #   [9,]    0    0    1    0    1    1    0    1    0     0
# #  [10,]    0    0    1    0    1    1    0    1    0     0
# #  [11,]    0    0    1    0    1    1    0    1    0     0
# #  [12,]    0    0    1    0    1    1    0    1    0     0
# #  [13,]    0    0    1    0    1    1    0    1    0     0
# #  [14,]    0    0    1    0    1    1    0    1    0     0
# #  [15,]    0    0    1    0    1    1    0    1    0     0
# #  [16,]    0    0    1    0    1    1    0    1    0     0
# #  [17,]    0    0    1    0    1    1    0    1    0     0
# #  [18,]    0    0    1    0    1    1    0    1    0     0
# #  [19,]    0    0    1    0    1    1    0    1    0     0
# #  [20,]    0    0    1    0    1    1    0    1    0     0
# #  [21,]    0    0    1    0    1    1    0    1    0     0
# #  [22,]    0    0    1    0    1    1    0    1    0     0
# #  [23,]    0    0    1    0    1    1    0    1    0     0
# #  [24,]    0    0    1    0    1    1    0    1    0     0
# #  [25,]    0    0    1    0    1    1    0    1    0     0
# #  [26,]    0    0    1    0    1    1    0    1    0     0
# #  [27,]    0    0    1    0    1    1    0    1    0     0
# #  [28,]    0    0    1    0    1    1    0    1    0     0
# #  [29,]    0    0    1    0    1    1    0    1    0     0
# #  [30,]    0    0    1    0    1    1    0    1    0     0
# #  [31,]    0    0    1    0    1    1    0    1    0     0
# #  [32,]    0    0    1    0    1    1    0    1    0     0
# #  [33,]    0    0    1    0    1    1    0    1    0     0
# #  [34,]    0    0    1    0    1    1    0    1    0     0
# #  [35,]    0    0    1    0    1    1    0    1    0     0
# #  [36,]    0    0    1    0    1    1    0    1    0     0
# #  [37,]    0    0    1    0    1    1    0    1    0     0
# #  [38,]    0    0    1    0    1    1    0    1    0     0
# #  [39,]    0    0    1    0    1    1    0    1    0     0
# #  [40,]    0    0    1    0    1    1    0    1    0     0
# #  [41,]    0    0    1    0    1    1    0    1    0     0
# #  [42,]    0    0    1    0    1    1    0    1    0     0
# #  [43,]    0    0    1    0    1    1    0    1    0     0
# #  [44,]    0    0    1    0    1    1    0    1    0     0
# #  [45,]    0    0    1    0    1    1    0    1    0     0
# #  [46,]    0    0    1    0    1    1    0    1    0     0
# #  [47,]    0    0    1    0    1    1    0    1    0     0
# #  [48,]    0    0    1    0    1    1    0    1    0     0
# #  [49,]    0    0    1    0    1    1    0    1    0     0
# #  [50,]    0    0    1    0    1    1    0    1    0     0
# #  [51,]    0    0    0    0    1    1    0    1    0     0
# #  [52,]    0    0    1    0    1    1    0    1    0     0
# #  [53,]    0    0    1    0    1    1    0    1    0     0
# #  [54,]    0    0    1    0    1    0    0    1    0     0
# #  [55,]    0    0    1    0    1    1    0    1    0     0
# #  [56,]    0    0    1    0    1    1    0    1    0     0
# #  [57,]    0    0    1    0    1    1    0    1    0     0
# #  [58,]    0    0    1    0    1    1    0    1    0     0
# #  [59,]    0    0    1    0    1    1    0    1    1     0
# #  [60,]    0    0    1    0    1    1    0    1    0     0
# #  [61,]    0    0    1    0    1    0    1    1    0     0
# #  [62,]    0    0    1    0    1    1    0    1    0     0
# #  [63,]    0    0    1    0    1    1    0    1    0     0
# #  [64,]    0    0    1    0    1    1    0    1    0     0
# #  [65,]    0    0    1    0    1    1    0    1    0     0
# #  [66,]    0    0    1    0    1    1    0    1    0     0
# #  [67,]    0    0    1    0    1    1    0    1    0     0
# #  [68,]    0    0    1    0    1    1    0    1    0     0
# #  [69,]    0    0    1    0    1    1    0    1    0     0
# #  [70,]    0    0    1    0    1    1    0    1    0     0
# #  [71,]    0    0    1    0    1    1    0    1    0     0
# #  [72,]    0    0    1    0    1    1    0    1    0     0
# #  [73,]    0    0    1    0    1    1    0    1    0     0
# #  [74,]    0    0    1    0    1    1    0    1    0     0
# #  [75,]    0    0    1    0    1    1    0    1    0     0
# #  [76,]    0    0    1    0    1    1    0    1    0     0
# #  [77,]    0    0    1    0    1    1    0    1    0     0
# #  [78,]    0    0    1    0    1    1    0    1    0     0
# #  [79,]    0    0    1    0    1    1    0    1    0     0
# #  [80,]    0    0    1    0    1    1    0    1    0     0
# #  [81,]    0    0    1    0    1    1    0    1    0     0
# #  [82,]    0    0    1    0    1    1    0    1    0     0
# #  [83,]    0    0    1    0    1    1    0    1    0     0
# #  [84,]    0    0    1    0    1    1    0    1    0     0
# #  [85,]    0    0    1    0    1    1    0    1    0     0
# #  [86,]    0    0    1    0    1    1    0    1    0     0
# #  [87,]    0    0    1    0    1    1    0    1    0     0
# #  [88,]    0    0    0    0    1    1    0    1    0     0
# #  [89,]    0    0    1    0    1    1    0    1    0     0
# #  [90,]    0    0    1    0    1    1    0    1    0     0
# #  [91,]    0    0    1    0    1    1    0    1    0     0
# #  [92,]    0    0    1    0    1    1    0    1    0     0
# #  [93,]    0    0    1    0    1    1    0    1    0     0
# #  [94,]    0    0    1    0    1    1    0    1    0     0
# #  [95,]    0    0    1    0    1    1    0    1    0     0
# #  [96,]    0    0    1    0    1    1    0    1    0     0
# #  [97,]    0    0    1    0    1    1    0    1    0     0
# #  [98,]    0    0    1    0    1    1    0    1    0     0
# #  [99,]    0    0    1    0    1    1    0    1    0     0
# # [100,]    0    0    1    0    1    1    0    1    0     0
# #  [ reached getOption("max.print") -- omitted 100 rows ]
# # 
# # $elitism
# # [1] TRUE
# # 
# # $mutationChance
# # [1] 0.01
# # 
# # $evaluations
# #   [1] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# #  [11] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# #  [21] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# #  [31] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# #  [41] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# #  [51] -160863.66 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42       0.00 -170796.42
# #  [61]  -36589.68 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# #  [71] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# #  [81] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -160863.66 -170796.42 -170796.42
# #  [91] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [101] -170796.42 -170796.42 -170796.42 -150466.50 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [111] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [121] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [131] -170796.42 -170796.42 -170796.42 -170796.42       0.00 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [141] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42       0.00 -170796.42
# # [151] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [161] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [171] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -150466.50 -170796.42 -170796.42 -170796.42 -170796.42
# # [181] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # [191] -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42 -170796.42
# # 
# # $best
# #   [1] -154603.2 -154678.0 -159572.4 -169505.2 -169581.7 -169581.7 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [12] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [23] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [34] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [45] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [56] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [67] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [78] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# #  [89] -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4 -170796.4
# # [100] -170796.4
# # 
# # $mean
# #   [1]  -39276.75  -75122.51 -126396.74 -138777.16 -145419.86 -148900.93 -148413.17 -152223.71 -155265.41 -158350.50
# #  [11] -147671.59 -147680.22 -146965.76 -163214.88 -167812.09 -169190.49 -169809.48 -167745.74 -168153.50 -168200.84
# #  [21] -170157.53 -168195.45 -168887.48 -170379.19 -170702.49 -169007.48 -168918.79 -165327.39 -167177.19 -169470.30
# #  [31] -168997.44 -170593.12 -166435.50 -169200.74 -168620.40 -166784.87 -168078.52 -167231.50 -170250.87 -168291.10
# #  [41] -168101.51 -169323.07 -168599.72 -169425.88 -170149.22 -168887.48 -168719.72 -168957.82 -169791.12 -168769.80
# #  [51] -168783.51 -167794.24 -169239.77 -169809.48 -165619.38 -168153.50 -169480.93 -170105.55 -169746.86 -169597.86
# #  [61] -165001.17 -168939.46 -168236.80 -170694.77 -166395.87 -168083.16 -167417.20 -170175.89 -169647.53 -168193.12
# #  [71] -168365.11 -169582.58 -168385.79 -165844.52 -167430.16 -168817.14 -168869.13 -168947.78 -169289.84 -169879.82
# #  [81] -168435.45 -168466.76 -170311.17 -166709.13 -168835.49 -168804.18 -169668.80 -168187.13 -167900.54 -169944.76
# #  [91] -168294.77 -169138.12 -167396.52 -168529.38 -169226.81 -169911.13 -166301.38 -169334.86 -161371.63 -167260.81
# # 
# # attr(,"class")
# # [1] "rbga"

Authors

Kiran Dhanjal-Adams

Relevant references

Dhanjal‐Adams K.L., Mustin K., Possingham H.P. and Fuller R.A. (2016), Optimizing disturbance management for wildlife protection: the enforcement allocation problem. Journal of Applied Ecology, 53: 1215-1224. doi:10.1111/1365-2664.12606

License

This project is licensed under the GNU General Public License version 3 - see the LICENSE file for details



KiranLDA/patrolR documentation built on July 1, 2024, 2:45 p.m.