pops-core  0.9
PoPS (Pest or Pathogen Spread) Model Core C++ library
Public Member Functions | List of all members
pops::Scheduler Class Reference

#include <scheduling.hpp>

Public Member Functions

 Scheduler (const Date &start, const Date &end, StepUnit simulation_unit, unsigned simulation_num_units)
 Scheduler creates a vector of simulation steps based on start, end date, unit and number of units. More...
 
unsigned get_num_steps () const
 Get number of simulation steps. More...
 
Step get_step (unsigned index) const
 Get step based on index. More...
 
std::tuple< unsigned, StepUnitget_step_length () const
 Get length of simulation step as number of units and unit type. More...
 
std::vector< bool > schedule_spread (const Season &season) const
 Schedule spread. More...
 
std::vector< bool > schedule_action_yearly (int month, int day) const
 Schedule an action at certain date each year, e.g. More...
 
std::vector< bool > schedule_action_end_of_year () const
 Schedule an action at the end of each year, e.g. More...
 
std::vector< bool > schedule_action_end_of_simulation () const
 Schedule an action at the end of simulation. More...
 
std::vector< bool > schedule_action_nsteps (unsigned n_steps) const
 Schedule action every N simulation steps,. More...
 
std::vector< bool > schedule_action_monthly () const
 Schedule action at the end of each month. More...
 
unsigned schedule_action_date (const Date &date) const
 Schedule action at a specific date (not repeated action). More...
 
void debug_schedule (std::vector< bool > &schedule) const
 Prints schedule for debugging purposes. More...
 
void debug_schedule (unsigned n) const
 
void debug_schedule () const
 

Detailed Description

Definition at line 94 of file scheduling.hpp.

Constructor & Destructor Documentation

◆ Scheduler()

pops::Scheduler::Scheduler ( const Date start,
const Date end,
StepUnit  simulation_unit,
unsigned  simulation_num_units 
)
inline

Scheduler creates a vector of simulation steps based on start, end date, unit and number of units.

The steps can be e.g. 1 day, 3 months, 2 weeks. Step is scheduled if start date of an interval is within [start, end] even if end date of the step is outside. That means the entire interval is contained in the simulation steps even when only part of it was requested.

Parameters
startsimulation start date
endsimulation end date
simulation_unitsimulation unit
simulation_num_unitsnumber of days/weeks/months in a simulation step

Definition at line 111 of file scheduling.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ debug_schedule() [1/3]

void pops::Scheduler::debug_schedule ( ) const
inline

Definition at line 324 of file scheduling.hpp.

◆ debug_schedule() [2/3]

void pops::Scheduler::debug_schedule ( std::vector< bool > &  schedule) const
inline

Prints schedule for debugging purposes.

Parameters
vectorof bools to print along the steps

Definition at line 313 of file scheduling.hpp.

◆ debug_schedule() [3/3]

void pops::Scheduler::debug_schedule ( unsigned  n) const
inline

Definition at line 319 of file scheduling.hpp.

◆ get_num_steps()

unsigned pops::Scheduler::get_num_steps ( ) const
inline

Get number of simulation steps.

Definition at line 152 of file scheduling.hpp.

Here is the caller graph for this function:

◆ get_step()

Step pops::Scheduler::get_step ( unsigned  index) const
inline

Get step based on index.

Definition at line 160 of file scheduling.hpp.

◆ get_step_length()

std::tuple<unsigned, StepUnit> pops::Scheduler::get_step_length ( ) const
inline

Get length of simulation step as number of units and unit type.

Definition at line 168 of file scheduling.hpp.

Here is the caller graph for this function:

◆ schedule_action_date()

unsigned pops::Scheduler::schedule_action_date ( const Date date) const
inline

Schedule action at a specific date (not repeated action).

Should be used within Treatments class.

Parameters
datedate to schedule action
Returns
index of step

Definition at line 301 of file scheduling.hpp.

Here is the caller graph for this function:

◆ schedule_action_end_of_simulation()

std::vector<bool> pops::Scheduler::schedule_action_end_of_simulation ( ) const
inline

Schedule an action at the end of simulation.

Returns
vector of bools, true if action should happen that step

Definition at line 242 of file scheduling.hpp.

Here is the caller graph for this function:

◆ schedule_action_end_of_year()

std::vector<bool> pops::Scheduler::schedule_action_end_of_year ( ) const
inline

Schedule an action at the end of each year, e.g.

mortality.

Returns
vector of bools, true if action should happen that step

Definition at line 224 of file scheduling.hpp.

Here is the caller graph for this function:

◆ schedule_action_monthly()

std::vector<bool> pops::Scheduler::schedule_action_monthly ( ) const
inline

Schedule action at the end of each month.

More precisely, whenever end of the month is within the step interval.

Returns
vector of bools, true if action should happen that step

Definition at line 278 of file scheduling.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ schedule_action_nsteps()

std::vector<bool> pops::Scheduler::schedule_action_nsteps ( unsigned  n_steps) const
inline

Schedule action every N simulation steps,.

Useful for e.g. export. If simulation step is 2 months and n_steps = 2, actions is scheduled every 4 months.

Parameters
n_stepsschedule every N steps
Returns
vector of bools, true if action should happen that step

Definition at line 258 of file scheduling.hpp.

Here is the caller graph for this function:

◆ schedule_action_yearly()

std::vector<bool> pops::Scheduler::schedule_action_yearly ( int  month,
int  day 
) const
inline

Schedule an action at certain date each year, e.g.

lethality.

This doesn't handle cases where there is change in year within interval, but that doesn't happen with current implementation

Parameters
monthmonth
dayday
Returns
vector of bools, true if action should happen that step

Definition at line 203 of file scheduling.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ schedule_spread()

std::vector<bool> pops::Scheduler::schedule_spread ( const Season season) const
inline

Schedule spread.

Parameters
seasonseasonality information
Returns
vector of bools, true if spread should happen that step

Definition at line 178 of file scheduling.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: