Exemplo n.º 1
0
def construct_description():

    description = cmsmodel.CmsModel("polio")

    description.add_species("S", INITIAL_SUSCEPTIBLE, observe=True)
    description.add_species("I", INITIAL_INFECTIOUS, observe=True)
    description.add_species("R", INITIAL_RECOVERED, observe=True)
    description.add_species("CI", 0, observe=True)  # Count of Infections
    description.add_species("CP", 0, observe=True)  # Count of Paralysis

    Ki = 1.05 / 30 / (
        5 / 80
    )  # R0 1.05, 30 day mean infectious duration, in under 5 population
    # Ki = 1.05/30            # R0 1.05, 30 day mean infectious duration
    Kp = 1 / 200  # ratio of paralytic cases
    Kin = (1 - Kp) * Ki  # non-paralytic cases
    Kip = Kp * Ki  # paralytic cases
    Kr = 1 / 30  # recover, 30 day mean infectious duration

    description.add_parameter("Kin", Kin)
    description.add_parameter("Kip", Kip)
    description.add_parameter("Kr", Kr)

    description.add_reaction("infection", ["S"], ["I", "CI"],
                             "(/ (* Kin S I) (+ S I R))")
    description.add_reaction("paralysis", ["S"], ["I", "CI", "CP"],
                             "(/ (* Kip S I) (+ S I R))")
    description.add_reaction("recovery", ["I"], ["R"], "(* Kr I)")

    return description
Exemplo n.º 2
0
def build_model():

    model = cmsmodel.CmsModel("seir")

    model.add_species("S", 990, observe=True)
    model.add_species("E", 0, observe=True)
    model.add_species("I", 10, observe=True)
    model.add_species("R", 0, observe=True)
    model.add_species("CI", 0)

    model.add_parameter("Ki", 0.5)
    model.add_parameter("Kl", 0.2)
    model.add_parameter("Kr", 1 / 7)
    model.add_parameter("Kw", 1 / 365)

    model.add_reaction("transmit", ["S"], ["E", "CI"],
                       "(/ (* Ki S I) (+ S E I R))")
    model.add_reaction("shed", ["E"], ["I"], "(* Kl E)")
    model.add_reaction("recover", ["I"], ["R"], "(* Kr I)")
    model.add_reaction("waning", ["R"], ["S"], "(* Kw R)")

    model.add_observable("cumulative", "CI")
    model.add_observable("population", "(+ S E I R)")

    return model
