Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular population structure #4

Open
GJHSimmons opened this issue Oct 20, 2023 · 1 comment
Open

Modular population structure #4

GJHSimmons opened this issue Oct 20, 2023 · 1 comment
Labels
feature Description of functionality

Comments

@GJHSimmons
Copy link
Collaborator

GJHSimmons commented Oct 20, 2023

Description

A population object should recursively consist of:

  • a list S of population objects
  • a list V of variables
  • a list P of parameters
  • a list E of expressions (equations) describing interactions among variables V in terms of parameters P.

The most basic population object consists of:

  • S = [self]
  • V = [self.variable]
  • P = []
  • E = []

A population object should provide functionality to assign parameters and expressions to self. Convenience functions should be provided to implement common functionality.

@GJHSimmons GJHSimmons changed the title [FEATURE] Modular population structure Modular population structure Oct 20, 2023
@GJHSimmons GJHSimmons added the feature Description of functionality label Oct 20, 2023
@GJHSimmons
Copy link
Collaborator Author

Population objects have been implemented as described, along with some convenience functions.

For example, the function add_growth_rate(r) creates a parameter growth_rate with value r, and an expression corresponding to the ODE dx/dt = rx. It assigns these to the lists P and E, respectively.

Another convenience function is link_populations. At base, given two populations Pop_1 and Pop_2 with variables x and y, Pop_1 is assigned a parameter flow with value k, and an expression corresponding to the ODE dx/dt = -kx. Pop_2 is also assigned the flow parameter with value k, and an expression corresponding to the ODE dy/dt = kx. The function link_populations takes a subset T of S and a list R of rates, and sequentially links the populations in T with the rates in R according to the above process.

When a population object Pop_1 is added to another population object Pop_2, the lists V,P,E of Pop_2 are updated with the lists V,P,E of Pop_1. Therefore both Pop_1 and Pop_2 describe the full behaviour of Pop_1, however, Pop_2 can obtain additional information, such as interactions of elements of Pop_1 with elements of Pop_2 \ Pop_1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Description of functionality
Projects
None yet
Development

No branches or pull requests

1 participant