.. _lifecycle: ===================== Component Lifecycle ===================== |project| components :ref:`(not nodes!) ` maintain a lifecycle, that is specific to the AMARSi learning domain. The lifecycle maintains the component state and handles changing between those states. The basic lifecycle is: .. image:: images/lifecycle.png :width: 500px :align: right :target: _images/lifecycle.png A component author can hook into the lifecycle by implementing the following process methods of the component states and the methods called when changing the state. *All hooks are optional an can be left unimplemented.* Execution ========= **Execution** is the main state of a component. The hooks are: * ``onStartExecution()`` - called once when entering this state * ``onProcess()`` - called every time when the :ref:`procstrat` triggers processing * ``onStopExecution()`` - called once when leaving this this state Online Learning =============== **Online Learning** is for online learning of an adaptive component. The hooks are: * ``onStartLearnOnline()`` - called once when entering this state * ``onLearnOnlineBeforeProcess()`` - called every time when the :ref:`procstrat` triggers processing. This method is called **right before** onProcess() in case needed for the online learning method. The main computation of the online learning step should go in *onLearnOnlineBeforeProcess()*. * ``onProcess()`` - called every time when the :ref:`procstrat` triggers processing * ``onLearnOnlineBeforeProcess()`` - called every time when the :ref:`procstrat` triggers processing. This method is called **right after** onProcess(). The main computation of the online learning step should go here. * ``onStopLearnOnline()`` - called once when leaving this this state Offline Learning ================ **Offline Learning** is for offline learning of an adaptive component. The hooks are: * ``onStartLearnOffline()`` - called once when entering this state * ``onLearnOffline()`` - called every time when the :ref:`procstrat` triggers processing * ``onStopLearnOffline()`` - called once when leaving this this state Recording ========= *to come …* (`#448 `_)