A method for solving constrained maximization programs is to use the Bellman dynamic programming approach. This method was developed for the optimal control case in order to evaluate public policy, or to solve problems in forward or backward induction in finite time. The model can be written as a Bellman equation of the form:

V\left( k_{t},\lambda _{t}\right) =\max_{c_{t},h_{t}}\left[ \ln c_{t}+A\ln  \left( 1-h_{t}\right) +\beta E_{t}\left\{ V\left( k_{t+1},\lambda  _{t+1}\right) |\lambda _{t}\right\} \right]

under the constraints of the three equations mentioned above. Note that the Bellman function also contains \beta E_{t}\left\{ V\left( k_{t+1},\lambda _{t+1}\right) |\lambda _{t}\right\}, this means that expectations are conditional on the achievement of \lambda _{t+1}, this comes from the stochastic nature of \lambda _{t}. The Bellman equation becomes:

V\left( k_{t},\lambda _{t}\right) =\max_{k_{t+1},h_{t}}\left[ \ln \left(  \lambda _{t} k_{t} ^{\theta } h_{t} ^{1-\theta  }-k_{t+1}+\left( 1-\delta \right) k_{t}\right) +A\ln \left( 1-h_{t}\right)  +\beta E_{t}\left\{ V\left( k_{t+1},\lambda _{t+1}\right) |\lambda  _{t}\right\} \right]

with the control variables k_{t+1} et h_{t}. The first order conditions are:
CPO &:&\frac{\partial V\left(  k_{t},\lambda _{t}\right) }{\partial k_{t+1}}=0 \\  &\Leftrightarrow &\frac{-1}{\lambda _{t}\left( k_{t}\right) ^{\theta }\left(  h_{t}\right) ^{1-\theta }-k_{t+1}+\left( 1-\delta \right) k_{t}}+\beta  E_{t}\left\{ V_{k}\left( k_{t+1},\lambda _{t+1}\right) |\lambda _{t}\right\}  =0
CPO &:&\frac{\partial V\left(  k_{t},\lambda _{t}\right) }{\partial h_{t}}=0
$latex\Leftrightarrow &\frac{\left( 1-\theta \right) \lambda _{t}\left( \frac{
k_{t}}{h_{t}}\right) ^{\theta }}{\lambda _{t}\left( k_{t}\right) ^{\theta
}h_{t}^{1-\theta }-k_{t+1}+\left( 1-\delta \right) k_{t}}-A\frac{1}{1-h_{t}}
=0 $
\Leftrightarrow &\frac{1}{\lambda _{t} k_{t} ^{\theta }  h_{t} ^{1-\theta }-k_{t+1}+\left( 1-\delta \right) k_{t}}=\beta  E_{t}\left\{ \frac{\left( \theta \lambda _{t+1} k_{t+1}  ^{\theta -1} h_{t+1} ^{1-\theta }+\left( 1-\delta \right)  \right) }{\lambda _{t+1} k_{t+1} ^{\theta }  h_{t+1} _{t}^{1-\theta }-k_{t+2}+\left( 1-\delta \right) k_{t+1}}  |\lambda _{t}\right\}
Applying the envelope theorem of BenVista-Scheinkman gives:
\frac{\partial V\left( k_{t},\lambda _{t}\right) }{\partial k_{t}}=\frac{%
\theta \lambda _{t}\left( k_{t}\right) ^{\theta -1}\left( h_{t}\right)
^{1-\theta }+\left( 1-\delta \right) }{\lambda _{t}\left( k_{t}\right)
^{\theta }\left( h_{t}\right) ^{1-\theta }-k_{t+1}+\left( 1-\delta \right)
\] This allows to write the first order condition as follows,
k_{t+1} &:&\frac{-1}{\lambda _{t}k_{t}^{\theta
}h_{t}^{1-\theta }-k_{t+1}+\left( 1-\delta \right) k_{t}}+\beta E_{t}\left\{
V_{k}\left( k_{t+1},\lambda _{t+1}\right) |\lambda _{t}\right\} =0 \\
&\Leftrightarrow &\frac{-1}{\lambda _{t}k_{t}^{\theta }h_{t}^{1-\theta
}-k_{t+1}+\left( 1-\delta \right) k_{t}}+\beta \frac{\theta \lambda
_{t+1}k_{t+1}^{\theta -1}h_{t+1}^{1-\theta }+\left( 1-\delta \right) }{%
\lambda _{t+1}k_{t+1}^{\theta }h_{t+1t}^{1-\theta }-k_{t+2}+\left( 1-\delta
\right) k_{t+1}}=0 \\
&\Leftrightarrow &\beta \frac{\left( 1-\theta \right) \lambda
_{t+1}k_{t+1}^{\theta -1}h_{t+1}^{1-\theta }+\left( 1-\delta \right) }{%
\lambda _{t+1}k_{t+1}^{\theta }h_{t+1t}^{1-\theta }-k_{t+2}+\left( 1-\delta
\right) k_{t+1}}=\frac{1}{\lambda _{t}k_{t}^{\theta }h_{t}^{1-\theta
}-k_{t+1}+\left( 1-\delta \right) k_{t}} \\
&\Leftrightarrow &\left( 1-\theta \right) \lambda _{t}\left( \frac{k_{t}}{%
h_{t}}\right) ^{\theta }\left( 1-h_{t}\right) =A\left( \lambda
_{t}k_{t}^{\theta }h_{t}^{1-\theta }-k_{t+1}+\left( 1-\delta \right)
The first order conditions are:
\frac{c_{t+1}}{\beta c_{t}}r_{t}+\left( 1-\delta \right) \\
Ac_{t}=\left( 1-h_{t}\right) w_{t}%