Stride Reference Manual  1.0
PopulationBuilder.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * any later version.
7  * The software is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License
12  * along with the software. If not, see <http://www.gnu.org/licenses/>.
13  *
14  * Copyright 2017, Willem L, Kuylen E, Stijven S & Broeckhove J
15  */
16 
22 #include "Population.h"
23 #include "util/Random.h"
24 
25 #include <boost/property_tree/ptree.hpp>
26 #include <spdlog/spdlog.h>
27 #include <memory>
28 #include <string>
29 #include <vector>
30 
31 namespace stride {
32 
33 class Population;
34 
39 public:
40 
48  static std::shared_ptr<Population> build(
49  const boost::property_tree::ptree& pt_config,
50  const boost::property_tree::ptree& pt_disease,
51  const boost::property_tree::ptree& pt_pop,
52  util::Random& rng);
53 
54 private:
56  static std::vector<double> getDistribution(const boost::property_tree::ptree& pt_root, const std::string& xml_tag);
57 
59  static unsigned int sample(util::Random& rng, const std::vector<double>& distribution);
60 };
61 
62 }
63 
Initializes Population objects.
Time Dependent Person DataType.
Definition: NoBehaviour.h:17
static unsigned int sample(util::Random &rng, const std::vector< double > &distribution)
Sample from the distribution.
Header file for the core Population class.
Header for the Random Number Generator class.
static std::shared_ptr< Population > build(const boost::property_tree::ptree &pt_config, const boost::property_tree::ptree &pt_disease, const boost::property_tree::ptree &pt_pop, util::Random &rng)
Initializes a Population: add persons, set immunity, seed infection.
static std::vector< double > getDistribution(const boost::property_tree::ptree &pt_root, const std::string &xml_tag)
Get distribution associateed with tag values.
The random number generator.
Definition: Random.h:39