Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes test Set_Gillespie_Random_Seed to fail less. #1224

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions test/model_analysis/model_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1738,11 +1738,15 @@ TEST_F(ModelAnalysisTests, Set_Gillespie_Random_Seed) {
RoadRunner rr1((modelAnalysisModelsDir / "gillespie_random_seed.xml").string());
RoadRunner rr2((modelAnalysisModelsDir / "gillespie_random_seed.xml").string());
rr1.setIntegrator("gillespie");
rr1.getIntegrator()->setValue("variable_step_size", true);
rr1.setSeed(-1, false);
rr1.simulate(0, 10, 2);
const ls::DoubleMatrix* rr1_results = rr1.simulate(0, 10, 2);
rr2.setIntegrator("gillespie");
rr1.getIntegrator()->setValue("variable_step_size", true);
rr2.setSeed(-1, false);
rr2.simulate(0, 10, 2);
EXPECT_NE(rr1.getValue("S2"), rr2.getValue("S2"));
const ls::DoubleMatrix* rr2_results = rr2.simulate(0, 10, 2);
// With a variable step size, every time step is a random draw, which should be different.
EXPECT_NE(rr1_results->Element(1, 0), rr2_results->Element(1, 0));
//std::cout << rr1_results->Element(1, 0) << ", " << rr2_results->Element(1, 0) << std::endl;
}

Loading