Skip to content

Commit

Permalink
change all the expansion to cons-exp-cons
Browse files Browse the repository at this point in the history
  • Loading branch information
yxu927 committed Nov 23, 2024
1 parent 86a9db7 commit 72e9984
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
import org.apache.commons.math3.exception.NoBracketingException;
import org.apache.commons.math3.exception.TooManyEvaluationsException;

public class ExpansionPopulation implements PopulationFunction {
public class Cons_Exp_ConsPopulation implements PopulationFunction {

private double tau; // Time before which population size is constant at N0
private double r; // Exponential growth rate
private double NC; // Current population size after time x
private double x; // Independent parameter for time at which the population reaches NC

/**
* Constructor for ExpansionPopulation model
* Constructor for Cons_Exp_ConsPopulation model
*
* @param tau Time before which population size is constant at N0
* @param r Exponential growth rate
* @param NC Current population size after time x
* @param x Independent parameter indicating time at which population size equals NC
*/
public ExpansionPopulation(double tau, double r, double NC, double x) {
public Cons_Exp_ConsPopulation(double tau, double r, double NC, double x) {
this.tau = tau;
this.r = r;
this.NC = NC;
Expand Down Expand Up @@ -116,7 +116,7 @@ public boolean isAnalytical() {

@Override
public String toString() {
return "Expansion Population with tau=" + tau + ", r=" + r + ", NC=" + NC + ", x=" + x;
return "Cons_Exp_Cons Population with tau=" + tau + ", r=" + r + ", NC=" + NC + ", x=" + x;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import lphy.core.model.annotation.GeneratorInfo;
import lphy.core.model.annotation.ParameterInfo;

public class ExpansionPopulationFunction extends DeterministicFunction<PopulationFunction> {
public class Cons_Exp_ConsPopulationFunction extends DeterministicFunction<PopulationFunction> {

public static final String TAU_PARAM_NAME = "tau";
public static final String R_PARAM_NAME = "r";
public static final String NC_PARAM_NAME = "NC";
public static final String X_PARAM_NAME = "x"; // New independent parameter for time x

public ExpansionPopulationFunction(
public Cons_Exp_ConsPopulationFunction(
@ParameterInfo(name = TAU_PARAM_NAME, description = "Time before which population size is constant.")
Value<Double> tau,
@ParameterInfo(name = R_PARAM_NAME, description = "The exponential growth rate.")
Expand All @@ -31,10 +31,10 @@ public ExpansionPopulationFunction(
}

@GeneratorInfo(
name = "expansionPopFunc",
name = "Cons_Exp_ConsPopFunc",
narrativeName = "Piecewise Exponential Growth Function",
category = GeneratorCategory.COAL_TREE,
examples = {"expansionCoal.lphy"},
examples = {"Cons_Exp_ConsCoal.lphy"},
description = "Models population growth using a piecewise exponential growth function with x as an independent parameter."
)
@Override
Expand All @@ -50,9 +50,9 @@ public Value<PopulationFunction> apply() {
double x = xValue.value();

// Create the population function using tau, r, NC, and x
PopulationFunction expansionPopulation = new ExpansionPopulation(tau, r, NC, x);
PopulationFunction Cons_Exp_ConsPopulation = new Cons_Exp_ConsPopulation(tau, r, NC, x);

return new Value<>(expansionPopulation, this);
return new Value<>(Cons_Exp_ConsPopulation, this);
}

public Value<Double> getTau() {
Expand Down
2 changes: 1 addition & 1 deletion lphy-base/src/main/java/lphy/base/spi/LPhyBaseImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public List<Class<? extends BasicFunction>> declareFunctions() {
GompertzPopulationFunction_f0.class,
GompertzPopulationFunction_t50.class, ExponentialPopulationFunction.class,
LogisticPopulationFunction.class, ConstantPopulationFunction.class,
ExpansionPopulationFunction.class
Cons_Exp_ConsPopulationFunction.class

);

Expand Down

0 comments on commit 72e9984

Please sign in to comment.