12#ifndef RESPOND_MODEL_HPP_
13#define RESPOND_MODEL_HPP_
21#include <respond/constants.hpp>
22#include <respond/history.hpp>
23#include <respond/runtime_config.hpp>
24#include <respond/timestep.hpp>
47 [[deprecated(
"Use Model::Create(name, RuntimeConfig) instead")]]
48 static std::unique_ptr<Model>
50 const std::string &log_name = RESPOND_DEFAULT_LOG,
51 const std::string &log_filepath = RESPOND_DEFAULT_LOG_FILE);
63 [[deprecated(
"Use Model::Create(name, RuntimeConfig) instead")]]
64 static std::unique_ptr<Model>
65 Create(
const std::string &name,
const unsigned int processor_count,
66 const std::string &log_name = RESPOND_DEFAULT_LOG,
67 const std::string &log_filepath = RESPOND_DEFAULT_LOG_FILE);
75 [[deprecated(
"Use Model::Create(name, RuntimeConfig) instead")]]
76 static std::unique_ptr<Model>
78 const std::string &log_name = RESPOND_DEFAULT_LOG,
79 const std::string &log_filepath = RESPOND_DEFAULT_LOG_FILE);
83 static std::unique_ptr<Model>
Create(
const std::string &name,
97 virtual std::unique_ptr<Model>
clone()
const = 0;
145 virtual const Eigen::Ref<const Eigen::VectorXd>
GetState()
const = 0;
156 virtual const std::map<std::string, History> &
GetHistories()
const = 0;
180 virtual void SetState(
const Eigen::Ref<const Eigen::VectorXd> &state) = 0;
218inline std::ostream &operator<<(std::ostream &os,
const Model &model) {
Abstract base class representing a state transition model. Models manage a state vector,...
Definition: model.hpp:31
virtual const Eigen::Ref< const Eigen::VectorXd > GetState() const =0
Retrieves the current state of the model.
static std::unique_ptr< Model > Create(const std::string &name, const RuntimeConfig &runtime_config)
Creates a Markov model with shared runtime settings.
virtual bool GetInitialHistoryRecorded() const =0
Checks if the initial history has been recorded for this model.
virtual void RunTimestep(size_t idx)=0
Executes the timestep in the model's sequence.
Model & operator=(const Model &)=delete
Deleted copy assignment operator (models are non-copyable by public API).
virtual std::unique_ptr< Model > clone() const =0
Creates a deep copy of this model.
virtual Timestep GetTimestepAtIndex(size_t index) const =0
Retrieve a copy of a specific timestep by index.
virtual std::string GetName() const =0
Retrieves the name identifier for this model.
virtual void AddTimestep(const Timestep ×tep)=0
Helper function to add a single timestep to the model.
virtual void RunTimestep()=0
Executes the next timestep in the model's sequence.
static std::unique_ptr< Model > Create(const std::string &name, const std::string &log_name=RESPOND_DEFAULT_LOG, const std::string &log_filepath=RESPOND_DEFAULT_LOG_FILE)
Factory method to create a Model instance.
virtual int GetHistoryCaptureInterval() const =0
Retrieves the global history capture interval.
virtual int GetTimestep() const =0
Retrieves the current simulation timestep.
virtual void SetFinalTimestep(int final_timestep)=0
Sets the final timestep that must always be recorded.
virtual void Serialize(std::ostream &os) const =0
Function to serialize the model's state and metadata to an output stream.
virtual const std::map< std::string, History > & GetHistories() const =0
Retrieves a reference to the map of all registered histories. The histories cannot be edited directly...
virtual void SetInitialHistoryRecorded(bool recorded)=0
Sets whether the initial state has been recorded in history.
Model(const Model &)=delete
Deleted copy constructor (models are non-copyable by public API).
virtual int GetFinalTimestep() const =0
Retrieves the final timestep forced into history output.
virtual ~Model()=default
Virtual destructor for proper polymorphic cleanup.
static std::unique_ptr< Model > Create(const std::string &name, const ExecutionConfig &execution_config, const std::string &log_name=RESPOND_DEFAULT_LOG, const std::string &log_filepath=RESPOND_DEFAULT_LOG_FILE)
Creates a Model with explicit execution settings.
virtual void SetState(const Eigen::Ref< const Eigen::VectorXd > &state)=0
Sets the current state of the model.
static std::unique_ptr< Model > Create(const std::string &name, const unsigned int processor_count, const std::string &log_name=RESPOND_DEFAULT_LOG, const std::string &log_filepath=RESPOND_DEFAULT_LOG_FILE)
Alternate factory method to create a Model instance.
Model()=default
Protected default constructor for subclass initialization. Not intended for direct public use.
virtual void RunTimesteps()=0
Executes all registered timesteps in sequence, applying their transitions to the model's state.
virtual void ClearHistories()=0
Clear all history records and reset the history tracking state.
virtual void CreateDefaultHistories()=0
Creates default history tracking for the model. This method initializes standard history records base...
virtual void ClearTimesteps()=0
Clears all timesteps from the model.
virtual void SetHistoryCaptureInterval(int interval)=0
Sets the global history capture interval for this model.
Represents a single timestep in a simulation, managing a collection of transitions....
Definition: timestep.hpp:31
Controls how a Simulation distributes execution resources.
Definition: execution_config.hpp:14
Groups execution and logging settings shared by runtime objects.
Definition: runtime_config.hpp:17