def build_model(beta_h=0.0076, **kwargs):

    # See hatmodel.md

    model = cmsmodel.CmsModel("hat")

    # The "odd" construction of `kwargs[...] if ... in kwargs else 0` allows you to selectively specify
    # some initial populations in the call to build_model() and those values will be used to initialize
    # the population of those species. If you do not specify a value, the initial population will be 0.
    species = [{
        "name":
        "human-susceptible",
        "population":
        kwargs["human-susceptible"] if "human-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-exposed",
        "population":
        kwargs["human-exposed"] if "human-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-infectious-one",
        "population":
        kwargs["human-infectious-one"]
        if "human-infectious-one" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-infectious-two",
        "population":
        kwargs["human-infectious-two"]
        if "human-infectious-two" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-recovered",
        "population":
        kwargs["human-recovered"] if "human-recovered" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-infection-cumulative",
        "population":
        kwargs["human-infection-cumulative"]
        if "human-infection-cumulative" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-dead",
        "population":
        kwargs["human-dead"] if "human-dead" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-susceptible",
        "population":
        kwargs["tsetse-susceptible"] if "tsetse-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-exposed",
        "population":
        kwargs["tsetse-exposed"] if "tsetse-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-infectious",
        "population":
        kwargs["tsetse-infectious"] if "tsetse-infectious" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-non-susceptible",
        "population":
        kwargs["tsetse-non-susceptible"]
        if "tsetse-non-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-susceptible",
        "population":
        kwargs["reservoir-susceptible"]
        if "reservoir-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-exposed",
        "population":
        kwargs["reservoir-exposed"] if "reservoir-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-infectious",
        "population":
        kwargs["reservoir-infectious"]
        if "reservoir-infectious" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-recovered",
        "population":
        kwargs["reservoir-recovered"]
        if "reservoir-recovered" in kwargs else 0,
        "observe":
        True
    }]

    def _add_species(name: str, population: int, observe: bool):
        model.add_species(name, population, observe)

    for specie in species:
        _add_species(**specie)

    parameters = [
        {
            "name": "sigma-h",
            "value": 0.083333333
        },  # incubation rate (human E->I1)
        {
            "name": "phi-h",
            "value": 0.001901141
        },  # progression from human I1->I2
        {
            "name": "omega-h",
            "value": 0.005479452
        },  # rate of progression from I2-> death
        {
            "name": "beta-v",
            "value": 0.212
        },  # beta for tsetse fly infection from infectious human or reservoir animal
        {
            "name": "p-human-feed",
            "value": 0.089
        },  # probability of human feed. Changed to 0.2 in South Sudan, just assumed
        #{"name":"p-reservoir-feed", "value":0.153},      # probability of reservoir host feed
        {
            "name": "sigma-v",
            "value": 0.06
        },  # incubation rate (tsetse E->I)
        {
            "name": "mu-v",
            "value": 0.03846154
        },  # tsetse fly mortality rate
        {
            "name": "treatment-one",
            "value": 0.1608275
        },  # probability a human is treated in stage 1
        {
            "name": "treatment-two",
            "value": 0.5384225
        },  # probability a human is treated in stage 2
        # _not_ from the paper referenced above
        {
            "name": "p-feed",
            "value": 1.0 / 3
        },  # probability of feeding in a given 24 hours
        {
            "name": "beta-h",
            "value": beta_h
        },  # beta for human infection by infectious tsetse fly. Changed to 0.26 for South Sudan, just assumed
        {
            "name": "beta-r",
            "value": 0.1345
        },  # beta for reservoir infection by infectious tsetse fly
        {
            "name": "phi-r",
            "value": 0.14285714
        },  # reservoir incubation rate, swine
        {
            "name": "omega-r-nt",
            "value": 1 / 182.5
        },  # reservoir recovery rate with treatment (assume no recovery otherwise); assume treatment q6 months. FIT
        {
            "name": "omega-r-t",
            "value": 1 / 91.25
        },  # reservoir recovery rate without treatment
        {
            "name": "treatment-reservoir",
            "value": 0
        },  # probability reservoir is treated (assume lifelong infection otherwise)
        {
            "name": "mu-h",
            "value": 0.000053
        },  # human mortality rate
        {
            "name": "mu-r",
            "value": 0.001369863
        },  # reservoir mortality rate
        {
            "name": "wane_immunity",
            "value": 1 / 50
        }  # same for animals and humans
    ]

    def _add_parameter(name: str, value: float):
        model.add_parameter(name, value)

    for parameter in parameters:
        _add_parameter(**parameter)

    # Convenience functions:
    model.add_function(
        "human-population",
        "(+ human-susceptible human-exposed human-infectious-one human-infectious-two human-recovered)"
    )
    model.add_function(
        "reservoir-population",
        "(+ reservoir-susceptible reservoir-exposed reservoir-infectious reservoir-recovered)"
    )
    model.add_function(
        "tsetse-population",
        "(+ tsetse-susceptible tsetse-exposed tsetse-infectious tsetse-non-susceptible)"
    )
    model.add_function("tsetse-human-ratio",
                       "(/ tsetse-population human-population)")
    model.add_function("tsetse-reservoir-ratio",
                       "(/ tsetse-population reservoir-population)")

    # Reactions/transitions

    # human S->E->I1->I2->R
    model.add_reaction(
        "human-infection", ["human-susceptible"],
        ["human-exposed", "human-infection-cumulative"],
        "(* human-susceptible beta-h p-feed p-human-feed tsetse-human-ratio (/ tsetse-infectious tsetse-population))"
    )
    model.add_reaction("human-exposed-infectious", ["human-exposed"],
                       ["human-infectious-one"], "(* sigma-h human-exposed)")
    model.add_reaction("human-infectious-progression",
                       ["human-infectious-one"], ["human-infectious-two"],
                       "(* phi-h human-infectious-one (- 1 treatment-one))")
    model.add_reaction("human-recovery-passive", ["human-infectious-two"],
                       ["human-recovered"],
                       "(* omega-h human-infectious-two treatment-two)")
    model.add_reaction("human-recovery-active", ["human-infectious-one"],
                       ["human-recovered"],
                       "(* phi-h human-infectious-one treatment-one)")
    model.add_reaction("human-death", ["human-infectious-two"], ["human-dead"],
                       "(* omega-h human-infectious-two (- 1 treatment-two))")

    # Tsetse S->E->I->R, NS
    model.add_function(
        "infectious-feed",
        "(+ (* p-human-feed (/ human-infectious-one human-population)) (* p-reservoir-feed (/ reservoir-infectious reservoir-population)))"
    )  # probability a given feed is infectious and transmission occurs
    # model.add_function("infectious-feed", "(* beta-v p-feed (+ (* p-human-feed (/ human-infectious-one human-population)) (* p-reservoir-feed (/ reservoir-infectious reservoir-population))))")#probablility a given feed is infectious and transmission occurs
    model.add_reaction(
        "feed-and-infected", ["tsetse-susceptible"], ["tsetse-exposed"],
        "(* p-feed beta-v infectious-feed tsetse-susceptible)"
    )  # probability a feed happens in first 24 hours, is infectious, and transmission occurs
    # model.add_reaction("become-non-susceptible", ["tsetse-susceptible"], ["tsetse-non-susceptible"], "(+ (- 1 p-feed)(* p-feed (- 1 infectious-feed)))")#probability tsetse doesn't feed in first 24 hours, or does but transmission doesn't occur
    model.add_reaction(
        "become-non-susceptible", ["tsetse-susceptible"],
        ["tsetse-non-susceptible"],
        "(* (+ (- 1 p-feed)(* p-feed (- 1 infectious-feed))) tsetse-susceptible)"
    )  # probability tsetse doesn't feed in first 24 hours, or does but transmission doesn't occur
    model.add_reaction("tsetse-progress-to-infectious", ["tsetse-exposed"],
                       ["tsetse-infectious"], "(* sigma-v tsetse-exposed)")

    # reservoir S->E->I->R
    model.add_reaction(
        "reservoir-infection", ["reservoir-susceptible"],
        ["reservoir-exposed"],
        "(* reservoir-susceptible beta-r p-feed p-reservoir-feed tsetse-reservoir-ratio (/ tsetse-infectious tsetse-population))"
    )
    model.add_reaction("reservoir-exposed-infectious", ["reservoir-exposed"],
                       ["reservoir-infectious"], "(* phi-r reservoir-exposed)")
    model.add_reaction("reservoir-recovery", ["reservoir-infectious"],
                       ["reservoir-recovered"],
                       "(* omega-r treatment-reservoir reservoir-infectious)")

    # vital dynamics: stable population - recycle deaths directly into births (susceptible)

    # model.add_reaction("human-susceptible-death-birth",    ["human-susceptible"],   ["human-susceptible"], "(* mu-h human-susceptible)")
    model.add_reaction("human-exposed-death-birth", ["human-exposed"],
                       ["human-susceptible"], "(* mu-h human-exposed)")
    model.add_reaction("human-infectious-one-death-birth",
                       ["human-infectious-one"], ["human-susceptible"],
                       "(* mu-h human-infectious-one)")
    model.add_reaction("human-infectious-two-death-birth",
                       ["human-infectious-two"], ["human-susceptible"],
                       "(* mu-h human-infectious-two)")
    model.add_reaction("human-recovered-death-birth", ["human-recovered"],
                       ["human-susceptible"], "(* mu-h human-recovered)")

    # model.add_reaction("vector-susceptible-death-birth",     ["tsetse-susceptible"],     ["tsetse-susceptible"], "(* mu-v tsetse-susceptible)")
    model.add_reaction("vector-exposed-death-birth", ["tsetse-exposed"],
                       ["tsetse-susceptible"], "(* mu-v tsetse-exposed)")
    model.add_reaction("vector-infectious-death-birth", ["tsetse-infectious"],
                       ["tsetse-susceptible"], "(* mu-v tsetse-infectious)")
    model.add_reaction("vector-non-susceptible-death-birth",
                       ["tsetse-non-susceptible"], ["tsetse-susceptible"],
                       "(* mu-v tsetse-non-susceptible)")

    # model.add_reaction("reservoir-susceptible-death-birth", ["reservoir-susceptible"], ["reservoir-susceptible"], "(* mu-r reservoir-susceptible)")
    model.add_reaction("reservoir-exposed-death-birth", ["reservoir-exposed"],
                       ["reservoir-susceptible"], "(* mu-r reservoir-exposed)")
    model.add_reaction("reservoir-infectious-death-birth",
                       ["reservoir-infectious"], ["reservoir-susceptible"],
                       "(* mu-r reservoir-infectious)")
    model.add_reaction("reservoir-recovered-death-birth",
                       ["reservoir-recovered"], ["reservoir-susceptible"],
                       "(* mu-r reservoir-recovered)")

    return model
