def find_cutoff_rule(self, J):
"""
This function takes a value function and returns the corresponding
cutoffs of where you transition between continue and choosing a
specific model
"""
payoff_choose_f0 = self.payoff_choose_f0
payoff_choose_f1 = self.payoff_choose_f1
m, pgrid = self.m, self.pgrid
# Evaluate cost at all points on grid for choosing a model
p_c_0 = payoff_choose_f0(pgrid)
p_c_1 = payoff_choose_f1(pgrid)
# The cutoff points can be found by differencing these costs with
# the Bellman equation (J is always less than or equal to p_c_i)
lb = pgrid[np.searchsorted(p_c_1 - J, 1e-10) - 1]
ub = pgrid[np.searchsorted(J - p_c_0, -1e-10)]
return (lb, ub)
评论列表
文章目录