Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a871ba6
first working example
reneSchm Sep 3, 2025
f65c9b2
typename FPMerge branch 'main' into abm-parameter-study
reneSchm Sep 17, 2025
7f69da2
[wip] parameter studies v2
reneSchm Oct 9, 2025
eaaa5c2
[wip] add run_idx to create_sim function
reneSchm Oct 9, 2025
280afa5
mpi wokrks
xsaschako Oct 9, 2025
f52035d
use ParameterStudy2 in ode_secir examples
reneSchm Oct 16, 2025
6df3ab5
Merge branch 'abm-parameter-study' of github.com:SciCompMod/memilio i…
reneSchm Oct 16, 2025
47088f7
[wip] remove old ParameterStudies from cpp
reneSchm Oct 21, 2025
703e03a
Merge branch 'main' into abm-parameter-study
reneSchm Oct 21, 2025
2646042
Fix up ode_secir_read_graph
reneSchm Oct 21, 2025
9b593f5
patch python bindings to mostly emulate old ParameterStudy behaviour
reneSchm Oct 22, 2025
df4f000
explicit type conversion
reneSchm Oct 22, 2025
2d278c0
another explicit type conversion
reneSchm Oct 22, 2025
5fa14f4
improve coverage
reneSchm Oct 22, 2025
c6e292a
move abm study, restore minimal abm
reneSchm Oct 23, 2025
3af580c
clean up examples, improve mpi handling
reneSchm Oct 23, 2025
4371622
add hdf5 dep to abm study example
reneSchm Oct 23, 2025
fe9ef05
improve non-PS coverage
reneSchm Oct 24, 2025
fcde395
remove Simulation template from ParameterStudy2.
reneSchm Oct 24, 2025
63b7a6d
remove developement artifacts
reneSchm Oct 24, 2025
9bae572
small cleanup, add test
reneSchm Oct 27, 2025
9e1de1e
Merge branch 'main' into abm-parameter-study
reneSchm Oct 27, 2025
651f1ba
change name back to ParameterStudy
reneSchm Oct 28, 2025
ea3acde
update parameters to run
xsaschako Oct 29, 2025
f23f5ff
Revert "update parameters to run"
reneSchm Oct 29, 2025
6b21559
update rng log message
reneSchm Nov 6, 2025
7dc86ac
[ci skip] Apply suggestions from code review
reneSchm Nov 6, 2025
3db2bcd
remove out of scope index ctor
reneSchm Nov 7, 2025
67dfb49
fix comment
reneSchm Nov 7, 2025
5c03d29
Apply suggestions from code review
reneSchm Nov 7, 2025
665f8c4
[ci skip] clarify comment on abm study creation
reneSchm Nov 7, 2025
35fb3a1
[ci skip] review suggestion
reneSchm Nov 7, 2025
7819b98
[ci skip] update parameter study class description
reneSchm Nov 10, 2025
da4495d
allow for process_simulation_result to return void
reneSchm Nov 14, 2025
6e3769e
clean up MEMILIO_BASE_DIR
reneSchm Nov 14, 2025
c8c8297
add documentation
reneSchm Nov 14, 2025
0c1e723
do not use native paths, as windows's backslashes escape random letters
reneSchm Nov 14, 2025
8d39db9
[ci skip] better explanation for "void run()"
reneSchm Nov 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve non-PS coverage
  • Loading branch information
reneSchm committed Oct 24, 2025
commit fe9ef05ddbc5a72cd832f0bd0af174105cfaba14
29 changes: 29 additions & 0 deletions cpp/tests/test_abm_simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
* limitations under the License.
*/
#include "abm/location_type.h"
#include "abm/simulation.h"
#include "abm/result_simulation.h"
#include "abm/time.h"
#include "abm_helpers.h"
#include "abm/common_abm_loggers.h"
#include "matchers.h"
#include "memilio/io/history.h"
#include <cstddef>
#include <cstdint>

TEST(TestSimulation, advance_random)
Expand Down Expand Up @@ -143,3 +147,28 @@ TEST(TestSimulation, advanceWithCommonHistory)
3); // Check if all persons are in the delta-logger Mobility helper entry 0, 3 persons
EXPECT_EQ(logMobilityInfoDelta[1].size(), 3); // Check if all persons are in the delta-log first entry, 3 persons
}

TEST(TestSimulation, ResultSimulation)
{
// run a ResultSimulation on a minimal setup
auto model = mio::abm::Model(num_age_groups);
auto location = model.add_location(mio::abm::LocationType::Home);
auto person = model.add_person(location, age_group_15_to_34);

model.assign_location(person, location);

const auto t0 = mio::abm::TimePoint(0) + mio::abm::hours(100);
const auto tmax = t0 + mio::abm::hours(50);
auto sim = mio::abm::ResultSimulation(std::move(model), t0);

// run simulation. expect one timepopint per day, but nothing to change in the results
Comment thread
reneSchm marked this conversation as resolved.
Outdated
sim.advance(tmax);
const size_t N = (size_t)(tmax - t0).hours() + 1;
ASSERT_EQ(sim.get_result().get_num_time_points(), N);
EXPECT_THAT(sim.get_result().get_times(), ElementsAreLinspace(t0.days(), tmax.days(), N));
for (const auto& tp : sim.get_result()) {
EXPECT_EQ(tp.sum(), 1.0);
}
EXPECT_EQ(sim.get_result().get_value(0)[(Eigen::Index)mio::abm::InfectionState::Susceptible], 1.0);
EXPECT_EQ(sim.get_result().get_value(N - 1)[(Eigen::Index)mio::abm::InfectionState::Susceptible], 1.0);
}
13 changes: 13 additions & 0 deletions cpp/tests/test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "memilio/utils/base_dir.h"
#include "memilio/utils/index.h"
#include "memilio/utils/index_range.h"
#include "memilio/utils/logging.h"
Expand All @@ -27,6 +28,8 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <boost/filesystem.hpp>

template <size_t Tag>
struct CategoryTag : public mio::Index<CategoryTag<Tag>> {
CategoryTag(size_t value)
Expand Down Expand Up @@ -160,3 +163,13 @@ TEST(TestUtils, RedirectLogger)

logger.release();
}

TEST(TestUtils, base_dir)
{
auto base_dir = boost::filesystem::path(mio::base_dir());
// check that the path exists
EXPECT_TRUE(boost::filesystem::exists(base_dir));
// check that the path is correct, by sampling some fixed paths from project files
EXPECT_TRUE(boost::filesystem::exists(base_dir / "cpp" / "memilio"));
EXPECT_TRUE(boost::filesystem::exists(base_dir / "pycode" / "memilio-epidata"));
}