Exemplo n.º 4
0
def build_model(beta_h=0.000917341, **kwargs):

    # See hatmodel.md

    model = cmsmodel.CmsModel("hat")

    # The "odd" construction of `kwargs[...] if ... in kwargs else 0` allows you to selectively specify
    # some initial populations in the call to build_model() and those values will be used to initialize
    # the population of those species. If you do not specify a value, the initial population will be 0.
    species = [{
        "name":
        "human-susceptible",
        "population":
        kwargs["human-susceptible"] if "human-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-exposed",
        "population":
        kwargs["human-exposed"] if "human-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-infectious-one",
        "population":
        kwargs["human-infectious-one"]
        if "human-infectious-one" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-infectious-two",
        "population":
        kwargs["human-infectious-two"]
        if "human-infectious-two" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-recovered",
        "population":
        kwargs["human-recovered"] if "human-recovered" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-infection-cumulative",
        "population":
        kwargs["human-infection-cumulative"]
        if "human-infection-cumulative" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "human-dead",
        "population":
        kwargs["human-dead"] if "human-dead" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-susceptible",
        "population":
        kwargs["tsetse-susceptible"] if "tsetse-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-exposed",
        "population":
        kwargs["tsetse-exposed"] if "tsetse-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-infectious",
        "population":
        kwargs["tsetse-infectious"] if "tsetse-infectious" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "tsetse-non-susceptible",
        "population":
        kwargs["tsetse-non-susceptible"]
        if "tsetse-non-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sd-susceptible",
        "population":
        kwargs["reservoir-sd-susceptible"]
        if "reservoir-sd-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sd-exposed",
        "population":
        kwargs["reservoir-sd-exposed"]
        if "reservoir-sd-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sd-infectious",
        "population":
        kwargs["reservoir-sd-infectious"]
        if "reservoir-sd-infectious" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sd-recovered",
        "population":
        kwargs["reservoir-sd-recovered"]
        if "reservoir-sd-recovered" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rd-susceptible",
        "population":
        kwargs["reservoir-rd-susceptible"]
        if "reservoir-rd-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rd-exposed",
        "population":
        kwargs["reservoir-rd-exposed"]
        if "reservoir-rd-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rd-infectious",
        "population":
        kwargs["reservoir-rd-infectious"]
        if "reservoir-rd-infectious" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rd-recovered",
        "population":
        kwargs["reservoir-rd-recovered"]
        if "reservoir-rd-recovered" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sw-susceptible",
        "population":
        kwargs["reservoir-sw-susceptible"]
        if "reservoir-sw-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sw-exposed",
        "population":
        kwargs["reservoir-sw-exposed"]
        if "reservoir-sw-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sw-infectious",
        "population":
        kwargs["reservoir-sw-infectious"]
        if "reservoir-sw-infectious" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-sw-recovered",
        "population":
        kwargs["reservoir-sw-recovered"]
        if "reservoir-sw-recovered" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rw-susceptible",
        "population":
        kwargs["reservoir-rw-susceptible"]
        if "reservoir-rw-susceptible" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rw-exposed",
        "population":
        kwargs["reservoir-rw-exposed"]
        if "reservoir-rw-exposed" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rw-infectious",
        "population":
        kwargs["reservoir-rw-infectious"]
        if "reservoir-rw-infectious" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "reservoir-rw-recovered",
        "population":
        kwargs["reservoir-rw-recovered"]
        if "reservoir-rw-recovered" in kwargs else 0,
        "observe":
        True
    }, {
        "name":
        "non-reservoir-hosts",
        "population":
        kwargs["non-reservoir-hosts"]
        if "non-reservoir-hosts" in kwargs else 0,
        "observe":
        True
    }]

    def _add_species(name: str, population: int, observe: bool):
        model.add_species(name, population, observe)

    for specie in species:
        _add_species(**specie)

    parameters = [
        {
            "name": "sigma-h",
            "value": 0.083333333
        },  # incubation rate (human E->I1)
        {
            "name": "phi-h",
            "value": 1 / 23
        },  # progression from human I1->I2
        {
            "name": "omega-h",
            "value": 1 / (50 - 23)
        },  # rate of progression from I2-> death
        {
            "name": "beta-v",
            "value": 0.212
        },  # beta for tsetse fly infection from infectious human or reservoir animal
        {
            "name": "p-human-feed",
            "value": 0.05
        },  # probability of human feed
        #{"name":"p-reservoir-feed", "value":0.85},      # probability of reservoir host feed
        {
            "name": "sigma-v",
            "value": 0.06
        },  # incubation rate (tsetse E->I)
        {
            "name": "p-survives-feed",
            "value": 0.89
        },
        {
            "name": "treatment-one",
            "value": 0
        },  # probability a human is treated in stage 1
        {
            "name": "treatment-two",
            "value": 0.083333333
        },  # probability a human is treated in stage 2
        # _not_ from the paper referenced above
        {
            "name": "p-feed",
            "value": 1.0 / 3
        },  # probability of feeding in a given 24 hours
        {
            "name": "beta-h",
            "value": beta_h
        },  # beta for human infection by infectious tsetse fly
        {
            "name": "beta-r",
            "value": 0.1345
        },  # beta for reservoir infection by infectious tsetse fly; FIT
        {
            "name": "phi-r-s",
            "value": 0.14285714
        },  # reservoir incubation rate, swine
        {
            "name": "phi-r-r",
            "value": 0.083333333
        },  # reservoir incubation rate, ruminants
        {
            "name": "omega-r-nt-s",
            "value": 1 / 182.5
        },  # reservoir recovery rate with treatment (assume no recovery otherwise); assume treatment q6 months. FIT
        {
            "name": "omega-r-nt-r",
            "value": 1 / 225
        },  # reservoir recovery rate with treatment (assume no recovery otherwise); assume treatment q6 months. FIT
        {
            "name": "omega-r-t",
            "value": 1 / 91.25
        },  # reservoir recovery rate without treatment (assume no recovery otherwise); assume treatment q6 months. FIT
        {
            "name": "treatment-reservoir-d",
            "value": 1
        },  # probability domestic reservoir is treated (assume lifelong infection otherwise)
        {
            "name": "treatment-reservoir-w",
            "value": 0
        },  # probability wild reservoir is treated (assume lifelong infection otherwise)
        {
            "name": "mu-h",
            "value": 0.00053
        },  # human mortality rate
        {
            "name": "mu-r-sd",
            "value": 0.001369863
        },  # reservoir mortality rate
        {
            "name": "mu-r-rd",
            "value": 0.000176757
        },  # reservoir mortality rate
        {
            "name": "mu-r-sw",
            "value": 0.000156556
        },  # reservoir mortality rate
        {
            "name": "mu-r-rw",
            "value": 0.000182648
        },  # reservoir mortality rate
        {
            "name": "wane_immunity",
            "value": 1 / 50
        },
        {
            "name": "p-itc",
            "value": 1
        }
    ]

    def _add_parameter(name: str, value: float):
        model.add_parameter(name, value)

    for parameter in parameters:
        _add_parameter(**parameter)

    # Convenience functions:
    model.add_function(
        "human-population",
        "(+ human-susceptible human-exposed human-infectious-one human-infectious-two human-recovered)"
    )
    model.add_function(
        "reservoir-sd-population",
        "(+ reservoir-sd-susceptible reservoir-sd-exposed reservoir-sd-infectious reservoir-sd-recovered)"
    )
    model.add_function(
        "reservoir-sw-population",
        "(+ reservoir-sw-susceptible reservoir-sw-exposed reservoir-sw-infectious reservoir-sw-recovered)"
    )
    model.add_function(
        "reservoir-rd-population",
        "(+ reservoir-rd-susceptible reservoir-rd-exposed reservoir-rd-infectious reservoir-rd-recovered)"
    )
    model.add_function(
        "reservoir-rw-population",
        "(+ reservoir-rw-susceptible reservoir-rw-exposed reservoir-rw-infectious reservoir-rw-recovered)"
    )
    model.add_function(
        "tsetse-population",
        "(+ tsetse-susceptible tsetse-exposed tsetse-infectious tsetse-non-susceptible)"
    )
    model.add_function("tsetse-human-ratio",
                       "(/ tsetse-population human-population)")
    model.add_function("tsetse-reservoir-ratio-sd",
                       "(/ tsetse-population reservoir-sd-population)")
    model.add_function("tsetse-reservoir-ratio-rd",
                       "(/ tsetse-population reservoir-rd-population)")
    model.add_function("tsetse-reservoir-ratio-sw",
                       "(/ tsetse-population reservoir-sw-population)")
    model.add_function("tsetse-reservoir-ratio-rw",
                       "(/ tsetse-population reservoir-rw-population)")
    model.add_function(
        "reservoir-population",
        "(+ reservoir-sd-population reservoir-rd-population reservoir-sw-population reservoir-rw-population)"
    )
    model.add_function(
        "reservoir-infectious",
        "(+ reservoir-sd-infectious reservoir-rd-infectious reservoir-sw-infectious reservoir-rw-infectious)"
    )
    model.add_function(
        "p-feed-sd",
        "(* (- 1 p-human-feed) (/ reservoir-sd-population (+ reservoir-population non-reservoir-hosts)))"
    )
    model.add_function(
        "p-feed-sw",
        "(* (- 1 p-human-feed) (/ reservoir-sw-population (+ reservoir-population non-reservoir-hosts)))"
    )
    model.add_function(
        "p-feed-rd",
        "(* (- 1 p-human-feed) (/ reservoir-rd-population (+ reservoir-population non-reservoir-hosts)))"
    )
    model.add_function(
        "p-feed-rw",
        "(* (- 1 p-human-feed) (/ reservoir-rw-population (+ reservoir-population non-reservoir-hosts)))"
    )
    model.add_function("p-itc-d",
                       "(+ (* p-feed-sd p-itc) (* p-feed-rd p-itc))")
    model.add_function("mu-v",
                       "(/(-(ln (* (- 1 p-itc-d) p-survives-feed)))3) ")

    # Reactions/transitions

    # human S->E->I1->I2->R
    model.add_reaction(
        "human-infection", ["human-susceptible"],
        ["human-exposed", "human-infection-cumulative"],
        "(* human-susceptible beta-h p-feed p-human-feed tsetse-human-ratio (/ tsetse-infectious tsetse-population))"
    )
    model.add_reaction("human-exposed-infectious", ["human-exposed"],
                       ["human-infectious-one"], "(* sigma-h human-exposed)")
    model.add_reaction("human-infectious-progression",
                       ["human-infectious-one"], ["human-infectious-two"],
                       "(* phi-h human-infectious-one (- 1 treatment-one))")
    model.add_reaction("human-recovery-passive", ["human-infectious-two"],
                       ["human-recovered"],
                       "(* omega-h human-infectious-two treatment-two)")
    model.add_reaction("human-recovery-active", ["human-infectious-one"],
                       ["human-recovered"],
                       "(* phi-h human-infectious-one treatment-one)")
    model.add_reaction("human-waning-immunity", ["human-recovered"],
                       ["human-susceptible"],
                       "(* wane_immunity human-recovered)")
    model.add_reaction("human-death", ["human-infectious-two"], ["human-dead"],
                       "(* omega-h human-infectious-two (- 1 treatment-two))")

    # Tsetse S->E->I->R, NS
    model.add_function(
        "infectious-feed",
        "(+ (* p-human-feed (/ human-infectious-one human-population)) (* p-feed-sd (/ reservoir-sd-infectious reservoir-sd-population)) (* p-feed-rd (/ reservoir-rd-infectious reservoir-rd-population)) (* p-feed-sw (/ reservoir-sw-infectious reservoir-sw-population)) (* p-feed-rw (/ reservoir-rw-infectious reservoir-rw-population)))"
    )  #probablility a given feed is infectious and transmission occurs
    model.add_reaction(
        "feed-and-infected", ["tsetse-susceptible"], ["tsetse-exposed"],
        "(* p-feed beta-v infectious-feed tsetse-susceptible)"
    )  #probabilty a feed happens in first 24 hours, is infectious, and transmission occurs
    model.add_reaction(
        "become-non-susceptible", ["tsetse-susceptible"],
        ["tsetse-non-susceptible"],
        "(+ (- 1 p-feed)(* p-feed (- 1 infectious-feed)))"
    )  #probability tsetse doesn't feed in first 24 hours, or does but transmission doesn't occur
    model.add_reaction("tsetse-progress-to-infectious", ["tsetse-exposed"],
                       ["tsetse-infectious"], "(* sigma-v tsetse-exposed)")

    # domestic swine reservoir S->E->I->R
    model.add_reaction(
        "reservoir-infection-sd", ["reservoir-sd-susceptible"],
        ["reservoir-sd-exposed"],
        "(* reservoir-sd-susceptible beta-r p-feed p-feed-sd tsetse-reservoir-ratio-sd (/ tsetse-infectious tsetse-population))"
    )
    model.add_reaction("reservoir-exposed-infectious-sd",
                       ["reservoir-sd-exposed"], ["reservoir-sd-infectious"],
                       "(* phi-r-s reservoir-sd-exposed)")
    model.add_reaction(
        "reservoir-recovery-sd", ["reservoir-sd-infectious"],
        ["reservoir-sd-recovered"],
        "(+ (* omega-r-t treatment-reservoir-d reservoir-sd-infectious) (* omega-r-nt-s (- 1 treatment-reservoir-d) reservoir-sd-infectious))"
    )
    model.add_reaction("reservoir-waning-immunity-sd",
                       ["reservoir-sd-recovered"],
                       ["reservoir-sd-susceptible"],
                       "(* wane_immunity reservoir-sd-recovered)")

    #Domestic ruminant reservoir
    model.add_reaction(
        "reservoir-infection-rd", ["reservoir-rd-susceptible"],
        ["reservoir-rd-exposed"],
        "(* reservoir-rd-susceptible beta-r p-feed p-feed-rd tsetse-reservoir-ratio-rd (/ tsetse-infectious tsetse-population))"
    )
    model.add_reaction("reservoir-exposed-infectious-rd",
                       ["reservoir-rd-exposed"], ["reservoir-rd-infectious"],
                       "(* phi-r-r reservoir-rd-exposed)")
    model.add_reaction(
        "reservoir-recovery-rd", ["reservoir-rd-infectious"],
        ["reservoir-rd-recovered"],
        "(+ (* omega-r-t treatment-reservoir-d reservoir-rd-infectious) (* omega-r-nt-r (- 1 treatment-reservoir-d) reservoir-rd-infectious))"
    )
    model.add_reaction("reservoir-waning-immunity-rd",
                       ["reservoir-rd-recovered"],
                       ["reservoir-rd-susceptible"],
                       "(* wane_immunity reservoir-rd-recovered)")

    #Wild boar reservoir
    model.add_reaction(
        "reservoir-infection-sw", ["reservoir-sw-susceptible"],
        ["reservoir-sw-exposed"],
        "(* reservoir-sw-susceptible beta-r p-feed p-feed-sw tsetse-reservoir-ratio-sw (/ tsetse-infectious tsetse-population))"
    )
    model.add_reaction("reservoir-exposed-infectious-sw",
                       ["reservoir-sw-exposed"], ["reservoir-sw-infectious"],
                       "(* phi-r-s reservoir-sw-exposed)")
    model.add_reaction(
        "reservoir-recovery-sw", ["reservoir-sw-infectious"],
        ["reservoir-sw-recovered"],
        "(+ (* omega-r-t treatment-reservoir-w reservoir-sw-infectious) (* omega-r-nt-s (- 1 treatment-reservoir-w) reservoir-sw-infectious))"
    )
    model.add_reaction("reservoir-waning-immunity-sw",
                       ["reservoir-sw-recovered"],
                       ["reservoir-sw-susceptible"],
                       "(* wane_immunity reservoir-sw-recovered)")

    #Wild ruminant reservoir
    model.add_reaction(
        "reservoir-infection-rw", ["reservoir-rw-susceptible"],
        ["reservoir-rw-exposed"],
        "(* reservoir-rw-susceptible beta-r p-feed p-feed-rw tsetse-reservoir-ratio-rw (/ tsetse-infectious tsetse-population))"
    )
    model.add_reaction("reservoir-exposed-infectious-rw",
                       ["reservoir-rw-exposed"], ["reservoir-rw-infectious"],
                       "(* phi-r-r reservoir-rw-exposed)")
    model.add_reaction(
        "reservoir-recovery-rw", ["reservoir-rw-infectious"],
        ["reservoir-rw-recovered"],
        "(+ (* omega-r-t treatment-reservoir-w reservoir-rw-infectious) (* omega-r-nt-r (- 1 treatment-reservoir-w) reservoir-rw-infectious))"
    )
    model.add_reaction("reservoir-waning-immunity-rw",
                       ["reservoir-rw-recovered"],
                       ["reservoir-rw-susceptible"],
                       "(* wane_immunity reservoir-rw-recovered)")

    # vital dynamics: stable population - recycle deaths directly into births (susceptible)

    # model.add_reaction("human-susceptible-death-birth",    ["human-susceptible"],   ["human-susceptible"], "(* mu-h human-susceptible)")
    model.add_reaction("human-exposed-death-birth", ["human-exposed"],
                       ["human-susceptible"], "(* mu-h human-exposed)")
    model.add_reaction("human-infectious-one-death-birth",
                       ["human-infectious-one"], ["human-susceptible"],
                       "(* mu-h human-infectious-one)")
    model.add_reaction("human-infectious-two-death-birth",
                       ["human-infectious-two"], ["human-susceptible"],
                       "(* mu-h human-infectious-two)")
    model.add_reaction("human-recovered-death-birth", ["human-recovered"],
                       ["human-susceptible"], "(* mu-h human-recovered)")

    # model.add_reaction("vector-susceptible-death-birth",     ["tsetse-susceptible"],     ["tsetse-susceptible"], "(* mu-v tsetse-susceptible)")
    model.add_reaction("vector-exposed-death-birth", ["tsetse-exposed"],
                       ["tsetse-susceptible"], "(* mu-v tsetse-exposed)")
    model.add_reaction("vector-infectious-death-birth", ["tsetse-infectious"],
                       ["tsetse-susceptible"], "(* mu-v tsetse-infectious)")
    model.add_reaction("vector-non-susceptible-death-birth",
                       ["tsetse-non-susceptible"], ["tsetse-susceptible"],
                       "(* mu-v tsetse-non-susceptible)")

    # model.add_reaction("reservoir-susceptible-death-birth", ["reservoir-susceptible"], ["reservoir-susceptible"], "(* mu-r reservoir-susceptible)")
    # model.add_reaction("reservoir-susceptible-death-birth", ["reservoir-susceptible"], ["reservoir-susceptible"], "(* mu-r reservoir-susceptible)")
    model.add_reaction("reservoir-exposed-death-birth-sd",
                       ["reservoir-sd-exposed"], ["reservoir-sd-susceptible"],
                       "(* mu-r-sd reservoir-sd-exposed)")
    model.add_reaction("reservoir-infectious-death-birth-sd",
                       ["reservoir-sd-infectious"],
                       ["reservoir-sd-susceptible"],
                       "(* mu-r-sd reservoir-sd-infectious)")
    model.add_reaction("reservoir-recovered-death-birth-sd",
                       ["reservoir-sd-recovered"],
                       ["reservoir-sd-susceptible"],
                       "(* mu-r-sd reservoir-sd-recovered)")

    model.add_reaction("reservoir-exposed-death-birth-rd",
                       ["reservoir-rd-exposed"], ["reservoir-rd-susceptible"],
                       "(* mu-r-rd reservoir-rd-exposed)")
    model.add_reaction("reservoir-infectious-death-birth-rd",
                       ["reservoir-rd-infectious"],
                       ["reservoir-rd-susceptible"],
                       "(* mu-r-rd reservoir-rd-infectious)")
    model.add_reaction("reservoir-recovered-death-birth-rd",
                       ["reservoir-rd-recovered"],
                       ["reservoir-rd-susceptible"],
                       "(* mu-r-rd reservoir-rd-recovered)")

    model.add_reaction("reservoir-exposed-death-birth-sw",
                       ["reservoir-sw-exposed"], ["reservoir-sw-susceptible"],
                       "(* mu-r-sw reservoir-sw-exposed)")
    model.add_reaction("reservoir-infectious-death-birth-sw",
                       ["reservoir-sw-infectious"],
                       ["reservoir-sw-susceptible"],
                       "(* mu-r-sw reservoir-sw-infectious)")
    model.add_reaction("reservoir-recovered-death-birth-sw",
                       ["reservoir-sw-recovered"],
                       ["reservoir-sw-susceptible"],
                       "(* mu-r-sw reservoir-sw-recovered)")

    model.add_reaction("reservoir-exposed-death-birth-rw",
                       ["reservoir-rw-exposed"], ["reservoir-rw-susceptible"],
                       "(* mu-r-rw reservoir-rw-exposed)")
    model.add_reaction("reservoir-infectious-death-birth-rw",
                       ["reservoir-rw-infectious"],
                       ["reservoir-rw-susceptible"],
                       "(* mu-r-rw reservoir-rw-infectious)")
    model.add_reaction("reservoir-recovered-death-birth-rw",
                       ["reservoir-rw-recovered"],
                       ["reservoir-rw-susceptible"],
                       "(* mu-r-rw reservoir-rw-recovered)")

    return model