dynamic_npis.h Source File
|
CPP API
|
dynamic_npis.h
Go to the documentation of this file.
44 insert_sorted_replace(m_thresholds, std::make_pair(threshold, dampings), [](auto& t1, auto& t2) {
57 //thresholds are sorted by value descending, so upper_bound returns the first threshold that is smaller using binary search
214 std::vector<size_t> get_damping_indices(const DampingExpr& damping_expr, DampingLevel lvl, DampingType type,
220 if (d.get_level() == lvl && d.get_type() == type && d.get_time() > begin && d.get_time() < end) {
239 Eigen::Ref<const typename DampingExpr::Matrix> get_active_damping(const DampingExpr& damping_expr, DampingLevel lvl,
243 std::find_if(damping_expr.get_dampings().rbegin(), damping_expr.get_dampings().rend(), [lvl, type, t](auto& d) {
249 return DampingExpr::Matrix::Zero(damping_expr.get_shape().rows(), damping_expr.get_shape().cols());
279 void implement_dynamic_npis(DampingExprGroup& damping_expr_group, const std::vector<DampingSampling<FP>>& npis,
316 //remove duplicates that accumulated because of dampings that become active during the time span
317 //a damping is obsolete if the most recent damping of the same type and level has the same value
320 //use indices to loop instead of reverse iterators because removing invalidates the current iterator
330 if (it_prev != damping_expr.get_dampings().rend() && it->get_coeffs() == it_prev->get_coeffs()) {
represents non-pharmaceutical interventions (NPI) that are activated during the simulation if some va...
Definition: dynamic_npis.h:35
void draw_sample()
draw a random sample from the damping distributions
Definition: dynamic_npis.h:144
static IOResult< DynamicNPIs > deserialize(IOContext &io)
deserialize an object of this class.
Definition: dynamic_npis.h:172
FP get_base_value() const
Get/Set the base value of the thresholds.
Definition: dynamic_npis.h:128
SimulationTime< FP > get_duration() const
get the duration of the NPIs.
Definition: dynamic_npis.h:85
void set_threshold(FP threshold, const std::vector< DampingSampling< FP >> &dampings)
set a threshold and the NPIs that should be enacted.
Definition: dynamic_npis.h:42
auto get_max_exceeded_threshold(FP value)
find the highest threshold that is smaller than the value.
Definition: dynamic_npis.h:55
void serialize(IOContext &io) const
serialize this.
Definition: dynamic_npis.h:158
void set_duration(SimulationTime< FP > v)
set the duration of the NPIs.
Definition: dynamic_npis.h:94
std::vector< std::pair< FP, std::vector< DampingSampling< FP > > > > m_thresholds
Definition: dynamic_npis.h:195
auto get_thresholds()
range of pairs of threshold values and NPIs.
Definition: dynamic_npis.h:75
auto get_thresholds() const
range of pairs of threshold values and NPIs.
Definition: dynamic_npis.h:71
void set_interval(SimulationTime< FP > interval)
Definition: dynamic_npis.h:113
SimulationTime< FP > get_interval() const
Get/Set the interval at which the NPIs are checked.
Definition: dynamic_npis.h:106
int size(Comm comm)
Return the size of the given communicator.
Definition: miompi.cpp:75
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
requires details::IsElementReference< M > RowMajorIterator< M, false > end(M &m)
create a non-const end iterator for the matrix m.
Definition: eigen_util.h:449
Range(std::pair< I, S > iterator_pair) -> Range< I, S >
Deduction guide to correctly deduce range type when constructed from a pair.
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
details::ApplyResultT< F, T... > apply(IOContext &io, F f, const IOResult< T > &... rs)
Evaluate a function with zero or more unpacked IOResults as arguments.
Definition: io.h:481
std::vector< size_t > get_damping_indices(const DampingExpr &damping_expr, DampingLevel lvl, DampingType type, SimulationTime< FP > begin, SimulationTime< FP > end)
Get a list of indices of specified dampings.
Definition: dynamic_npis.h:214
void implement_dynamic_npis(DampingExprGroup &damping_expr_group, const std::vector< DampingSampling< FP >> &npis, SimulationTime< FP > begin, SimulationTime< FP > end, MakeMatrix &&make_matrix)
implement dynamic NPIs for a time span.
Definition: dynamic_npis.h:279
auto max(const Eigen::MatrixBase< A > &a, B &&b)
coefficient wise maximum of two matrices.
Definition: eigen_util.h:171
requires details::IsElementReference< M > RowMajorIterator< M, false > begin(M &m)
create a non-const iterator to first element of the matrix m.
Definition: eigen_util.h:421
Eigen::Ref< const typename DampingExpr::Matrix > get_active_damping(const DampingExpr &damping_expr, DampingLevel lvl, DampingType type, SimulationTime< FP > t)
Get the value of the damping that matches the given type and level and that is active at the specifie...
Definition: dynamic_npis.h:239
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:353
void insert_sorted_replace(std::vector< T > &vec, T const &item, Pred pred)
inserts element in a sorted vector, replacing items that are equal precondition: elements in the vect...
Definition: stl_util.h:66
Generated by