From ddd38c14569f7824627b1fbc380db78befba9319 Mon Sep 17 00:00:00 2001 From: Matthew Carroll <28577806+MJC598@users.noreply.github.com> Date: Wed, 22 Jul 2026 16:07:30 -0400 Subject: [PATCH 1/5] [Feature] Indexing a Simulation (#150) * Adding a ModelProxy for overloading the `[]` operator for Sim. Additionally changing returns to `up` ownership for easier pybinding * documentation update --- tests/unit/simulation_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/simulation_test.cpp b/tests/unit/simulation_test.cpp index 21b75bdb..21b26d8e 100644 --- a/tests/unit/simulation_test.cpp +++ b/tests/unit/simulation_test.cpp @@ -4,7 +4,7 @@ // Created Date: 2026-02-09 // // Author: Matthew Carroll // // ----- // -// Last Modified: 2026-07-15 // +// Last Modified: 2026-08-19 // // Modified By: Matthew Carroll // // ----- // // Copyright (c) 2026 Syndemics Lab at Boston Medical Center // From b423f81aa874893e9dc5704dff1403916aa8aed2 Mon Sep 17 00:00:00 2001 From: Matthew Carroll <28577806+MJC598@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:52:40 -0400 Subject: [PATCH 2/5] [Feature] Timestep Index Operator (#151) * adding timestep index operator overload * adding AddTransition function to timestep * updating docs and tests --- tests/unit/timestep_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/timestep_test.cpp b/tests/unit/timestep_test.cpp index b230e920..4dc2d33c 100644 --- a/tests/unit/timestep_test.cpp +++ b/tests/unit/timestep_test.cpp @@ -4,7 +4,7 @@ // Created Date: 2026-07-06 // // Author: Matthew Carroll // // ----- // -// Last Modified: 2026-07-09 // +// Last Modified: 2026-08-19 // // Modified By: Matthew Carroll // // ----- // // Copyright (c) 2026 Syndemics Lab at Boston Medical Center // From 9dfa4a359234ec548e4127c158f30d3ecb4b3321 Mon Sep 17 00:00:00 2001 From: Matthew Carroll <28577806+MJC598@users.noreply.github.com> Date: Wed, 19 Aug 2026 11:41:37 -0400 Subject: [PATCH 3/5] fixing the run function in benchmarking --- extras/benchmark/src/benchmark_respond.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/benchmark/src/benchmark_respond.cpp b/extras/benchmark/src/benchmark_respond.cpp index fbc49e51..a3cb4311 100644 --- a/extras/benchmark/src/benchmark_respond.cpp +++ b/extras/benchmark/src/benchmark_respond.cpp @@ -4,7 +4,7 @@ // Created Date: 2026-04-27 // // Author: Matthew Carroll // // ----- // -// Last Modified: 2026-07-09 // +// Last Modified: 2026-08-18 // // Modified By: Matthew Carroll // // ----- // // Copyright (c) 2026 Syndemics Lab at Boston Medical Center // @@ -325,10 +325,10 @@ TimedRunResult TimeOneSample(respond::Simulation sim, const double checksum = sim.GetModels()[0]->GetState().sum(); std::size_t recorded_points = 0; - const auto histories = sim.GetModelHistories()[0]; + const auto histories = sim.GetModelHistory(0); const auto state_history = histories.find("state"); if (state_history != histories.end()) { - recorded_points = state_history->second.size(); + recorded_points = state_history->second.GetStateAsVector().size(); } DoNotOptimize(checksum); ClobberMemory(); From a88f0a473db4a27b282f3c5ad03f424bfb672069 Mon Sep 17 00:00:00 2001 From: Matthew Carroll <28577806+MJC598@users.noreply.github.com> Date: Wed, 19 Aug 2026 11:50:42 -0400 Subject: [PATCH 4/5] fixing benchmarking to utilize the deep copy and produce correct checksums --- extras/benchmark/src/benchmark_respond.cpp | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/extras/benchmark/src/benchmark_respond.cpp b/extras/benchmark/src/benchmark_respond.cpp index a3cb4311..106ccc87 100644 --- a/extras/benchmark/src/benchmark_respond.cpp +++ b/extras/benchmark/src/benchmark_respond.cpp @@ -55,7 +55,7 @@ inline void ClobberMemory() { #endif struct BenchmarkConfig { - std::size_t state_size = 200; + std::size_t state_size = 64; int steps = 365; int warmup_iterations = 5; int sample_iterations = 25; @@ -158,7 +158,7 @@ void PrintUsage(const char *program_name) { std::cout << "Usage: " << program_name << " [options]\n\n" << "Options:\n" - << " --state-size Number of state dimensions (default: 200)\n" + << " --state-size Number of state dimensions (default: 64)\n" << " --steps Number of simulation timesteps per sample " "(default: 365)\n" << " --warmup Warm-up iterations per repetition (default: " @@ -280,8 +280,6 @@ respond::Timestep CreateTestTimestep(std::size_t state_size) { ts.CreateTransition("behavior"); ts.AddMatrixToTransition("behavior", MakeShiftMatrix(state_size, 0.985, 1)); - auto temp = ts.GetTransition("behavior")->clone(); - ts.CreateTransition("intervention"); ts.AddMatrixToTransition("intervention", MakeShiftMatrix(state_size, 0.990, -1)); @@ -304,31 +302,36 @@ respond::Simulation BuildSimulation(std::size_t state_size, size_t duration) { respond::Simulation sim; sim.CreateNewModel("markov"); - sim.GetModels()[0]->SetHistoryCaptureInterval(history_capture_interval); - sim.GetModels()[0]->SetFinalTimestep(duration); + sim[0]->SetHistoryCaptureInterval(history_capture_interval); + sim[0]->SetFinalTimestep(static_cast(duration)); auto timestep = CreateTestTimestep(state_size); for (size_t t = 0; t < duration; ++t) { - sim.GetModels()[0]->AddTimestep(timestep); + sim[0]->AddTimestep(timestep); } return sim; } TimedRunResult TimeOneSample(respond::Simulation sim, const Eigen::VectorXd &initial_state, int steps) { - sim.GetModels()[0]->SetState(initial_state); - sim.GetModels()[0]->CreateDefaultHistories(); + sim[0]->SetState(initial_state); + sim[0]->CreateDefaultHistories(); const auto start = Clock::now(); sim.Run(steps); const auto end = Clock::now(); - const double checksum = sim.GetModels()[0]->GetState().sum(); + if (sim[0]->GetTimestep() != steps) { + throw std::runtime_error("Benchmark ran an unexpected number of " + "timesteps."); + } + + const double checksum = sim[0]->GetState().sum(); std::size_t recorded_points = 0; - const auto histories = sim.GetModelHistory(0); + const auto &histories = sim.GetModelHistory(0); const auto state_history = histories.find("state"); if (state_history != histories.end()) { - recorded_points = state_history->second.GetStateAsVector().size(); + recorded_points = state_history->second.GetRecordedStates().size(); } DoNotOptimize(checksum); ClobberMemory(); From 0a5ed066ecd48f0ced927d86fb3eb42d2acb63e4 Mon Sep 17 00:00:00 2001 From: Matthew Carroll <28577806+MJC598@users.noreply.github.com> Date: Wed, 19 Aug 2026 11:55:12 -0400 Subject: [PATCH 5/5] fixing release workflow name collision --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6cbbc71..abd6b270 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,10 @@ jobs: cmake --preset package-${{matrix.build-variant}} && cmake --build --preset package-${{matrix.build-variant}} - name: Run CPack run: | - cpack --preset ${{matrix.package-type}}-${{matrix.build-variant}} + cpack --preset ${{matrix.package-type}}-${{matrix.build-variant}} \ + -D CPACK_PACKAGE_NAME=respond-${{matrix.build-variant}} \ + -D CPACK_RPM_PACKAGE_NAME=respond-${{matrix.build-variant}} \ + -D CPACK_DEBIAN_PACKAGE_NAME=respond-${{matrix.build-variant}} - name: Upload Linux Package to Release uses: svenstaro/upload-release-action@v2