The RESPOND model can be used in multiple ways:
- As a C++ library - Integrate into your own C++ projects
- Via Python package - Use the higher-level respondpy interface
- Standalone executable - Legacy support for direct command-line execution
Using RESPOND as a C++ Library
For C++ developers, RESPOND can be integrated directly into projects. See the C++ API Guide for:
- Complete API reference
- Usage examples
- Memory management details
- Design patterns and best practices
Basic Example
#include <respond/simulation.hpp>
#include <respond/model.hpp>
int main() {
Eigen::VectorXd initial_state(50);
initial_state.setZero();
initial_state(0) = 1000;
model->SetState(initial_state);
"behavior", "my_logger");
model->AddTransition(transition);
sim.AddModel(model);
for (int t = 0; t < 52; ++t) {
sim.Run();
}
auto histories = sim.GetModelHistories();
return 0;
}
static std::unique_ptr< Model > Create(const std::string &name, const std::string &log_name="console")
Factory method to create a Model instance.
Manages and executes multiple models in a coordinated simulation. A Simulation aggregates Model insta...
Definition: simulation.hpp:30
static std::unique_ptr< Transition > CreateTransition(const std::string &type, const std::string &log_name)
Creates a transition of the specified type.
For complete examples and API documentation, see the C++ API Guide.
Using the Standalone Executable
Legacy support for standalone execution is available in release v0.3.0.
Command-Line Usage
To run the executable (requires legacy release):
./respond_exe /path/to/input/folders 1 1
Arguments
The executable takes 3 positional arguments:
- Input folder path: Directory containing simulation configuration and data
- Start folder index: First input folder number (e.g., 1 for
input1)
- End folder index: Last input folder number (inclusive)
Examples
# Run single input folder
./respond_exe /home/user/data 1 1
# Run folders input1, input2, input3
./respond_exe /home/user/data 1 3
# Run folders input5 through input10
./respond_exe /home/user/data 5 10
Output
The executable produces output files in the same directory as the input data.
Python Integration
For a higher-level interface, use the respondpy Python package:
import respondpy as respond
results = sim.run()
See the respondpy documentation for details.
Previous: Data
Next: Under the Hood