Debian Codegraph @

src/dr/evomodel/coalescent/PowerLawGrowthModel.java

raw symbols SCIP
1 /*
2 * PowerLawGrowthModel.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.evomodel.coalescent;
27
28 import dr.evolution.coalescent.DemographicFunction;
29 import dr.evolution.coalescent.PowerLawGrowth;
30 import dr.evomodelxml.coalescent.PowerLawGrowthModelParser;
31 import dr.inference.model.Parameter;
32
33 /**
34 * This class models an exponentially growing (or shrinking) population
35 * (Parameters: N0=present-day population size; r=growth rate).
36 * This model is nested with the constant-population size model (r=0).
37 *
38 * @author Alexei Drummond
39 * @author Andrew Rambaut
40 * @version $Id: ExponentialGrowthModel.java,v 1.14 2005/05/24 20:25:57 rambaut Exp $
41 */
42 public class PowerLawGrowthModel extends DemographicModel {
43
44 //
45 // Public stuff
46 //
47 /**
48 * Construct demographic model with default settings
49 */
50 public PowerLawGrowthModel(Parameter N0Parameter, Parameter growthRateParameter,
51 Type units) {
52
53 this(PowerLawGrowthModelParser.POWER_LAW_GROWTH_MODEL, N0Parameter, growthRateParameter, units);
54 }
55
56 /**
57 * Construct demographic model with default settings
58 */
59 public PowerLawGrowthModel(String name, Parameter N0Parameter, Parameter powerParameter,
60 Type units) {
61
62 super(name);
63
64 powerLawGrowth = new PowerLawGrowth(units);
65
66 this.N0Parameter = N0Parameter;
67 addVariable(N0Parameter);
68 N0Parameter.addBounds(new Parameter.DefaultBounds(Double.MAX_VALUE, 0.0, 1));
69
70 this.powerParameter = powerParameter;
71 addVariable(powerParameter);
72 powerParameter.addBounds(new Parameter.DefaultBounds(Double.MAX_VALUE, 1, 1));
73
74 setUnits(units);
75 }
76
77
78 // general functions
79
80 public DemographicFunction getDemographicFunction() {
81 powerLawGrowth.setN0(N0Parameter.getParameterValue(0));
82
83
84 double r = powerParameter.getParameterValue(0);
85 powerLawGrowth.setR(r);
86
87 return powerLawGrowth;
88 }
89 //
90 // protected stuff
91 //
92
93 Parameter N0Parameter = null;
94 Parameter powerParameter = null;
95 PowerLawGrowth powerLawGrowth = null;
96 }