gEconpy.model.block.Block.solve_optimization#
- Block.solve_optimization(try_simplify=True)#
Solve the Block’s optimization program.
The optimization program is implied by the block structure as follows:
\[\begin{split}\begin{aligned} \max_{\text{[Controls]}} \quad & \sum_{t=0}^{\infty} \text{[Objective]} \\ \text{subject to} \quad & \text{[Constraints]} \end{aligned}\end{split}\]By setting up the following Lagrangian:
L = Sum_{t=0}^\infty \text{Objective} - lambda_1 * \text{constraint}_1 - ... - \lambda_n * \text{constraint}_nAnd taking the derivative with respect to each control variable in turn.
When the objective equation carries the
@minimizetag, the objective is automatically negated before forming the Lagrangian (i.e.minimize fis converted tomaximize -f). The resulting first-order conditions are those of the corresponding minimization program.Notes
All first order conditions, along with the constraints and objective are stored in the .system_equations method. No attempt is made to simplify the resulting system if try_simplify = False.