################################# # Model parameters fitfile = "fitness.data" decfile = "decision.data" t_period = 10 # seconds--length of one time unit e_unit = 1000.0 # kJ per energy unit o_unit = 400.0 # mL per oxygen unit #t_total = 1 * 24*60*60 # seconds--total length of the simulation (1 day) t_total = 1000*t_period # 1000 units for testing tmax = t_total/t_period # time units--total time units in simulation haul_time=int(6000/t_period) # time units--time needed to haul out/in dive_time=int(100/t_period) # time units--time needed to dive up/down xrep=6 # energy units xmax=10 # energy units yk=6 # oxygen units ymax=10 # oxygen units hmax=3 # number of habitats basal=(0.971/e_unit) # energy units swimming=2*basal # energy units moving=(1.625/e_unit) # energy units chasing=2*moving # energy units max_o_gain=(40.425/o_unit) # oxygen units base_o_gain=max_o_gain/4 # oxygen units diving_o_cost=(80.85/o_unit) # oxygen units chasing_o_cost=2*diving_o_cost # oxygen units # enc prob: P(find food in bottom time of 2 min)=1, therefore for # one unit it is 0.08 encounter_prob=0.08 # prob of encountering prey at depth catch_prob=.40 # prob of catching prey if encountered prey_gain=2087/e_unit # energy units--gain if prey caught #june 18 corrected for sleeper shark analysis of iphc-lee data #then experiments #haul is surface/2, dive is depth/4 haul_prob=[0.68e-8, 3.5e-5] # ...in haulout/surface transit surf_prob=[1.36e-8, 7e-5] # ...at the surface dive_prob=[0.395e-8, 2.8e-12] # ...in surface/depth transit depth_prob=[1.58E-08, 2.8e-13] # ...at depth def survive(p): """ function used to combine two probabilies of depredation into prob. of survival TODO: check this vs. Clark's formula """ return 1 - p[0] - p[1] + p[0]*p[1] from numarray import * from math import pow # survival probabilities in various situations. # survive_prob[h,d] is the prob of survival in habitat h, decision d survive_prob=zeros((hmax,hmax), Float) survive_prob[0,0] = 1.0 survive_prob[0,1] = pow(survive(haul_prob), haul_time) survive_prob[1,0] = pow(survive(haul_prob), haul_time) survive_prob[1,1] = survive(surf_prob) survive_prob[1,2] = pow(survive(dive_prob), dive_time) survive_prob[2,1] = pow(survive(dive_prob), dive_time) survive_prob[2,2] = survive(depth_prob) impossible=-1 # the fitness if the seal tries to do impossible things