simopt.model ============ .. py:module:: simopt.model .. autoapi-nested-parse:: Base class for simulation models used in simulation optimization problems. Module Contents --------------- .. py:class:: Model(fixed_factors: dict | None = None) Bases: :py:obj:`abc.ABC` Base class for simulation models used in simulation-optimization problems. Each model defines the simulation logic behind a given problem instance. Initialize a model object. :param fixed_factors: Dictionary of user-specified model factors. :type fixed_factors: dict | None, optional .. py:attribute:: class_name_abbr :type: ClassVar[str] Short name of the model class. .. py:attribute:: class_name :type: ClassVar[str] Long name of the model class. .. py:attribute:: config_class :type: ClassVar[type[pydantic.BaseModel]] Configuration class for the model. .. py:attribute:: n_rngs :type: ClassVar[int] Number of RNGs used to run a simulation replication. .. py:attribute:: n_responses :type: ClassVar[int] Number of responses (performance measures). .. py:attribute:: config .. py:method:: name() -> str Name of model. .. py:method:: specifications() -> dict[str, dict] Details of each factor (for GUI, data validation, and defaults). .. py:property:: factors :type: dict Changeable factors of the simulation model. .. py:method:: model_created() -> None Hook called after the model is constructed. Subclasses can override this to use custom input models. .. py:method:: before_replicate(rng_list: list[mrg32k3a.mrg32k3a.MRG32k3a]) -> None :abstractmethod: Prepare the model just before generating a replication. :param rng_list: RNGs used to drive the simulation. :type rng_list: list[MRG32k3a] :raises NotImplementedError: If the subclass does not implement this hook. .. py:method:: replicate() -> tuple[dict, dict] :abstractmethod: Simulate a single replication for the current model factors. :param rng_list: List of random-number generators used to generate a random replication. :type rng_list: list[``mrg32k3a.mrg32k3a.MRG32k3a``] :returns: - dict: Performance measures of interest. - dict: Gradient estimates for each response. :rtype: tuple