### Example Simulation Setup Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/docs-build/C++APIReference/rrRoadRunner.html Demonstrates how to set up simulation options, including start time, end time, and number of steps, for a simulation using a stiff integrator. ```cpp RoadRunner rr = RoadRunner("someFile.xml"); SimulateOptions opt = rr.getSimulateOptions(); opt.start = 0; opt.end = 10; opt.steps = 1000; ``` -------------------------------- ### Install Executable Source: https://github.com/sys-bio/roadrunner/blob/develop/examples/create_uuid/CMakeLists.txt Installs the built target executable to the bin directory, categorized under the 'examples' component. This is used for deploying built examples. ```cmake install(TARGETS ${target} DESTINATION bin COMPONENT examples) ``` -------------------------------- ### Example: Gillespie Simulation Setup Source: https://github.com/sys-bio/roadrunner/blob/develop/wrappers/C/html/group__stochastic.html Example demonstrating how to set up parameters for the gillespieOnGridEx function. Ensure rrHandle is properly initialized before calling. ```c RRCDataPtr m; double timeStart = 0.0; double timeEnd = 25; int numberOfPoints = 200; m = gillespieOnGridEx (rrHandle, timeStart, timeEnd, numberOfPoints); ``` -------------------------------- ### Example: Gillespie Simulation Setup Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/OriginalDoxygenStyleDocs/html/group__stochastic.html Example demonstrating how to set up parameters for the gillespieOnGridEx function. Ensure the RRCDataPtr structure is freed after use. ```c [RRCDataPtr](struct_r_r_c_data.html) m; double timeStart = 0.0; double timeEnd = 25; int numberOfPoints = 200; m = [gillespieOnGridEx](group__stochastic.html#gabedfc117be6781c6caca54ecc74561ea) (rrHandle, timeStart, timeEnd, numberOfPoints); ``` -------------------------------- ### Installation Folder Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/OriginalDoxygenStyleDocs/html/rrc__api_8h_source.html Functions for setting and getting the installation folder. ```APIDOC ## setInstallFolder ### Description Set the internal string containing the folder in where the RoadRunner C wrappers is installed. ### Method POST ### Endpoint /setInstallFolder ### Parameters #### Path Parameters - **folder** (const char *) - Required - The path to the installation folder. ### Response #### Success Response (200) - **success** (bool) - True if the folder was set successfully, false otherwise. ### Response Example ```json { "success": true } ``` ## getInstallFolder ### Description Returns the folder in which the RoadRunner wrappers is installed. ### Method GET ### Endpoint /getInstallFolder ### Parameters None ### Response #### Success Response (200) - **folderPath** (char *) - The path to the installation folder. ### Response Example ```json { "folderPath": "/usr/local/roadrunner" } ``` ``` -------------------------------- ### Example: Simulate Model with Custom Options Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/C++APIReference/rrRoadRunner.html Demonstrates how to set simulation options (start time, end time, number of steps) and then perform a simulation using a specific integrator. ```cpp RoadRunner rr = RoadRunner("someFile.xml"); SimulateOptions opt = rr.getSimulateOptions(); opt.start = 0; // opt.end = 10; // opt.steps = 1000; // rr.simulate(&opt); ``` -------------------------------- ### Example Usage of Setting Get and GetAs Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/classrr_1_1Setting.html Demonstrates the usage of get() and getAs() methods for retrieving and converting values from a Setting object. It shows successful retrieval, expected exceptions for type mismatches, and successful conversions between compatible types. ```cpp [Setting](classrr_1_1Setting.html#a2f3f6beff36ad237ca6493dfaa19741f) setting(5); ASSERT_EQ(setting.get(), 5); // fails if setting is not int ASSERT_THROW(setting.get();, std::bad_variant_access); // bad, setting contains an int ASSERT_EQ(setting.getAs(), 5); // Okay, we can convert from int to unsigned (when int > 0) ``` -------------------------------- ### Example: Simulate with Stiff Integrator Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/OriginalDoxygenStyleDocs/html/classrr_1_1_road_runner.html Demonstrates setting simulation options for a stiff integrator, including start time, duration, steps, and enabling stiffness. ```cpp [RoadRunner](classrr_1_1_road_runner.html#a04a6fd481cfacc2510d5d113520143ef) r = [RoadRunner](classrr_1_1_road_runner.html#a04a6fd481cfacc2510d5d113520143ef)("someFile.xml"); BasicDictionary opt; opt.setItem("start", 0); opt.setItem("duration", 10); opt.setItem("steps", 1000); opt.setItem("stiff", true); const DoubleMatrix *result = r.simulate(&opt); ``` -------------------------------- ### Minimal Hello RoadRunner Plugin Example Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/rrplugins/rrplugins_architecture.html A minimal example demonstrating how to create a plugin for RoadRunner. This example serves as a starting point for developing more complex plugins. ```python import roadrunner # Example usage of roadrunner functionalities within a plugin context # (Actual plugin code would be more complex and involve C++ or other language bindings) # Placeholder for plugin logic print("Hello RoadRunner Plugin!") ``` -------------------------------- ### CMake Project Setup and Installation Source: https://github.com/sys-bio/roadrunner/blob/develop/rrplugins/examples/python/parameter_minimization/one_parameter/CMakeLists.txt Configures the minimum required CMake version, names the project, and specifies files to be installed. Ensure the DESTINATION path is correctly set for your project structure. ```cmake CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) PROJECT(TEL_PYTHON_EXAMPLES) set(plugin_examples ) install ( FILES README.txt ${plugin_examples} DESTINATION examples/python/parameter_minimization/one_parameter COMPONENT examples ) ``` -------------------------------- ### main.cpp Example for RoadRunner C++ Simulation Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/docs-build/_sources/UsingRoadRunnerFromCxx/using_roadrunner_from_cxx.rst.txt This C++ code demonstrates how to initialize RoadRunner, load a model, create a simulation, and run it. Ensure RoadRunner is installed and CMakeLists.txt is correctly configured. ```C++ #include #include int main() { // Create a RoadRunner instance rr::RoadRunner rr; // Load a model (replace with your model file path) rr.loadModel("path/to/your/model.xml"); // Create a simulation rr.setSimulateOptions(0.0, 10.0); // Start time, end time // Run the simulation rr.simulate(); // Get results (example: get the value of the first variable) rr::RVCollection* results = rr.getFloatingSpeciesCongruentValues(); if (results && results->size() > 0) { std::cout << "First floating species value: " << (*results)[0] << std::endl; } // Clean up delete results; return 0; } ``` -------------------------------- ### Example: Add Plugin Usage Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/_sources/rrplugins/introduction.rst.txt Demonstrates a complete workflow: instantiating an 'add' plugin, setting input properties, executing, and retrieving the result. ```python p = Plugin("add") p.x = 3.4 p.y = 5.6 p.execute() print(p.result) ``` -------------------------------- ### Install Python Setup Script with CMake Source: https://github.com/sys-bio/roadrunner/blob/develop/rrplugins/wrappers/python/CMakeLists.txt Installs the Python setup script for the Roadrunner plugins to the root of the installation directory. This script is essential for package management. ```cmake install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/setup_rrplugins.py DESTINATION . COMPONENT rrplugins ) ``` -------------------------------- ### Conditional Python Build and Example Installation Source: https://github.com/sys-bio/roadrunner/blob/develop/rrplugins/plugins/monte_carlo_bs/CMakeLists.txt Installs the target library to a Python-specific location and copies example files if the BUILD_PYTHON flag is enabled. ```cmake if(BUILD_PYTHON) install (TARGETS ${target} DESTINATION ${RR_PLUGINS_PYLIB_INSTALL_PREFIX} COMPONENT plugins ) file(GLOB EXAMPLES docs/Examples/*) install(FILES ${EXAMPLES} DESTINATION "${RR_PLUGINS_PYTHON_INSTALL_PREFIX}" COMPONENT plugins) unset(EXAMPLES) endif() ``` -------------------------------- ### Create Project Directory Source: https://github.com/sys-bio/roadrunner/blob/develop/test/googletest-master/docs/quickstart-cmake.md Initializes a new project directory and navigates into it. This is the first step in setting up a new project. ```bash $ mkdir my_project && cd my_project ``` -------------------------------- ### Installation Folder Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/group__initialization.html Functions to get and set the RoadRunner installation folder. ```APIDOC ## getInstallFolder() ### Description Returns the folder in which the RoadRunner wrappers are installed. ### Method N/A (C function) ### Endpoint N/A ### Parameters None ### Request Example ```c char* install_dir = getInstallFolder(); ``` ### Response #### Success Response - **char*** - Pointer to a string holding the install folder path. #### Response Example ```c char* install_dir = getInstallFolder(); printf("RoadRunner installed in: %s\n", install_dir); ``` ## setInstallFolder(const char *folder) ### Description Set the internal string containing the folder where the RoadRunner C wrappers are installed. ### Method N/A (C function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```c setInstallFolder("/opt/roadrunner/lib"); ``` ### Response #### Success Response - **bool** - Boolean indicating success. #### Response Example ```c bool success = setInstallFolder("/usr/local/roadrunner"); ``` ``` -------------------------------- ### Simulate Model with Custom Options (Example 1) Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/classrr_1_1RoadRunner.html Example demonstrating how to set simulation options for time, duration, and steps, and specifying a stiff integrator. ```cpp [RoadRunner](classrr_1_1RoadRunner.html#a04a6fd481cfacc2510d5d113520143ef) rr = [RoadRunner](classrr_1_1RoadRunner.html#a04a6fd481cfacc2510d5d113520143ef)("someFile.xml"); SimulateOptions opt = rr.getSimulateOptions(); opt.start = 0; opt.duration = 10; opt.steps = 1000; const DoubleMatrix *result = rr.simulate(&opt); ``` -------------------------------- ### Get Time Start Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/group__simulation.html Retrieves the current start time for the simulation. ```APIDOC ## GET /sys-bio/roadrunner/timeStart ### Description Get the value of the current time start. ### Method GET ### Endpoint /sys-bio/roadrunner/timeStart ### Parameters #### Query Parameters - **handle** (RRHandle) - Required - Handle to a RoadRunner instance ### Response #### Success Response (200) - **timeStart** (double) - The current value for the time start. #### Response Example ```json { "timeStart": 0.0 } ``` ``` -------------------------------- ### getTimeStart() - Get Simulation Start Time Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/OriginalDoxygenStyleDocs/html/group__simulation.html Retrieves the current start time of the simulation. ```APIDOC ## GET /sys-bio/roadrunner/getTimeStart ### Description Get the value of the current time start. ### Method GET ### Endpoint /sys-bio/roadrunner/getTimeStart ### Parameters #### Path Parameters - **handle** (RRHandle) - Required - Handle to a RoadRunner instance #### Query Parameters - **timeStart** (double*) - Required - Pointer to store the current value for the time start ### Response #### Success Response (200) - **success** (bool) - Returns true if successful #### Response Example ```json { "success": true, "timeStart": 0.0 } ``` ``` -------------------------------- ### Basic Plugin Usage Example Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/_sources/rrplugins/introduction.rst.txt A simple example demonstrating loading a 'test' plugin, setting its 'x' and 'y' properties, executing it, and printing the result from property 'z'. ```python import rrplugins as tel p = tel.Plugin("test") p.x = 1.2 p.y = 4.5 p.execute() print(p.z) ``` -------------------------------- ### Get Simulation Start Time Source: https://github.com/sys-bio/roadrunner/blob/develop/wrappers/C/html/group__simulation.html Retrieves the current start time of the simulation. Requires a valid RRHandle. ```c bool rrcCallConv getTimeStart(RRHandle handle, double *timeStart) ``` -------------------------------- ### Get Start Time of Simulation Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/group__simulation.html Retrieves the current start time for the simulation. Requires a handle to a RoadRunner instance. ```c bool rrcCallConv getTimeStart(RRHandle handle, double *timeStart) ``` ```c status = getTimeStart (rrHandle, &timeStart); ``` -------------------------------- ### Get Installation Folder Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/group__initialization.html Retrieves the installation directory of the RoadRunner C wrappers. Useful for locating necessary files or configurations. ```c char * getInstallFolder(void) ``` -------------------------------- ### Model Initialization and Setup Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/classrr_1_1CompiledExecutableModel-members.html Methods for initializing and setting up the simulation model. ```APIDOC ## setupDLLFunctions ### Description Sets up the necessary functions from the loaded DLL. ### Method POST ### Endpoint /api/model/setupDLLFunctions ### Response #### Success Response (200) - **status** (string) - Indicates success. #### Response Example ```json { "status": "success" } ``` ``` ```APIDOC ## setupModelData ### Description Initializes and sets up the internal data structures for the model. ### Method POST ### Endpoint /api/model/setupModelData ### Response #### Success Response (200) - **status** (string) - Indicates success. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Installation Source: https://github.com/sys-bio/roadrunner/blob/develop/source/thread-pool/README.md Instructions for installing the thread pool library using different methods. ```APIDOC ## Installation ### Including the Library Download the `thread_pool.hpp` header file and include it in your project: ```cpp #include "thread_pool.hpp" ``` ### Installing using vcpkg **Linux/macOS:** ```none ./vcpkg install bshoshany-thread-pool ``` **Windows:** ```none .\vcpkg install bshoshany-thread-pool:x86-windows bshoshany-thread-pool:x64-windows ``` After installation with vcpkg, include `thread_pool.hpp` directly in your project. ``` -------------------------------- ### Basic Simulation with Options Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/C++APIReference/rrRoadRunner.html A basic example of setting simulation duration and steps using `SimulateOptions` before calling the simulate function. ```cpp opt.duration = 10; opt.steps = 1000; const DoubleMatrix *result = rr.simulate(&opt); ``` -------------------------------- ### Project and Include Directories Setup Source: https://github.com/sys-bio/roadrunner/blob/develop/rrplugins/plugins/CMakeLists.txt Sets up the project name and includes directories for common plugin headers. Ensure RR_PLUGINS_ROOT is defined in your environment. ```cmake project(plugins) #Give all plugins access to headers in the following folders include_directories( ${RR_PLUGINS_ROOT}/rrplugins/core ${RR_PLUGINS_ROOT}/rrplugins/common ${RR_PLUGINS_ROOT}/rrplugins/math ${RR_PLUGINS_ROOT}/wrappers/C ) ``` -------------------------------- ### Install Roadrunner Library Components Source: https://github.com/sys-bio/roadrunner/blob/develop/rrplugins/plugins/test_model/CMakeLists.txt Configures the installation of the Roadrunner library targets for runtime, archive, and library components. Includes conditional installation for Python components and example files if BUILD_PYTHON is enabled. ```cmake install( TARGETS ${target} RUNTIME DESTINATION bin COMPONENT rrplugins ARCHIVE DESTINATION lib COMPONENT rrplugins LIBRARY DESTINATION lib COMPONENT rrplugins ) if(BUILD_PYTHON) install(TARGETS ${target} DESTINATION ${RR_PLUGINS_PYLIB_INSTALL_PREFIX} COMPONENT plugins) file(GLOB EXAMPLES docs/Examples/*) install(FILES ${EXAMPLES} DESTINATION "${RR_PLUGINS_PYTHON_INSTALL_PREFIX}" COMPONENT plugins) unset(EXAMPLES) endif() ``` -------------------------------- ### Simulate Model with Custom Options (Example 2) Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/classrr_1_1RoadRunner.html Example showing how to set integrator, simulation time, duration, steps, and integrator-specific options like 'seed' for the Gillespie integrator. ```cpp [RoadRunner](classrr_1_1RoadRunner.html#a04a6fd481cfacc2510d5d113520143ef) rr = [RoadRunner](classrr_1_1RoadRunner.html#a04a6fd481cfacc2510d5d113520143ef)("someFile.xml"); rr.setIntegrator("gillespie"); SimulateOptions opt; opt.start = 0; opt.duration = 10; opt.steps = 1000; opt.setItem("stiff", true); opt.setItem("seed", 12345); const DoubleMatrix *result = rr.simulate(&opt); ``` -------------------------------- ### Get Floating Species Initial Concentrations (Example) Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/group__initialConditions.html Example usage for retrieving initial floating species concentrations. Requires a valid RRHandle. ```c vec = [getFloatingSpeciesInitialConcentrations](group__initialConditions.html#ga69c0a516f028a0608d8b9167ff56111f) ([RRHandle](rrc__types_8h.html#a1d68f0592372208fa5a5f2799ea4b3ae) handle); ``` -------------------------------- ### Setup and Execute Minimization Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/source/rrplugins/rrplugins_LM_plugin.md This snippet loads necessary plugins, sets up a progress event handler, executes a model to generate data, configures the Levenberg-Marquardt minimizer with model data and parameters, and initiates the minimization process. ```python chiPlugin = Plugin("tel_chisquare") lm = Plugin("tel_levenberg_marquardt") modelPlugin = Plugin("tel_test_model") addNoisePlugin = Plugin("tel_add_noise") try: #========== EVENT FUNCTION SETUP =========================== def myEvent(dummy): #We are not capturing any data from the plugin, so just pass a dummy print('Iteration, Norm = ' + `lm.getProperty("NrOfIter")` + ', ' + `lm.getProperty("Norm")`) #Setup progress event function progressEvent = NotifyEventEx(myEvent) assignOnProgressEvent(lm.plugin, progressEvent) #============================================================ #Create model data, with and without noise using the test_model plugin modelPlugin.execute() #Setup lmfit properties. lm.SBML = modelPlugin.Model lm.ExperimentalData = modelPlugin.TestDataWithNoise # Add the parameters that we're going to fit and an initial 'start' value lm.setProperty("InputParameterList", ["k1", .3]) lm.setProperty("FittedDataSelectionList", "[S1] [S2]") lm.setProperty("ExperimentalDataSelectionList", "[S1] [S2]") # Start minimization lm.execute() print('Minimization finished. ==== Result ====') print('Fit engine status: ' + `lm.getProperty('StatusMessage')`) print('Hessian Matrix') print(lm.getProperty("Hessian")) print('Covariance Matrix') print(lm.getProperty("CovarianceMatrix")) print('ChiSquare = ' + `lm.getProperty("ChiSquare")`) print('Reduced ChiSquare = ' + `lm.getProperty("ReducedChiSquare")`) #This is a list of parameters parameters = tpc.getPluginProperty (lm.plugin, "OutputParameterList") confLimits = tpc.getPluginProperty (lm.plugin, "ConfidenceLimits") #Iterate trough list of parameters and confidence limits para = getFirstProperty(parameters) limit = getFirstProperty(confLimits) while para and limit: print(getPropertyName(para) + ' = ' + `getPropertyValue(para)` + ' +/- ' + `getPropertyValue(limit)`) para = getNextProperty(parameters) limit = getNextProperty(confLimits) # Get the fitted and residual data fittedData = lm.getProperty ("FittedData").toNumpy residuals = lm.getProperty ("Residuals").toNumpy # Get the experimental data as a numpy array experimentalData = modelPlugin.TestDataWithNoise.toNumpy telplugins.plot(fittedData [:,[0,1]], "blue", "-", "", "S1 Fitted") telplugins.plot(fittedData [:,[0,2]], "blue", "-", "", "S2 Fitted") telplugins.plot(residuals [:,[0,1]], "blue", "None", "x", "S1 Residual") telplugins.plot(residuals [:,[0,2]], "red", "None", "x", "S2 Residual") telplugins.plot(experimentalData [:,[0,1]], "red", "", "*", "S1 Data") telplugins.plot(experimentalData [:,[0,2]], "blue", "", "*", "S2 Data") telplugins.plt.show() except Exception as e: print('Problem.. ' + `e`) ``` -------------------------------- ### Get Simulation Time Start - C Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/OriginalDoxygenStyleDocs/html/group__simulation.html Retrieves the current start time of the simulation. Requires a valid RRHandle and a pointer to a double to store the result. ```c C_DECL_SPEC bool rrcCallConv getTimeStart ( [RRHandle](rrc__types_8h.html#a1d68f0592372208fa5a5f2799ea4b3ae) _handle_, double * _timeStart_ ) ``` ```c status = [getTimeStart](group__simulation.html#ga0d05bdfec6dd9387c64dd196ec3d880d) (rrHandle, &timeStart); ``` ```c C_DECL_SPEC bool rrcCallConv getTimeStart(RRHandle handle, double *timeStart) ``` -------------------------------- ### Run Monte Carlo Simulation Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/_sources/rrplugins/rrplugins_monte_carlo_plugin.rst.txt This snippet demonstrates the setup and execution of a Monte Carlo simulation. It includes configuring experimental data, selecting a minimization plugin, setting the number of runs, and defining input parameters and data selection lists. Use this to perform parameter fitting and uncertainty analysis. ```python myEvent = NotifyEventEx(myEventFunction) #Uncomment the event assignment below to plot each monte carlo data set #assignOnFinishedEvent(lmP.plugin, myEvent, None) #This will create test data with noise. We will use that as 'experimental' data modelP.execute() #Setup Monte Carlo properties. mcP.SBML = modelP.Model mcP.ExperimentalData = modelP.TestDataWithNoise #Select what minimization plugin to use #mcP.MinimizerPlugin = "Nelder-Mead" mcP.MinimizerPlugin = "Levenberg-Marquardt" mcP.NrOfMCRuns = 100 mcP.InputParameterList = ["k1", 1.5] mcP.FittedDataSelectionList = "[S1] [S2]" mcP.ExperimentalDataSelectionList = "[S1] [S2]" # Start Monte Carlo mcP.execute() ``` -------------------------------- ### Get Floating Species Initial Concentration IDs (Example) Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/group__initialConditions.html Example usage for retrieving initial floating species IDs. Requires a valid RRHandle. ```c vec = [getFloatingSpeciesInitialConcentrationIds](group__initialConditions.html#ga205905d483bb876f0557d8b40cba2213) ([RRHandle](rrc__types_8h.html#a1d68f0592372208fa5a5f2799ea4b3ae) handle); ``` -------------------------------- ### Write a Basic GoogleTest Example Source: https://github.com/sys-bio/roadrunner/blob/develop/test/googletest-master/docs/quickstart-cmake.md Includes the GoogleTest header and demonstrates basic assertions like EXPECT_STRNE and EXPECT_EQ. This file should be placed in your project directory. ```cpp #include // Demonstrate some basic assertions. TEST(HelloTest, BasicAssertions) { // Expect two strings not to be equal. EXPECT_STRNE("hello", "world"); // Expect equality. EXPECT_EQ(7 * 6, 42); } ``` -------------------------------- ### Minimal Plugin Example (Python) Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/docs-build/rrplugins/rrplugins_architecture.html A basic example demonstrating how to create a plugin for RoadRunner. This serves as a starting point for developing custom plugin functionalities. ```python import rrplugins class HelloRoadRunner(rrplugins.Plugin): def __init__(self): super(HelloRoadRunner, self).__init__() def __del__(self): super(HelloRoadRunner, self).__del__() def getName(self): return "HelloRoadRunner" def getVersion(self): return "1.0.0" def getRRInfo(self): return "Hello RoadRunner Plugin" def execute(self, input): print("Hello RoadRunner!") return "Hello RoadRunner!" ``` -------------------------------- ### Get Simulation Time Range Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/globals_func_g.html Retrieves the start and end times for the simulation. ```APIDOC ## GET /api/simulation/time ### Description Retrieves the start and end times for the simulation. ### Method GET ### Endpoint /api/simulation/time ### Response #### Success Response (200) - **timeStart** (number) - The start time of the simulation. - **timeEnd** (number) - The end time of the simulation. #### Response Example { "timeStart": 0.0, "timeEnd": 100.0 } ``` -------------------------------- ### Install Library Components Source: https://github.com/sys-bio/roadrunner/blob/develop/rrplugins/plugins/monte_carlo_bs/CMakeLists.txt Defines installation rules for the target library, specifying runtime, archive, and library destinations and components. ```cmake install( TARGETS ${target} RUNTIME DESTINATION bin COMPONENT rrplugins ARCHIVE DESTINATION lib COMPONENT rrplugins LIBRARY DESTINATION lib COMPONENT rrplugins ) ``` -------------------------------- ### Conditional Python Plugin Installation Source: https://github.com/sys-bio/roadrunner/blob/develop/rrplugins/plugins/add_noise/CMakeLists.txt Conditionally installs the 'add_noise' library and associated example files into Python-specific directories if the BUILD_PYTHON flag is enabled. This facilitates Python integration. ```cmake if(BUILD_PYTHON) install (TARGETS ${target} DESTINATION ${RR_PLUGINS_PYLIB_INSTALL_PREFIX} COMPONENT plugins ) file(GLOB EXAMPLES docs/*) install(FILES ${EXAMPLES} DESTINATION "${RR_PLUGINS_PYTHON_INSTALL_PREFIX}" COMPONENT plugins) unset(EXAMPLES) endif() ``` -------------------------------- ### Get Floating Species Initial Condition IDs (Example) Source: https://github.com/sys-bio/roadrunner/blob/develop/wrappers/C/html/group__initial_conditions.html Example usage for retrieving floating species initial condition IDs. This function requires a handle to a RoadRunner instance. ```c vec = getFloatingSpeciesInitialConcentrationIds(handle); ``` -------------------------------- ### Example Usage of simulateEx Source: https://github.com/sys-bio/roadrunner/blob/develop/wrappers/C/html/group__simulation.html An example demonstrating how to call the simulateEx function with specific simulation parameters. ```c RRCDataPtr m; double timeStart = 0.0; double timeEnd = 25; int numberOfPoints = 200; m = simulateEx(rrHandle, timeStart, timeEnd, numberOfPoints); ``` -------------------------------- ### Simulation Time Control API Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/rrRoadRunnerData_8h_source.html Functions to get the start and end times of the simulation. ```APIDOC ## GET /simulation/time/start ### Description Get the value of the current time start. ### Method GET ### Endpoint /simulation/time/start ### Parameters #### Query Parameters - **handle** (RRHandle) - Required - Handle to the RoadRunner instance. ### Response #### Success Response (200) - **timeStart** (double *) - Pointer to a double that will store the time start value. ## GET /simulation/time/end ### Description Get the value of the current time end. ### Method GET ### Endpoint /simulation/time/end ### Parameters #### Query Parameters - **handle** (RRHandle) - Required - Handle to the RoadRunner instance. ### Response #### Success Response (200) - **timeEnd** (double *) - Pointer to a double that will store the time end value. ``` -------------------------------- ### Create JIT Engine with LLVM Backend Options Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/doxygen-output/html/_2home_2vsts_2work_21_2s_2source_2llvm_2JitFactory_8h-example.html Instantiate a JIT engine using LoadSBMLOptions, specifying the LLVM backend. Options include MCJIT or LLJit. ```cpp LoadSBMLOptions opt; opt.setLLVMBackend(LoadSBMLOptions::MCJIT); // or LoadSBMLOptions::LLJit; std::unique_ptr j = JitFactory::makeJitEngine(opt.modelGeneratorOpt); ``` -------------------------------- ### Load and Setup Plugins Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/rrplugins/rrplugins_LM_plugin.html Loads necessary plugins for chi-square, Levenberg-Marquardt optimization, model testing, and noise addition. It also sets up a progress event function to monitor the minimization process. ```python chiPlugin = Plugin("tel_chisquare") lm = Plugin("tel_levenberg_marquardt") modelPlugin = Plugin("tel_test_model") addNoisePlugin = Plugin("tel_add_noise") try: #========== EVENT FUNCTION SETUP =========================== def myEvent(dummy): #We are not capturing any data from the plugin, so just pass a dummy print('Iteration, Norm = ' + `lm.getProperty("NrOfIter")` + ', ' + `lm.getProperty("Norm")`) #Setup progress event function progressEvent = NotifyEventEx(myEvent) assignOnProgressEvent(lm.plugin, progressEvent) #============================================================ #Create model data, with and without noise using the test_model plugin modelPlugin.execute() #Setup lmfit properties. lm.SBML = modelPlugin.Model lm.ExperimentalData = modelPlugin.TestDataWithNoise # Add the parameters that we're going to fit and an initial 'start' value lm.setProperty("InputParameterList", ["k1", .3]) lm.setProperty("FittedDataSelectionList", "[S1] [S2]") lm.setProperty("ExperimentalDataSelectionList", "[S1] [S2]") # Start minimization lm.execute() print('Minimization finished. \n==== Result ====') print('Fit engine status: ' + `lm.getProperty('StatusMessage')`) print('Hessian Matrix') print(lm.getProperty("Hessian")) print('Covariance Matrix') print(lm.getProperty("CovarianceMatrix")) print('ChiSquare = ' + `lm.getProperty("ChiSquare")`) print('Reduced ChiSquare = ' + `lm.getProperty("ReducedChiSquare")`) #This is a list of parameters parameters = tpc.getPluginProperty (lm.plugin, "OutputParameterList") confLimits = tpc.getPluginProperty (lm.plugin, "ConfidenceLimits") #Iterate trough list of parameters and confidence limits para = getFirstProperty(parameters) limit = getFirstProperty(confLimits) while para and limit: print(getPropertyName(para) + ' = ' + `getPropertyValue(para)` + ' +/- ' + `getPropertyValue(limit)`) para = getNextProperty(parameters) limit = getNextProperty(confLimits) # Get the fitted and residual data fittedData = lm.getProperty ("FittedData").toNumpy residuals = lm.getProperty ("Residuals").toNumpy # Get the experimental data as a numpy array experimentalData = modelPlugin.TestDataWithNoise.toNumpy telplugins.plot(fittedData [:,[0,1]], "blue", "-", "", "S1 Fitted") telplugins.plot(fittedData [:,[0,2]], "blue", "-", "", "S2 Fitted") telplugins.plot(residuals [:,[0,1]], "blue", "None", "x", "S1 Residual") telplugins.plot(residuals [:,[0,2]], "red", "None", "x", "S2 Residual") telplugins.plot(experimentalData [:,[0,1]], "red", "", "*", "S1 Data") telplugins.plot(experimentalData [:,[0,2]], "blue", "", "*", "S2 Data") telplugins.plt.show() except Exception as e: print('Problem.. ' + `e`) ``` -------------------------------- ### Time Parameters Source: https://github.com/sys-bio/roadrunner/blob/develop/wrappers/C/html/rrc__api_8h_source.html Functions to get the start time, end time, and number of points for simulations. ```APIDOC ## GET /api/simulation/timestart ### Description Retrieves the start time of the simulation. ### Method GET ### Endpoint /api/simulation/timestart ### Parameters #### Path Parameters None #### Query Parameters - **handle** (RRHandle) - Required - Handle to the simulation model. ### Request Example ```json { "handle": "your_model_handle" } ``` ### Response #### Success Response (200) - **timeStart** (double) - The start time of the simulation. #### Response Example ```json { "timeStart": 0.0 } ``` ``` ```APIDOC ## GET /api/simulation/timeend ### Description Retrieves the end time of the simulation. ### Method GET ### Endpoint /api/simulation/timeend ### Parameters #### Path Parameters None #### Query Parameters - **handle** (RRHandle) - Required - Handle to the simulation model. ### Request Example ```json { "handle": "your_model_handle" } ``` ### Response #### Success Response (200) - **timeEnd** (double) - The end time of the simulation. #### Response Example ```json { "timeEnd": 10.0 } ``` ``` ```APIDOC ## GET /api/simulation/numpoints ### Description Retrieves the number of data points for the simulation. ### Method GET ### Endpoint /api/simulation/numpoints ### Parameters #### Path Parameters None #### Query Parameters - **handle** (RRHandle) - Required - Handle to the simulation model. ### Request Example ```json { "handle": "your_model_handle" } ``` ### Response #### Success Response (200) - **numPoints** (int) - The number of data points. #### Response Example ```json { "numPoints": 100 } ``` ``` -------------------------------- ### Simulation Time Control API Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/OriginalDoxygenStyleDocs/html/rr_road_runner_data_8h_source.html Functions to get the start and end times of the current simulation. ```APIDOC ## Simulation Time Control ### GET /simulation/time/start #### Description Retrieves the start time of the current simulation. #### Method GET #### Endpoint /simulation/time/start #### Parameters ##### Query Parameters - **handle** (RRHandle) - Required - Handle to the RoadRunner instance. #### Response ##### Success Response (200) - **timeStart** (double*) - Pointer to a double that will store the start time. ### GET /simulation/time/end #### Description Retrieves the end time of the current simulation. #### Method GET #### Endpoint /simulation/time/end #### Parameters ##### Query Parameters - **handle** (RRHandle) - Required - Handle to the RoadRunner instance. #### Response ##### Success Response (200) - **timeEnd** (double*) - Pointer to a double that will store the end time. ``` -------------------------------- ### Enable Test and Example Builds Source: https://github.com/sys-bio/roadrunner/blob/develop/source/parallel-hashmap/CMakeLists.txt Configures options to enable building tests and examples. These options are typically controlled by the master project. ```cmake option(PHMAP_BUILD_TESTS "Whether or not to build the tests" ${PHMAP_MASTER_PROJECT}) option(PHMAP_BUILD_EXAMPLES "Whether or not to build the examples" ${PHMAP_MASTER_PROJECT}) ``` -------------------------------- ### Install CPython Debug Build (Windows) Source: https://github.com/sys-bio/roadrunner/blob/develop/docs/docs-build/developers_docs/build_with_python_debug.html This command installs the CPython debug build into the specified directory. Ensure the paths for `-d`, `-s`, `-b`, and `--copy install-cpython/x64/dbg` are correct for your setup. ```batch .\python.bat .\PC\layout\ -d -s . -b .\PCbuild\amd64\ --copy install-cpython/x64/dbg --preset-default ```