Skip to content

Commit c4f331c

Browse files
authored
refactor: Remove unsupported growthRate for demography. (#438)
* Remove growthRate attribute from <demography>. Nonzero values for this attribute were not supported anyway. E.g. when one adds growthRate="0.1" to the <demography> node in the example, XML, the output is: Error: Population growth rate provided. In: example_scenario.xml * Fix whitespace.
1 parent 4c4e123 commit c4f331c

File tree

4 files changed

+7
-36
lines changed

4 files changed

+7
-36
lines changed

model/Population.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ void Population::update()
8181
{
8282
//NOTE: other parts of code are not set up to handle changing population size. Also
8383
// size is assumed to be the _actual and exact_ population size by other code.
84-
//targetPop is the population size at time t allowing population growth
85-
//int targetPop = (int) (size * exp( AgeStructure::rho * sim::ts1().inSteps() ));
8684
int cumPop = 0;
8785

8886
for (auto it = humans.begin(); it != humans.end();) {

model/PopulationAgeStructure.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ namespace OM {
3636
vector<double> AgeStructure::ageGroupBounds;
3737
vector<double> AgeStructure::ageGroupPercent;
3838

39-
double AgeStructure::initialRho = 0.0;
4039
double AgeStructure::mu0;
4140
double AgeStructure::mu1;
4241
double AgeStructure::alpha0;
4342
double AgeStructure::alpha1;
44-
double AgeStructure::rho;
4543

4644
vector<double> AgeStructure::cumAgeProp;
4745

@@ -137,14 +135,6 @@ void AgeStructure::estimateRemovalRates( const scnXml::Demography& demography ){
137135
for(size_t i = 0;i < ngroups; i++) {
138136
ageGroupPercent[i] = ageGroupPercent[i] * sumperc;
139137
}
140-
/*
141-
RSS between observed and predicted log percentage of population in age groups
142-
is minimised for values of mu1 and alpha1
143-
calls setDemoParameters to calculate the RSS
144-
*/
145-
if( demography.getGrowthRate().present() ){
146-
initialRho = demography.getGrowthRate().get();
147-
}
148138

149139
/* NOTE: unused --- why?
150140
double tol = 0.00000000001;
@@ -160,14 +150,6 @@ void AgeStructure::estimateRemovalRates( const scnXml::Demography& demography ){
160150
// Static method used by estimateRemovalRates
161151
double AgeStructure::setDemoParameters (double param1, double param2)
162152
{
163-
rho = initialRho;
164-
165-
rho = rho * (0.01 * sim::yearsPerStep());
166-
if (rho != 0.0)
167-
// Issue: in this case the total population size differs from populationSize,
168-
// however, some code currently uses this as the total population size.
169-
throw util::xml_scenario_error ("Population growth rate provided.");
170-
171153
const double IMR = 0.1;
172154
double M_inf = -log (1 - IMR);
173155

model/PopulationAgeStructure.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,19 @@ namespace OM
7171
* setDemoParameters()). */
7272
//@{
7373
static vector<double> ageGroupBounds;
74-
static vector<double> ageGroupPercent;
74+
static vector<double> ageGroupPercent;
7575
//@}
76-
static double initialRho;
7776
/** Parameters defining smooth curve of target age-distribution.
7877
*
7978
* Set by estimateRemovalRates() (via setDemoParameters()) and used by
8079
* setupPyramid(). */
8180
//@{
82-
static double mu0;
83-
static double mu1;
84-
static double alpha0;
85-
static double alpha1;
86-
static double rho;
81+
static double mu0;
82+
static double mu1;
83+
static double alpha0;
84+
static double alpha1;
85+
// rho is growth rate of human population.
86+
constexpr static double rho = 0.0;
8787
//@}
8888
//END
8989

schema/demography.xsd

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ Licence: GNU General Public Licence version 2 or later (see COPYING) -->
4242
<xs:appinfo>units:Years;min:0;max:100;name:Maximum age of simulated humans;</xs:appinfo>
4343
</xs:annotation>
4444
</xs:attribute>
45-
<xs:attribute name="growthRate" type="xs:double" use="optional">
46-
<xs:annotation>
47-
<xs:documentation>
48-
Growth rate of human population.
49-
(we should be able to implement this with non-zero values)
50-
</xs:documentation>
51-
<xs:appinfo>units:Number;min:0;max:0;name:Growth rate of human population;</xs:appinfo>
52-
</xs:annotation>
53-
</xs:attribute>
5445
</xs:complexType>
5546
<!-- ageGroup -->
5647
<xs:complexType name="DemogAgeGroup">

0 commit comments

Comments
 (0)