sciencegym.simulations.sirv_compartments module

class sciencegym.simulations.sirv_compartments.CompartmentalModel(compartments: list[str])

Bases: object

Base class for constructing compartmental models.

apply_transitions(*compartment_changes)

Adjusts compartments according to the provided transitions

abstract calculate_transitions() tuple[int, ...]

Calculates transfers between compartments.

get_compartments() tuple[int, ...]
get_full_population()
abstract modify_compartments()

Applies changes to compartments which don’t result in transfers from one compartment to another.

step()
class sciencegym.simulations.sirv_compartments.SIRCompartments(transmission_rate, recovery_rate, susceptible, infected, recovered=0)

Bases: CompartmentalModel

Basic susceptible, infected, recovered model.

calculate_new_infections()
calculate_new_recoveries()
calculate_transitions() tuple

Calculates transfers between compartments.

get_r_0()

Base reproduction number.

modify_compartments()

Applies changes to compartments which don’t result in transfers from one compartment to another.

class sciencegym.simulations.sirv_compartments.SIRVCompartments(transmission_rate, recovery_rate, vaccination_rate: float, susceptible, infected, recovered=0, vaccinated=0)

Bases: SIRCompartments

SIR model expanded with a vaccinated compartment.

calculate_new_vaccinations()
calculate_transitions() tuple[int, ...]

Calculates transfers between compartments.

class sciencegym.simulations.sirv_compartments.SIRVVitalDynamics(transmission_rate, recovery_rate, vaccination_rate, susceptible, infected, recovered=0, vaccinated=0, birth_rate=0, death_rate=0)

Bases: SIRVCompartments, SIRVitalDynamics

SIRV model with deaths and births.

class sciencegym.simulations.sirv_compartments.SIRVitalDynamics(transmission_rate, recovery_rate: float, susceptible, infected, recovered=0, birth_rate=0, death_rate=0)

Bases: SIRCompartments

SIR model with deaths and births.

apply_vital_dynamics()
get_deaths()
get_r_0()

Base reproduction number.

modify_compartments()

Applies changes to compartments which don’t result in transfers from one compartment to another.

static steady(beta, gamma, death_rate=0, birth_rate=0)

Expected steady-state