# Policy Costs * author Carl Boettiger, * license: CC0 This example illustrates the impact of adding a cost to changing the harvest level between years ### Define all parameters we'll use log normal noise functions Chose the state equation / population dynamics function Our initial condition is the equilibrium size (note the stochastic deflation of mean) and we use a harvest-based profit function with default parameters Set up the discrete grids for stock size and havest levels (which will use same resolution as for stock). ### Calculate the stochastic transition matrix We calculate the stochastic transition matrix for the probability of going from any state \(x_t \) to any other state \(x_{t+1}\) the following year, for each possible choice of harvest \( h_t \). This provides a look-up table for the dynamic programming calculations. Note that this only includes uncertainty in the growth rate (projected stock next year). ### Find the optimum by dynamic programming We use Bellman's dynamic programming algorithm to compute the optimal solution for all possible trajectories, ignoring potential policy costs as before. We will later use this solution to compare against the optimal solution with policy costs. A modified algorithm lets us include a penalty of magnitude `P` and a functional form that can be an `L1` norm, `L2` norm, `asymmetric` L1 norm (costly to lower harvest rates), fixed cost, or `none` (no cost). Here is an asymmetric norm example. Note that this calculation is considerably slower. ### Simulate Now we'll simulate 100 replicates of this stochastic process under the optimal harvest policy determined above. We use a modified simulation function that can simulate an alternate policy (the Reed optimum, where policy costs are zero, `opt$D` ) and a focal policy, `policycost$D` ## Summarize and plot the results Make data tidy (melt), fast (data.tables), and nicely labeled. ### Plots A single replicate, alternate dynamics should show the Reed optimum, while harvest/fishstock should show the impact of having policy costs. Compare the optimal policy that involves this cost: Against the policy with no cost: Compare dynamics on a single replicate to see how this policy differs from the Reed policy. ## Alternate policy cost models #### L2 norm #### L1 norm