{% import macros as m with context %} .. _w2_optimal_inventory: Week 2: Optimal planning in the Inventory-environment ============================================================================================================= {{ m.embed_game('week2_inventory_solved') }} .. topic:: Controls :class: margin :kbd:`Space` Take an (optimal) action according to the DP algorithm :kbd:`0`, :kbd:`1`, :kbd:`2` Buy the given number of items. :kbd:`p` Automatically take optimal actions :kbd:`r` Reset the game .. rubric:: Run locally :gitref:`../irlc/lectures/lec02/lecture_02_optimal_inventory.py` What you see ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This example shows what happens when you apply the DP algorithm to the inventory control problem. The optimal policy is in this case very simple: buy one item if the inventory is empty. How it works ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The planning occurs using the DP algorithm that you implement during week 2 and to make the visualization work I use the DP Agent you will implement during week 2.