################################################################## # Implementation of a model of seal foraging behaviour # # Parameters shared by the other programs. # # Copyright (C) 2003 Greg Baker, Tony Wong, Alejandro Frid # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # http://www.gnu.org/copyleft/gpl.html #parameters last modified by Alejandro 12 June 03 from math import pow ################################# # 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 # seconds--total length of the simulation (1000 units) 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 # probabilities of being depredated by a [sleeper shark, killer whale] ... #haul_prob=[0,0] # ...in haulout/surface transit #surf_prob=[0,0] # ...at the surface #dive_prob=[0,0] # ...in surface/depth transit #depth_prob=[0,0] # ...at depth #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] # import one of the numeric array modules (either will do) try: from numarray import zeros, Float, Int8, fromfile except: from Numeric import zeros, Float, Int8, fromfile # 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