From a8a56c6ddddf7d2fc1567a5307958a4bef18360b Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Wed, 28 Feb 2024 13:30:51 -0600 Subject: [PATCH 1/3] rename random distributions for clarity --- src/storage.cc | 18 +++++++++--------- src/storage.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/storage.cc b/src/storage.cc index 71962f95d..9c75a40d9 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -60,13 +60,13 @@ void Storage::InitBuyPolicyParameters() { } if (active_buying_frequency_type == "Fixed") { - active_dist_ = boost::shared_ptr(new cyclus::FixedIntDist(active_buying_val)); + active_dist_ = cyclus::FixedIntDist::Ptr (new cyclus::FixedIntDist(active_buying_val)); } else if (active_buying_frequency_type == "Uniform") { if ((active_buying_min == -1) || (active_buying_max == -1)) { throw cyclus::ValueError("Invalid active buying frequency range. Please provide both a min and max value."); } - active_dist_ = boost::shared_ptr(new cyclus::UniformIntDist(active_buying_min, active_buying_max)); + active_dist_ = cyclus::UniformIntDist>(new cyclus::UniformIntDist(active_buying_min, active_buying_max)); } else if (active_buying_frequency_type == "Normal") { if ((active_buying_mean == -1) || (active_buying_stddev == -1)) { @@ -76,7 +76,7 @@ void Storage::InitBuyPolicyParameters() { if (active_buying_max == -1) { active_buying_max = std::numeric_limits::max();} - active_dist_ = boost::shared_ptr(new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, + active_dist_ = cyclus::NormalIntDist>(new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, active_buying_min, active_buying_max)); } else { @@ -84,13 +84,13 @@ void Storage::InitBuyPolicyParameters() { /// set up dormant buying distribution if (dormant_buying_frequency_type == "Fixed") { - dormant_dist_ = boost::shared_ptr(new cyclus::FixedIntDist(dormant_buying_val)); + dormant_dist_ = cyclus::FixedIntDist>(new cyclus::FixedIntDist(dormant_buying_val)); } else if (dormant_buying_frequency_type == "Uniform") { if ((dormant_buying_min == -1) || (dormant_buying_max == -1)) { throw cyclus::ValueError("Invalid dormant buying frequency range. Please provide both a min and max value."); } - dormant_dist_ = boost::shared_ptr(new cyclus::UniformIntDist(dormant_buying_min, dormant_buying_max)); + dormant_dist_ = cyclus::UniformIntDist>(new cyclus::UniformIntDist(dormant_buying_min, dormant_buying_max)); } else if (dormant_buying_frequency_type == "Normal") { if ((dormant_buying_mean == -1) || (dormant_buying_stddev == -1)) { @@ -99,7 +99,7 @@ void Storage::InitBuyPolicyParameters() { if (dormant_buying_min == -1) {dormant_buying_min = 1;} if (dormant_buying_max == -1) { dormant_buying_max = std::numeric_limits::max();} - dormant_dist_ = boost::shared_ptr(new cyclus::NormalIntDist(dormant_buying_mean, dormant_buying_stddev, + dormant_dist_ = cyclus::NormalIntDist>(new cyclus::NormalIntDist(dormant_buying_mean, dormant_buying_stddev, dormant_buying_min, dormant_buying_max)); } else { @@ -107,13 +107,13 @@ void Storage::InitBuyPolicyParameters() { /// set up buying size distribution if (buying_size_type == "Fixed") { - size_dist_ = boost::shared_ptr(new cyclus::FixedDoubleDist(buying_size_val)); + size_dist_ = cyclus::FixedDoubleDist>(new cyclus::FixedDoubleDist(buying_size_val)); } else if (buying_size_type == "Uniform") { if ((buying_size_min == -1) || (buying_size_max == -1)) { throw cyclus::ValueError("Invalid buying size range. Please provide both a min and max value."); } - size_dist_ = boost::shared_ptr(new cyclus::UniformDoubleDist(buying_size_min, buying_size_max)); + size_dist_ = cyclus::UniformDoubleDist>(new cyclus::UniformDoubleDist(buying_size_min, buying_size_max)); } else if (buying_size_type == "Normal") { if ((buying_size_mean == -1) || (buying_size_stddev == -1)) { @@ -121,7 +121,7 @@ void Storage::InitBuyPolicyParameters() { } if (buying_size_min == -1) {buying_size_min = 0;} if (buying_size_max == -1) {buying_size_max = 1;} - size_dist_ = boost::shared_ptr(new cyclus::NormalDoubleDist(buying_size_mean, buying_size_stddev, + size_dist_ = cyclus::NormalDoubleDist>(new cyclus::NormalDoubleDist(buying_size_mean, buying_size_stddev, buying_size_min, buying_size_max)); } else { diff --git a/src/storage.h b/src/storage.h index b8683e288..36f6acc17 100644 --- a/src/storage.h +++ b/src/storage.h @@ -486,9 +486,9 @@ class Storage } double longitude; - boost::shared_ptr active_dist_ = NULL; - boost::shared_ptr dormant_dist_ = NULL; - boost::shared_ptr size_dist_ = NULL; + cyclus::IntDistribution::Ptr active_dist_ = NULL; + cyclus::IntDistribution::Ptr dormant_dist_ = NULL; + cyclus::DoubleDistribution::Ptr size_dist_ = NULL; cyclus::toolkit::Position coordinates; From dd39ed4e52d91507b2ec6039abc908d79e1d8b32 Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Wed, 28 Feb 2024 13:32:13 -0600 Subject: [PATCH 2/3] changelog --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cd95bbd0e..0ebc4bee8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,7 +8,7 @@ cycamore Change Log * Downstream testing in CI workflows (#573, #580, #582, #583) * GitHub workflow for publishing images on release (#573, #582, #583) * GitHub workflows for building/testing on a PR and push to `main` (#549, #564, #573, #582, #583) -* Add functionality for random behavior on the size (#550) and frequency (#565) of a sink +* Add functionality for random behavior on the size (#550) and frequency (#565) of a sink (#586) * GitHub workflow to check that the CHANGELOG has been updated (#562) * Added inventory policies to Storage through the material buy policy (#574) From a8eef67f17a17c2d1eab5e758d192ffa00db6216 Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Wed, 28 Feb 2024 13:39:51 -0600 Subject: [PATCH 3/3] you should check your find-replace handiwork before pushing --- src/storage.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/storage.cc b/src/storage.cc index 9c75a40d9..e01317983 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -66,7 +66,7 @@ void Storage::InitBuyPolicyParameters() { if ((active_buying_min == -1) || (active_buying_max == -1)) { throw cyclus::ValueError("Invalid active buying frequency range. Please provide both a min and max value."); } - active_dist_ = cyclus::UniformIntDist>(new cyclus::UniformIntDist(active_buying_min, active_buying_max)); + active_dist_ = cyclus::UniformIntDist::Ptr (new cyclus::UniformIntDist(active_buying_min, active_buying_max)); } else if (active_buying_frequency_type == "Normal") { if ((active_buying_mean == -1) || (active_buying_stddev == -1)) { @@ -76,7 +76,7 @@ void Storage::InitBuyPolicyParameters() { if (active_buying_max == -1) { active_buying_max = std::numeric_limits::max();} - active_dist_ = cyclus::NormalIntDist>(new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, + active_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, active_buying_min, active_buying_max)); } else { @@ -84,13 +84,13 @@ void Storage::InitBuyPolicyParameters() { /// set up dormant buying distribution if (dormant_buying_frequency_type == "Fixed") { - dormant_dist_ = cyclus::FixedIntDist>(new cyclus::FixedIntDist(dormant_buying_val)); + dormant_dist_ = cyclus::FixedIntDist::Ptr (new cyclus::FixedIntDist(dormant_buying_val)); } else if (dormant_buying_frequency_type == "Uniform") { if ((dormant_buying_min == -1) || (dormant_buying_max == -1)) { throw cyclus::ValueError("Invalid dormant buying frequency range. Please provide both a min and max value."); } - dormant_dist_ = cyclus::UniformIntDist>(new cyclus::UniformIntDist(dormant_buying_min, dormant_buying_max)); + dormant_dist_ = cyclus::UniformIntDist::Ptr (new cyclus::UniformIntDist(dormant_buying_min, dormant_buying_max)); } else if (dormant_buying_frequency_type == "Normal") { if ((dormant_buying_mean == -1) || (dormant_buying_stddev == -1)) { @@ -99,7 +99,7 @@ void Storage::InitBuyPolicyParameters() { if (dormant_buying_min == -1) {dormant_buying_min = 1;} if (dormant_buying_max == -1) { dormant_buying_max = std::numeric_limits::max();} - dormant_dist_ = cyclus::NormalIntDist>(new cyclus::NormalIntDist(dormant_buying_mean, dormant_buying_stddev, + dormant_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(dormant_buying_mean, dormant_buying_stddev, dormant_buying_min, dormant_buying_max)); } else { @@ -107,13 +107,13 @@ void Storage::InitBuyPolicyParameters() { /// set up buying size distribution if (buying_size_type == "Fixed") { - size_dist_ = cyclus::FixedDoubleDist>(new cyclus::FixedDoubleDist(buying_size_val)); + size_dist_ = cyclus::FixedDoubleDist::Ptr (new cyclus::FixedDoubleDist(buying_size_val)); } else if (buying_size_type == "Uniform") { if ((buying_size_min == -1) || (buying_size_max == -1)) { throw cyclus::ValueError("Invalid buying size range. Please provide both a min and max value."); } - size_dist_ = cyclus::UniformDoubleDist>(new cyclus::UniformDoubleDist(buying_size_min, buying_size_max)); + size_dist_ = cyclus::UniformDoubleDist::Ptr (new cyclus::UniformDoubleDist(buying_size_min, buying_size_max)); } else if (buying_size_type == "Normal") { if ((buying_size_mean == -1) || (buying_size_stddev == -1)) { @@ -121,7 +121,7 @@ void Storage::InitBuyPolicyParameters() { } if (buying_size_min == -1) {buying_size_min = 0;} if (buying_size_max == -1) {buying_size_max = 1;} - size_dist_ = cyclus::NormalDoubleDist>(new cyclus::NormalDoubleDist(buying_size_mean, buying_size_stddev, + size_dist_ = cyclus::NormalDoubleDist::Ptr (new cyclus::NormalDoubleDist(buying_size_mean, buying_size_stddev, buying_size_min, buying_size_max)); } else {