param Area = 800000
param Food_max = 4.8e008
param Food_per_deer_normal = 1000
	
table Deer_fractional_increase_f = spline({0,-0.5}, {0.4,-0.15}, {0.8,0}, {1.2,0.1}, {1.6,0.16}, {2,0.2})
table Deer_kills_p_predator_f = spline({0,0}, {0.005,5}, {0.01,10}, {0.015,14}, {0.02,17.5}, {0.025,20})
table Food_consumed_p_deer_f = spline({0,0.5}, {0.1,450}, {0.2,810}, {0.3,1140}, {0.4,1340}, {0.5,1540}, {0.6,1670}, {0.7,1790},
	{0.8,1880}, {0.9,1960}, {1,2000}, {1.1,2000}, {1.2,2000})
table Food_regeneration_time_f = spline({0,35}, {0.25,15}, {0.5,5}, {0.75,1.5}, {1,1})
table Fraction_harvest_p_yr_f = linear({1900,0}, {1905,0}, {1910,0.2}, {1915,0.2}, {1920,0.2}, {1925,0.2}, {1930,0.2}, {1935,0.2},
	{1940,0.2}, {1945,0.2}, {1950,0.2})
table Predator_fractional_increase_f = spline({0,-0.2}, {5,0}, {10,0.08}, {15,0.14}, {20,0.18})

state Deer = 4000
state Food = Area*590
state Predators = 160

aux Time = t

aux Deer_density = Deer/Area
aux Deer_kills_per_predator = Deer_kills_p_predator_f(Deer_density)
aux Deer_predation_rate = Predators*Deer_kills_per_predator

aux Food_per_deer_ratio = (Food/Deer)/(Food_per_deer_normal)
aux Deer_fractional_increase = Deer_fractional_increase_f(Food_per_deer_ratio)
aux Deer_net_increase = Deer*Deer_fractional_increase

aux Fraction_harvested_p_yr = Fraction_harvest_p_yr_f(Time)
	
aux Food_consumed_p_deer = Food_consumed_p_deer_f(Food_per_deer_ratio)aux Food_consumption_rate = Deer*Food_consumed_p_deer

aux Food_regeneration_time = Food_regeneration_time_f(Food/Food_max)
aux Food_regeneration_rate = (Food_max - Food)/Food_regeneration_time

aux Predator_fractional_increase = Predator_fractional_increase_f(Deer_kills_per_predator)
aux Predator_net_increase = Predators*Predator_fractional_increase
aux Predator_harvest = Predators*Fraction_harvested_p_yr

Deer'= Deer_net_increase - Deer_predation_rate
Food'= Food_regeneration_rate - Food_consumption_ratePredators'= Predator_net_increase - Predator_harvest

print t, Deer, Food, Predators

option tstart=1900, tstop=1950