diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index dd911f3..d77d3a0 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -1,7 +1,7 @@ name: TagBot on: schedule: - - cron: 0 0 * * * + - cron: 0 * * * * jobs: TagBot: runs-on: ubuntu-latest diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 454d0cc..1a8f187 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,13 +10,13 @@ jobs: - name: "Set up Julia" uses: julia-actions/setup-julia@latest with: - version: '1.4' + version: '1.5' - name: "Install system dependencies" run: | sudo apt-get update sudo apt-get install graphviz ttf-dejavu - name: "Install Julia dependencies" - run: julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate();' + run: julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.update();' - name: "Build and deploy docs" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Project.toml b/Project.toml index b1b7ea3..ab9a540 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Petri" uuid = "4259d249-1051-49fa-8328-3f8ab9391c33" authors = ["Micah Halter ", "James Fairbanks "] -version = "1.1.1" +version = "1.2" [deps] AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f" diff --git a/examples/epidemiology.jl b/examples/epidemiology.jl index e0a6e0b..9c3af6c 100644 --- a/examples/epidemiology.jl +++ b/examples/epidemiology.jl @@ -32,7 +32,10 @@ Graph(sir) u0 = LVector(S=990.0, I=10.0, R=0.0) tspan = (0.0,40.0) -β = LVector(inf=0.5/sum(u0), rec=0.25); +# add a dynamic transition rate for infection +# where the rate of infection decreases over time +# as is dependent on the current state of the system +β = LVector(inf=((u,t)->((3/sum(u))/(t+1))), rec=0.25); # Petri.jl provides interfaces to StochasticDiffEq.jl, DiffEqJump.jl, and # OrdinaryDiffEq.jl Here, we call the `JumpProblem` function that returns an diff --git a/src/solvers.jl b/src/solvers.jl index c081064..5a9a815 100644 --- a/src/solvers.jl +++ b/src/solvers.jl @@ -11,11 +11,11 @@ import StochasticDiffEq: SDEProblem import DiffEqJump: JumpProblem funcindex!(list, key, f, vals...) = list[key] = f(list[key],vals...) -valueat(x::Number, t) = x -valueat(f::Function, t) = f(t) +valueat(x::Number, u, t) = x +valueat(f::Function, u, t) = try f(u,t) catch e f(t) end transitionrate(S, T, k, rate, t) = exp(reduce((x,y)->x+log(S[y] <= 0 ? 0 : S[y]), keys(first(T[k])); - init=log(valueat(rate[k],t)))) + init=log(valueat(rate[k],S,t)))) """ vectorfield(m::Model)