state fish = 1000
state ships = 10
state profit = 0

table cps = spline({0,0}, {1,5}, {2,10.4}, {3,15.9}, {4,20.2}, {5,22.1}, {6,23.2},
					{7,23.8}, {8,24.2}, {9,24.6}, {10,25}, {11,25.3}, {12,25.5})
table fdf = spline({0,5.22}, {0.1,5.22}, {0.2,5.23}, {0.3,5.24}, {0.4,5.26}, {0.5,5.29}, {0.6,5.34},
					{0.7,5.45}, {0.8,5.66}, {0.9,5.95}, {1.0,6.00})

param hatch_fraction = 6.0
param area = 100
param carrying_capacity = 1200
param fish_price = 20
param fraction_invested = 0.2
param cost_per_ship_per_year = 250
param ship_cost = 300

aux density = fish/area
aux catch_per_ship = cps(density)
aux death_fraction = fdf(fish/carrying_capacity)

aux operating_costs = cost_per_ship_per_year*ships
aux total_catch_per_year = ships*catch_per_ship
aux revenues = total_catch_per_year*fish_price
aux yearly_profits = revenues - operating_costs

aux fish_hatch_rate = hatch_fraction*fish
aux fish_death_rate = death_fraction*fish
aux total_catch_rate = catch_per_ship*ships

aux ship_building_rate = yearly_profits*fraction_invested/ship_cost

fish'= fish_hatch_rate - fish_death_rate - total_catch_per_year
ships'= ship_building_rate
profit'= yearly_profits

print t, fish, ships, profit
plot grid t, fish, ships

option tstart=1970, tstop=1986, outstep=0.5