pyfebiopt.monitoring.runstate
=============================

.. py:module:: pyfebiopt.monitoring.runstate

.. autoapi-nested-parse::

   Represent optimization runs and iteration histories for the monitor.



Classes
-------

.. autoapisummary::

   pyfebiopt.monitoring.runstate.IterationRecord
   pyfebiopt.monitoring.runstate.OptimizationRun


Module Contents
---------------

.. py:class:: IterationRecord

   Record metrics for a single optimizer iteration.


   .. py:attribute:: index
      :type:  int


   .. py:attribute:: cost
      :type:  float


   .. py:attribute:: theta
      :type:  dict[str, float]


   .. py:attribute:: metrics
      :type:  dict[str, Any]


   .. py:attribute:: timestamp
      :type:  float


   .. py:attribute:: series
      :type:  dict[str, dict[str, list[float]]] | None
      :value: None



   .. py:method:: to_dict() -> dict[str, Any]

      Serialize the iteration record into JSON-friendly form.

      :returns: JSON-ready payload.
      :rtype: dict[str, Any]



.. py:class:: OptimizationRun

   Track the lifecycle and metadata of an optimization run.


   .. py:attribute:: run_id
      :type:  str


   .. py:attribute:: label
      :type:  str


   .. py:attribute:: status
      :type:  str
      :value: 'created'



   .. py:attribute:: created_at
      :type:  float


   .. py:attribute:: updated_at
      :type:  float


   .. py:attribute:: parameters
      :type:  dict[str, Any]


   .. py:attribute:: meta
      :type:  dict[str, Any]


   .. py:attribute:: iterations
      :type:  list[IterationRecord]
      :value: []



   .. py:method:: to_dict() -> dict[str, Any]

      Serialize the run along with its metadata.

      :returns: JSON-ready run payload.
      :rtype: dict[str, Any]



   .. py:method:: from_dict(payload: dict[str, Any]) -> OptimizationRun
      :classmethod:


      Rebuild a run snapshot from the persisted dictionary.

      :returns: Reconstructed run snapshot.
      :rtype: OptimizationRun



   .. py:method:: apply_event(event: str, payload: dict[str, Any], ts: float) -> None

      Update the run metadata based on the incoming event.



