search for: bestpatch

Displaying 1 result from an estimated 1 matches for "bestpatch".

Did you mean: bestmatch
2011 May 29
1
dynamic programming
...help me? Many thanks > ccrit <- 0 > cmax <- 5 > cclass <- ccrit:cmax > nc <- length(cclass) > tmax <- 10 > times <- 1:(tmax-1) > nprey <- 3 > dive <- c(0.02,0.1,0.14) > pfood <- c(200,60,40) > f <- matrix(nrow=cmax,ncol=nc ,0) > bestpatch <- matrix(nrow=tmax-1,ncol=nc-1,0) > V <- vector(length=nprey) > fitness <- function(c,t) + { + cc <- pmin(c ,cmax) + cc <- pmax(cc,ccrit) + fitness <- f[t,cc-ccrit+1] + } > for (t in rev(times)) + { + for (c in cclass[-1]) + { + V<-fitness*(c+dive*pfood, t+1) Error: u...