whichMoves: Which moves should be made

Description Usage Arguments Value Examples

View source: R/whichMoves.R

Description

Helper function to decide if any moves should be made, and if so, where should foragers be transferred FROM and TO.

Usage

1
whichMoves(scenarioSet = NA)

Arguments

scenarioSet

Scenario set for current simulation.

Value

List with three elements, move, from, and to.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#Create scenario
nests<-list(xloc=1,yloc=1,n=matrix(c(5,10,15),1),
                   whatCurr="eff",sol=T,
                   eps=0,L_max=59.5,v=7.8,
                   beta=0.102,p_i=1,
                      h=matrix(rep(1.5,3)),
                      c_f=0.05,c_i=0.0042,
                      H=100,d=matrix(c(50,100,150),1),
                      L=matrix(rep(59.5,3),1),
                      curr=matrix(c(5,10,15),1),
                      steps=5,stepNum=1)
world<-list(mu=matrix(rep(8.33e-05,3),1),
           flDens=matrix(rep(520,3),1),
           e=matrix(rep(14.3,3),1),
           l=matrix(rep(1,3),1),
           f=matrix(rep(0.86,3),1),
           cellSize=10,forageType='omniscient',
           S=matrix(rep(1,3),1))
baseScen=list(nests=nests,world=world)
use=c(1,2,3)
temp=lapply(use,optimLoadCurr,scenario=baseScen)
baseScen$world$S[use]=sapply(temp,function(x) x$S) #Assigns S-values
baseScen$nests$L[use]=sapply(temp,function(x) x$optimL) #Assigns L
baseScen$nests$curr[use]=sapply(temp,function(x) x$optimCurr) #Assigns currency
#Create scenario set
bestScen=makeBest(baseScen)
worstScen=makeWorst(baseScen)
scenSet=list(best=bestScen,base=baseScen,worst=worstScen)
(moves=whichMoves(scenSet)) #What moves should foragers make?

samuelVJrobinson/CPForage documentation built on Jan. 20, 2021, 6:22 p.m.