| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 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 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public class PowerLawGrowthModel extends DemographicModel { |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 91 |
|
| 92 |
|
| 93 |
Parameter N0Parameter = null; |
| 94 |
Parameter powerParameter = null; |
| 95 |
PowerLawGrowth powerLawGrowth = null; |
| 96 |
} |